actual-css 0.16.0 → 0.17.0

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.
Files changed (79) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +8 -4
  3. package/components.json +21 -5
  4. package/dist/actual.full.css +410 -75
  5. package/dist/actual.full.js +2 -1
  6. package/dist/actual.full.min.css +1 -1
  7. package/docs/design-notes/app-ui.md +37 -3
  8. package/docs/design-notes/enhancement-contract.md +3 -1
  9. package/docs/design-notes/tokens.md +2 -0
  10. package/docs/navigation.json +14 -1
  11. package/docs/pages/components/accordion.md +5 -0
  12. package/docs/pages/components/alert.md +45 -17
  13. package/docs/pages/components/button.md +3 -0
  14. package/docs/pages/components/chat.md +20 -0
  15. package/docs/pages/components/dialog.md +36 -0
  16. package/docs/pages/components/drawer.md +52 -8
  17. package/docs/pages/components/navbar.md +26 -2
  18. package/docs/pages/components/rating.md +111 -12
  19. package/docs/pages/components/segmented.md +36 -1
  20. package/docs/pages/components/spinner.md +2 -0
  21. package/docs/pages/components/table.md +77 -0
  22. package/docs/pages/components/timeline.md +3 -1
  23. package/docs/pages/enhancements/flyout.md +83 -14
  24. package/docs/pages/enhancements/status-bar.md +1 -0
  25. package/docs/pages/enhancements/tabs.md +5 -0
  26. package/docs/pages/examples/overview.md +7 -1
  27. package/docs/pages/forms/ajax.md +101 -0
  28. package/docs/pages/forms/color-swatches.md +31 -2
  29. package/docs/pages/forms/date-picker.md +6 -0
  30. package/docs/pages/forms/joined-controls.md +8 -3
  31. package/docs/pages/forms/overview.md +2 -2
  32. package/docs/pages/forms/sticky-actions.md +2 -0
  33. package/docs/pages/forms/unsaved-changes.md +198 -0
  34. package/docs/pages/foundations/philosophy.md +2 -1
  35. package/docs/pages/foundations/theming.md +21 -4
  36. package/docs/pages/foundations/tokens.md +1 -1
  37. package/docs/pages/guides/introduction.md +1 -1
  38. package/docs/pages/guides/progressive-enhancement.md +30 -49
  39. package/docs/pages/guides/upgrading.md +16 -3
  40. package/docs/pages/layout/choosing.md +5 -0
  41. package/docs/pages/layout/column-layout.md +22 -8
  42. package/docs/pages/layout/scroll-snap.md +69 -2
  43. package/docs/pages/layout/sidebar-shell.md +68 -0
  44. package/docs/pages/patterns/empty-state.md +74 -0
  45. package/docs/pages/patterns/hierarchical-nav.md +40 -19
  46. package/docs/pages/patterns/navigation-list.md +3 -60
  47. package/docs/pages/patterns/stat.md +61 -0
  48. package/docs/pages/utilities/accessibility.md +32 -10
  49. package/package.json +4 -1
  50. package/reserved-classes.json +2 -0
  51. package/src/css/components/busy.css +25 -0
  52. package/src/css/components/button.css +3 -0
  53. package/src/css/components/chat.css +5 -1
  54. package/src/css/components/drawer.css +37 -3
  55. package/src/css/components/flyout.css +37 -0
  56. package/src/css/components/modal.css +3 -0
  57. package/src/css/components/navbar.css +99 -38
  58. package/src/css/components/rating.css +50 -5
  59. package/src/css/components/segmented.css +25 -2
  60. package/src/css/components/status-bar.css +4 -2
  61. package/src/css/forms/choice-card.css +5 -2
  62. package/src/css/forms/color-swatch.css +38 -19
  63. package/src/css/forms/custom-select.css +5 -0
  64. package/src/css/forms/form.css +3 -1
  65. package/src/css/layout/index.css +2 -0
  66. package/src/css/layout/sidebar-shell.css +67 -0
  67. package/src/js/ajax.js +148 -0
  68. package/src/js/dialog.js +59 -2
  69. package/src/js/dirty.js +140 -0
  70. package/src/js/dismiss.js +25 -0
  71. package/src/js/events.js +17 -0
  72. package/src/js/focus.js +12 -0
  73. package/src/js/form-submission.js +34 -0
  74. package/src/js/full.js +2 -0
  75. package/src/js/selectors.js +10 -2
  76. package/src/js/status.js +71 -10
  77. package/src/js/tab.js +16 -2
  78. package/src/js/validation.js +12 -4
  79. package/src/tooling/theme-contrast.js +3 -2
@@ -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
+ ```
@@ -2,25 +2,46 @@
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
- <aside>
7
- <nav class="nav-list scroller" data-enhance="scrollspy" aria-label="Docs">
8
- <details open>
9
- <summary>Getting started</summary>
10
- <a class="nav-link" href="#intro">Introduction</a>
11
- <a class="nav-link" href="#install">Installation</a>
12
- </details>
13
- <details>
14
- <summary>Components</summary>
15
- <a class="nav-link" href="#alert">Alert</a>
16
- <a class="nav-link" href="#badge">Badge</a>
17
- </details>
18
- </nav>
19
- </aside>
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
- - `.nav-list` + `.nav-link`: Actual's nav chrome
23
- - Native `<details>`: exclusive accordion with `<details name>` (no JS engine)
24
- - `data-enhance="scrollspy"`: scroll-driven `aria-current`
25
- - `.scroller`: thin, theme-aware scrollbar
26
- - No `.nav-heading` / `.nav-sublist` classes — the existing primitives are enough
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.
@@ -91,66 +91,9 @@ A project may add `.site-header` when it needs a visual shell.
91
91
 
92
92
  ### App Shell With Sidebar
93
93
 
94
- `.app-shell` (see Layout App Shell) covers the simple case: a single column stacked `header`/`main`/`footer`. A persistent-sidebar app — a dashboard, an admin panel — needs a second, distinct shape: a two-column grid where the sidebar collapses below a breakpoint. These are not the same primitive solving the same problem two ways; `.app-shell` has no sidebar at all.
95
-
96
- ```html
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
 
@@ -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
- .sr-only {
24
- position: absolute;
25
- inline-size: 1px;
26
- block-size: 1px;
27
- padding: 0;
28
- margin: -1px;
29
- overflow: hidden;
30
- clip: rect(0, 0, 0, 0);
31
- white-space: nowrap;
32
- border: 0;
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "actual-css",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Plain CSS component framework with semantic classes, universal variants, small tokens, theme hooks, and progressive enhancements.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.4.4",
@@ -72,6 +72,8 @@
72
72
  "./js/tab": "./src/js/tab.js",
73
73
  "./js/tooltip": "./src/js/tooltip.js",
74
74
  "./js/validation": "./src/js/validation.js",
75
+ "./js/dirty": "./src/js/dirty.js",
76
+ "./js/ajax": "./src/js/ajax.js",
75
77
  "./js/status": "./src/js/status.js",
76
78
  "./js/surface": "./src/js/surface.js",
77
79
  "./reserved-classes.json": "./reserved-classes.json",
@@ -150,6 +152,7 @@
150
152
  "shot:states": "bun scripts/shot-states.js",
151
153
  "probe": "bun scripts/probe.js",
152
154
  "serve": "bun scripts/serve.js",
155
+ "play:ajax": "bun --watch scripts/playground/ajax.js",
153
156
  "check:sync": "bun scripts/check-sync.js",
154
157
  "release": "bun scripts/release.js",
155
158
  "release:notes": "bun scripts/release-notes.js",
@@ -207,6 +207,7 @@
207
207
  "shadow-popout-context",
208
208
  "shimmer",
209
209
  "sidebar-layout",
210
+ "sidebar-shell",
210
211
  "skeleton",
211
212
  "sm",
212
213
  "soft",
@@ -259,6 +260,7 @@
259
260
  "touch-target",
260
261
  "truncate",
261
262
  "user-select-none",
263
+ "vertical",
262
264
  "visibility-hidden",
263
265
  "warning",
264
266
  "was-validated"
@@ -7,8 +7,13 @@
7
7
  * shows that spinner as a centered overlay over a faded surface. Buttons keep
8
8
  * their spinners inline (e.g. .btn[aria-busy] > .spinner stays inline-flex).
9
9
  *
10
+ * The overlay fades in after --busy-delay, so a fast request leaves the
11
+ * content untouched instead of flashing it. Reduced motion drops the delay
12
+ * with every other animation (reset.css): the overlay then shows at once.
13
+ *
10
14
  * Public hooks:
11
15
  * --busy-overlay-bg
16
+ * --busy-delay
12
17
  *
13
18
  * Internal:
14
19
  * --spinner-size (overlay copy of the shared spinner hook)
@@ -43,6 +48,26 @@
43
48
  margin: auto;
44
49
  display: block;
45
50
  }
51
+
52
+ @media (prefers-reduced-motion: no-preference) {
53
+ [aria-busy="true"]:not(.btn):has(> .spinner:last-child)::before {
54
+ animation: actual-busy-reveal var(--duration-slow) var(--busy-delay, 300ms) ease both;
55
+ }
56
+
57
+ /* Restates the spin: one animation list replaces spinner.css's. */
58
+ [aria-busy="true"]:not(.btn) > .spinner:last-child {
59
+ animation:
60
+ actual-busy-reveal var(--duration-slow) var(--busy-delay, 300ms) ease both,
61
+ actual-spin var(--duration-spin) linear infinite;
62
+ }
63
+ }
64
+ }
65
+
66
+ /* `both` holds the from-frame through the delay. */
67
+ @keyframes actual-busy-reveal {
68
+ from {
69
+ opacity: 0;
70
+ }
46
71
  }
47
72
 
48
73
  @supports (selector([aria-busy="true"]:has(> .spinner:last-child))) and
@@ -106,6 +106,9 @@
106
106
  }
107
107
 
108
108
  .btn.icon-only {
109
+ /* why: beside a full-width control (.join, a flex row) it would share the
110
+ shrink and stop being square. */
111
+ flex: none;
109
112
  inline-size: var(--btn-min-size);
110
113
  block-size: var(--btn-min-size);
111
114
  padding: 0;
@@ -6,6 +6,7 @@
6
6
  * Public hooks:
7
7
  * --chat-gap
8
8
  * --chat-max-size
9
+ * --chat-avatar-align
9
10
  *
10
11
  * Internal:
11
12
  * --chat-bubble-bg
@@ -15,6 +16,9 @@
15
16
  .chat {
16
17
  --chat-gap: var(--space-30);
17
18
  --chat-max-size: min(85%, 40rem);
19
+ /* end: the avatar sits beside the last line, as in messaging. start sets it
20
+ beside the header, for long answers or comment threads with a footer. */
21
+ --chat-avatar-align: end;
18
22
 
19
23
  display: grid;
20
24
  grid-auto-rows: min-content;
@@ -33,7 +37,7 @@
33
37
 
34
38
  .chat-avatar {
35
39
  grid-row: 1 / span 3;
36
- align-self: end;
40
+ align-self: var(--chat-avatar-align);
37
41
  }
38
42
 
39
43
  .chat-start > .chat-avatar {
@@ -13,14 +13,17 @@
13
13
  * navigation content inside uses .nav-link and .accordion, which carry their
14
14
  * own link/summary styling.
15
15
  *
16
+ * Sides: start (default), end, and bottom (a bottom sheet) via data-side.
17
+ *
16
18
  * Public hooks:
17
- * --drawer-size
19
+ * --drawer-size (width on start/end, maximum height on bottom)
18
20
  * --drawer-pad
19
21
  *
20
22
  * The corner close control is .close (components/close.css).
21
23
  *
22
24
  * Internal:
23
25
  * --drawer-closed-translate (side/RTL positioning state)
26
+ * --drawer-closed-transform (closed position; bottom changes its axis)
24
27
  * --drawer-focus-bleed
25
28
  * --drawer-close-reserve (header room for a corner close; zero without a close)
26
29
  * --drawer-motion-duration (shared by panel and ::backdrop so exit duration
@@ -33,6 +36,9 @@
33
36
  /* The inset a direct .bleed child cancels (components/bleed.css). */
34
37
  --surface-pad: var(--drawer-pad);
35
38
  --drawer-closed-translate: -100%;
39
+ /* The closed position as one transform, so a side can change axis without
40
+ a rule that would tie with [open] on specificity. */
41
+ --drawer-closed-transform: translateX(var(--drawer-closed-translate));
36
42
  /* Header room for a corner close. Unconditional baseline: without :has()
37
43
  (Degraded tier) a header keeps too much room rather than a title running
38
44
  under the close. Zeroed when the drawer has no close. */
@@ -71,7 +77,7 @@
71
77
  color: var(--text);
72
78
  box-shadow: var(--shadow);
73
79
  opacity: 0;
74
- transform: translateX(var(--drawer-closed-translate));
80
+ transform: var(--drawer-closed-transform);
75
81
  /* Unsupported discrete behavior drops alone, preserving opacity/transform. */
76
82
  transition-property: opacity, transform, overlay, display;
77
83
  transition-duration: var(--drawer-motion-duration);
@@ -125,10 +131,32 @@
125
131
  opacity: 1;
126
132
  }
127
133
 
134
+ /* Bottom sheet: the same drawer on the block-end edge, sized by its content
135
+ up to --drawer-size, which reads as a height here. :where() keeps the size
136
+ at the base rule's weight, so an application class still overrides it. */
137
+ :where(dialog).drawer:where([data-side="bottom"]) {
138
+ --drawer-size: 32rem;
139
+ --drawer-closed-transform: translateY(100%);
140
+ }
141
+
142
+ :where(dialog).drawer[data-side="bottom"] {
143
+ inset-block: auto 0;
144
+ inset-inline: 0;
145
+ inline-size: 100%;
146
+ block-size: auto;
147
+ max-block-size: min(calc(var(--viewport-block) * 0.85), var(--drawer-size));
148
+ /* The home indicator sits over the panel's last line otherwise. */
149
+ padding-block-end: calc(var(--drawer-pad) + env(safe-area-inset-bottom, 0px));
150
+ border-inline-end: 0;
151
+ border-block-start: var(--border-width) solid var(--border);
152
+ border-start-start-radius: var(--radius-lg);
153
+ border-start-end-radius: var(--radius-lg);
154
+ }
155
+
128
156
  @starting-style {
129
157
  :where(dialog).drawer[open] {
130
158
  opacity: 0;
131
- transform: translateX(var(--drawer-closed-translate));
159
+ transform: var(--drawer-closed-transform);
132
160
  }
133
161
 
134
162
  :where(dialog).drawer[open]::backdrop {
@@ -156,6 +184,12 @@
156
184
  under the header or footer. */
157
185
  margin: calc(var(--drawer-focus-bleed) * -1);
158
186
  padding: var(--drawer-focus-bleed);
187
+ /* The scrollport reaches the panel's inline-end edge and takes the panel
188
+ padding back inside: the scrollbar sits on the edge and the content keeps
189
+ --drawer-pad on both sides. Inside the content box, the scrollbar sat a
190
+ focus bleed from the text with the panel padding wasted beyond it. */
191
+ margin-inline-end: calc(var(--drawer-pad) * -1);
192
+ padding-inline-end: var(--drawer-pad);
159
193
  overflow: auto;
160
194
  overscroll-behavior: contain;
161
195
  }
@@ -11,6 +11,9 @@
11
11
  * Runtime marker (managed by surface.js): .is-open marks an open flyout.
12
12
  * --surface-anchor-width is set by surface.js while an open flyout is positioned.
13
13
  *
14
+ * Modifier: .scrollable keeps a header and footer in view while the one body
15
+ * region between them scrolls.
16
+ *
14
17
  * Public hooks:
15
18
  * --flyout-inline-size
16
19
  * --flyout-max-inline-size
@@ -18,6 +21,7 @@
18
21
  *
19
22
  * Internal:
20
23
  * --menu-item-size (derived from --control-size for menu rows)
24
+ * --flyout-focus-bleed (focus reserve of the .scrollable body)
21
25
  * --available-height (measured by the positioner)
22
26
  * --surface-anchor-width (measured by surface.js)
23
27
  */
@@ -168,6 +172,39 @@
168
172
  margin: 0;
169
173
  }
170
174
 
175
+ /* .scrollable: the .modal.scrollable contract on a panel with a header, one
176
+ body and a footer — the header and footer keep their size and the body
177
+ absorbs the overflow, so an Apply row stays in view however long the list
178
+ or however little room the positioner leaves. Opt-in, because a menu or a
179
+ multi-section nav panel has no single body to scroll. :where() keeps the
180
+ display at .flyout's weight, so [hidden] and the closed popover still win
181
+ whatever the source order. */
182
+ .flyout:where(.scrollable) {
183
+ display: flex;
184
+ flex-direction: column;
185
+ overflow: hidden;
186
+ }
187
+
188
+ .flyout.scrollable > :is(header, footer) {
189
+ flex: none;
190
+ }
191
+
192
+ .flyout.scrollable > :not(:is(header, footer)) {
193
+ /* Declared here, not as a :root alias: an inherited alias arrives already
194
+ computed, so a --focus-ring-width override on the panel would not reach
195
+ it. */
196
+ --flyout-focus-bleed: calc(var(--focus-outline-offset) + var(--focus-ring-width));
197
+
198
+ flex: 1 1 auto;
199
+ min-block-size: 0;
200
+ /* Keep focus paint inside the clip without moving the content: the reserve
201
+ reaches into the panel gap and padding, both --space-10 by default. */
202
+ margin: calc(var(--flyout-focus-bleed) * -1);
203
+ padding: var(--flyout-focus-bleed);
204
+ overflow: auto;
205
+ overscroll-behavior: contain;
206
+ }
207
+
171
208
  /* Vertical dividers — .menu-separator (menu.css) is the canonical way to
172
209
  separate menu items. Flyout panels that are not menus use auto grid gap
173
210
  declared on .flyout itself. */
@@ -55,6 +55,9 @@
55
55
  /* Keep the surface anchored to the viewport in the top layer. This also
56
56
  provides the containing block for the absolutely positioned close button. */
57
57
  position: fixed;
58
+ /* Restates the UA centering: a modal authored inside .stack or .cluster
59
+ would otherwise take their child margin reset and pin to the top. */
60
+ margin: auto;
58
61
 
59
62
  /* The root is :where(dialog).modal (0-1-0), so a single author class can
60
63
  outrank these defaults — no fallback-only indirection needed here. */