actual-css 0.16.1 → 0.17.1
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/CHANGELOG.md +101 -0
- package/README.md +8 -4
- package/components.json +19 -4
- package/dist/actual.full.css +464 -80
- package/dist/actual.full.js +2 -1
- package/dist/actual.full.min.css +1 -1
- package/docs/design-notes/app-ui.md +37 -3
- package/docs/design-notes/enhancement-contract.md +3 -1
- package/docs/navigation.json +17 -3
- package/docs/pages/components/accordion.md +8 -0
- package/docs/pages/components/alert.md +47 -17
- package/docs/pages/components/app-navigation.md +2 -2
- package/docs/pages/components/aura.md +2 -2
- package/docs/pages/components/badge.md +4 -3
- package/docs/pages/components/button.md +3 -0
- package/docs/pages/components/card.md +1 -1
- package/docs/pages/components/chat.md +2 -2
- package/docs/pages/components/dialog.md +36 -0
- package/docs/pages/components/drawer.md +52 -8
- package/docs/pages/components/fab.md +2 -1
- package/docs/pages/components/list.md +1 -1
- package/docs/pages/components/meter.md +1 -1
- package/docs/pages/components/navbar.md +27 -3
- package/docs/pages/components/overview.md +17 -0
- package/docs/pages/components/rating.md +111 -12
- package/docs/pages/components/segmented.md +36 -1
- package/docs/pages/components/shimmer.md +2 -2
- package/docs/pages/components/spinner.md +2 -0
- package/docs/pages/components/table.md +77 -0
- package/docs/pages/components/timeline.md +3 -1
- package/docs/pages/enhancements/flyout.md +83 -14
- package/docs/pages/enhancements/overview.md +2 -2
- package/docs/pages/enhancements/status-bar.md +1 -1
- package/docs/pages/enhancements/tabs.md +5 -0
- package/docs/pages/examples/overview.md +5 -1
- package/docs/pages/forms/ajax.md +101 -0
- package/docs/pages/forms/choice-cards.md +1 -1
- package/docs/pages/forms/color-swatches.md +31 -2
- package/docs/pages/forms/detached-actions.md +1 -1
- package/docs/pages/forms/floating-field.md +5 -3
- package/docs/pages/forms/form-actions.md +1 -1
- package/docs/pages/forms/input-policy.md +1 -1
- package/docs/pages/forms/joined-controls.md +9 -4
- package/docs/pages/forms/otp.md +2 -2
- package/docs/pages/forms/overview.md +1 -1
- package/docs/pages/forms/password.md +1 -1
- package/docs/pages/forms/states-and-sizes.md +1 -1
- package/docs/pages/forms/sticky-actions.md +1 -1
- package/docs/pages/forms/unsaved-changes.md +198 -0
- package/docs/pages/foundations/philosophy.md +2 -1
- package/docs/pages/foundations/theming.md +4 -3
- package/docs/pages/foundations/tokens.md +30 -5
- package/docs/pages/foundations/typography.md +1 -1
- package/docs/pages/guides/introduction.md +1 -1
- package/docs/pages/guides/progressive-enhancement.md +31 -50
- package/docs/pages/guides/upgrading.md +15 -2
- package/docs/pages/layout/app-layout.md +1 -1
- package/docs/pages/layout/app-shell.md +1 -1
- package/docs/pages/layout/choosing.md +5 -0
- package/docs/pages/layout/column-layout.md +23 -9
- package/docs/pages/layout/media.md +1 -1
- package/docs/pages/layout/overview.md +1 -1
- package/docs/pages/layout/scroll-snap.md +1 -1
- package/docs/pages/layout/scroll-target.md +1 -1
- package/docs/pages/layout/sidebar-layout.md +1 -1
- package/docs/pages/layout/sidebar-shell.md +68 -0
- package/docs/pages/patterns/code-block.md +1 -1
- package/docs/pages/patterns/empty-state.md +74 -0
- package/docs/pages/patterns/exclusive-accordion.md +1 -1
- package/docs/pages/patterns/hierarchical-nav.md +41 -20
- package/docs/pages/patterns/icon-input.md +1 -1
- package/docs/pages/patterns/intent-nesting.md +1 -1
- package/docs/pages/patterns/navigation-list.md +5 -62
- package/docs/pages/patterns/overview.md +1 -1
- package/docs/pages/patterns/stat.md +61 -0
- package/docs/pages/patterns/structured-lists.md +1 -1
- package/docs/pages/utilities/accessibility.md +32 -10
- package/docs/pages/utilities/flex.md +1 -1
- package/docs/pages/utilities/links.md +1 -1
- package/docs/pages/utilities/list.md +1 -1
- package/docs/pages/utilities/shape.md +1 -1
- package/docs/pages/utilities/sizing-wrapping.md +1 -1
- package/docs/pages/utilities/spacing.md +1 -1
- package/docs/pages/utilities/text.md +1 -1
- package/package.json +4 -1
- package/reserved-classes.json +2 -0
- package/src/cli/actual-css.js +4 -4
- package/src/css/components/accordion.css +10 -6
- package/src/css/components/alert.css +4 -0
- package/src/css/components/busy.css +25 -0
- package/src/css/components/button.css +3 -0
- package/src/css/components/drawer.css +37 -3
- package/src/css/components/flyout.css +37 -0
- package/src/css/components/join.css +14 -0
- package/src/css/components/modal.css +3 -0
- package/src/css/components/navbar.css +102 -38
- package/src/css/components/rating.css +50 -5
- package/src/css/components/segmented.css +25 -2
- package/src/css/core/theme.css +20 -1
- package/src/css/core/tokens.css +4 -1
- package/src/css/forms/color-swatch.css +38 -19
- package/src/css/forms/custom-select.css +10 -0
- package/src/css/forms/input-icon.css +5 -3
- package/src/css/layout/index.css +2 -0
- package/src/css/layout/sidebar-shell.css +67 -0
- package/src/css/typography/prose.css +6 -0
- package/src/js/ajax.js +148 -0
- package/src/js/dialog.js +59 -2
- package/src/js/dirty.js +140 -0
- package/src/js/dismiss.js +25 -0
- package/src/js/events.js +17 -0
- package/src/js/focus.js +12 -0
- package/src/js/form-submission.js +34 -0
- package/src/js/full.js +2 -0
- package/src/js/tab.js +16 -2
- package/src/js/validation.js +12 -4
- package/src/tooling/design-tokens.js +1 -0
- package/src/tooling/theme-contrast.js +44 -4
- package/tokens.json +1 -0
|
@@ -9,6 +9,7 @@ number of children visible in one mockup.
|
|
|
9
9
|
| ----------------------------------------------- | ------------------------------------------- |
|
|
10
10
|
| A normally scrolling page | Semantic landmarks, optionally `.app-shell` |
|
|
11
11
|
| Full-width bands over a centered content column | `.center` inside each landmark |
|
|
12
|
+
| Persistent sidebar + main, drawer on a phone | `.sidebar-shell` |
|
|
12
13
|
| Topbar + scrolling main + adaptive nav | `.app-layout` |
|
|
13
14
|
|
|
14
15
|
For public, marketing, and editorial pages, use semantic landmarks and add
|
|
@@ -23,6 +24,10 @@ rather than the row (see
|
|
|
23
24
|
[Marketing](../../demo/templates/marketing.html) and
|
|
24
25
|
[Blog](../../demo/templates/blog.html) compose bands this way.
|
|
25
26
|
|
|
27
|
+
Use `.sidebar-shell` for an admin or dashboard whose sidebar stays beside the
|
|
28
|
+
content on a wide screen and moves to a drawer on a phone, where the document
|
|
29
|
+
scrolls normally. See [Sidebar Shell](sidebar-shell.md).
|
|
30
|
+
|
|
26
31
|
Use `.app-layout` for a viewport-sized shell where the main region scrolls
|
|
27
32
|
independently and navigation moves from bottom to side. Follow its
|
|
28
33
|
[required structure](app-layout.md). For other arrangements, compose the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Column
|
|
1
|
+
# Column layout
|
|
2
2
|
|
|
3
3
|
`.column-layout` is an explicit twelve-column composition canvas. Each direct
|
|
4
4
|
child places itself with two numbers: `--column-span` (how many units) and
|
|
@@ -9,6 +9,9 @@ are a collection, a known density, peers that switch together, or a main region
|
|
|
9
9
|
with an aside, one of the other primitives already says so — and says it with
|
|
10
10
|
intrinsic responsive behavior this one does not have.
|
|
11
11
|
|
|
12
|
+
**Related terms:** twelve-column grid, bento, bento grid, mosaic, uneven
|
|
13
|
+
feature grid, offset column.
|
|
14
|
+
|
|
12
15
|
```css
|
|
13
16
|
.article-main {
|
|
14
17
|
--column-span: 8;
|
|
@@ -111,6 +114,23 @@ Both sections use start 3 and span 8, so their content shares a left edge and
|
|
|
111
114
|
an alignment gutter without a wrapping grid. In an application, give that pair
|
|
112
115
|
one class and reuse it.
|
|
113
116
|
|
|
117
|
+
## Uneven feature grids
|
|
118
|
+
|
|
119
|
+
A bento or mosaic layout is spans plus a row span. The canvas places columns;
|
|
120
|
+
`grid-row` on the region adds the height, as plain CSS Grid.
|
|
121
|
+
|
|
122
|
+
```html demo
|
|
123
|
+
<div class="column-layout">
|
|
124
|
+
<article class="card" style="--column-span: 6; grid-row: span 2">Featured — 6 columns, 2 rows</article>
|
|
125
|
+
<article class="card" style="--column-span: 6">6</article>
|
|
126
|
+
<article class="card" style="--column-span: 3">3</article>
|
|
127
|
+
<article class="card" style="--column-span: 3">3</article>
|
|
128
|
+
</div>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Give the tiles a class and recompose them in your container query like any
|
|
132
|
+
other region.
|
|
133
|
+
|
|
114
134
|
## The responsive contract
|
|
115
135
|
|
|
116
136
|
`.column-layout` has **no automatic collapse**. The canvas stays twelve columns
|
|
@@ -215,14 +235,8 @@ its track. Define a narrow representation where the composition needs one.
|
|
|
215
235
|
|
|
216
236
|
The primitive is horizontal only. There are no row, area, or order hooks, and no
|
|
217
237
|
breakpoint variants — those would move responsive strategy back into markup.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
```css
|
|
222
|
-
.dashboard-summary {
|
|
223
|
-
grid-row: 1 / span 2;
|
|
224
|
-
}
|
|
225
|
-
```
|
|
238
|
+
Row placement is plain CSS Grid on your own class, as in
|
|
239
|
+
[uneven feature grids](#uneven-feature-grids).
|
|
226
240
|
|
|
227
241
|
The column count is fixed at twelve and is not configurable. Twelve is what
|
|
228
242
|
makes the coordinates shared and lets `6 + 6`, `4 + 4 + 4`, `3 + 3 + 3 + 3`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Layout
|
|
1
|
+
# Layout overview
|
|
2
2
|
|
|
3
3
|
Layout provides a small set of composable building blocks for common page, app, and content structure. It is not a utility-first framework, and the twelve-column canvas it does ship (`.column-layout`) is an opt-in vocabulary for deliberate composition rather than the default way to build a page.
|
|
4
4
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Sidebar shell
|
|
2
|
+
|
|
3
|
+
> A persistent sidebar beside the main region on a wide screen, each scrolling on its own; a drawer on a phone.
|
|
4
|
+
|
|
5
|
+
**Related terms:** admin layout, dashboard shell, persistent sidebar, side navigation, app frame.
|
|
6
|
+
|
|
7
|
+
`.sidebar-shell` takes two direct children: an `aside`, the side region, and
|
|
8
|
+
one other element, the main region. From `64rem`, they sit side by side at the
|
|
9
|
+
height of the viewport and each scrolls on its own, so the sidebar stays put
|
|
10
|
+
while the content scrolls. Below `64rem`, the `aside` is hidden and the
|
|
11
|
+
document scrolls as any page does; the page offers the same navigation in a
|
|
12
|
+
[drawer](../components/drawer.md).
|
|
13
|
+
|
|
14
|
+
```html demo
|
|
15
|
+
<div class="sidebar-shell" style="--viewport-block: 14rem; --sidebar-shell-size: 12rem">
|
|
16
|
+
<aside class="stack" aria-label="Primary" style="padding: var(--space-40); border-inline-end: var(--border-width) solid var(--border)">
|
|
17
|
+
<strong>Product</strong>
|
|
18
|
+
<nav aria-label="Primary">
|
|
19
|
+
<ul class="nav-list">
|
|
20
|
+
<li><a class="nav-link" href="#overview" aria-current="page">Overview</a></li>
|
|
21
|
+
<li><a class="nav-link" href="#orders">Orders</a></li>
|
|
22
|
+
<li><a class="nav-link" href="#customers">Customers</a></li>
|
|
23
|
+
<li><a class="nav-link" href="#settings">Settings</a></li>
|
|
24
|
+
</ul>
|
|
25
|
+
</nav>
|
|
26
|
+
</aside>
|
|
27
|
+
<main class="stack" style="padding: var(--space-40)">
|
|
28
|
+
<h2>Overview</h2>
|
|
29
|
+
<p>The main region scrolls; the sidebar beside it does not move.</p>
|
|
30
|
+
<p>Orders, revenue and recent activity would follow here.</p>
|
|
31
|
+
<p>Keep scrolling: the content is taller than the shell.</p>
|
|
32
|
+
<p>The sidebar keeps its place.</p>
|
|
33
|
+
<p>Each region has its own scrollbar.</p>
|
|
34
|
+
<p>The page itself does not scroll.</p>
|
|
35
|
+
<p>End of the content.</p>
|
|
36
|
+
</main>
|
|
37
|
+
</div>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The demo sets `--viewport-block` to fit the page; an application leaves it to
|
|
41
|
+
the viewport. The `aside` keeps its own `display`, so `.stack` lays it out.
|
|
42
|
+
Put the topbar inside the main region: it then spans the content column only.
|
|
43
|
+
|
|
44
|
+
## Drawer on a phone
|
|
45
|
+
|
|
46
|
+
Keep the drawer outside the shell and open it from a button that only the
|
|
47
|
+
narrow layout shows. A drawer left open when the window widens past `64rem`
|
|
48
|
+
would sit over the sidebar it mirrors; close it from the page:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<script>
|
|
52
|
+
const wide = matchMedia("(width >= 64rem)");
|
|
53
|
+
wide.addEventListener("change", () => {
|
|
54
|
+
if (wide.matches) document.getElementById("main-drawer").close();
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
[App](../../demo/templates/app.html) composes the shell, its drawer and this
|
|
60
|
+
script.
|
|
61
|
+
|
|
62
|
+
## Hooks
|
|
63
|
+
|
|
64
|
+
- `--sidebar-shell-size` — width of the side region.
|
|
65
|
+
|
|
66
|
+
The breakpoint is a literal `64rem`: a custom property cannot sit in a media
|
|
67
|
+
condition. For another breakpoint, copy the two media rules of
|
|
68
|
+
`sidebar-shell.css` into the application.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Empty state
|
|
2
|
+
|
|
3
|
+
> A region with nothing to show yet: a first-run list, a cleared inbox, a
|
|
4
|
+
> search with no results. Composed from layout primitives; there is no
|
|
5
|
+
> empty-state component.
|
|
6
|
+
|
|
7
|
+
**Related terms:** blank slate, zero state, no data, no results, first run,
|
|
8
|
+
placeholder content.
|
|
9
|
+
|
|
10
|
+
## Anatomy
|
|
11
|
+
|
|
12
|
+
- An icon, decorative, with `aria-hidden="true"`.
|
|
13
|
+
- A heading at the level the page outline calls for: `<h2>` under the page
|
|
14
|
+
title, `<h3>` inside a section. Pick the level for the outline and the size
|
|
15
|
+
with a class, never the other way round.
|
|
16
|
+
- One sentence saying what belongs here or how to get it.
|
|
17
|
+
- Optional actions, the first one the way out.
|
|
18
|
+
|
|
19
|
+
```html demo
|
|
20
|
+
<section class="stack items-center text-center"
|
|
21
|
+
aria-labelledby="empty-views-title">
|
|
22
|
+
<i class="ti ti-layout-dashboard muted"
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
style="font-size: 2.5rem"></i>
|
|
25
|
+
<hgroup>
|
|
26
|
+
<h3 id="empty-views-title">No saved views yet</h3>
|
|
27
|
+
<p class="muted">Save a filtered view to come back to this work faster.</p>
|
|
28
|
+
</hgroup>
|
|
29
|
+
<menu class="cluster">
|
|
30
|
+
<li><button class="btn primary" type="button">Save current view</button></li>
|
|
31
|
+
<li><button class="btn ghost" type="button">Clear filters</button></li>
|
|
32
|
+
</menu>
|
|
33
|
+
</section>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For an icon on a tinted disc, compose an [icon slot](icon-slot.md).
|
|
37
|
+
|
|
38
|
+
## No results
|
|
39
|
+
|
|
40
|
+
An empty search names the query and offers to clear it. Clearing removes the
|
|
41
|
+
empty state and the button with it, so move focus back to the search field;
|
|
42
|
+
otherwise it falls to the page.
|
|
43
|
+
|
|
44
|
+
```html demo
|
|
45
|
+
<div class="stack">
|
|
46
|
+
<div class="field">
|
|
47
|
+
<label class="field-label" for="member-search">Search members</label>
|
|
48
|
+
<input class="input" type="search" id="member-search" value="zebra">
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<section class="stack items-center text-center"
|
|
52
|
+
id="no-results"
|
|
53
|
+
aria-labelledby="no-results-title">
|
|
54
|
+
<hgroup>
|
|
55
|
+
<h3 id="no-results-title">No members match “zebra”</h3>
|
|
56
|
+
<p class="muted">Check the spelling, or clear the search to see everyone.</p>
|
|
57
|
+
</hgroup>
|
|
58
|
+
<button class="btn outline" type="button" id="clear-member-search">
|
|
59
|
+
Clear search
|
|
60
|
+
</button>
|
|
61
|
+
</section>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<script>
|
|
65
|
+
const search = document.getElementById("member-search");
|
|
66
|
+
const noResults = document.getElementById("no-results");
|
|
67
|
+
|
|
68
|
+
document.getElementById("clear-member-search").addEventListener("click", () => {
|
|
69
|
+
search.value = "";
|
|
70
|
+
noResults.hidden = true;
|
|
71
|
+
search.focus();
|
|
72
|
+
});
|
|
73
|
+
</script>
|
|
74
|
+
```
|
|
@@ -1,26 +1,47 @@
|
|
|
1
|
-
# Hierarchical
|
|
1
|
+
# Hierarchical scrollable nav
|
|
2
2
|
|
|
3
3
|
App shell with a collapsible nav tree. Uses existing primitives only — no treeview component.
|
|
4
4
|
|
|
5
|
+
**Related terms:** collapsible sidebar, nav group, sub-navigation, nested menu, expandable section, sidebar tree.
|
|
6
|
+
|
|
5
7
|
```html demo
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</
|
|
8
|
+
<nav class="scroller" data-enhance="scrollspy" aria-label="Docs">
|
|
9
|
+
<span class="overline">Documentation</span>
|
|
10
|
+
<ul class="nav-list">
|
|
11
|
+
<li>
|
|
12
|
+
<details open>
|
|
13
|
+
<summary class="nav-link">
|
|
14
|
+
<i class="ti ti-rocket" aria-hidden="true"></i> Getting started
|
|
15
|
+
</summary>
|
|
16
|
+
<ul class="nav-list">
|
|
17
|
+
<li><a class="nav-link" href="#intro">Introduction</a></li>
|
|
18
|
+
<li><a class="nav-link" href="#install">Installation</a></li>
|
|
19
|
+
</ul>
|
|
20
|
+
</details>
|
|
21
|
+
</li>
|
|
22
|
+
<li>
|
|
23
|
+
<details>
|
|
24
|
+
<summary class="nav-link">
|
|
25
|
+
<i class="ti ti-box" aria-hidden="true"></i> Components
|
|
26
|
+
</summary>
|
|
27
|
+
<ul class="nav-list">
|
|
28
|
+
<li><a class="nav-link" href="#alert">Alert</a></li>
|
|
29
|
+
<li><a class="nav-link" href="#badge">Badge</a></li>
|
|
30
|
+
</ul>
|
|
31
|
+
</details>
|
|
32
|
+
</li>
|
|
33
|
+
</ul>
|
|
34
|
+
</nav>
|
|
20
35
|
```
|
|
21
36
|
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
37
|
+
- A group is a `<details>` inside a row `<li>`, never a direct child of the
|
|
38
|
+
`<ul>`. Its `<summary class="nav-link">` takes the row, hover and focus, and
|
|
39
|
+
a chevron that follows the native `[open]` state.
|
|
40
|
+
- The group's links are a nested `.nav-list`, indented so its labels start
|
|
41
|
+
under the parent label past a 1em icon. Set `--nav-list-indent` on the nav
|
|
42
|
+
when the icons are larger.
|
|
43
|
+
- `.overline` labels a section of the nav.
|
|
44
|
+
- `<details name="…">` makes the groups an exclusive accordion, without
|
|
45
|
+
JavaScript.
|
|
46
|
+
- `data-enhance="scrollspy"` sets `aria-current="location"` while the page
|
|
47
|
+
scrolls; `.scroller` gives the nav a thin, theme-aware scrollbar.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Navigation
|
|
1
|
+
# Navigation list
|
|
2
2
|
|
|
3
3
|
Use `.nav-list` for a vertical list of navigation links: it removes native list
|
|
4
4
|
chrome, stacks the rows and stretches each `.nav-link` across the row. For a
|
|
@@ -89,68 +89,11 @@ A project may add `.site-header` when it needs a visual shell.
|
|
|
89
89
|
}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
### App
|
|
92
|
+
### App shell with sidebar
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<div class="shell-sidebar">
|
|
98
|
-
<aside class="shell-sidebar-nav" aria-label="Primary">
|
|
99
|
-
<a class="navbar-brand" href="#"><span class="avatar primary"><abbr>AC</abbr></span> Product</a>
|
|
100
|
-
<nav aria-label="Primary">
|
|
101
|
-
<ul class="nav-list">
|
|
102
|
-
<li><a class="nav-link" href="#" aria-current="page">Overview</a></li>
|
|
103
|
-
<li><a class="nav-link" href="#">Settings</a></li>
|
|
104
|
-
</ul>
|
|
105
|
-
</nav>
|
|
106
|
-
</aside>
|
|
107
|
-
|
|
108
|
-
<div class="shell-sidebar-main">
|
|
109
|
-
<header class="topbar">...</header>
|
|
110
|
-
<main class="center">...</main>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
```css
|
|
116
|
-
.shell-sidebar {
|
|
117
|
-
display: grid;
|
|
118
|
-
grid-template-columns: 1fr;
|
|
119
|
-
min-block-size: var(--viewport-block);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.shell-sidebar-nav {
|
|
123
|
-
display: none;
|
|
124
|
-
flex-direction: column;
|
|
125
|
-
gap: var(--gap);
|
|
126
|
-
inline-size: var(--shell-sidebar-size, 16rem);
|
|
127
|
-
padding: var(--space-40);
|
|
128
|
-
border-inline-end: var(--border-width) solid var(--border);
|
|
129
|
-
background: var(--surface-raised);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.shell-sidebar-main {
|
|
133
|
-
min-inline-size: 0;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
@media (min-width: 64rem) {
|
|
137
|
-
.shell-sidebar {
|
|
138
|
-
grid-template-columns: auto minmax(0, 1fr);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.shell-sidebar-nav {
|
|
142
|
-
display: flex;
|
|
143
|
-
position: sticky;
|
|
144
|
-
inset-block-start: 0;
|
|
145
|
-
block-size: var(--viewport-block);
|
|
146
|
-
overflow-y: auto;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
The sidebar width is the one tunable a project reaches for often, so it is exposed as `--shell-sidebar-size` rather than hard-coded — override it locally (`style="--shell-sidebar-size: 18rem"` or in a project stylesheet) instead of forking the rule. The breakpoint stays a literal `64rem` in the media query: custom properties cannot be substituted into a media condition, so a project that genuinely needs a different one copies the rule rather than fighting the token.
|
|
152
|
-
|
|
153
|
-
Below the breakpoint, mirror the sidebar into a `.drawer` (see Components Drawer) for mobile access — the two are separate elements, not a responsive transform of one.
|
|
94
|
+
A persistent sidebar beside the content — a dashboard, an admin panel — is
|
|
95
|
+
[`.sidebar-shell`](../layout/sidebar-shell.md): side by side from `64rem`, each
|
|
96
|
+
region scrolling on its own, and a drawer on a phone.
|
|
154
97
|
|
|
155
98
|
### Side Navigation
|
|
156
99
|
|
|
@@ -17,7 +17,7 @@ Use patterns when a semantic element needs a small amount of normalization befor
|
|
|
17
17
|
- Avoid broad element selectors such as `nav ul` or `.alert menu`.
|
|
18
18
|
- A pattern should be useful in more than one component or context.
|
|
19
19
|
|
|
20
|
-
## Relationship
|
|
20
|
+
## Relationship with layout
|
|
21
21
|
|
|
22
22
|
Patterns often compose with layout primitives.
|
|
23
23
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Stat
|
|
2
|
+
|
|
3
|
+
> One figure with its label, a detail line and an optional trend: KPI tiles,
|
|
4
|
+
> dashboard summaries, metric cards. Composed from a card, a grid and a badge;
|
|
5
|
+
> there is no stat component.
|
|
6
|
+
|
|
7
|
+
**Related terms:** KPI, metric, statistic, figure, stat card, number tile,
|
|
8
|
+
delta, trend indicator.
|
|
9
|
+
|
|
10
|
+
## Anatomy
|
|
11
|
+
|
|
12
|
+
- A label.
|
|
13
|
+
- The value, in a `<data value>` when it is a formatted number.
|
|
14
|
+
- A detail line: the period, a target, a comparison.
|
|
15
|
+
- An optional trend: a badge whose sign states the direction, so it reads
|
|
16
|
+
without color. Use the minus sign `−`, which screen readers announce.
|
|
17
|
+
|
|
18
|
+
Keep the label first in source order, so each tile reads as one sentence.
|
|
19
|
+
`.grid` wraps the tiles as the width allows.
|
|
20
|
+
|
|
21
|
+
```html demo resize
|
|
22
|
+
<div class="grid" style="--grid-min: 12rem">
|
|
23
|
+
<div class="card stack">
|
|
24
|
+
<span class="muted">Revenue</span>
|
|
25
|
+
<data class="text-title" value="48902">$48,902</data>
|
|
26
|
+
<p class="cluster">
|
|
27
|
+
<span class="badge success soft">+12.4%</span>
|
|
28
|
+
<span class="muted">vs. last month</span>
|
|
29
|
+
</p>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div class="card stack">
|
|
33
|
+
<span class="muted">Active users</span>
|
|
34
|
+
<data class="text-title" value="1284">1,284</data>
|
|
35
|
+
<p class="cluster">
|
|
36
|
+
<span class="badge danger soft">−3.1%</span>
|
|
37
|
+
<span class="muted">vs. last month</span>
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="card stack">
|
|
42
|
+
<span class="muted">Churn</span>
|
|
43
|
+
<data class="text-title" value="0.009">0.9%</data>
|
|
44
|
+
<p class="cluster">
|
|
45
|
+
<span class="badge success soft">−0.3 pts</span>
|
|
46
|
+
<span class="muted">lower is better</span>
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Inverted trends
|
|
53
|
+
|
|
54
|
+
When lower is better — churn, response time, open incidents — the sign keeps
|
|
55
|
+
following the number and the intent follows the outcome: a fall is `−` and
|
|
56
|
+
`success`. Say so in the detail line, as the Churn tile does, so the color is
|
|
57
|
+
never the only cue.
|
|
58
|
+
|
|
59
|
+
Promote the stat to a component only when the same markup is hand-rolled
|
|
60
|
+
across a product; until then, a local class on the card carries any
|
|
61
|
+
product-specific type or spacing.
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Text hidden visually but still available to assistive technology.
|
|
4
4
|
|
|
5
|
+
**Related terms:** visually hidden, screen-reader text, hide label on mobile,
|
|
6
|
+
icon-only on small screens.
|
|
7
|
+
|
|
5
8
|
## Class reference
|
|
6
9
|
|
|
7
10
|
| Class | Kind | Description |
|
|
@@ -19,20 +22,39 @@ Use `.sr-only` for text that should be available to assistive technology but vis
|
|
|
19
22
|
</button>
|
|
20
23
|
```
|
|
21
24
|
|
|
25
|
+
### Hidden on narrow screens only
|
|
26
|
+
|
|
27
|
+
A toolbar label that shows beside its icon on wide screens and stays only as
|
|
28
|
+
the accessible name on narrow ones. `.sr-only` has no responsive variant:
|
|
29
|
+
repeat its declarations in your own query. Never use `display: none`, which
|
|
30
|
+
removes the name too.
|
|
31
|
+
|
|
22
32
|
```css
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
@media (width < 48rem) {
|
|
34
|
+
.toolbar-label {
|
|
35
|
+
position: absolute;
|
|
36
|
+
inline-size: 1px;
|
|
37
|
+
block-size: 1px;
|
|
38
|
+
margin: -1px;
|
|
39
|
+
padding: 0;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
clip-path: inset(50%);
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
border: 0;
|
|
44
|
+
}
|
|
33
45
|
}
|
|
34
46
|
```
|
|
35
47
|
|
|
48
|
+
```html
|
|
49
|
+
<button class="btn ghost" type="button">
|
|
50
|
+
<i class="ti ti-download" aria-hidden="true"></i>
|
|
51
|
+
<span class="toolbar-label">Export</span>
|
|
52
|
+
</button>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The hidden text is positioned absolutely, so give it a positioned ancestor
|
|
56
|
+
inside any scroll container, as `.table-wrap` does.
|
|
57
|
+
|
|
36
58
|
## Touch targets
|
|
37
59
|
|
|
38
60
|
`.touch-target` adds 8px of invisible hit area around a small control on coarse
|