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
@@ -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
@@ -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
@@ -15,6 +15,7 @@ runtime targets, empty by default.
15
15
  - Use it for transient status (`Saved.`, `Reconnected.`, `Copied.`). Critical, persistent, or actionable information belongs in `.alert`, inline messages, or dialogs.
16
16
  - Intents: `danger`, `success`, `warning`, `neutral`. The default (no intent) is a neutral dark pill.
17
17
  - On mobile, the runtime keeps the bar above the software keyboard by tracking `visualViewport` while a message is showing.
18
+ - A [sticky form-actions](../forms/sticky-actions.md) bar docked to the bottom edge lifts the bar above it, so an invalid-submit message never covers the submit button.
18
19
  - A message from an open modal dialog temporarily moves the bar inside that
19
20
  dialog so it remains visible and announced. The bar returns after its exit.
20
21
 
@@ -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
@@ -57,6 +61,8 @@ extension points.
57
61
  - [Adaptive filter surface](../../demo/templates/adaptive-surface.html) - app-level flyout/drawer composition with one synchronized filter state
58
62
  - [Select intents](../../demo/templates/select-intents.html) - extending the enhancer with a project's own `data-enhance` behavior, injected markup included, with no framework change
59
63
  - [Popover transport probe](../../demo/templates/popover-transport.html) - self-scoring bench for the native popover transport go/no-go
64
+ - [Card rail](../../demo/templates/card-rail.html) - one list as a 3-column grid in a wide container and a scroll-snap rail with a peek and CSS scroll markers in a narrow one
65
+ - [Playful FAQ](../../demo/templates/playful-faq.html) - the separated accordion with an application palette, a pill plus/close marker and an animated open/close through `::details-content`, no JavaScript
60
66
  - [Tooltips](../../demo/templates/tooltips.html) - generated text is a snapshot at show time: what updates, what stays, and the explicit-tip way for dynamic content
61
67
 
62
68
  ### Third-party components on Actual tokens
@@ -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.
@@ -7,11 +7,24 @@
7
7
  `.color-swatch` is a `<label>` wrapping a native radio, with the color in
8
8
  `--color-swatch-value`. The radio stays the control: it submits, takes the
9
9
  arrow keys and carries the name in `aria-label`. The checked swatch shows a
10
- double ring that reads on any color. Use checkboxes for several colors at once.
10
+ ring around the color, which reads on any color and any background. Use
11
+ checkboxes for several colors at once.
11
12
 
12
13
  For a free color, use the native [`.color`](controls.md) picker; a custom
13
14
  spectrum or RGB sliders are outside Actual.
14
15
 
16
+ ## Anatomy
17
+
18
+ ```text
19
+ fieldset.field-group.cluster the palette, or a .grid; spaced with --gap
20
+ ├── legend
21
+ └── label.color-swatch ×N, --color-swatch-value
22
+ └── input[type="radio"] aria-label names the color; checkbox for several
23
+
24
+ button.color-swatch flyout trigger, --color-swatch-value
25
+ └── .sr-only the current color's name
26
+ ```
27
+
15
28
  ## Palette
16
29
 
17
30
  Lay the swatches out with `.cluster` or `.grid`, and space them with `--gap`
@@ -31,6 +44,21 @@ the column count with `--grid-columns: repeat(6, max-content)` on `.grid`.
31
44
  </fieldset>
32
45
  ```
33
46
 
47
+ ## Shape
48
+
49
+ Set `--color-swatch-radius` on the palette for square or rounded swatches; the
50
+ selection ring follows the corners.
51
+
52
+ ```html demo
53
+ <fieldset class="field-group cluster" style="--color-swatch-radius: var(--radius-sm)">
54
+ <legend>Label color</legend>
55
+ <label class="color-swatch" style="--color-swatch-value: #7c3aed"><input type="radio" name="label" value="#7c3aed" aria-label="Violet" checked></label>
56
+ <label class="color-swatch" style="--color-swatch-value: #0891b2"><input type="radio" name="label" value="#0891b2" aria-label="Cyan"></label>
57
+ <label class="color-swatch" style="--color-swatch-value: #65a30d"><input type="radio" name="label" value="#65a30d" aria-label="Lime"></label>
58
+ <label class="color-swatch" style="--color-swatch-value: #111827"><input type="radio" name="label" value="#111827" aria-label="Black"></label>
59
+ </fieldset>
60
+ ```
61
+
34
62
  ## Palette in a flyout
35
63
 
36
64
  A `<button class="color-swatch">` shows the current color and opens the
@@ -128,4 +156,5 @@ The color dialog is the browser's own and looks different on each platform.
128
156
  - `--color-swatch-value` — the color, set on each swatch.
129
157
  - `--color-swatch-size` — visible swatch size, the height of a `.switch` track
130
158
  by default. `.sm` and `.lg` scale it and the hit area.
131
- - `--color-swatch-radius` — corner radius; round by default.
159
+ - `--color-swatch-radius` — corner radius; round by default. Inherited, so one
160
+ declaration on the palette shapes every swatch.
@@ -38,6 +38,12 @@ control, the masked field and
38
38
  [`@lekoala/date-picker`](https://github.com/lekoala/date-picker) side by side, the
39
39
  picker skinned entirely with Actual tokens.
40
40
 
41
+ The picker also masks typed entry in the locale: digits gain the `Intl`
42
+ separators (`29102026` becomes `29/10/2026` in `fr-BE`) while the submitted value
43
+ stays ISO. `format-on-type="false"` disables the automatic separators; parsing,
44
+ validation and the ISO value are unaffected. Do not combine the picker with
45
+ `data-mask` — two writers on the same value have no defined caret behaviour.
46
+
41
47
  ```html
42
48
  <label class="field">
43
49
  <span class="field-label">Booking date</span>
@@ -15,7 +15,12 @@ choice among a few on a shared track, use a
15
15
  | `.join` | Composition | Joins adjacent controls into a single unit. |
16
16
  | `.join-addon` | Composition | Static prefix or suffix content. |
17
17
 
18
- Add `.join` to the wrapper that groups the controls. Use `.join-addon` for static prefix/suffix content such as currency symbols, units, or protocol text. Action buttons inside the group should use `.btn`. The wrapper should still carry `role="group"` with a label for accessibility.
18
+ Add `.join` to the wrapper that groups the controls. Use `.join-addon` for static prefix/suffix content such as currency symbols, units, or protocol text. Action buttons inside the group should use `.btn`.
19
+
20
+ Give the wrapper `role="group"` and a label when it holds several controls
21
+ that act as a set, such as a button group. A labelled input with an addon or
22
+ one attached button takes no group role: the field label already names the
23
+ input, and the group would repeat it.
19
24
 
20
25
  Each child keeps its own variant. Use the same variant across the group, and
21
26
  change it only to mark state, such as a solid pressed toggle among outlines.
@@ -25,8 +30,8 @@ controls it groups so joined corners take precedence.
25
30
 
26
31
  ```html demo
27
32
  <div class="field">
28
- <label class="field-label" id="amount-label" for="amount">Amount</label>
29
- <div class="join" role="group" aria-labelledby="amount-label">
33
+ <label class="field-label" for="amount">Amount</label>
34
+ <div class="join">
30
35
  <span class="join-addon">$</span>
31
36
  <input class="input" id="amount" name="amount" inputmode="decimal" />
32
37
  <button class="btn outline" type="button">Clear</button>
@@ -191,13 +191,13 @@ root; keyboard focus and an open custom select keep it.
191
191
  - `.field` is the canonical field wrapper. It works on `<label>` and `<div>`.
192
192
  - `.field-label` is element-agnostic. Use it on `<span>` inside a wrapped label, on `<label for="…">` in a detached layout, or on `<legend>` inside a fieldset.
193
193
  - `.field-group` styles a `<fieldset class="field-group">` as a grouped field container. Its legend gutter is tunable with `--fieldset-legend-padding-inline` (`var(--space-10)`). It carries no sibling margin: space consecutive groups with `.stack` on the form, so the rhythm follows the layout instead of the component.
194
- - `.field-group.flush` drops the frame (unboxed, borderless fieldset) for a group that already sits in a card or a form section; the legend then reads as a plain label above the options. It keeps the `<fieldset>` and `<legend>` semantics.
194
+ - `.field-group.flush` drops the frame (unboxed, borderless fieldset) for a group that already sits in a card or a form section; the legend then reads as a plain label above the options, at `--control-font-size` like a `.field` label. It keeps the `<fieldset>` and `<legend>` semantics.
195
195
  - Use native `<optgroup>` and `disabled` options in `.select` controls when applicable; the customizable picker preserves both as a progressive enhancement.
196
196
  - `.choice` is the choice-label API. Use `.check` or `.radio` on the nested control. The control goes first, the label group second, so multi-line labels align the control with the first line.
197
197
  - For a switch, use `class="switch"` and `role="switch"`.
198
198
  - `.range` skins the native range control (`appearance: none` track, thumb, and focus ring). Add `data-enhance="range"` for the fill share, named `datalist` values, and output sync.
199
199
  - `.form-actions` is the role of a `.cluster` row (`class="cluster form-actions"`) and carries no outer margin: `.stack` on the form spaces it from the fields. It is class-only and may live inside or outside `<form>`. See Detached Actions below.
200
- - `.join` visually joins adjacent controls into a single unit. Use `.join-addon` for static prefix/suffix content. The container still carries `role="group"` for accessibility.
200
+ - `.join` visually joins adjacent controls into a single unit. Use `.join-addon` for static prefix/suffix content. The container carries `role="group"` and a label only when it holds several controls acting as a set.
201
201
 
202
202
  ## Optional automatic required marks
203
203
 
@@ -187,3 +187,5 @@ Scroll the page to see the detached footer stay reachable.
187
187
  ```
188
188
 
189
189
  A sticky footer can cover the last field on short pages. That is a page-layout concern, not a framework concern. Add bottom padding to the page or scroll container if needed.
190
+
191
+ While a docked sticky bar is on screen, the [status bar](../enhancements/status-bar.md) rises above it, so a message never covers the actions — including the validation message an invalid submit shows.