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.
Files changed (119) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +8 -4
  3. package/components.json +19 -4
  4. package/dist/actual.full.css +464 -80
  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/navigation.json +17 -3
  10. package/docs/pages/components/accordion.md +8 -0
  11. package/docs/pages/components/alert.md +47 -17
  12. package/docs/pages/components/app-navigation.md +2 -2
  13. package/docs/pages/components/aura.md +2 -2
  14. package/docs/pages/components/badge.md +4 -3
  15. package/docs/pages/components/button.md +3 -0
  16. package/docs/pages/components/card.md +1 -1
  17. package/docs/pages/components/chat.md +2 -2
  18. package/docs/pages/components/dialog.md +36 -0
  19. package/docs/pages/components/drawer.md +52 -8
  20. package/docs/pages/components/fab.md +2 -1
  21. package/docs/pages/components/list.md +1 -1
  22. package/docs/pages/components/meter.md +1 -1
  23. package/docs/pages/components/navbar.md +27 -3
  24. package/docs/pages/components/overview.md +17 -0
  25. package/docs/pages/components/rating.md +111 -12
  26. package/docs/pages/components/segmented.md +36 -1
  27. package/docs/pages/components/shimmer.md +2 -2
  28. package/docs/pages/components/spinner.md +2 -0
  29. package/docs/pages/components/table.md +77 -0
  30. package/docs/pages/components/timeline.md +3 -1
  31. package/docs/pages/enhancements/flyout.md +83 -14
  32. package/docs/pages/enhancements/overview.md +2 -2
  33. package/docs/pages/enhancements/status-bar.md +1 -1
  34. package/docs/pages/enhancements/tabs.md +5 -0
  35. package/docs/pages/examples/overview.md +5 -1
  36. package/docs/pages/forms/ajax.md +101 -0
  37. package/docs/pages/forms/choice-cards.md +1 -1
  38. package/docs/pages/forms/color-swatches.md +31 -2
  39. package/docs/pages/forms/detached-actions.md +1 -1
  40. package/docs/pages/forms/floating-field.md +5 -3
  41. package/docs/pages/forms/form-actions.md +1 -1
  42. package/docs/pages/forms/input-policy.md +1 -1
  43. package/docs/pages/forms/joined-controls.md +9 -4
  44. package/docs/pages/forms/otp.md +2 -2
  45. package/docs/pages/forms/overview.md +1 -1
  46. package/docs/pages/forms/password.md +1 -1
  47. package/docs/pages/forms/states-and-sizes.md +1 -1
  48. package/docs/pages/forms/sticky-actions.md +1 -1
  49. package/docs/pages/forms/unsaved-changes.md +198 -0
  50. package/docs/pages/foundations/philosophy.md +2 -1
  51. package/docs/pages/foundations/theming.md +4 -3
  52. package/docs/pages/foundations/tokens.md +30 -5
  53. package/docs/pages/foundations/typography.md +1 -1
  54. package/docs/pages/guides/introduction.md +1 -1
  55. package/docs/pages/guides/progressive-enhancement.md +31 -50
  56. package/docs/pages/guides/upgrading.md +15 -2
  57. package/docs/pages/layout/app-layout.md +1 -1
  58. package/docs/pages/layout/app-shell.md +1 -1
  59. package/docs/pages/layout/choosing.md +5 -0
  60. package/docs/pages/layout/column-layout.md +23 -9
  61. package/docs/pages/layout/media.md +1 -1
  62. package/docs/pages/layout/overview.md +1 -1
  63. package/docs/pages/layout/scroll-snap.md +1 -1
  64. package/docs/pages/layout/scroll-target.md +1 -1
  65. package/docs/pages/layout/sidebar-layout.md +1 -1
  66. package/docs/pages/layout/sidebar-shell.md +68 -0
  67. package/docs/pages/patterns/code-block.md +1 -1
  68. package/docs/pages/patterns/empty-state.md +74 -0
  69. package/docs/pages/patterns/exclusive-accordion.md +1 -1
  70. package/docs/pages/patterns/hierarchical-nav.md +41 -20
  71. package/docs/pages/patterns/icon-input.md +1 -1
  72. package/docs/pages/patterns/intent-nesting.md +1 -1
  73. package/docs/pages/patterns/navigation-list.md +5 -62
  74. package/docs/pages/patterns/overview.md +1 -1
  75. package/docs/pages/patterns/stat.md +61 -0
  76. package/docs/pages/patterns/structured-lists.md +1 -1
  77. package/docs/pages/utilities/accessibility.md +32 -10
  78. package/docs/pages/utilities/flex.md +1 -1
  79. package/docs/pages/utilities/links.md +1 -1
  80. package/docs/pages/utilities/list.md +1 -1
  81. package/docs/pages/utilities/shape.md +1 -1
  82. package/docs/pages/utilities/sizing-wrapping.md +1 -1
  83. package/docs/pages/utilities/spacing.md +1 -1
  84. package/docs/pages/utilities/text.md +1 -1
  85. package/package.json +4 -1
  86. package/reserved-classes.json +2 -0
  87. package/src/cli/actual-css.js +4 -4
  88. package/src/css/components/accordion.css +10 -6
  89. package/src/css/components/alert.css +4 -0
  90. package/src/css/components/busy.css +25 -0
  91. package/src/css/components/button.css +3 -0
  92. package/src/css/components/drawer.css +37 -3
  93. package/src/css/components/flyout.css +37 -0
  94. package/src/css/components/join.css +14 -0
  95. package/src/css/components/modal.css +3 -0
  96. package/src/css/components/navbar.css +102 -38
  97. package/src/css/components/rating.css +50 -5
  98. package/src/css/components/segmented.css +25 -2
  99. package/src/css/core/theme.css +20 -1
  100. package/src/css/core/tokens.css +4 -1
  101. package/src/css/forms/color-swatch.css +38 -19
  102. package/src/css/forms/custom-select.css +10 -0
  103. package/src/css/forms/input-icon.css +5 -3
  104. package/src/css/layout/index.css +2 -0
  105. package/src/css/layout/sidebar-shell.css +67 -0
  106. package/src/css/typography/prose.css +6 -0
  107. package/src/js/ajax.js +148 -0
  108. package/src/js/dialog.js +59 -2
  109. package/src/js/dirty.js +140 -0
  110. package/src/js/dismiss.js +25 -0
  111. package/src/js/events.js +17 -0
  112. package/src/js/focus.js +12 -0
  113. package/src/js/form-submission.js +34 -0
  114. package/src/js/full.js +2 -0
  115. package/src/js/tab.js +16 -2
  116. package/src/js/validation.js +12 -4
  117. package/src/tooling/design-tokens.js +1 -0
  118. package/src/tooling/theme-contrast.js +44 -4
  119. package/tokens.json +1 -0
@@ -16,23 +16,62 @@ filled while the control remains fully functional.
16
16
  | `.rating[role="img"]` | Component | Read-only display of a value. |
17
17
  | `.sm` / `.lg` | Size | Smaller or larger star geometry. |
18
18
 
19
+ ## Anatomy
20
+
21
+ ```text
22
+ fieldset.field
23
+ ├── legend.field-label names the group
24
+ └── .rating
25
+ └── input[type="radio"] ×1..N, ascending values, aria-label each
26
+
27
+ .rating[role="img"] empty; aria-label and --rating-value
28
+ ```
29
+
30
+ ## Rate this item
31
+
19
32
  ```html demo
20
33
  <fieldset class="field">
21
- <legend class="field-label">Rate your experience</legend>
34
+ <legend class="field-label">Rate this item</legend>
22
35
  <div class="rating">
23
- <input type="radio" name="experience" value="1" aria-label="1 star" />
24
- <input type="radio" name="experience" value="2" aria-label="2 stars" />
25
- <input type="radio" name="experience" value="3" aria-label="3 stars" checked />
26
- <input type="radio" name="experience" value="4" aria-label="4 stars" />
27
- <input type="radio" name="experience" value="5" aria-label="5 stars" />
36
+ <input type="radio" name="item" value="1" aria-label="1 star" />
37
+ <input type="radio" name="item" value="2" aria-label="2 stars" />
38
+ <input type="radio" name="item" value="3" aria-label="3 stars" checked />
39
+ <input type="radio" name="item" value="4" aria-label="4 stars" />
40
+ <input type="radio" name="item" value="5" aria-label="5 stars" />
28
41
  </div>
29
42
  </fieldset>
30
43
  ```
31
44
 
32
45
  Use a visible `<legend>` to name the group and an `aria-label` on every radio
33
- to name its value. Add `required` to the radios when the form must receive a
34
- rating. In forced-colors mode the stars deliberately return to native platform
35
- radios so checked and focus states remain unambiguous.
46
+ to name its value. In forced-colors mode the stars deliberately return to
47
+ native platform radios so checked and focus states remain unambiguous.
48
+
49
+ ## Required rating
50
+
51
+ Add `required` to the radios. With [form validation](../forms/validation.md),
52
+ the `.field-error` appears once the reader leaves the stars empty or submits,
53
+ never on page load, and picking a star clears it.
54
+
55
+ ```html demo
56
+ <form class="stack needs-validation" data-enhance="validation" novalidate>
57
+ <fieldset class="field">
58
+ <legend class="field-label">Rate your stay</legend>
59
+ <div class="rating">
60
+ <input type="radio" name="stay" value="1" aria-label="1 star" required aria-describedby="stay-error" />
61
+ <input type="radio" name="stay" value="2" aria-label="2 stars" required aria-describedby="stay-error" />
62
+ <input type="radio" name="stay" value="3" aria-label="3 stars" required aria-describedby="stay-error" />
63
+ <input type="radio" name="stay" value="4" aria-label="4 stars" required aria-describedby="stay-error" />
64
+ <input type="radio" name="stay" value="5" aria-label="5 stars" required aria-describedby="stay-error" />
65
+ </div>
66
+ <span class="field-error" id="stay-error">Pick a rating to continue.</span>
67
+ </fieldset>
68
+ <div class="cluster">
69
+ <button class="btn primary" type="submit">Send review</button>
70
+ </div>
71
+ </form>
72
+ ```
73
+
74
+ ## Sizes and intents
36
75
 
37
76
  Intent classes change the active color without changing the interaction model.
38
77
 
@@ -69,9 +108,9 @@ value; without `role="img"` nothing is drawn, so a display cannot ship
69
108
  without an accessible name. Do not present a value with disabled radios.
70
109
 
71
110
  ```html demo
72
- <p>
73
- <span class="rating" role="img" aria-label="4.5 out of 5 stars" style="--rating-value: 4.5"></span>
74
- 4.5 from 312 reviews
111
+ <p class="cluster">
112
+ <span class="rating" role="img" aria-label="4.6 out of 5 stars" style="--rating-value: 4.6"></span>
113
+ <span><strong>4.6</strong> out of 5 from 128 reviews</span>
75
114
  </p>
76
115
 
77
116
  <span class="rating sm primary" role="img" aria-label="7 out of 10" style="--rating-value: 7; --rating-max: 10"></span>
@@ -81,6 +120,65 @@ Stars line up with an input `.rating` of the same size, and `.sm`, `.lg` and
81
120
  intent classes apply as above. The fill follows the writing direction. In
82
121
  forced-colors mode the filled share is painted in system colors.
83
122
 
123
+ ## In context
124
+
125
+ Stars sit at the scale of the text and controls around them: a form field with
126
+ help text, a review summary, a review line, a row beside a field and a button.
127
+
128
+ ```html demo
129
+ <div class="stack">
130
+ <fieldset class="field">
131
+ <legend class="field-label">Rate this release</legend>
132
+ <div class="rating">
133
+ <input type="radio" name="release" value="1" aria-label="1 star" />
134
+ <input type="radio" name="release" value="2" aria-label="2 stars" />
135
+ <input type="radio" name="release" value="3" aria-label="3 stars" />
136
+ <input type="radio" name="release" value="4" aria-label="4 stars" checked />
137
+ <input type="radio" name="release" value="5" aria-label="5 stars" />
138
+ </div>
139
+ <small class="field-help">How did this version work for you?</small>
140
+ </fieldset>
141
+
142
+ <p class="cluster">
143
+ <span class="rating sm" role="img" aria-label="4.6 out of 5" style="--rating-value: 4.6"></span>
144
+ <strong>4.6</strong> <span class="muted">· 128 reviews</span>
145
+ </p>
146
+
147
+ <p class="cluster">
148
+ <span class="rating" role="img" aria-label="3.5 out of 5" style="--rating-value: 3.5"></span>
149
+ Great docs, slow build.
150
+ </p>
151
+
152
+ <div class="cluster">
153
+ <input class="input" style="inline-size: 10rem" aria-label="Name" placeholder="Name" />
154
+ <span class="rating" role="img" aria-label="4 out of 5" style="--rating-value: 4"></span>
155
+ <button class="btn" type="button">Send</button>
156
+ </div>
157
+ </div>
158
+ ```
159
+
160
+ ## Star shapes
161
+
162
+ `--rating-star` draws a star and `--rating-star-empty` an empty one; the empty
163
+ shape is the filled one unless set. An outline makes empty and filled differ by
164
+ shape, not only by color; give it an ink that reads as a line, such as
165
+ `--text-subtle`. The same hooks draw any other symbol, a heart here, in the
166
+ page ink.
167
+
168
+ ```html demo
169
+ <div class="stack">
170
+ <span class="rating" role="img" aria-label="3.5 out of 5"
171
+ style="--rating-value: 3.5; --rating-empty: var(--text-subtle); --rating-star-empty: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%222 2 16 16%22%3E%3CclipPath id=%22c%22%3E%3Cpath d=%22M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.922-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.783.57-1.838-.196-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292Z%22/%3E%3C/clipPath%3E%3Cpath d=%22M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.922-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.783.57-1.838-.196-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292Z%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.4%22 clip-path=%22url(%23c)%22/%3E%3C/svg%3E')"></span>
172
+ <span class="rating" role="img" aria-label="4 out of 5"
173
+ style="--rating-value: 4; --rating-color: var(--text); --rating-star: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22%3E%3Cpath d=%22M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.6 4.5c2.1 0 3.6 1.2 4.4 2.6.8-1.4 2.3-2.6 4.4-2.6 3.6 0 5.7 3.9 4.2 7.3C19.5 16.4 12 21 12 21z%22/%3E%3C/svg%3E')"></span>
174
+ </div>
175
+ ```
176
+
177
+ Set the hooks on the `.rating` element or in a rule that targets it: the
178
+ component declares its defaults there, so a value set on an ancestor is
179
+ overridden. A browser without `mask-composite` (Chromium before 120) draws
180
+ custom empty stars of a read-only display in the filled shape.
181
+
84
182
  ### Hooks
85
183
 
86
184
  - `--rating-size` — size of each star; `.sm` and `.lg` set this hook.
@@ -88,5 +186,6 @@ forced-colors mode the filled share is painted in system colors.
88
186
  - `--rating-color` — star color. Prefer an intent class for semantic color.
89
187
  - `--rating-empty` — color of unselected stars; use a surface or border token.
90
188
  - `--rating-star` — mask image used to draw a star; override it when a strict CSP disallows data URLs.
189
+ - `--rating-star-empty` — mask image of an empty star; follows `--rating-star` unless set.
91
190
  - `--rating-value` — display only: the value shown, fractions allowed.
92
191
  - `--rating-max` — display only: the number of stars.
@@ -2,7 +2,7 @@
2
2
 
3
3
  > One compact choice among a few options, on a shared track with the selected segment raised.
4
4
 
5
- **Related terms:** segmented control, toggle group, pill tabs, view switcher, button group.
5
+ **Related terms:** segmented control, toggle group, pill tabs, view switcher, button group, option list, preset list, vertical radio group.
6
6
 
7
7
  `.segmented` is the track and each `.segment` a direct child. The look is
8
8
  shared; the semantics come from the markup, so pick the anatomy by what the
@@ -20,6 +20,24 @@ any control. A long label wraps instead of truncating, and the row grows with
20
20
  it. A parent that stretches its children (`.stack`) makes it full width; add
21
21
  `.align-self-start` to keep it at its content width.
22
22
 
23
+ ## Anatomy
24
+
25
+ One tree per use; the track and segment classes are the same in all three.
26
+
27
+ ```text
28
+ fieldset.segmented
29
+ ├── legend (may be .sr-only)
30
+ └── label.segment ×2..N
31
+ ├── input[type="radio"]
32
+ └── label text
33
+
34
+ .segmented[role="tablist"]
35
+ └── button.segment[role="tab"] ×2..N, one aria-selected="true"
36
+
37
+ nav.segmented
38
+ └── a.segment ×2..N, at most one aria-current="page"
39
+ ```
40
+
23
41
  ## Pick a value
24
42
 
25
43
  Wrap each radio in its label. The radio is visually hidden but stays focusable
@@ -59,6 +77,23 @@ runtime unchanged: it reads the roles, not the classes.
59
77
  </nav>
60
78
  ```
61
79
 
80
+ ## Vertical
81
+
82
+ `.vertical` stacks the segments in one column with their labels at the inline
83
+ start — a preset list (Today, Last 7 days, All time), a settings switcher. It
84
+ changes the layout only. A tablist sets `aria-orientation="vertical"` instead,
85
+ which both stacks it and gives the tabs runtime Up and Down.
86
+
87
+ ```html demo
88
+ <fieldset class="segmented vertical">
89
+ <legend class="sr-only">Date range</legend>
90
+ <label class="segment"><input type="radio" name="preset" value="today">Today</label>
91
+ <label class="segment"><input type="radio" name="preset" value="7d" checked>Last 7 days</label>
92
+ <label class="segment"><input type="radio" name="preset" value="30d">Last 30 days</label>
93
+ <label class="segment"><input type="radio" name="preset" value="all">All time</label>
94
+ </fieldset>
95
+ ```
96
+
62
97
  ## When to use something else
63
98
 
64
99
  - Several options on at once (bold, italic): `.join` of `.btn` with
@@ -1,10 +1,10 @@
1
1
  # Shimmer
2
2
 
3
- > **Module** — import `actual-css/css/effects/shimmer` or `actual-css/css/effects`.
4
-
5
3
  Shimmer sweeps a highlight across a text label to show an activity in
6
4
  progress: an agent working, a chatbot composing, a job processing.
7
5
 
6
+ > **Module** — import `actual-css/css/effects/shimmer` or `actual-css/css/effects`.
7
+
8
8
  ```html demo
9
9
  <div class="stack">
10
10
  <span class="shimmer" role="status">Working…</span>
@@ -96,3 +96,5 @@ surface; buttons keep their spinners inline instead (see Button).
96
96
  - `--spinner-value` — the moving gap; swap the two for an inverted spinner.
97
97
  - `--busy-overlay-bg` — background of the busy overlay. Set it on a surface you
98
98
  paint yourself so the overlay blends with that surface.
99
+ - `--busy-delay` — how long the overlay waits before fading in, so a fast
100
+ request never flashes it. Reduced motion shows it at once.
@@ -98,6 +98,75 @@ table width before the wrapper scrolls horizontally.
98
98
  </div>
99
99
  ```
100
100
 
101
+ ## Sticky headers
102
+
103
+ Frozen header row, fixed header, frozen first column. `.table-wrap` scrolls
104
+ horizontally, which makes it a scroll container on both axes: a sticky
105
+ `thead` sticks inside the wrap, never to the page. Pick the scroller first.
106
+
107
+ **Header stuck to the page.** `overflow: clip` keeps the wrap's rounded clip
108
+ without making it a scroll container, so the header sticks to the page. The
109
+ wrap no longer scrolls: use it for a table that fits its column.
110
+
111
+ ```css
112
+ .members-table {
113
+ overflow: clip;
114
+ }
115
+
116
+ .members-table thead th {
117
+ position: sticky;
118
+ inset-block-start: 0; /* the height of a sticky page header, if any */
119
+ background: var(--table-header-bg, var(--surface-subtle));
120
+ box-shadow: inset 0 calc(var(--border-width) * -1) var(--border);
121
+ }
122
+ ```
123
+
124
+ **Header and first column stuck in a scroll box.** Give the wrap a block size;
125
+ the header row sticks to its top and the row headers to its inline start.
126
+
127
+ ```css
128
+ .revenue-table {
129
+ max-block-size: 24rem;
130
+ overflow: auto;
131
+ }
132
+
133
+ .revenue-table thead th {
134
+ position: sticky;
135
+ inset-block-start: 0;
136
+ z-index: 1;
137
+ background: var(--table-header-bg, var(--surface-subtle));
138
+ box-shadow: inset 0 calc(var(--border-width) * -1) var(--border);
139
+ }
140
+
141
+ .revenue-table thead th:first-child {
142
+ inset-inline-start: 0;
143
+ z-index: 2;
144
+ }
145
+
146
+ .revenue-table tbody th {
147
+ position: sticky;
148
+ inset-inline-start: 0;
149
+ background: var(--surface-raised);
150
+ }
151
+
152
+ .revenue-table tbody tr:hover > th {
153
+ background-image: linear-gradient(var(--hover-overlay), var(--hover-overlay));
154
+ }
155
+
156
+ .revenue-table th[scope="rowgroup"] > span {
157
+ position: sticky;
158
+ inset-block-start: 3rem; /* below the header row */
159
+ }
160
+ ```
161
+
162
+ - Sticky cells need an opaque fill, or the rows scroll through them. The fill
163
+ also hides the row's hover band, so the hover rule repaints it on the cell.
164
+ - A collapsed border stays with the table, not the cell: the header's rule is
165
+ an inset shadow so it travels with the row.
166
+ - A row-group label (`th scope="rowgroup"` with `rowspan`) cannot stick as a
167
+ cell; wrap its text, and the wrapper sticks inside the spanning cell.
168
+ - Keep `role="region"`, `aria-labelledby` and `tabindex="0"` on the scroll box.
169
+
101
170
  ## Compact tables
102
171
 
103
172
  `.compact` lowers cell padding and establishes compact density for controls or
@@ -124,6 +193,14 @@ vocabulary as `.card.compact`.
124
193
  </div>
125
194
  ```
126
195
 
196
+ ## Sliding row hover
197
+
198
+ The core hover switches each row's background instantly. For a highlight that
199
+ slides from row to row (animated hover, moving indicator), a theme anchors one
200
+ layer to the hovered row with CSS anchor positioning; the `material` theme in
201
+ `src/css/themes/material.css` is a recipe to copy. Browsers without anchor
202
+ positioning keep the core hover.
203
+
127
204
  ## When a table stops reading as a table
128
205
 
129
206
  Responsive strategy is horizontal overflow: the wrap scrolls, the table keeps
@@ -13,7 +13,9 @@ log, changelog, order tracking.
13
13
  For progress through a process (checkout, onboarding), use
14
14
  [Steps](steps.md): a timeline records what happened, steps show where you
15
15
  are. For a horizontal, alternating or time-scaled chronology, or a Gantt
16
- chart, render a diagram: see [Diagrams](diagrams.md).
16
+ chart, render a diagram: see [Diagrams](diagrams.md). For release notes with
17
+ the version beside the rail, see the
18
+ [Changelog template](../../demo/templates/changelog.html).
17
19
 
18
20
  ## Basic usage
19
21
 
@@ -2,25 +2,26 @@
2
2
 
3
3
  > Positioned surface attached to a trigger, commonly used for action lists and small panels.
4
4
 
5
- **Related terms:** popover, dropdown, dropdown menu, action menu, context menu, bottom sheet, action sheet, anchored panel.
5
+ **Related terms:** popover, dropdown, dropdown menu, action menu, context menu, bottom sheet, action sheet, anchored panel, filter panel, sticky footer, apply button.
6
6
 
7
7
  ## Class reference
8
8
 
9
- | Class | Kind | Description |
10
- | ----------------- | ----------- | ------------------------------------------- |
11
- | `.flyout-trigger` | Composition | Positioning wrapper for trigger and panel. |
12
- | `.stretch` | Modifier | Spans a `.flyout-trigger` to its container. |
13
- | `.flyout` | Component | Floating surface, positioned by JavaScript. |
14
- | `.menu` | Component | Action-list primitive. |
15
- | `.menu-item` | Component | One action row; joins roving focus. |
16
- | `.menu-item-icon` | Slot | Fixed leading column for an icon. |
17
- | `.menu-item-text` | Slot | Flexible label column; truncates. |
18
- | `.menu-item-end` | Slot | Trailing shortcut, badge or status. |
9
+ | Class | Kind | Description |
10
+ | ----------------- | ----------- | ---------------------------------------------- |
11
+ | `.flyout-trigger` | Composition | Positioning wrapper for trigger and panel. |
12
+ | `.stretch` | Modifier | Spans a `.flyout-trigger` to its container. |
13
+ | `.flyout` | Component | Floating surface, positioned by JavaScript. |
14
+ | `.scrollable` | Modifier | Header and footer stay while the body scrolls. |
15
+ | `.menu` | Component | Action-list primitive. |
16
+ | `.menu-item` | Component | One action row; joins roving focus. |
17
+ | `.menu-item-icon` | Slot | Fixed leading column for an icon. |
18
+ | `.menu-item-text` | Slot | Flexible label column; truncates. |
19
+ | `.menu-item-end` | Slot | Trailing shortcut, badge or status. |
20
+ | `.menu-label` | Variant | Muted, non-interactive group heading. |
21
+ | `.menu-separator` | Variant | Divider between menu groups (`<hr>`). |
22
+ | `.sm` / `.lg` | Size | Smaller or larger menu rows and type. |
19
23
 
20
24
  `.menu` has a strict `.menu > li > .menu-item` anatomy.
21
- | `.menu-label` | Variant | Muted section heading inside a menu; not interactive. |
22
- | `.menu-separator` | Variant | Divider between menu groups (`<hr>`). |
23
- | `.sm` / `.lg` | Size | Smaller or larger menu rows and type. |
24
25
 
25
26
  ## Usage
26
27
 
@@ -432,6 +433,74 @@ a separate `dialog.drawer` when the content needs a modal mobile presentation.
432
433
  </nav>
433
434
  ```
434
435
 
436
+ ## Panel with actions
437
+
438
+ A filter, picker or quick-edit panel with an Apply row: a `<form>` as the
439
+ flyout, named by its visible title. A named form is a landmark, which is the
440
+ name the panel needs; do not add `role="dialog"`, since the flyout runtime is
441
+ not a non-modal dialog manager. Use `data-flyout-auto-close="outside"` so
442
+ clicks inside the form keep it open.
443
+
444
+ Add `.scrollable` to keep the header and footer in view while the body
445
+ scrolls: a long option list, or a panel the positioner squeezes near the
446
+ viewport edge, keeps its Apply button on screen. The panel takes a `<header>`,
447
+ one body region and a `<footer>`; a menu or a multi-section nav panel has no
448
+ single body and stays without it. Columns go inside the body.
449
+
450
+ ```html demo
451
+ <div class="flyout-trigger">
452
+ <button class="btn outline"
453
+ type="button"
454
+ data-enhance="flyout"
455
+ aria-expanded="false"
456
+ aria-controls="issue-filters">
457
+ <i class="ti ti-filter" aria-hidden="true"></i>
458
+ Filters
459
+ </button>
460
+
461
+ <form class="flyout scrollable"
462
+ id="issue-filters"
463
+ aria-labelledby="issue-filters-title"
464
+ data-flyout-auto-close="outside"
465
+ style="--flyout-pad: var(--space-30)"
466
+ hidden>
467
+ <header><strong id="issue-filters-title">Labels</strong></header>
468
+ <div class="stack">
469
+ <label><input type="checkbox" name="label" value="bug"> Bug</label>
470
+ <label><input type="checkbox" name="label" value="feature"> Feature</label>
471
+ <label><input type="checkbox" name="label" value="docs"> Docs</label>
472
+ <label><input type="checkbox" name="label" value="chore"> Chore</label>
473
+ <label><input type="checkbox" name="label" value="security"> Security</label>
474
+ <label><input type="checkbox" name="label" value="performance"> Performance</label>
475
+ <label><input type="checkbox" name="label" value="design"> Design</label>
476
+ <label><input type="checkbox" name="label" value="infra"> Infra</label>
477
+ <label><input type="checkbox" name="label" value="release"> Release</label>
478
+ <label><input type="checkbox" name="label" value="question"> Question</label>
479
+ <label><input type="checkbox" name="label" value="support"> Support</label>
480
+ <label><input type="checkbox" name="label" value="triage"> Needs triage</label>
481
+ </div>
482
+ <footer class="cluster justify-content-end">
483
+ <button class="btn ghost sm" type="reset">Reset</button>
484
+ <button class="btn primary sm" type="button" data-flyout-close>Apply</button>
485
+ </footer>
486
+ </form>
487
+ </div>
488
+ ```
489
+
490
+ `data-flyout-close` closes on click, before the form validates or submits.
491
+ That suits a panel applying local values, as above. A form that validates or
492
+ saves keeps the control a plain submit button and closes from its success
493
+ path, so an invalid field or a failed save leaves the panel open:
494
+
495
+ ```js
496
+ import { closeSurface } from "actual-css/js/surface";
497
+
498
+ form.addEventListener("submit", async (event) => {
499
+ event.preventDefault();
500
+ if (await save(new FormData(form))) closeSurface(form);
501
+ });
502
+ ```
503
+
435
504
  ## Context menu
436
505
 
437
506
  Context menus use the same `.menu > li > .menu-item` presentation primitive as
@@ -1,4 +1,4 @@
1
- # Progressive Enhancements
1
+ # Progressive enhancements
2
2
 
3
3
  > The optional JavaScript runtime that completes Actual's interactive components — dialog, drawer, flyout, tooltip, tabs, scrollspy, and status bar — through progressive enhancement.
4
4
 
@@ -56,5 +56,5 @@ after opening. The runtime warns in the console when a second copy loads.
56
56
 
57
57
  Each interactive component has its own page documenting the exact markup its
58
58
  enhancement expects: Dialog, Drawer, Flyout, Tooltip, Tabs, Scrollspy, and
59
- Status Bar. The full runtime is loaded on the docs pages, so the examples
59
+ Status bar. The full runtime is loaded on the docs pages, so the examples
60
60
  work with the documented markup alone.
@@ -1,4 +1,4 @@
1
- # Status Bar
1
+ # Status bar
2
2
 
3
3
  > Singleton floating area for short, non-critical, transient feedback.
4
4
 
@@ -33,6 +33,11 @@
33
33
  by the arrow keys. An application filtering a tab strip only has to set
34
34
  `hidden`; deciding what to show when the selected tab is filtered out is the
35
35
  application's call.
36
+ - `actual:tab-change` bubbles from the tablist after the user selects another
37
+ tab, with `{ tab, panel, previousTab }`. It cannot be canceled and does not
38
+ fire at connect: read `aria-selected` for the initial tab. Use it to sync
39
+ content outside the panels, such as a summary card that follows the selected
40
+ tab.
36
41
 
37
42
  ```html demo
38
43
  <div class="tabs" data-enhance="tabs" role="tablist" aria-label="Settings">
@@ -7,6 +7,9 @@ and `actual.full.js` from `dist/`, plus the theme palettes bundle from
7
7
  `demo/assets/`. Both are build output: in a clone, run `bun run build:dist`,
8
8
  `bun run build:js` and `bun run build:themes` before opening a page.
9
9
 
10
+ For copy-paste blocks (marketing sections, application screens, navigation)
11
+ with their HTML and CSS, see [Actual Blocks](https://github.com/lekoala/actual-blocks).
12
+
10
13
  ## Templates
11
14
 
12
15
  `demo/templates/` are standalone pages. The first three explain the system; the
@@ -28,7 +31,8 @@ Whole pages, composed the way a real product would.
28
31
  - [Workspaces](../../demo/templates/workspaces.html) - sectioned sidebar, master/detail list with native current state, and workspace cards
29
32
  - [Marketing](../../demo/templates/marketing.html) - landing page with typography and fluid type
30
33
  - [Blog](../../demo/templates/blog.html) - article page with prose
31
- - [Settings modal](../../demo/templates/settings-modal.html) - two-pane preferences dialog, with the local CSS it needs audited rule by rule
34
+ - [Changelog](../../demo/templates/changelog.html) - release notes on a `.timeline`: version and date beside the rail on wide containers, and a light on the rail that runs from the first release to the last as the page scrolls
35
+ - [Settings modal](../../demo/templates/settings-modal.html) - two-pane preferences dialog opening on load with `data-dialog-open`, with the local CSS it needs audited rule by rule
32
36
  - [Modal patterns](../../demo/templates/modal-patterns.html) - eight application modals, each the modal surface plus the smallest application CSS it needs
33
37
  - [Workspace settings](../../demo/templates/settings-pricing.html) - plans with visible native choices, preferences and segmented tabs
34
38
  - [iOS-style settings](../../demo/templates/settings-ios.html) - iOS-like controls and grouped settings from unchanged framework markup, a local theme, and its findings listed rule by rule
@@ -0,0 +1,101 @@
1
+ # Ajax submission
2
+
3
+ > Submit a form with `fetch` and show the server's HTML answer in place.
4
+
5
+ **Related terms:** ajax form, async submit, fetch form, submit without reload, remote form.
6
+
7
+ ## Usage
8
+
9
+ Opt in with `data-enhance="ajax"` on a form whose `action` and `method` work
10
+ without JavaScript. With `data-ajax-target`, the HTML answer replaces the
11
+ target's content.
12
+
13
+ ```html
14
+ <form class="stack" action="/contact" method="post"
15
+ data-enhance="validation ajax" data-ajax-target="#contact-feedback">
16
+ <label class="field">
17
+ <span class="field-label">Email</span>
18
+ <input class="input" type="email" name="email" required />
19
+ </label>
20
+ <div class="cluster form-actions">
21
+ <button class="btn primary" type="submit">Send</button>
22
+ </div>
23
+ </form>
24
+ <div id="contact-feedback" role="status"></div>
25
+ ```
26
+
27
+ The request carries what a native submission would: the submitter's name and
28
+ value, its `formaction`, `formmethod` and `formenctype`, files as multipart or
29
+ by name when URL-encoded, and `GET` data as the query string. It sends
30
+ `X-Requested-With: XMLHttpRequest`, so the server can answer with a fragment
31
+ instead of a page.
32
+
33
+ The browser keeps the submissions the module cannot reproduce:
34
+ `method="dialog"`, `enctype="text/plain"`, a `target`, `formtarget` or
35
+ `<base target>` other than `_self`, and an `action` on another origin.
36
+ `form.submit()` bypasses the module too; use `form.requestSubmit()`.
37
+
38
+ ## Request state
39
+
40
+ While a request runs, the form and its submitter carry `aria-busy="true"`,
41
+ which picks up the [busy button](../components/button.md) styles. Add a
42
+ `.spinner` inside the button for a visible indicator, or as the form's last
43
+ child for a [busy overlay](../components/spinner.md#busy-state) that fades in
44
+ only when the request is slow; give the element `aria-busy="false"` so the
45
+ spinner stays hidden at rest, the module restores it after each request.
46
+ Further submissions are
47
+ ignored until the answer arrives; a submission left to the browser, such as a
48
+ dialog's cancel button, still goes through. Removing the form aborts its
49
+ request.
50
+
51
+ To cancel a submission, call `preventDefault()` on its `submit` event from a
52
+ listener on the form. The `validation` enhancer does so for an invalid form.
53
+
54
+ ## Responses
55
+
56
+ The target is updated when the response is `text/html` with a 2xx or `422`
57
+ status, the usual status for server-rendered errors. Any other answer leaves
58
+ it alone. The answer is read as UTF-8. The target may contain the form: a
59
+ server that re-renders the whole form with its errors replaces it, and the new
60
+ form is enhanced again. A CSRF token in a hidden field is sent like any other
61
+ field; when the server issues a new token per submission, re-render the form
62
+ with the answer, or the next submission sends a spent token. A redirect, such as post/redirect/get, navigates the
63
+ page; `fetch` has already followed it, so the destination loads twice.
64
+
65
+ Every response reaches `actual:ajax-response` with
66
+ `{ form, submitter, response }`, after the target update or before a redirect
67
+ navigates; check `response.ok`. A network failure reaches `actual:ajax-error`
68
+ with `{ form, submitter, error }`. `actual:ajax-start` marks the beginning of
69
+ a request. The events bubble from the form, or from the document when the
70
+ update replaced it; listen on the document. None of them can be canceled.
71
+
72
+ ```js
73
+ document.addEventListener("actual:ajax-response", ({ detail }) => {
74
+ if (detail.response.ok) detail.form.reset();
75
+ });
76
+ ```
77
+
78
+ ## With unsaved changes
79
+
80
+ The module never decides that a response means "saved". With
81
+ [Unsaved Changes](unsaved-changes.md), clear the dirty state from the
82
+ application, using the data that was sent:
83
+
84
+ ```js
85
+ import { FormDirty } from "actual-css/js/dirty";
86
+
87
+ const sent = new WeakMap();
88
+ document.addEventListener("actual:ajax-start", ({ detail }) => {
89
+ sent.set(detail.form, FormDirty.capture(detail.form));
90
+ });
91
+ document.addEventListener("actual:ajax-response", ({ detail }) => {
92
+ if (detail.response.ok) FormDirty.markClean(detail.form, sent.get(detail.form));
93
+ });
94
+ ```
95
+
96
+ Edits made during the request stay dirty.
97
+
98
+ ## Beyond one form
99
+
100
+ The module answers one submission with one target. Navigation, history, DOM
101
+ morphing and coordinated region updates belong to a dedicated library.
@@ -1,4 +1,4 @@
1
- # Choice Cards
1
+ # Choice cards
2
2
 
3
3
  > Card-style radio and checkbox labels where the whole card acts as a clickable target.
4
4