Density was applied to every fine-pointer device with no way out, which M3 forbids outright: "don't apply density by default; offer an explicit density opt-in instead, keeping opt-out targets at >= 48x48 CSS px". A row is now 52px and `dense` is a prop that tightens it to 36. The row divider also takes outline-variant itself rather than 60% of it, since M3 keeps opacity for state layers and disabled. Plan step 20, findings IN-16 and IN-30. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
83 lines
3.0 KiB
CSS
83 lines
3.0 KiB
CSS
/*
|
|
* Data tables: `<x-table>` (resources/views/components/table.blade.php), whose callers write plain
|
|
* `<thead>`, `<tr>`, `<th>` and `<td>` inside it.
|
|
*
|
|
* So the styling is descendant selectors on the one attribute the component sets, all inside
|
|
* `:where()` and `@layer components`: a caller's `text-end` or `whitespace-nowrap` on a cell always
|
|
* wins. Header cells in title-small on-surface-variant over an outline-variant rule, body cells in
|
|
* body-medium between outline-variant rules. A row that opens something is `data-list-row` and
|
|
* answers a pointer as a list row does (components/list.css).
|
|
*
|
|
* A row is 52px: 16px above and below a body-medium line. Density is never applied by itself —
|
|
* "don't apply density by default; offer an explicit density opt-in instead, keeping opt-out targets
|
|
* at >= 48x48 CSS px" (docs/reference/m3/foundations-supplement.md § Accessibility) — so `dense`
|
|
* (`data-dense`) is the caller's decision, and it is the caller's to justify: a dense row is 36px,
|
|
* and a dense row inside an `xs` table 24px.
|
|
*/
|
|
|
|
@layer components {
|
|
/* `relative` makes the table the containing block for anything absolute inside it — an `sr-only`
|
|
header label, a tooltip. Without it they escape the scroll box and widen a phone's layout
|
|
viewport. */
|
|
[data-table] {
|
|
--cell-x: 0.75rem;
|
|
--cell-y: 1rem;
|
|
|
|
position: relative;
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
color: var(--md-sys-color-on-surface);
|
|
font: var(--md-sys-typescale-body-md);
|
|
letter-spacing: var(--md-sys-typescale-body-md-tracking);
|
|
}
|
|
|
|
[data-table][data-size="xs"] {
|
|
--cell-x: 0.5rem;
|
|
--cell-y: 0.5rem;
|
|
|
|
font: var(--md-sys-typescale-body-sm);
|
|
letter-spacing: var(--md-sys-typescale-body-sm-tracking);
|
|
}
|
|
|
|
[data-table][data-dense] {
|
|
--cell-y: 0.5rem;
|
|
}
|
|
|
|
[data-table][data-size="xs"][data-dense] {
|
|
--cell-y: 0.25rem;
|
|
}
|
|
|
|
[data-table] :where(th, td) {
|
|
padding: var(--cell-y) var(--cell-x);
|
|
text-align: start;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
[data-table] :where(thead th) {
|
|
color: var(--md-sys-color-on-surface-variant);
|
|
font: var(--md-sys-typescale-title-sm);
|
|
letter-spacing: var(--md-sys-typescale-title-sm-tracking);
|
|
white-space: nowrap;
|
|
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
|
}
|
|
|
|
[data-table][data-size="xs"] :where(thead th) {
|
|
font: var(--md-sys-typescale-label-md);
|
|
letter-spacing: var(--md-sys-typescale-label-md-tracking);
|
|
}
|
|
|
|
/* The role itself, not a fraction of it: M3 reserves opacity for state layers and disabled. */
|
|
[data-table] :where(tbody tr) {
|
|
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
|
}
|
|
|
|
[data-table] :where(tbody tr:last-child) {
|
|
border-bottom: 0;
|
|
}
|
|
|
|
[data-table] :where(tbody tr[aria-selected="true"]) {
|
|
background-color: var(--md-sys-color-secondary-container);
|
|
color: var(--md-sys-color-on-secondary-container);
|
|
}
|
|
}
|