actual-css 0.19.5 → 0.20.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.
- package/CHANGELOG.md +59 -0
- package/README.md +4 -4
- package/components.json +6 -3
- package/dist/actual.full.css +249 -54
- package/dist/actual.full.js +2 -2
- package/dist/actual.full.min.css +1 -1
- package/dist/types/menu.d.ts +2 -5
- package/docs/pages/components/accordion.md +11 -6
- package/docs/pages/components/alert.md +64 -62
- package/docs/pages/components/avatar.md +12 -12
- package/docs/pages/components/badge.md +15 -15
- package/docs/pages/components/breadcrumb.md +10 -8
- package/docs/pages/components/button.md +56 -7
- package/docs/pages/components/card.md +21 -21
- package/docs/pages/components/dialog.md +97 -69
- package/docs/pages/components/drawer.md +33 -33
- package/docs/pages/components/indicator.md +12 -12
- package/docs/pages/components/navbar.md +41 -9
- package/docs/pages/components/pagination.md +7 -7
- package/docs/pages/components/progress.md +18 -13
- package/docs/pages/components/rating.md +19 -19
- package/docs/pages/components/reveal.md +2 -0
- package/docs/pages/components/segmented.md +35 -31
- package/docs/pages/components/skeleton.md +10 -8
- package/docs/pages/components/spinner.md +21 -15
- package/docs/pages/components/table.md +26 -28
- package/docs/pages/enhancements/flyout.md +94 -43
- package/docs/pages/enhancements/in-view.md +3 -1
- package/docs/pages/enhancements/scrollspy.md +51 -18
- package/docs/pages/enhancements/tabs.md +43 -37
- package/docs/pages/enhancements/tooltip.md +4 -2
- package/docs/pages/forms/ajax.md +66 -0
- package/docs/pages/forms/choice-cards.md +8 -8
- package/docs/pages/forms/color-swatches.md +12 -12
- package/docs/pages/forms/form-actions.md +23 -0
- package/docs/pages/forms/joined-controls.md +7 -7
- package/docs/pages/forms/labels.md +11 -11
- package/docs/pages/forms/overview.md +35 -29
- package/docs/pages/forms/states-and-sizes.md +9 -9
- package/docs/pages/forms/switch.md +35 -4
- package/docs/pages/forms/validation.md +16 -16
- package/docs/pages/foundations/theming.md +32 -2
- package/docs/pages/foundations/tokens.md +7 -5
- package/docs/pages/guides/coding-agents.md +18 -0
- package/docs/pages/guides/introduction.md +1 -1
- package/package.json +2 -1
- package/reserved-classes.json +1 -0
- package/skills/actual-css/SKILL.md +7 -0
- package/src/cli/actual-css.js +1 -1
- package/src/css/components/badge.css +10 -6
- package/src/css/components/button.css +20 -7
- package/src/css/components/join.css +14 -4
- package/src/css/components/navbar.css +83 -1
- package/src/css/components/pagination.css +3 -1
- package/src/css/components/segmented.css +27 -7
- package/src/css/core/theme.css +11 -9
- package/src/css/core/tokens.css +7 -1
- package/src/css/core/variants.css +2 -0
- package/src/css/effects/reveal.css +15 -6
- package/src/css/forms/control.css +11 -1
- package/src/css/forms/form.css +14 -4
- package/src/css/forms/switch.css +32 -7
- package/src/js/ajax.js +18 -1
- package/src/js/context-menu.js +1 -3
- package/src/js/flyout.js +14 -5
- package/src/js/in-view.js +41 -30
- package/src/js/menu.js +9 -21
- package/src/js/surface.js +38 -0
- package/src/tooling/design-tokens.js +1 -0
- package/src/tooling/theme-contrast.js +22 -11
- package/tokens.json +1 -0
|
@@ -2,14 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> Card-style radio and checkbox labels where the whole card acts as a clickable target.
|
|
4
4
|
|
|
5
|
-
## Class reference
|
|
6
|
-
|
|
7
|
-
| Class | Kind | Description |
|
|
8
|
-
| ------------------------- | --------- | --------------------------------------------- |
|
|
9
|
-
| `.choice-card` | Component | Card-style `<label>` around a native control. |
|
|
10
|
-
| `.chip` | Modifier | Compact pill form: filter chips, tags. |
|
|
11
|
-
| `.primary` / `.secondary` | Intent | Accent for the selected state. |
|
|
12
|
-
|
|
13
5
|
- Use `.choice-card` on a `<label>` wrapping a native `<input type="radio">` or `<input type="checkbox">`. The input is visually hidden; in browsers without `:has()` it stays visible so selection state never disappears.
|
|
14
6
|
- The control shows before any choice: a ring (radio) or a rounded box (checkbox) on the leading edge, level with the first line. Checked, it fills with a check, and the card takes a primary border and a subtle tint.
|
|
15
7
|
- Each child element of the label sits on its own row beside the indicator — a title and a `.muted` detail need no wrapper. Wrap loose text in an element.
|
|
@@ -117,6 +109,14 @@ follows through its `em` sizing. Padding is density, so use a `.compact` or
|
|
|
117
109
|
`.spacious` context to change it. Intent classes (`.primary`, `.secondary`) are
|
|
118
110
|
supported on the `.choice-card` element.
|
|
119
111
|
|
|
112
|
+
## Class reference
|
|
113
|
+
|
|
114
|
+
| Class | Kind | Description |
|
|
115
|
+
| ------------------------- | --------- | --------------------------------------------- |
|
|
116
|
+
| `.choice-card` | Component | Card-style `<label>` around a native control. |
|
|
117
|
+
| `.chip` | Modifier | Compact pill form: filter chips, tags. |
|
|
118
|
+
| `.primary` / `.secondary` | Intent | Accent for the selected state. |
|
|
119
|
+
|
|
120
120
|
## Corner badge
|
|
121
121
|
|
|
122
122
|
A tile whose content is the choice itself — a product image, a centred plan
|
|
@@ -13,18 +13,6 @@ checkboxes for several colors at once.
|
|
|
13
13
|
For a free color, use the native [`.color`](controls.md) picker; a custom
|
|
14
14
|
spectrum or RGB sliders are outside Actual.
|
|
15
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
|
-
|
|
28
16
|
## Palette
|
|
29
17
|
|
|
30
18
|
Lay the swatches out with `.cluster` or `.grid`, and space them with `--gap`
|
|
@@ -44,6 +32,18 @@ the column count with `--grid-columns: repeat(6, max-content)` on `.grid`.
|
|
|
44
32
|
</fieldset>
|
|
45
33
|
```
|
|
46
34
|
|
|
35
|
+
## Anatomy
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
fieldset.field-group.cluster the palette, or a .grid; spaced with --gap
|
|
39
|
+
├── legend
|
|
40
|
+
└── label.color-swatch ×N, --color-swatch-value
|
|
41
|
+
└── input[type="radio"] aria-label names the color; checkbox for several
|
|
42
|
+
|
|
43
|
+
button.color-swatch flyout trigger, --color-swatch-value
|
|
44
|
+
└── .sr-only the current color's name
|
|
45
|
+
```
|
|
46
|
+
|
|
47
47
|
## Shape
|
|
48
48
|
|
|
49
49
|
Set `--color-swatch-radius` on the palette for square or rounded swatches; the
|
|
@@ -81,6 +81,29 @@ one at the trailing edge:
|
|
|
81
81
|
</form>
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
## Full-width submit
|
|
85
|
+
|
|
86
|
+
A button and a field share `--control-pad-x`, so a button at its own width
|
|
87
|
+
under a field already sets its label on the field's text line. A button
|
|
88
|
+
stretched to the column keeps that line only with its label at the start; an
|
|
89
|
+
icon after it goes to the far end. Centered stays the default everywhere else.
|
|
90
|
+
|
|
91
|
+
```html demo
|
|
92
|
+
<form class="stack" novalidate>
|
|
93
|
+
<label class="field">
|
|
94
|
+
<span class="field-label">Hostname</span>
|
|
95
|
+
<input class="input" type="text" value="baremetal.example.com" />
|
|
96
|
+
</label>
|
|
97
|
+
|
|
98
|
+
<button type="submit"
|
|
99
|
+
class="btn primary"
|
|
100
|
+
style="inline-size: 100%; justify-content: space-between; text-align: start">
|
|
101
|
+
Create resource
|
|
102
|
+
<i class="ti ti-plus" aria-hidden="true"></i>
|
|
103
|
+
</button>
|
|
104
|
+
</form>
|
|
105
|
+
```
|
|
106
|
+
|
|
84
107
|
> The sticky variant adds `--form-actions-sticky-block-offset`,
|
|
85
108
|
> `--form-actions-sticky-padding`, and `--form-actions-sticky-inline-offset` —
|
|
86
109
|
> see Sticky Actions.
|
|
@@ -8,13 +8,6 @@
|
|
|
8
8
|
choice among a few on a shared track, use a
|
|
9
9
|
[segmented control](../components/segmented.md).
|
|
10
10
|
|
|
11
|
-
## Class reference
|
|
12
|
-
|
|
13
|
-
| Class | Kind | Description |
|
|
14
|
-
| ------------- | ----------- | ------------------------------------------- |
|
|
15
|
-
| `.join` | Composition | Joins adjacent controls into a single unit. |
|
|
16
|
-
| `.join-addon` | Composition | Static prefix or suffix content. |
|
|
17
|
-
|
|
18
11
|
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
12
|
|
|
20
13
|
Give the wrapper `role="group"` and a label when it holds several controls
|
|
@@ -43,6 +36,13 @@ controls it groups so joined corners take precedence.
|
|
|
43
36
|
`.join` handles border-radius and border collapsing between adjacent children. It works with any direct child — `.input`, `.btn`, `.select`, or `.join-addon` — plus one wrapper level (e.g. a combobox element around the native control): the wrapper receives the group corners and the inner control inherits them via `border-radius: inherit`.
|
|
44
37
|
When an `.input`, `.textarea`, or `.select` receives keyboard focus, it keeps its own inset focus outline; the group never moves the ring onto itself, so the focused segment remains identifiable.
|
|
45
38
|
|
|
39
|
+
## Class reference
|
|
40
|
+
|
|
41
|
+
| Class | Kind | Description |
|
|
42
|
+
| ------------- | ----------- | ------------------------------------------- |
|
|
43
|
+
| `.join` | Composition | Joins adjacent controls into a single unit. |
|
|
44
|
+
| `.join-addon` | Composition | Static prefix or suffix content. |
|
|
45
|
+
|
|
46
46
|
## Linting `role="group"`
|
|
47
47
|
|
|
48
48
|
Biome's `a11y/useSemanticElements` reports the wrapper and offers `<fieldset>`
|
|
@@ -2,17 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> The field wrapper is `.field`. Choose between a wrapped `<label>` and a detached `for`/`id` pair based on the layout.
|
|
4
4
|
|
|
5
|
-
## Class reference
|
|
6
|
-
|
|
7
|
-
| Class | Kind | Description |
|
|
8
|
-
| ---------------- | ----------- | ------------------------------------------------- |
|
|
9
|
-
| `.field` | Composition | Field wrapper; canonical on `<label>` or `<div>`. |
|
|
10
|
-
| `.field-label` | Composition | Label text, element-agnostic. |
|
|
11
|
-
| `.required-mark` | Composition | Visual required marker (`aria-hidden`). |
|
|
12
|
-
|
|
13
|
-
`.field-label` works on a `<span>`, on a detached `<label for>`, or on a
|
|
14
|
-
`<legend>`. `.required-mark` goes inside a label.
|
|
15
|
-
|
|
16
5
|
Use a **wrapped label** for simple hand-authored forms. The whole label area becomes the click target, there is no `id` noise, and the markup is harder to break.
|
|
17
6
|
|
|
18
7
|
```html demo
|
|
@@ -43,3 +32,14 @@ Use **`for`/`id`** when the layout needs the label and control in different grid
|
|
|
43
32
|
```
|
|
44
33
|
|
|
45
34
|
The mixed shape `<label for="x">…<input id="x"></label>` is allowed by the spec but rarely useful. Prefer either pure wrapped or pure `for`/`id`.
|
|
35
|
+
|
|
36
|
+
## Class reference
|
|
37
|
+
|
|
38
|
+
| Class | Kind | Description |
|
|
39
|
+
| ---------------- | ----------- | ------------------------------------------------- |
|
|
40
|
+
| `.field` | Composition | Field wrapper; canonical on `<label>` or `<div>`. |
|
|
41
|
+
| `.field-label` | Composition | Label text, element-agnostic. |
|
|
42
|
+
| `.required-mark` | Composition | Visual required marker (`aria-hidden`). |
|
|
43
|
+
|
|
44
|
+
`.field-label` works on a `<span>`, on a detached `<label for>`, or on a
|
|
45
|
+
`<legend>`. `.required-mark` goes inside a label.
|
|
@@ -15,34 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|
**Related terms:** form controls, select, custom select, dropdown, input, textarea, checkbox, radio.
|
|
17
17
|
|
|
18
|
-
## Class reference
|
|
19
|
-
|
|
20
|
-
| Class | Kind | Description |
|
|
21
|
-
| --------------- | ----------- | --------------------------------------------- |
|
|
22
|
-
| `.input` | Component | Text input. |
|
|
23
|
-
| `.textarea` | Component | Multi-line text control. |
|
|
24
|
-
| `.select` | Component | Dropdown, native baseline with a CSS chevron. |
|
|
25
|
-
| `.check` | Component | Styled checkbox. |
|
|
26
|
-
| `.radio` | Component | Styled radio button. |
|
|
27
|
-
| `.switch` | Component | Toggle switch on a `role="switch"` checkbox. |
|
|
28
|
-
| `.range` | Component | Native range slider, theme-aware accent. |
|
|
29
|
-
| `.file` | Component | Native file input, themed picker button. |
|
|
30
|
-
| `.color` | Component | Native color picker in a control-sized box. |
|
|
31
|
-
| `.color-swatch` | Component | Palette color on a radio, or its trigger. |
|
|
32
|
-
| `.field` | Composition | Field wrapper, on `<label>` or `<div>`. |
|
|
33
|
-
| `.field-label` | Composition | Label text, element-agnostic. |
|
|
34
|
-
| `.field-help` | Composition | Supporting helper text under a control. |
|
|
35
|
-
| `.field-error` | Composition | Inline error message, shown while invalid. |
|
|
36
|
-
| `.field-group` | Composition | `<fieldset>` with a tunable legend gutter. |
|
|
37
|
-
| `.choice` | Composition | Choice-label layout around an inline control. |
|
|
38
|
-
| `.form-actions` | Composition | Role of the `.cluster` row closing a form. |
|
|
39
|
-
|
|
40
|
-
`.input` shares the text-control recipe with `.textarea` and `.select`, and
|
|
41
|
-
`.select` also has an opt-in enhanced picker. `.field-label` works on a
|
|
42
|
-
`<span>`, a detached `<label>` or a `<legend>`. `.choice` wraps a `.check`,
|
|
43
|
-
`.radio` or `.switch`, and `.form-actions` works inside or outside the
|
|
44
|
-
`<form>`.
|
|
45
|
-
|
|
46
18
|
## Example form
|
|
47
19
|
|
|
48
20
|
A full form using the control classes, field wrappers, and form actions:
|
|
@@ -170,6 +142,34 @@ A full form using the control classes, field wrappers, and form actions:
|
|
|
170
142
|
</form>
|
|
171
143
|
```
|
|
172
144
|
|
|
145
|
+
## Class reference
|
|
146
|
+
|
|
147
|
+
| Class | Kind | Description |
|
|
148
|
+
| --------------- | ----------- | --------------------------------------------- |
|
|
149
|
+
| `.input` | Component | Text input. |
|
|
150
|
+
| `.textarea` | Component | Multi-line text control. |
|
|
151
|
+
| `.select` | Component | Dropdown, native baseline with a CSS chevron. |
|
|
152
|
+
| `.check` | Component | Styled checkbox. |
|
|
153
|
+
| `.radio` | Component | Styled radio button. |
|
|
154
|
+
| `.switch` | Component | Toggle switch on a `role="switch"` checkbox. |
|
|
155
|
+
| `.range` | Component | Native range slider, theme-aware accent. |
|
|
156
|
+
| `.file` | Component | Native file input, themed picker button. |
|
|
157
|
+
| `.color` | Component | Native color picker in a control-sized box. |
|
|
158
|
+
| `.color-swatch` | Component | Palette color on a radio, or its trigger. |
|
|
159
|
+
| `.field` | Composition | Field wrapper, on `<label>` or `<div>`. |
|
|
160
|
+
| `.field-label` | Composition | Label text, element-agnostic. |
|
|
161
|
+
| `.field-help` | Composition | Supporting helper text under a control. |
|
|
162
|
+
| `.field-error` | Composition | Inline error message, shown while invalid. |
|
|
163
|
+
| `.field-group` | Composition | `<fieldset>` with a tunable legend gutter. |
|
|
164
|
+
| `.choice` | Composition | Choice-label layout around an inline control. |
|
|
165
|
+
| `.form-actions` | Composition | Role of the `.cluster` row closing a form. |
|
|
166
|
+
|
|
167
|
+
`.input` shares the text-control recipe with `.textarea` and `.select`, and
|
|
168
|
+
`.select` also has an opt-in enhanced picker. `.field-label` works on a
|
|
169
|
+
`<span>`, a detached `<label>` or a `<legend>`. `.choice` wraps a `.check`,
|
|
170
|
+
`.radio` or `.switch`, and `.form-actions` works inside or outside the
|
|
171
|
+
`<form>`.
|
|
172
|
+
|
|
173
173
|
## Hooks
|
|
174
174
|
|
|
175
175
|
Set `--control-default-bg` on a theme or region for an inherited resting field
|
|
@@ -177,6 +177,12 @@ background shared by `.input`, `.textarea`, `.select` and external widget bridge
|
|
|
177
177
|
Use `--control-bg` for a local field override; state rules still own readonly,
|
|
178
178
|
disabled and validation fills.
|
|
179
179
|
|
|
180
|
+
Set `--control-default-border` the same way for an inherited resting field
|
|
181
|
+
edge, and `--control-border-block-end-color` / `-width` for a different lower
|
|
182
|
+
edge. Together they keep the 3:1 cue on the lower edge alone; readonly and
|
|
183
|
+
disabled fields drop that lower edge. Recipes: Foundations · Theming (lighter
|
|
184
|
+
field borders).
|
|
185
|
+
|
|
180
186
|
Set `--control-hover-border` to tune the hover border of `.input` and `.textarea`.
|
|
181
187
|
Set `--control-hover-bg` to keep a `.select` background steady on hover, or give
|
|
182
188
|
it a stronger fill.
|
|
@@ -191,7 +197,7 @@ root; keyboard focus and an open custom select keep it.
|
|
|
191
197
|
- `.field` is the canonical field wrapper. It works on `<label>` and `<div>`.
|
|
192
198
|
- `.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
199
|
- `.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, at
|
|
200
|
+
- `.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 the size of a `.field` label. It keeps the `<fieldset>` and `<legend>` semantics.
|
|
195
201
|
- Use native `<optgroup>` and `disabled` options in `.select` controls when applicable; the customizable picker preserves both as a progressive enhancement.
|
|
196
202
|
- `.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
203
|
- For a switch, use `class="switch"` and `role="switch"`.
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> Read-only, disabled, and shared size modifiers for form controls.
|
|
4
4
|
|
|
5
|
-
## Class reference
|
|
6
|
-
|
|
7
|
-
| Class | Kind | Description |
|
|
8
|
-
| ----- | -------- | ---------------------------------------- |
|
|
9
|
-
| `.sm` | Modifier | Smaller control geometry and typography. |
|
|
10
|
-
| `.lg` | Modifier | Larger control geometry and typography. |
|
|
11
|
-
|
|
12
|
-
Each maps `--control-size` and `--control-font-size` to the matching step.
|
|
13
|
-
|
|
14
5
|
Use `readonly` for text-like values that can still be focused, selected, and submitted. Use `disabled` for unavailable controls that should not receive focus or submit a value.
|
|
15
6
|
|
|
16
7
|
The `.sm` and `.lg` modifiers set the shared control tokens used by inputs,
|
|
@@ -315,3 +306,12 @@ together. Density contexts leave both unchanged.
|
|
|
315
306
|
</fieldset>
|
|
316
307
|
</form>
|
|
317
308
|
```
|
|
309
|
+
|
|
310
|
+
## Class reference
|
|
311
|
+
|
|
312
|
+
| Class | Kind | Description |
|
|
313
|
+
| ----- | -------- | ---------------------------------------- |
|
|
314
|
+
| `.sm` | Modifier | Smaller control geometry and typography. |
|
|
315
|
+
| `.lg` | Modifier | Larger control geometry and typography. |
|
|
316
|
+
|
|
317
|
+
Each maps `--control-size` and `--control-font-size` to the matching step.
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
14
|
+
- Use a switch for an on/off setting that takes effect when toggled. Use a
|
|
15
|
+
[checkbox](overview.md#example-form) for a choice the user confirms by
|
|
16
|
+
submitting a form.
|
|
17
|
+
- Keep the label the same in both states. Name the setting, such as
|
|
18
|
+
“Notifications,” so the checked state can convey whether it is on.
|
|
14
19
|
- Apply `class="switch"` to a native checkbox and `role="switch"` for on/off semantics.
|
|
15
20
|
- Give it an accessible name through a label or `aria-label`.
|
|
16
21
|
- Use `checked` for the initial state and `.checked` to change it in JavaScript.
|
|
@@ -133,10 +138,14 @@ same optical line. Change the type or the control size and they stay level:
|
|
|
133
138
|
|
|
134
139
|
### Hooks
|
|
135
140
|
|
|
136
|
-
- `--switch-bg` — track fill.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
- `--switch-bg` — track fill. At rest it is `--border-control`: the filled pill
|
|
142
|
+
is the 3:1 edge that identifies the unchecked switch on its surface.
|
|
143
|
+
- `--switch-border` — track edge. It follows `--switch-bg`, so the track reads
|
|
144
|
+
as one shape; a disabled track takes the quiet `--border` of a disabled
|
|
145
|
+
check. Validation takes precedence.
|
|
146
|
+
- `--switch-knob` — knob fill. At rest it is `--surface-raised` in a light
|
|
147
|
+
scheme and `--surface-opaque` in a dark one, so it contrasts with the track
|
|
148
|
+
and keeps the tone of the checked knob.
|
|
140
149
|
|
|
141
150
|
- `--choice-control-size` — shared size for inline choices; the switch track is
|
|
142
151
|
this plus `0.125em`, so scaling it scales the checkbox and the switch together.
|
|
@@ -146,6 +155,28 @@ same optical line. Change the type or the control size and they stay level:
|
|
|
146
155
|
- `--switch-knob-inline-size` — knob width; wider than its height makes a
|
|
147
156
|
capsule knob. Defaults to the knob height.
|
|
148
157
|
|
|
158
|
+
### A lighter resting switch
|
|
159
|
+
|
|
160
|
+
The default puts the 3:1 cue of an unchecked switch on its track: a gray pill
|
|
161
|
+
whose knob only moves. A theme can move the cue to the knob instead, a dark
|
|
162
|
+
knob on a quiet track, which makes "off" lighter:
|
|
163
|
+
|
|
164
|
+
```css
|
|
165
|
+
.switch:not(:checked):not(:disabled) {
|
|
166
|
+
--switch-bg: var(--border);
|
|
167
|
+
--switch-knob: var(--text-muted);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.switch:not(:checked):not(:disabled):hover {
|
|
171
|
+
--switch-bg: color-mix(in oklab, var(--text) 10%, var(--border));
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The trade-off is the knob: dark when off, light on the colored track when on.
|
|
176
|
+
On the default palette the muted knob holds 5.9:1 against the surface in light
|
|
177
|
+
and 7.5:1 in dark. `actual-css contrast` reads a switch on its stronger cue,
|
|
178
|
+
track or knob.
|
|
179
|
+
|
|
149
180
|
Knob size and travel distance are derived from these hooks; set them rather
|
|
150
181
|
than the derived values. The knob is concentric in its track: the
|
|
151
182
|
inset is measured inside the border on both axes, so it clears the rails by the
|
|
@@ -4,21 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
**Related terms:** inline validation, field error, telephone input.
|
|
6
6
|
|
|
7
|
-
## Class reference
|
|
8
|
-
|
|
9
|
-
| Class | Kind | Description |
|
|
10
|
-
| ------------------- | ----------- | -------------------------------------------- |
|
|
11
|
-
| `.field-error` | Composition | Canonical inline error message. |
|
|
12
|
-
| `.field-help` | Composition | Canonical helper text. |
|
|
13
|
-
| `.field.danger` | Modifier | Manual invalid marking on the wrapper. |
|
|
14
|
-
| `.needs-validation` | Modifier | Opt-in for the enhancer and `:user-invalid`. |
|
|
15
|
-
| `.was-validated` | Modifier | Set by the enhancer after a submit attempt. |
|
|
16
|
-
| `.status-bar` | Component | Optional form-level status element. |
|
|
17
|
-
|
|
18
|
-
`.field-error` shows while the field is invalid; `.field-help` carries
|
|
19
|
-
supporting copy before and after validation. `.status-bar` shows
|
|
20
|
-
`data-validation-message` on an invalid submit.
|
|
21
|
-
|
|
22
7
|
- `.field-error` is the canonical error message. It is wired to `aria-invalid="true"` via the input, so the visual border and the assistive-tech announcement move together.
|
|
23
8
|
- `.field-help` is the canonical helper text. It carries supporting copy before and after validation.
|
|
24
9
|
- Set `aria-invalid="true"` on the input. The `.field-error` element is linked via `aria-describedby`.
|
|
@@ -49,6 +34,21 @@ supporting copy before and after validation. `.status-bar` shows
|
|
|
49
34
|
</form>
|
|
50
35
|
```
|
|
51
36
|
|
|
37
|
+
## Class reference
|
|
38
|
+
|
|
39
|
+
| Class | Kind | Description |
|
|
40
|
+
| ------------------- | ----------- | -------------------------------------------- |
|
|
41
|
+
| `.field-error` | Composition | Canonical inline error message. |
|
|
42
|
+
| `.field-help` | Composition | Canonical helper text. |
|
|
43
|
+
| `.field.danger` | Modifier | Manual invalid marking on the wrapper. |
|
|
44
|
+
| `.needs-validation` | Modifier | Opt-in for the enhancer and `:user-invalid`. |
|
|
45
|
+
| `.was-validated` | Modifier | Set by the enhancer after a submit attempt. |
|
|
46
|
+
| `.status-bar` | Component | Optional form-level status element. |
|
|
47
|
+
|
|
48
|
+
`.field-error` shows while the field is invalid; `.field-help` carries
|
|
49
|
+
supporting copy before and after validation. `.status-bar` shows
|
|
50
|
+
`data-validation-message` on an invalid submit.
|
|
51
|
+
|
|
52
52
|
## Optional JavaScript enhancer
|
|
53
53
|
|
|
54
54
|
Native validation first; the enhancer only adds state and focus behavior.
|
|
@@ -263,7 +263,7 @@ FormValidator.registerRule("iso-date", (value) => {
|
|
|
263
263
|
|
|
264
264
|
### Server and AJAX validation
|
|
265
265
|
|
|
266
|
-
The enhancer never makes network calls.
|
|
266
|
+
The enhancer never makes network calls. A server that answers with HTML can re-render the form with its errors through [Ajax submission](ajax.md#confirm-show-errors-recover). A server that answers with data maps its errors back onto fields through the public API:
|
|
267
267
|
|
|
268
268
|
```js
|
|
269
269
|
import { FormValidator } from "actual-css/js/validation";
|
|
@@ -90,6 +90,36 @@ Keep the outline visible against the surrounding surface when changing colors.
|
|
|
90
90
|
|
|
91
91
|
→ [Button hooks](../components/button.md#css-hooks) · [Focus tokens](./tokens.md#color)
|
|
92
92
|
|
|
93
|
+
### Lighter field borders / underline fields / bottom border only
|
|
94
|
+
|
|
95
|
+
A field must stay identifiable at rest. Keep a 3:1 edge on the lower side and
|
|
96
|
+
quiet the others by setting two inherited hooks on your theme root:
|
|
97
|
+
|
|
98
|
+
```css
|
|
99
|
+
:root {
|
|
100
|
+
/* Quiet sides, 3:1 lower edge. */
|
|
101
|
+
--control-default-border: var(--border);
|
|
102
|
+
--control-border-block-end-color: var(--border-control);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For an underline-only field on a tinted fill, also set
|
|
107
|
+
`--control-default-bg: var(--surface-subtle)`,
|
|
108
|
+
`--control-default-border: transparent` and
|
|
109
|
+
`--control-hover-border: transparent`; without the last one, hover draws a full
|
|
110
|
+
frame around the field. Readonly and disabled fields keep their quiet
|
|
111
|
+
`--border` frame on that tint; a theme that wants them frameless too sets
|
|
112
|
+
`--control-border: transparent` on those states. In forced colors every side
|
|
113
|
+
is drawn again in a system color.
|
|
114
|
+
|
|
115
|
+
The recipe covers `.input`, `.textarea`, `.select` and join addons; checkboxes,
|
|
116
|
+
radios and switches keep `--border-control`, their only cue. Readonly and
|
|
117
|
+
disabled fields drop the lower edge, and validation still colours every side.
|
|
118
|
+
Avoid lowering `--border-control-mix` instead: the default palette sits at
|
|
119
|
+
3.2:1, with no room under the threshold.
|
|
120
|
+
|
|
121
|
+
→ [Forms hooks](../forms/overview.md#hooks)
|
|
122
|
+
|
|
93
123
|
### Keep bare native controls on-theme / accent-color
|
|
94
124
|
|
|
95
125
|
Bare checkboxes, radios, ranges, and `<progress>` follow the theme through
|
|
@@ -154,8 +184,8 @@ application CSS and keep forms and intent ink out of it:
|
|
|
154
184
|
```
|
|
155
185
|
|
|
156
186
|
Transparent inks (`.btn.outline`, `.ghost`, `.link`) and headings follow that
|
|
157
|
-
ink; a neutral `.btn.outline` draws its border with `--border
|
|
158
|
-
|
|
187
|
+
ink; a neutral `.btn.outline` draws its border with `--border`, so the edge
|
|
188
|
+
is not derived from the band. Fields, their labels
|
|
159
189
|
and help text, and intent colors keep the page palette, which nothing tunes for
|
|
160
190
|
`--surface-solid`. Focus lines stay readable there: the theme contract keeps
|
|
161
191
|
`--focus` at 3:1 on `--surface-solid`.
|
|
@@ -128,8 +128,8 @@ A theme with translucent surfaces overrides both with opaque values.
|
|
|
128
128
|
|
|
129
129
|
`--border` separates surfaces: cards, tables, dividers, panels.
|
|
130
130
|
`--border-control` is the resting edge that tells a control apart from the
|
|
131
|
-
surface — fields, checkboxes and radios, unchecked
|
|
132
|
-
cards, join addons
|
|
131
|
+
surface — fields, checkboxes and radios, the unchecked switch track, OTP cells, choice
|
|
132
|
+
cards, join addons and the outline button beside them, the color and file inputs. It is
|
|
133
133
|
derived from `--text` and `--surface`; on the default palette it holds 3:1
|
|
134
134
|
against `--surface` and 2.9–3.0 against `--surface-subtle`. `actual-css
|
|
135
135
|
contrast` reports it for your theme. `--border-control-mix` sets the ink share;
|
|
@@ -218,7 +218,7 @@ Themes tune both globally instead of rewriting component selectors:
|
|
|
218
218
|
|
|
219
219
|
```css
|
|
220
220
|
:root {
|
|
221
|
-
--soft-bg-mix:
|
|
221
|
+
--soft-bg-mix: 92%; /* share of surface; the tint's opacity is 100% minus it */
|
|
222
222
|
--soft-hover-alpha: 6%; /* extra intent share on hover */
|
|
223
223
|
--soft-fg-mix: 100%;
|
|
224
224
|
}
|
|
@@ -339,8 +339,9 @@ Components can use local font variables for their own mapping, but should inheri
|
|
|
339
339
|
### Controls
|
|
340
340
|
|
|
341
341
|
Controls share geometry so buttons, inputs, selects, and compact app UI align.
|
|
342
|
-
Local `.sm`/`.lg` sizes map `--control-size`, `--control-font-size`,
|
|
343
|
-
`--control-pad-x`.
|
|
342
|
+
Local `.sm`/`.lg` sizes map `--control-size`, `--control-font-size`,
|
|
343
|
+
`--btn-font-size`, and `--control-pad-x`. A button label sits one step of the
|
|
344
|
+
type scale below the field text.
|
|
344
345
|
|
|
345
346
|
```css
|
|
346
347
|
:root {
|
|
@@ -353,6 +354,7 @@ Local `.sm`/`.lg` sizes map `--control-size`, `--control-font-size`, and
|
|
|
353
354
|
--control-pad-x-lg: var(--font-size-lg); /* .lg, .spacious */
|
|
354
355
|
--control-pad-x: var(--control-pad-x-md);
|
|
355
356
|
--control-font-size: var(--font-size-md);
|
|
357
|
+
--btn-font-size: var(--font-size-sm); /* .sm → xs, .lg → md */
|
|
356
358
|
--disabled-opacity: 0.65;
|
|
357
359
|
}
|
|
358
360
|
```
|
|
@@ -121,6 +121,24 @@ Status labels → .badge.soft + intent
|
|
|
121
121
|
Dense data views → .compact on the region
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
+
## Components are tools, not design decisions
|
|
125
|
+
|
|
126
|
+
Start from the product's content, audience and purpose; choose components and
|
|
127
|
+
blocks only once that structure is known. A section exists because it carries
|
|
128
|
+
information, a demonstration or an action, not because a layout has a slot for
|
|
129
|
+
it.
|
|
130
|
+
|
|
131
|
+
- Treat block markup as editable semantic HTML: remove, merge, reorder or
|
|
132
|
+
reshape sections freely.
|
|
133
|
+
- Do not invent content to fill a layout, or add decoration without a purpose:
|
|
134
|
+
a status dot marks a live state, an arrow a direction, an illustration
|
|
135
|
+
explains something.
|
|
136
|
+
- Express product identity in the theme and in application CSS. Writing it is
|
|
137
|
+
using Actual, not working around it.
|
|
138
|
+
|
|
139
|
+
A polished interface is not necessarily a finished design. Before polishing,
|
|
140
|
+
strip the ornaments mentally and ask what the page actually says.
|
|
141
|
+
|
|
124
142
|
## With a design skill
|
|
125
143
|
|
|
126
144
|
A design skill and the Actual skill do not overlap. The design skill owns the
|
|
@@ -52,7 +52,7 @@ optimizing — the bare `actual-css` entrypoint and `actual-css/full` both resol
|
|
|
52
52
|
to the complete compiled framework:
|
|
53
53
|
|
|
54
54
|
```html
|
|
55
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.
|
|
55
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.20/dist/actual.full.min.css">
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
The package does not maintain separate partial bundles. Modular entrypoints map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "actual-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.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",
|
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
"report:theme-contrast": "bun scripts/report-theme-contrast.js",
|
|
131
131
|
"report:neutral-ramp": "bun scripts/report-neutral-ramp.js",
|
|
132
132
|
"report:dead-css": "bun scripts/report-dead-css.js",
|
|
133
|
+
"report:composition": "bun scripts/report-composition.js",
|
|
133
134
|
"report:overflow": "bun scripts/report-overflow.js",
|
|
134
135
|
"report:paint": "bun scripts/report-paint.js",
|
|
135
136
|
"check:architecture": "bun scripts/check-css-architecture.js",
|
package/reserved-classes.json
CHANGED
|
@@ -44,6 +44,12 @@ If `DESIGN.md` (and `PRODUCT.md`) exists at the project root, read it after `PRO
|
|
|
44
44
|
- `DESIGN.md` records the approved direction; the theme stylesheet defines the values actually shipped. When they disagree, neither wins by default: report the drift and ask whether the design changed on purpose or the code drifted, then update the stale document or fix the theme. Never silently copy a value either way.
|
|
45
45
|
- A product-specific requirement no token, hook, or component expresses is focused application CSS, derived from theme tokens. Report a missing hook only when the need is generic and recurring. Never override a component's internal state or behavior.
|
|
46
46
|
|
|
47
|
+
Components are implementation tools, not design decisions. Start from the content and purpose, then choose the components that give it form:
|
|
48
|
+
|
|
49
|
+
- Do not invent content to fill a layout, or add decoration without a function (a status dot that marks no live state, an arrow on every link).
|
|
50
|
+
- Treat block markup as editable semantic HTML: remove, merge, reorder or reshape sections.
|
|
51
|
+
- A polished composition is not a finished design. A section that carries no information, demonstration or action is removed, not decorated.
|
|
52
|
+
|
|
47
53
|
When a design skill (Impeccable or similar) is active, it owns direction, critique, and `DESIGN.md`; this skill still owns vocabulary and the completion check. Fix its findings through the decision order, confirm computed sizes and colors on the rendered page rather than from a source scan, and never copy its preview snippets (`.impeccable/design.json`) into application code.
|
|
48
54
|
|
|
49
55
|
## Decision order
|
|
@@ -244,3 +250,4 @@ Before considering an Actual CSS UI change complete:
|
|
|
244
250
|
- JavaScript behavior and presentation stay decoupled.
|
|
245
251
|
- Focus and relevant disabled/current/selected/expanded states remain accessible.
|
|
246
252
|
- The implementation matches the Actual CSS version actually used by the project.
|
|
253
|
+
- Every section and graphic element carries content or a function; none exists only to fill a layout.
|
package/src/cli/actual-css.js
CHANGED
|
@@ -30,7 +30,7 @@ function usage() {
|
|
|
30
30
|
"",
|
|
31
31
|
"contrast: measure the pairs a theme tunes by hand in headless Chrome, in every",
|
|
32
32
|
"scheme it declares: soft ink on its resting and hovered fill, the resting edge",
|
|
33
|
-
"of a field, checkbox
|
|
33
|
+
"of a field, checkbox and radio and the track or knob of an unchecked switch, the focus line on --surface",
|
|
34
34
|
"and --surface-solid, the invalid-field focus line, and the inverse text. Exits 1",
|
|
35
35
|
"when a pair misses its threshold. Needs Bun (bunx --bun actual-css contrast ...).",
|
|
36
36
|
].join("\n");
|
|
@@ -40,10 +40,11 @@
|
|
|
40
40
|
|
|
41
41
|
.badge {
|
|
42
42
|
--badge-size: 1.5rem;
|
|
43
|
-
/*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
--badge-
|
|
43
|
+
/* Half the height keeps the pill proportional across local sizes without
|
|
44
|
+
coupling it to the label typography. A label one step under the body
|
|
45
|
+
text, with this much air, reads as a tag rather than as text on a fill. */
|
|
46
|
+
--badge-pad-x: calc(var(--badge-size) / 2);
|
|
47
|
+
--badge-font-size: var(--font-size-xs);
|
|
47
48
|
--badge-icon-size: 1em;
|
|
48
49
|
--badge-dot-size: 0.5rem;
|
|
49
50
|
/* A leading .avatar and a trailing .close are slots: a disc inside the pill
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
|
|
100
101
|
.badge.lg {
|
|
101
102
|
--badge-size: 1.875rem;
|
|
102
|
-
--badge-font-size: var(--font-size-
|
|
103
|
+
--badge-font-size: var(--font-size-sm);
|
|
103
104
|
--badge-dot-size: 0.625rem;
|
|
104
105
|
}
|
|
105
106
|
|
|
@@ -263,7 +264,10 @@ a.badge[aria-disabled="true"] {
|
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
266
|
@media print {
|
|
266
|
-
.badge
|
|
267
|
+
/* :empty is named because its border: 0 outranks .badge: a status dot
|
|
268
|
+
printed without background graphics would vanish. */
|
|
269
|
+
.badge,
|
|
270
|
+
.badge:empty {
|
|
267
271
|
border: var(--border-width) solid CanvasText;
|
|
268
272
|
}
|
|
269
273
|
}
|