mirror of
https://github.com/picocss/pico.git
synced 2025-04-21 17:16:14 -04:00
Striped table rows updated
This commit is contained in:
parent
0875d75701
commit
565884540b
6 changed files with 315 additions and 53 deletions
110
docs/index.html
110
docs/index.html
|
@ -194,6 +194,7 @@
|
||||||
<aside>
|
<aside>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><a href="#tables">Tables</a></li>
|
||||||
<li><a href="#tabs">Tabs [role=tablist]</a></li>
|
<li><a href="#tabs">Tabs [role=tablist]</a></li>
|
||||||
<li><a href="#hamburger-menu">Hamburger Menu</a></li>
|
<li><a href="#hamburger-menu">Hamburger Menu</a></li>
|
||||||
<li><a href="#tooltip">Tooltip</a></li>
|
<li><a href="#tooltip">Tooltip</a></li>
|
||||||
|
@ -243,6 +244,113 @@
|
||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
<hr>
|
<hr>
|
||||||
|
<article id="tables">
|
||||||
|
<header>
|
||||||
|
<h2>Tables</h2>
|
||||||
|
<h6 class="fw-n">Striped rows require .striped class</h6>
|
||||||
|
</header>
|
||||||
|
<h6>
|
||||||
|
To have the striped rows, can be solved 2 ways.
|
||||||
|
</h6>
|
||||||
|
<p>
|
||||||
|
The easy way is to set <code>tbody tr:nth-child(odd of :not([hidden]))</code>
|
||||||
|
but unfortunetly, when we minify the CSS it remove the space between odd and of, making the striped lines fail.
|
||||||
|
Until we can find a way to fix the minification of the CSS, we will use a secondary feature that does require some more CSS code.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
As a result of the minification we are resorting to use an answer that was found on StackOverflow
|
||||||
|
by <a href="https://stackoverflow.com/questions/3773890/zebra-striping-a-table-with-hidden-rows-using-css3/36892714#36892714">Shaggy</a>
|
||||||
|
that I converted into a sass mixin to create more or less nested hidden selectors.
|
||||||
|
</p>
|
||||||
|
<p>The default is currently set to <code>4</code> and can be changed with your settings, or when you include pico in your sass file.</p>
|
||||||
|
<pre class="language-css"><code>@use "pico" with (
|
||||||
|
$hidden-table-levels: 4
|
||||||
|
);</code></pre>
|
||||||
|
<p>If you do not intend to have any hidden rows you can set the <code>$hidden-table-levels</code> to 0.</p>
|
||||||
|
<p>Styles for a <code><caption></code> element have been added for tables as well.</p>
|
||||||
|
<nav><ul><li>When rows are toggled, the hidden rows have * around the first column.</li></ul><ul><li><button type="button" onclick="document.querySelectorAll('.hidden-table-row').forEach(row => {row.hidden = !row.hidden;});">Toggle Hidden Rows</button></li></ul></nav>
|
||||||
|
<table class="striped" id="hidden-row-example">
|
||||||
|
<caption>
|
||||||
|
Solar System Planets
|
||||||
|
</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Planet</th>
|
||||||
|
<th scope="col">Diameter (km)</th>
|
||||||
|
<th scope="col">Dist.to Sun (AU)</th>
|
||||||
|
<th scope="col">Orbit (days)</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Mercury</th>
|
||||||
|
<td>4,880</td>
|
||||||
|
<td>0.39</td>
|
||||||
|
<td>88</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Venus</th>
|
||||||
|
<td>12,104</td>
|
||||||
|
<td>0.72</td>
|
||||||
|
<td>225</td>
|
||||||
|
</tr>
|
||||||
|
<tr hidden class="hidden-table-row">
|
||||||
|
<td colspan="4" style="text-align: center;">*Hidden Row Found*</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Earth</th>
|
||||||
|
<td>12,742</td>
|
||||||
|
<td>1.00</td>
|
||||||
|
<td>365</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Mars</th>
|
||||||
|
<td>6,779</td>
|
||||||
|
<td>1.52</td>
|
||||||
|
<td>687</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Jupiter</th>
|
||||||
|
<td>139,820</td>
|
||||||
|
<td>5.20</td>
|
||||||
|
<td>4,333</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Saturn</th>
|
||||||
|
<td>116,460</td>
|
||||||
|
<td>9.58</td>
|
||||||
|
<td>10,759</td>
|
||||||
|
</tr>
|
||||||
|
<tr hidden class="hidden-table-row">
|
||||||
|
<th scope="row">* Uranus *</th>
|
||||||
|
<td>50,724</td>
|
||||||
|
<td>19.22</td>
|
||||||
|
<td>30,688</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Neptune</th>
|
||||||
|
<td>49,244</td>
|
||||||
|
<td>30.05</td>
|
||||||
|
<td>60,182</td>
|
||||||
|
</tr>
|
||||||
|
<tr hidden class="hidden-table-row">
|
||||||
|
<th scope="row">* Pluto *</th>
|
||||||
|
<td>2,377</td>
|
||||||
|
<td>39.48</td>
|
||||||
|
<td>90,560</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Average</th>
|
||||||
|
<td>49,594</td>
|
||||||
|
<td>8.58</td>
|
||||||
|
<td>13,666</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</article>
|
||||||
|
<hr>
|
||||||
<article id="tabs">
|
<article id="tabs">
|
||||||
<header>
|
<header>
|
||||||
<h2>Responsive Tabs <code>[role="tablist"]</code></h2>
|
<h2>Responsive Tabs <code>[role="tablist"]</code></h2>
|
||||||
|
@ -794,7 +902,7 @@
|
||||||
<code>.row</code> has a max width set to the viewport of your <code>xl</code> viewport (1300px by default)
|
<code>.row</code> has a max width set to the viewport of your <code>xl</code> viewport (1300px by default)
|
||||||
</p>
|
</p>
|
||||||
<code>.row-fluid</code> max width is 100%.
|
<code>.row-fluid</code> max width is 100%.
|
||||||
</p>
|
</>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<article style="background-color:var(--pico-primary-background); color:var(--pico-primary-inverse);">col-3</article>
|
<article style="background-color:var(--pico-primary-background); color:var(--pico-primary-inverse);">col-3</article>
|
||||||
|
|
140
docs/pico.css
140
docs/pico.css
|
@ -134,6 +134,10 @@ h6 {
|
||||||
--pico-typography-spacing-top: 1.5rem;
|
--pico-typography-spacing-top: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table > caption {
|
||||||
|
--pico-font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
thead th,
|
thead th,
|
||||||
thead td,
|
thead td,
|
||||||
tfoot th,
|
tfoot th,
|
||||||
|
@ -232,19 +236,19 @@ nav details.dropdown summary:focus-visible {
|
||||||
color-scheme: light;
|
color-scheme: light;
|
||||||
--pico-background-color: #fff;
|
--pico-background-color: #fff;
|
||||||
--pico-color: #373c44;
|
--pico-color: #373c44;
|
||||||
--pico-text-selection-color: rgba(119, 156, 0, 0.25);
|
--pico-text-selection-color: rgba(246, 84, 126, 0.25);
|
||||||
--pico-muted-color: #646b79;
|
--pico-muted-color: #646b79;
|
||||||
--pico-muted-border-color: rgb(231, 234, 239.5);
|
--pico-muted-border-color: rgb(231, 234, 239.5);
|
||||||
--pico-primary: #577400;
|
--pico-primary: #c72259;
|
||||||
--pico-primary-background: #a5d601;
|
--pico-primary-background: #d92662;
|
||||||
--pico-primary-border: var(--pico-primary-background);
|
--pico-primary-border: var(--pico-primary-background);
|
||||||
--pico-primary-underline: rgba(87, 116, 0, 0.5);
|
--pico-primary-underline: rgba(199, 34, 89, 0.5);
|
||||||
--pico-primary-hover: #435a00;
|
--pico-primary-hover: #9d1945;
|
||||||
--pico-primary-hover-background: #99c801;
|
--pico-primary-hover-background: #c72259;
|
||||||
--pico-primary-hover-border: var(--pico-primary-hover-background);
|
--pico-primary-hover-border: var(--pico-primary-hover-background);
|
||||||
--pico-primary-hover-underline: var(--pico-primary-hover);
|
--pico-primary-hover-underline: var(--pico-primary-hover);
|
||||||
--pico-primary-focus: rgba(119, 156, 0, 0.5);
|
--pico-primary-focus: rgba(246, 84, 126, 0.5);
|
||||||
--pico-primary-inverse: #000;
|
--pico-primary-inverse: #fff;
|
||||||
--pico-secondary: #5d6b89;
|
--pico-secondary: #5d6b89;
|
||||||
--pico-secondary-background: #525f7a;
|
--pico-secondary-background: #525f7a;
|
||||||
--pico-secondary-border: var(--pico-secondary-background);
|
--pico-secondary-border: var(--pico-secondary-background);
|
||||||
|
@ -308,7 +312,7 @@ nav details.dropdown summary:focus-visible {
|
||||||
--pico-switch-background-color: #bfc7d9;
|
--pico-switch-background-color: #bfc7d9;
|
||||||
--pico-switch-checked-background-color: var(--pico-primary-background);
|
--pico-switch-checked-background-color: var(--pico-primary-background);
|
||||||
--pico-switch-color: #fff;
|
--pico-switch-color: #fff;
|
||||||
--pico-switch-thumb-box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.25);
|
--pico-switch-thumb-box-shadow: 0 0 0 rgba(0, 0, 0, 0);
|
||||||
--pico-range-border-color: #dfe3eb;
|
--pico-range-border-color: #dfe3eb;
|
||||||
--pico-range-active-border-color: #bfc7d9;
|
--pico-range-active-border-color: #bfc7d9;
|
||||||
--pico-range-thumb-border-color: var(--pico-background-color);
|
--pico-range-thumb-border-color: var(--pico-background-color);
|
||||||
|
@ -343,7 +347,7 @@ nav details.dropdown summary:focus-visible {
|
||||||
[data-theme=light] details summary[role=button]:not(.outline, .contrast, .secondary)::after,
|
[data-theme=light] details summary[role=button]:not(.outline, .contrast, .secondary)::after,
|
||||||
:root:not([data-theme=dark]) details summary[role=button]:not(.outline, .contrast, .secondary)::after,
|
:root:not([data-theme=dark]) details summary[role=button]:not(.outline, .contrast, .secondary)::after,
|
||||||
:host(:not([data-theme=dark])) details summary[role=button]:not(.outline, .contrast, .secondary)::after {
|
:host(:not([data-theme=dark])) details summary[role=button]:not(.outline, .contrast, .secondary)::after {
|
||||||
filter: brightness(100) invert(1);
|
filter: brightness(100) invert(0);
|
||||||
}
|
}
|
||||||
[data-theme=light] details summary.secondary[role=button]::after,
|
[data-theme=light] details summary.secondary[role=button]::after,
|
||||||
:root:not([data-theme=dark]) details summary.secondary[role=button]::after,
|
:root:not([data-theme=dark]) details summary.secondary[role=button]::after,
|
||||||
|
@ -358,7 +362,7 @@ nav details.dropdown summary:focus-visible {
|
||||||
[data-theme=light] [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before,
|
[data-theme=light] [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before,
|
||||||
:root:not([data-theme=dark]) [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before,
|
:root:not([data-theme=dark]) [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before,
|
||||||
:host(:not([data-theme=dark])) [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before {
|
:host(:not([data-theme=dark])) [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before {
|
||||||
filter: brightness(0) invert(1);
|
filter: brightness(100) invert(0);
|
||||||
}
|
}
|
||||||
[data-theme=light] input:is([type=submit],
|
[data-theme=light] input:is([type=submit],
|
||||||
[type=button],
|
[type=button],
|
||||||
|
@ -387,19 +391,19 @@ nav details.dropdown summary:focus-visible {
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
--pico-background-color: rgb(19, 22.5, 30.5);
|
--pico-background-color: rgb(19, 22.5, 30.5);
|
||||||
--pico-color: #c2c7d0;
|
--pico-color: #c2c7d0;
|
||||||
--pico-text-selection-color: rgba(130, 171, 0, 0.1875);
|
--pico-text-selection-color: rgba(247, 112, 142, 0.1875);
|
||||||
--pico-muted-color: #7b8495;
|
--pico-muted-color: #7b8495;
|
||||||
--pico-muted-border-color: #202632;
|
--pico-muted-border-color: #202632;
|
||||||
--pico-primary: #82ab00;
|
--pico-primary: #f7708e;
|
||||||
--pico-primary-background: #a5d601;
|
--pico-primary-background: #d92662;
|
||||||
--pico-primary-border: var(--pico-primary-background);
|
--pico-primary-border: var(--pico-primary-background);
|
||||||
--pico-primary-underline: rgba(130, 171, 0, 0.5);
|
--pico-primary-underline: rgba(247, 112, 142, 0.5);
|
||||||
--pico-primary-hover: #99c801;
|
--pico-primary-hover: #f99eae;
|
||||||
--pico-primary-hover-background: #b2e51a;
|
--pico-primary-hover-background: #f42c6f;
|
||||||
--pico-primary-hover-border: var(--pico-primary-hover-background);
|
--pico-primary-hover-border: var(--pico-primary-hover-background);
|
||||||
--pico-primary-hover-underline: var(--pico-primary-hover);
|
--pico-primary-hover-underline: var(--pico-primary-hover);
|
||||||
--pico-primary-focus: rgba(130, 171, 0, 0.375);
|
--pico-primary-focus: rgba(247, 112, 142, 0.375);
|
||||||
--pico-primary-inverse: #000;
|
--pico-primary-inverse: #fff;
|
||||||
--pico-secondary: #969eaf;
|
--pico-secondary: #969eaf;
|
||||||
--pico-secondary-background: #525f7a;
|
--pico-secondary-background: #525f7a;
|
||||||
--pico-secondary-border: var(--pico-secondary-background);
|
--pico-secondary-border: var(--pico-secondary-background);
|
||||||
|
@ -463,7 +467,7 @@ nav details.dropdown summary:focus-visible {
|
||||||
--pico-switch-background-color: #333c4e;
|
--pico-switch-background-color: #333c4e;
|
||||||
--pico-switch-checked-background-color: var(--pico-primary-background);
|
--pico-switch-checked-background-color: var(--pico-primary-background);
|
||||||
--pico-switch-color: #fff;
|
--pico-switch-color: #fff;
|
||||||
--pico-switch-thumb-box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.25);
|
--pico-switch-thumb-box-shadow: 0 0 0 rgba(0, 0, 0, 0);
|
||||||
--pico-range-border-color: #202632;
|
--pico-range-border-color: #202632;
|
||||||
--pico-range-active-border-color: #2a3140;
|
--pico-range-active-border-color: #2a3140;
|
||||||
--pico-range-thumb-border-color: var(--pico-background-color);
|
--pico-range-thumb-border-color: var(--pico-background-color);
|
||||||
|
@ -523,7 +527,7 @@ nav details.dropdown summary:focus-visible {
|
||||||
}
|
}
|
||||||
:root:not([data-theme]) details summary[role=button]:not(.outline, .contrast, .secondary)::after,
|
:root:not([data-theme]) details summary[role=button]:not(.outline, .contrast, .secondary)::after,
|
||||||
:host(:not([data-theme])) details summary[role=button]:not(.outline, .contrast, .secondary)::after {
|
:host(:not([data-theme])) details summary[role=button]:not(.outline, .contrast, .secondary)::after {
|
||||||
filter: brightness(100) invert(1);
|
filter: brightness(100) invert(0);
|
||||||
}
|
}
|
||||||
:root:not([data-theme]) details summary.secondary[role=button]::after,
|
:root:not([data-theme]) details summary.secondary[role=button]::after,
|
||||||
:host(:not([data-theme])) details summary.secondary[role=button]::after {
|
:host(:not([data-theme])) details summary.secondary[role=button]::after {
|
||||||
|
@ -535,26 +539,26 @@ nav details.dropdown summary:focus-visible {
|
||||||
}
|
}
|
||||||
:root:not([data-theme]) [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before,
|
:root:not([data-theme]) [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before,
|
||||||
:host(:not([data-theme])) [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before {
|
:host(:not([data-theme])) [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before {
|
||||||
filter: brightness(100) invert(0);
|
filter: brightness(100) invert(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[data-theme=dark] {
|
[data-theme=dark] {
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
--pico-background-color: rgb(19, 22.5, 30.5);
|
--pico-background-color: rgb(19, 22.5, 30.5);
|
||||||
--pico-color: #c2c7d0;
|
--pico-color: #c2c7d0;
|
||||||
--pico-text-selection-color: rgba(130, 171, 0, 0.1875);
|
--pico-text-selection-color: rgba(247, 112, 142, 0.1875);
|
||||||
--pico-muted-color: #7b8495;
|
--pico-muted-color: #7b8495;
|
||||||
--pico-muted-border-color: #202632;
|
--pico-muted-border-color: #202632;
|
||||||
--pico-primary: #82ab00;
|
--pico-primary: #f7708e;
|
||||||
--pico-primary-background: #a5d601;
|
--pico-primary-background: #d92662;
|
||||||
--pico-primary-border: var(--pico-primary-background);
|
--pico-primary-border: var(--pico-primary-background);
|
||||||
--pico-primary-underline: rgba(130, 171, 0, 0.5);
|
--pico-primary-underline: rgba(247, 112, 142, 0.5);
|
||||||
--pico-primary-hover: #99c801;
|
--pico-primary-hover: #f99eae;
|
||||||
--pico-primary-hover-background: #b2e51a;
|
--pico-primary-hover-background: #f42c6f;
|
||||||
--pico-primary-hover-border: var(--pico-primary-hover-background);
|
--pico-primary-hover-border: var(--pico-primary-hover-background);
|
||||||
--pico-primary-hover-underline: var(--pico-primary-hover);
|
--pico-primary-hover-underline: var(--pico-primary-hover);
|
||||||
--pico-primary-focus: rgba(130, 171, 0, 0.375);
|
--pico-primary-focus: rgba(247, 112, 142, 0.375);
|
||||||
--pico-primary-inverse: #000;
|
--pico-primary-inverse: #fff;
|
||||||
--pico-secondary: #969eaf;
|
--pico-secondary: #969eaf;
|
||||||
--pico-secondary-background: #525f7a;
|
--pico-secondary-background: #525f7a;
|
||||||
--pico-secondary-border: var(--pico-secondary-background);
|
--pico-secondary-border: var(--pico-secondary-background);
|
||||||
|
@ -618,7 +622,7 @@ nav details.dropdown summary:focus-visible {
|
||||||
--pico-switch-background-color: #333c4e;
|
--pico-switch-background-color: #333c4e;
|
||||||
--pico-switch-checked-background-color: var(--pico-primary-background);
|
--pico-switch-checked-background-color: var(--pico-primary-background);
|
||||||
--pico-switch-color: #fff;
|
--pico-switch-color: #fff;
|
||||||
--pico-switch-thumb-box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.25);
|
--pico-switch-thumb-box-shadow: 0 0 0 rgba(0, 0, 0, 0);
|
||||||
--pico-range-border-color: #202632;
|
--pico-range-border-color: #202632;
|
||||||
--pico-range-active-border-color: #2a3140;
|
--pico-range-active-border-color: #2a3140;
|
||||||
--pico-range-thumb-border-color: var(--pico-background-color);
|
--pico-range-thumb-border-color: var(--pico-background-color);
|
||||||
|
@ -666,7 +670,7 @@ nav details.dropdown summary:focus-visible {
|
||||||
--pico-form-element-focus-color: var(--pico-primary-focus);
|
--pico-form-element-focus-color: var(--pico-primary-focus);
|
||||||
}
|
}
|
||||||
[data-theme=dark] details summary[role=button]:not(.outline, .contrast, .secondary)::after {
|
[data-theme=dark] details summary[role=button]:not(.outline, .contrast, .secondary)::after {
|
||||||
filter: brightness(100) invert(1);
|
filter: brightness(100) invert(0);
|
||||||
}
|
}
|
||||||
[data-theme=dark] details summary.secondary[role=button]::after {
|
[data-theme=dark] details summary.secondary[role=button]::after {
|
||||||
filter: brightness(100) invert(0);
|
filter: brightness(100) invert(0);
|
||||||
|
@ -675,7 +679,7 @@ nav details.dropdown summary:focus-visible {
|
||||||
filter: brightness(100) invert(1);
|
filter: brightness(100) invert(1);
|
||||||
}
|
}
|
||||||
[data-theme=dark] [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before {
|
[data-theme=dark] [aria-busy=true]:not(input, select, textarea, html, form):is(button, [type=submit], [type=button], [type=reset], [role=button]):not(.outline)::before {
|
||||||
filter: brightness(100) invert(0);
|
filter: brightness(100) invert(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
progress,
|
progress,
|
||||||
|
@ -1732,8 +1736,8 @@ button:focus, button:is([aria-current]:not([aria-current=false])):focus,
|
||||||
text-indent: 0;
|
text-indent: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
th,
|
table th,
|
||||||
td {
|
table td {
|
||||||
padding: calc(var(--pico-spacing) / 2) var(--pico-spacing);
|
padding: calc(var(--pico-spacing) / 2) var(--pico-spacing);
|
||||||
border-bottom: var(--pico-border-width) solid var(--pico-table-border-color);
|
border-bottom: var(--pico-border-width) solid var(--pico-table-border-color);
|
||||||
background-color: var(--pico-background-color);
|
background-color: var(--pico-background-color);
|
||||||
|
@ -1743,15 +1747,73 @@ td {
|
||||||
text-align: start;
|
text-align: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
tfoot th,
|
table > caption {
|
||||||
tfoot td {
|
margin-block: calc(var(--pico-block-spacing-vertical) * 0.5);
|
||||||
|
padding: calc(var(--pico-spacing) / 2) var(--pico-spacing);
|
||||||
|
background-color: var(--pico-table-row-stripped-background-color);
|
||||||
|
color: var(--pico-h3-color);
|
||||||
|
font-weight: var(--pico-font-weight);
|
||||||
|
font-size: 1.25rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
table > tfoot th,
|
||||||
|
table > tfoot td {
|
||||||
border-top: var(--pico-border-width) solid var(--pico-table-border-color);
|
border-top: var(--pico-border-width) solid var(--pico-table-border-color);
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.striped tbody tr:nth-child(odd of :not([hidden])) th,
|
table > caption {
|
||||||
table.striped tbody tr:nth-child(odd of :not([hidden])) td {
|
margin-block: calc(var(--pico-block-spacing-vertical) * 0.5);
|
||||||
background-color: var(--pico-table-row-stripped-background-color);
|
background-color: var(--pico-table-row-stripped-background-color);
|
||||||
|
color: var(--pico-h3-color);
|
||||||
|
font-weight: var(--pico-font-weight);
|
||||||
|
font-size: 1.25rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.striped > tbody > tr:nth-child(odd) > th,
|
||||||
|
table.striped > tbody > tr:nth-child(odd) > td {
|
||||||
|
background: var(--pico-table-row-stripped-background-color);
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr:nth-child(even) > th,
|
||||||
|
table.striped > tbody > tr:nth-child(even) > td {
|
||||||
|
background: var(--pico-background-color);
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr:nth-child(odd) > th,
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr:nth-child(odd) > td {
|
||||||
|
background: var(--pico-background-color);
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr:nth-child(even) > th,
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr:nth-child(even) > td {
|
||||||
|
background: var(--pico-table-row-stripped-background-color);
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr:nth-child(odd) > th,
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr:nth-child(odd) > td {
|
||||||
|
background: var(--pico-table-row-stripped-background-color);
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr:nth-child(even) > th,
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr:nth-child(even) > td {
|
||||||
|
background: var(--pico-background-color);
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr:nth-child(odd) > th,
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr:nth-child(odd) > td {
|
||||||
|
background: var(--pico-background-color);
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr:nth-child(even) > th,
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr:nth-child(even) > td {
|
||||||
|
background: var(--pico-table-row-stripped-background-color);
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr:nth-child(odd) > th,
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr:nth-child(odd) > td {
|
||||||
|
background: var(--pico-table-row-stripped-background-color);
|
||||||
|
}
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr:nth-child(even) > th,
|
||||||
|
table.striped > tbody > tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr[hidden] ~ tr:nth-child(even) > td {
|
||||||
|
background: var(--pico-background-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
2
docs/pico.min.css
vendored
2
docs/pico.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,7 @@
|
||||||
// Settings
|
// Settings
|
||||||
// ––––––––––––––––––––
|
// ––––––––––––––––––––
|
||||||
|
|
||||||
// Theme color
|
// Theme colors
|
||||||
$yo-themes: (
|
$yo-themes: (
|
||||||
"amber",
|
"amber",
|
||||||
"azure",
|
"azure",
|
||||||
|
@ -13,7 +13,6 @@ $yo-themes: (
|
||||||
"cyan",
|
"cyan",
|
||||||
"fuchsia",
|
"fuchsia",
|
||||||
"green",
|
"green",
|
||||||
"grey",
|
|
||||||
"indigo",
|
"indigo",
|
||||||
"jade",
|
"jade",
|
||||||
"lime",
|
"lime",
|
||||||
|
@ -22,11 +21,8 @@ $yo-themes: (
|
||||||
"pumpkin",
|
"pumpkin",
|
||||||
"purple",
|
"purple",
|
||||||
"red",
|
"red",
|
||||||
"sand",
|
|
||||||
"slate",
|
|
||||||
"violet",
|
"violet",
|
||||||
"yellow",
|
"yellow"
|
||||||
"zinc"
|
|
||||||
);
|
);
|
||||||
$random: list.nth($yo-themes, math.random(list.length($yo-themes)));
|
$random: list.nth($yo-themes, math.random(list.length($yo-themes)));
|
||||||
// picks a random theme to use as default
|
// picks a random theme to use as default
|
||||||
|
@ -64,6 +60,11 @@ $enable-transitions: true !default;
|
||||||
// Enable overriding with !important
|
// Enable overriding with !important
|
||||||
$enable-important: true !default;
|
$enable-important: true !default;
|
||||||
|
|
||||||
|
// How many hidden rows do you expect to have within a table?
|
||||||
|
// <tr hidden> is what is accounted for striped rows.
|
||||||
|
// if none, put 0 instead of 3.
|
||||||
|
$hidden-table-levels: 4 !default;
|
||||||
|
|
||||||
// Optional parent selector
|
// Optional parent selector
|
||||||
// If defined, all HTML tags are wrapped with this selector
|
// If defined, all HTML tags are wrapped with this selector
|
||||||
// :root is not wrapped
|
// :root is not wrapped
|
||||||
|
|
|
@ -1,6 +1,61 @@
|
||||||
@use "sass:map";
|
@use "sass:map";
|
||||||
@use "../settings" as *;
|
@use "../settings" as *;
|
||||||
|
|
||||||
|
// Variables for striped rows
|
||||||
|
$color-dark: var(#{$css-var-prefix}table-row-stripped-background-color);
|
||||||
|
$color-light: var(#{$css-var-prefix}background-color);
|
||||||
|
|
||||||
|
// Adjust this number to control how many <tr hidden> rows are expected.
|
||||||
|
$hidden-levels: $hidden-table-levels;
|
||||||
|
|
||||||
|
// Do not change, or remove the following line
|
||||||
|
// needed this outside of the mixin to compile, idk why
|
||||||
|
// sass --version = 1.83.4 compiled with dart2js 3.6.1
|
||||||
|
$selector: "& ~ tr";
|
||||||
|
|
||||||
|
// This is the work around because the compiler changes
|
||||||
|
// :nth-child(odd of :not(:hidden)) to :nth-child(oddof:not(:hidden))
|
||||||
|
// which makes the stripes fail.
|
||||||
|
// Mixin to handle the hidden row with striped backgrounds patterns
|
||||||
|
// Thanks Shaggy: https://stackoverflow.com/questions/3773890/zebra-striping-a-table-with-hidden-rows-using-css3/36892714#36892714
|
||||||
|
@mixin hidden-row-patterns($levels: 2, $dark-color: $color-dark, $light-color: $color-light) {
|
||||||
|
$current-color-odd: $light-color;
|
||||||
|
$current-color-even: $dark-color;
|
||||||
|
// Generate nested s electors for each level
|
||||||
|
$selector: "& ~ tr";
|
||||||
|
|
||||||
|
&[hidden] {
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
@for $i from 1 through $levels {
|
||||||
|
@if $i > 1 {
|
||||||
|
// Swap colors for next iteration
|
||||||
|
$temp: $current-color-odd;
|
||||||
|
$current-color-odd: $current-color-even;
|
||||||
|
$current-color-even: $temp;
|
||||||
|
|
||||||
|
// Add another level of nesting to the selector
|
||||||
|
$selector: "#{$selector}[hidden] ~ tr";
|
||||||
|
}
|
||||||
|
#{$selector} {
|
||||||
|
&:nth-child(odd) {
|
||||||
|
> th,
|
||||||
|
> td {
|
||||||
|
background: $current-color-odd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(even) {
|
||||||
|
> th,
|
||||||
|
> td {
|
||||||
|
background: $current-color-even;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@if map.get($modules, "content/table") {
|
@if map.get($modules, "content/table") {
|
||||||
/**
|
/**
|
||||||
* Table
|
* Table
|
||||||
|
@ -24,8 +79,8 @@
|
||||||
// ––––––––––––––––––––
|
// ––––––––––––––––––––
|
||||||
|
|
||||||
// Cells
|
// Cells
|
||||||
#{$parent-selector} th,
|
#{$parent-selector} table th,
|
||||||
#{$parent-selector} td {
|
#{$parent-selector} table td {
|
||||||
padding: calc(var(#{$css-var-prefix}spacing) / 2) var(#{$css-var-prefix}spacing);
|
padding: calc(var(#{$css-var-prefix}spacing) / 2) var(#{$css-var-prefix}spacing);
|
||||||
border-bottom: var(#{$css-var-prefix}border-width)
|
border-bottom: var(#{$css-var-prefix}border-width)
|
||||||
solid
|
solid
|
||||||
|
@ -37,8 +92,18 @@
|
||||||
text-align: start;
|
text-align: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#{$parent-selector} table > caption {
|
||||||
|
margin-block: calc(var(#{$css-var-prefix}block-spacing-vertical) * 0.5);
|
||||||
|
padding: calc(var(#{$css-var-prefix}spacing) / 2) var(#{$css-var-prefix}spacing);
|
||||||
|
background-color: var(#{$css-var-prefix}table-row-stripped-background-color);
|
||||||
|
color: var(#{$css-var-prefix}h3-color);
|
||||||
|
font-weight: var(#{$css-var-prefix}font-weight);
|
||||||
|
font-size: 1.25rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
// Footer
|
// Footer
|
||||||
#{$parent-selector} tfoot {
|
#{$parent-selector} table > tfoot {
|
||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
border-top: var(#{$css-var-prefix}border-width)
|
border-top: var(#{$css-var-prefix}border-width)
|
||||||
|
@ -48,13 +113,36 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#{$parent-selector} table > caption {
|
||||||
|
margin-block: calc(var(#{$css-var-prefix}block-spacing-vertical) * 0.5);
|
||||||
|
background-color: var(#{$css-var-prefix}table-row-stripped-background-color);
|
||||||
|
color: var(#{$css-var-prefix}h3-color);
|
||||||
|
font-weight: var(#{$css-var-prefix}font-weight);
|
||||||
|
font-size: 1.25rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
// Striped
|
// Striped
|
||||||
@if enable-classes {
|
@if enable-classes {
|
||||||
#{$parent-selector} table {
|
#{$parent-selector} table {
|
||||||
&.striped {
|
&.striped {
|
||||||
tbody tr:nth-child(odd of :not([hidden])) th,
|
> tbody > tr {
|
||||||
tbody tr:nth-child(odd of :not([hidden])) td {
|
&:nth-child(odd) {
|
||||||
background-color: var(#{$css-var-prefix}table-row-stripped-background-color);
|
> th,
|
||||||
|
> td {
|
||||||
|
background: $color-dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(even) {
|
||||||
|
> th,
|
||||||
|
> td {
|
||||||
|
background: $color-light;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply the hidden row patterns
|
||||||
|
@include hidden-row-patterns($hidden-levels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,6 +285,9 @@
|
||||||
|
|
||||||
// Table
|
// Table
|
||||||
@if map.get($modules, "content/table") {
|
@if map.get($modules, "content/table") {
|
||||||
|
table > caption {
|
||||||
|
#{$css-var-prefix}font-weight: 600;
|
||||||
|
}
|
||||||
thead,
|
thead,
|
||||||
tfoot {
|
tfoot {
|
||||||
th,
|
th,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue