@filipgutica/design-system 1.0.24 → 1.0.25
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/language/DESIGN.md +48 -5
- package/language/decisions.md +2 -0
- package/language/ui-sdk.css +125 -13
- package/package.json +1 -1
package/language/DESIGN.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Design language
|
|
2
2
|
|
|
3
|
-
A shared visual language for personal products, documentation, tools, mockups, and inline explainers. Claude and Codex follow this file. Take inspiration from the clarity and restraint of [Linear](https://linear.app/), [Codex](https://openai.com/codex/), [Director](https://director.sh/), and [T3 Code](https://t3.codes/): clear hierarchy, a balanced page frame, and real product evidence. Adapt their principles to the task; use original copy and assets.
|
|
3
|
+
A shared visual language for personal products, applications, documentation, tools, mockups, artifacts, dashboards, charts, and inline explainers. Claude and Codex follow this file. Take inspiration from the clarity and restraint of [Linear](https://linear.app/), [Codex](https://openai.com/codex/), [Director](https://director.sh/), and [T3 Code](https://t3.codes/): clear hierarchy, a balanced page frame, and real product evidence. Adapt their principles to the task; use original copy and assets.
|
|
4
4
|
|
|
5
5
|
## Scope and precedence
|
|
6
6
|
|
|
@@ -64,6 +64,7 @@ Token names depend on where the page runs. This file uses the `tokens.css` names
|
|
|
64
64
|
|
|
65
65
|
Controls use quiet depth and familiar shapes: borderless surfaces with one tight shadow at rest that sink when pressed or filled in.
|
|
66
66
|
|
|
67
|
+
- **Minimal by default.** Start from less: fewer words, boxes, and controls, and larger evidence. See [Minimal by default](#minimal-by-default).
|
|
67
68
|
- **Quiet surfaces, clear hierarchy.** Neutral paper and graphite backgrounds, with color reserved for the project hue, links, and meaningful states. Contrast, type, alignment, and proximity carry the structure.
|
|
68
69
|
- **Purposeful space.** Compact elements within a group, larger gaps between groups. Every gap should help a reader understand a relationship.
|
|
69
70
|
- **Evidence before decoration.** Show the actual product, command, or example. Use restrained framing so the evidence remains the focal point.
|
|
@@ -104,7 +105,7 @@ Controls use quiet depth and familiar shapes: borderless surfaces with one tight
|
|
|
104
105
|
| Phone | `@media (max-width: 640px)` | Side gutters drop from `--space-6` to `--space-4`, and section gaps take their phone step. |
|
|
105
106
|
|
|
106
107
|
Use `@media (min-width: 801px)` only for a rule that applies to desktop alone. One documented exception: the tool-home hero splits at `@media (min-width: 1024px)`, with the title across the top, the lede on the left, and the install block and facts on the right. Below 1024px it stacks in source order. Pages add no viewport breakpoint beyond the table and the hero split. A pane that must collapse at its own width uses a container query, as the detail column in `reference.html` does.
|
|
107
|
-
- Density: an application screen has one size for each place, not a range. Toolbar controls (buttons, segmented filters, and search fields) are `sm`, `--control-sm` tall. Rows in a table or list, such as the console's monitor list, and rail and navigation rows, are `--row` tall. Other controls keep the default `md` (`--control-md`). At tablet width every touch target grows to `--control-lg`. The console in `reference.html` uses these sizes.
|
|
108
|
+
- Density: an application screen has one size for each place, not a range. Toolbar controls (buttons, segmented filters, and search fields) are `sm`, `--control-sm` tall. Rows in a table or list, such as the console's monitor list, and rail and navigation rows, are `--row` tall. Other controls keep the default `md` (`--control-md`). At tablet width every touch target grows to `--control-lg`. The console in `reference.html` uses these sizes. This density is control size; how much a screen shows is [Minimal by default](#minimal-by-default).
|
|
108
109
|
- [Navigation](#navigation) is a strip of 6 links or fewer, or a section rail that moves into a drawer at tablet width. A sticky side rail taller than the window scrolls its link list, not the element that draws its divider, so an overlay scrollbar sits clear of the line. Keep wide code, tables, and charts scrolling inside their containers.
|
|
109
110
|
- Keep main headings, actions, and product evidence visible on load. Scrolling should reveal more content without being required to make existing content appear.
|
|
110
111
|
|
|
@@ -176,12 +177,17 @@ Each depth tier has one token. [`tokens.css`](tokens.css) holds every shadow val
|
|
|
176
177
|
|
|
177
178
|
- Pin every `@ui-sdk/*` package to the exact version `ui-sdk.css` names, `0.1.0-beta.5`. Do not load `@ui-sdk/core/web.css`, its `--ui-*` variables, or the unversioned `https://ui-sdk.dev/web.js`.
|
|
178
179
|
- Load a stylesheet that starts with `@layer ui-sdk, base, components;` first, then `tokens.css` and `ui-sdk.css`. ui-sdk adds the little CSS its behaviour needs to `@layer ui-sdk` at run time, so the declaration keeps it below the design system, and `ui-sdk.css` sits in `components`, above the base as the [component rule](#components) requires. With Tailwind, put the declaration above `@import "tailwindcss"`, so Tailwind's utilities still outrank the components.
|
|
179
|
-
- Supported components, with each variant, size, and state of its [component spec](components.md):
|
|
180
|
+
- Supported components, with each variant, size, and state of its [component spec](components.md). `ui-sdk.css` draws the composition given for each; where ui-sdk's own examples differ, such as a choice card's `data-slot="stack"` and `"hint"` spans or a text `DialogClose`, follow the composition here:
|
|
180
181
|
- [Button](components.md#button): no `data-variant` is primary; `data-variant="secondary"`, `"ghost"`, `"danger"`, or `"text"` picks another, and `data-size="sm"` or `"lg"` a size. A button whose `onClick` returns a promise is busy until it settles: it dims and shows the spinner, so do not add ui-sdk's `data-show="pending"` content. A button rendered as a link (`render={<a href=… />}`) keeps the button's look.
|
|
181
182
|
- [Field wrapper](components.md#field-wrapper) and [Text input and textarea](components.md#text-input-and-textarea): `Field`, `FieldLabel`, `FieldDescription`, `FieldError`, `Input`, and `Textarea`, with `data-size="sm"` or `"lg"` on an `Input`.
|
|
182
183
|
- [Checkbox and radio](components.md#checkbox-and-radio): each `Checkbox` or `Radio` as a direct child of a `<label data-slot="label">` with its text, and radios inside a `RadioGroup`. `data-size="sm"` or `"lg"` goes on the label.
|
|
183
|
-
-
|
|
184
|
-
-
|
|
184
|
+
- [Radio card group](components.md#radio-card-group): a `RadioGroup` of `<label data-slot="card">` cards, each holding a `<strong>` title, an optional `<span>` description, and the `Radio`.
|
|
185
|
+
- [Switch](components.md#switch): a `Switch` with its `SwitchThumb`, as a direct child of a `<label data-slot="label">` with its text, so the whole row toggles it. `data-size="sm"` or `"lg"` goes on the label.
|
|
186
|
+
- [Toggle button](components.md#toggle-button): a `Toggle` whose first child is an empty `ToggleIcon`, drawn as the switch track, then a `<span>` with the label and an optional `<small>` description. `data-size="sm"` or `"lg"` goes on the `Toggle`.
|
|
187
|
+
- [Select](components.md#select): `Select`, `SelectTrigger` with `SelectValue`, `SelectContent`, and `SelectItem`, inside a `Field` for the label and error. `data-size="sm"` or `"lg"` goes on the trigger. The item draws the check, so `SelectItemIndicator` is optional.
|
|
188
|
+
- [Dialog](components.md#dialog): `DialogBackdrop` and `DialogContent`. The content holds a `<header>` (a `<div>` with `DialogTitle` and `DialogDescription`, then an icon `DialogClose` with an `aria-label`), the body in one element, and an optional `<footer>` whose actions are `Button`s, such as `<DialogClose render={<Button data-variant="secondary" />}>`. On phones it is a bottom sheet.
|
|
189
|
+
- At tablet width and below, unsized buttons, inputs, select triggers, toggle buttons, and choice and switch rows grow to `--control-lg` for touch, as the catalogue's do.
|
|
190
|
+
- Any other ui-sdk component or part is unsupported: it renders unstyled. That includes `InputGroup`, `InputClear`, a mixed (indeterminate) checkbox, a `Toggle` with an icon, `ToggleGroup`, the switch choice card, the select's search, groups, and clear button, `presentation="sheet"` on a select or dialog (ui-sdk places the sheet, and its panel is not drawn), a `DialogClose` outside the dialog's `<header>` that is not rendered as a `Button`, `AlertDialog`, and the dialog [viewer](components.md#viewer). Use the owning library's component or the [`components.html`](components.html) recipe, or add a spec and its `ui-sdk.css` rules first. Do not style an unsupported part on a page.
|
|
185
191
|
- This file owns the look and the load order. The ui-sdk skill and the docs in the installed `@ui-sdk/*` package own which component to use, composition, `render`, ARIA, and the agent bridge. `interface-design` owns states and copy. The repository's own testing rules apply, not the ui-sdk skill's `test.fails` advice.
|
|
186
192
|
- To let an agent operate the page, create the bridge with `createAgent()` before the app renders; the agent reads with `snapshot()` and acts with `act()`. The app decides whether to expose it, through `createAgent` or WebMCP, and which actions to allow.
|
|
187
193
|
|
|
@@ -245,6 +251,36 @@ Each depth tier has one token. [`tokens.css`](tokens.css) holds every shadow val
|
|
|
245
251
|
- Label illustrative data and demo outcomes clearly. Credit upstream creators when presenting a derivative product.
|
|
246
252
|
- Use monochrome line icons sparingly; give an icon a purpose beyond filling space.
|
|
247
253
|
|
|
254
|
+
### Minimal by default
|
|
255
|
+
|
|
256
|
+
Every interface built with this language starts minimal: application screens, mockups, artifacts, dashboards, charts, and the interface parts of documentation and product pages. Prose in lessons, documentation, and product pages keeps the [copy rules](#copy-and-density). A word, box, or control stays only when it changes what the reader knows or can do; remove anything that repeats what is already in view. Give the space that frees to the evidence, such as a chart or a key value, not to more items.
|
|
257
|
+
|
|
258
|
+
- **Status in one sentence.** A view's summary sentence carries its status, the numbers behind it, and a status icon. Use an [alert](components.md#alert) only for a caveat or an action the summary cannot carry: one per view at most, and never one that repeats a sentence, badge, or heading in view.
|
|
259
|
+
- **One meta line.** Context, such as who ran it, the scope, the size, and liveness ("still running"), sits on one muted line under the title, joined with " · ". It is the one deliberate run of middle dots. Its details sit behind a disclosure on that line.
|
|
260
|
+
- **One-line rows.** Data rows in a table or list are one line, `--row` tall. Show a direction, trend, or unit as a glyph (↑ or ↓) and put the words in the accessible name. Secondary detail goes in the selected row's detail or a disclosure.
|
|
261
|
+
- **Mark the exceptions.** Status columns, badges, and status icons show only the values that differ from the default. The default has no mark, and one key line names it. Drop an icon that repeats a badge or label in the same row.
|
|
262
|
+
- **Primary action in reach.** A row or card shows its primary next action as a button, plus either one secondary button or, for two or more secondary actions, one overflow menu trigger. A failed or blocked item keeps its recovery action, such as Retry, Resume, or Reconnect, visible.
|
|
263
|
+
- **Forms.** A field takes a description only for a format, limit, or consequence its label does not state. No intro sentence restates the fields. A sticky action bar sits on the page background with a hairline divider, without a panel or shadow.
|
|
264
|
+
- **Containers group.** Never nest a panel, card, or well in another. A component's own parts, as its spec draws them, such as a code block's source panel, and the controls and alerts inside a container or a dialog are fine. Grid cells and stat tiles take a fill or nothing, not a border each.
|
|
265
|
+
- **Explanations on request.** Method notes, "How to read this", and multiple-comparison caveats go in a closed disclosure next to what they explain.
|
|
266
|
+
|
|
267
|
+
Never cut these:
|
|
268
|
+
|
|
269
|
+
- Accessible names that keep the full words: verdict, direction, and status.
|
|
270
|
+
- A second signal beside colour.
|
|
271
|
+
- Safety, cost, and consent text, and the confirmation of a destructive action.
|
|
272
|
+
- Recovery paths, and an error's fix.
|
|
273
|
+
- Uncertainty cues: intervals, provisional and partial marks, sample sizes, and "may be chance". They may be faint; they stay.
|
|
274
|
+
- Labels on illustrative data.
|
|
275
|
+
- Loading, empty, and error states.
|
|
276
|
+
- Keyboard paths, visible focus, and target sizes.
|
|
277
|
+
|
|
278
|
+
Measure each screen you build or revise. Count its words, boxes, and controls with `interface-design`'s `ui-check.mjs --count`, at 1280px wide, for the whole page and the tool's first screen, and report the counts before and after. A count that rises needs a reason. There is no fixed budget.
|
|
279
|
+
|
|
280
|
+
- Words are visible text tokens. The count leaves out screen-reader-only text, so cutting visible words never means cutting accessible names.
|
|
281
|
+
- For the count, a box is any element with three or more visible borders, or any shadow, so raised buttons count too.
|
|
282
|
+
- Controls are buttons, links, fields, selects, and summaries.
|
|
283
|
+
|
|
248
284
|
## Identity layer: terminal folio
|
|
249
285
|
|
|
250
286
|
The personal sites are terminal tools that read Markdown and paths, so their identity comes from that world. A new project replaces this section with its own identity and keeps the core.
|
|
@@ -267,6 +303,10 @@ The personal sites are terminal tools that read Markdown and paths, so their ide
|
|
|
267
303
|
- Large blank gaps that push the action or evidence away from the introduction.
|
|
268
304
|
- Centered long paragraphs, excessively faint text, and horizontal page overflow.
|
|
269
305
|
- Theme controls added automatically to inline charts and explainers.
|
|
306
|
+
- An alert that repeats the summary sentence, or a status icon beside a badge that says the same.
|
|
307
|
+
- A bordered box around each grid cell, or a sticky bar drawn as a panel with a shadow.
|
|
308
|
+
- Helper text that restates its label.
|
|
309
|
+
- A row of secondary buttons on every list row.
|
|
270
310
|
|
|
271
311
|
## Acceptance
|
|
272
312
|
|
|
@@ -278,4 +318,7 @@ The personal sites are terminal tools that read Markdown and paths, so their ide
|
|
|
278
318
|
- [ ] At 390, 720, and 1280 px wide there is no horizontal page scroll, and the page's own viewport media queries use only `max-width: 640px`, `max-width: 800px`, `min-width: 801px`, and the documented `min-width: 1024px` hero split.
|
|
279
319
|
- [ ] Keyboard, focus, touch, deep links, and reduced motion work across relevant states.
|
|
280
320
|
- [ ] Every control is the owning system's component or class, never a local copy built from its tokens; spacing uses its tokens; each panel and visual effect has a purpose.
|
|
321
|
+
- [ ] Each status sits in one sentence or one alert, and nothing in view repeats it.
|
|
322
|
+
- [ ] Rows are one line, and each item shows its primary action plus one secondary button or one menu trigger at most.
|
|
323
|
+
- [ ] Words, boxes, and controls are counted before and after, and nothing on the never-cut list is gone.
|
|
281
324
|
- [ ] Control states match between `components.html`, the example pages, and the owning library: hover, press, focus, disabled, busy, invalid, and forced colors.
|
package/language/decisions.md
CHANGED
|
@@ -13,6 +13,8 @@ Each entry records a choice this language made, the options it rejected, and why
|
|
|
13
13
|
| Quiet actions | Core | One recipe for Copy, Full size, dialog and drawer close, and the project trigger: transparent, `currentColor` at 6% on hover and 12% pressed (see Quiet action fill), no sink, and the control ring. The project trigger keeps the tint but takes the field corner (see One-line non-action controls). | Each had its own hover (`--color-row-hover`, a colour change only, or a 12% tint), so the same kind of action behaved differently. | rule present: `tests/design-foundations.test.mjs` "every state rule the guard requires exists in the catalogue"; tint recipe: `tests/catalogue/catalogue.spec.ts` "a hovering pointer adds a 6% fill, and a press 12%" |
|
|
14
14
|
| Quiet action fill | Core | `currentColor` at 6% under a hovering pointer and 12% pressed, a faint overlay after Astryx's ghost button overlay (the idea only; no code copied). The user approved it from rendered demos. | 12% hover and 18% pressed, the previous values, replaced by the fainter overlay the user chose. No fill on hover, with only the icon brightening: it hides the hit target, so the reader cannot see what a click will reach. | hover and press alpha: `tests/catalogue/catalogue.spec.ts` "a hovering pointer adds a 6% fill, and a press 12%"; no fill after a tap: "a tap leaves no fill behind" |
|
|
15
15
|
| One source per control | Core | Each control comes from the owning library's component or class, including a link styled as a button. | Local copies built from the same tokens drifted: a docs button had no raise and only faded when pressed. | copied rules unchanged: `tests/design-foundations.test.mjs` "example pages copy the catalogue rules for the shared controls and components they use unchanged" |
|
|
16
|
+
| Minimal by default | Core | Every interface starts minimal: the subtraction rules in [Minimal by default](DESIGN.md#minimal-by-default) for status, meta lines, rows, marks, actions, forms, boxes, and explanations, with a never-cut list, and words, boxes, and controls counted before and after each change. Prose keeps the copy rules. Taken from the PluginBench redesign, where cutting to these rules took Results from 412 to 306 words and 12 to 7 boxes, Queue from 34 to 28 controls, and New eval from 221 to 148 words (whole-page counts at 1280px). | A minimal pass per project: PluginBench needed two rounds of "less" before it got there. A fixed word or box budget: the right count depends on the task, and a budget would punish real data. Counting screen-reader-only text: it would reward cutting accessible names. The same rules for lessons and product prose: they need their explanation. | No test yet |
|
|
17
|
+
| Status in one sentence | Core | A view's summary sentence carries the status, its numbers, and a status icon. An alert holds only a caveat or action the summary cannot carry, one per view at most. | A banner above the summary that repeats it: PluginBench's Results had both, and the banner added a box and a second reading of the same fact. | No test yet |
|
|
16
18
|
| Section mark | Identity | The `##` mark goes only on the page-level section headings (h2) of documentation, CLI tool, article, and product pages, which are mono with a `--color-border-subtle` rule above. Application and inline-visualization section headings are plain `--font-ui` semibold at `--text-xl` or smaller, with no mark and no rule. h3 and lower never take it. | The mark on every section heading: on a dense screen, such as a metrics dashboard with six sections, it repeated down the page and competed with the data. The mark on h2 and h3: deeper levels repeat more often. A per-page opt-out class: every application page would need to remember it. Dropping the mark: reading pages lose the folio identity that ties them to the `~/name` header. Mono application section headings without the mark: the mono face alone still reads as a document heading among compact sans rows. | No test yet |
|
|
17
19
|
| Command plate | Identity | Owner decision, 2026-11-15: a shell command uses the normal code block and its source well in light and dark, with a CSS-drawn `$ ` prompt in `--color-accent`. Header, Copy, compact layout, and focus follow the code block. Keep `--color-command-bg` and `--color-command-border` as compatibility aliases for `--color-code` and `--color-border-subtle`. Terminal captures stay unchanged. | A: the dark, hue-tinted plate in both modes. On a light page it was the darkest element and looked mismatched beside light source blocks; the owner noticed it on every site. B: a pale hue-tinted plate in light mode. It followed the mode but added a second tinted surface and still differed from source code; the owner preferred one consistent code surface (option C). | `tests/catalogue/catalogue.spec.ts`: "contrast: shell command text on the code well reaches 4.5:1", "contrast: the accent shell prompt on the code well reaches 3:1"; compatibility aliases and DS-1 exceptions: `tests/token-values.test.mjs`; shared code recipes: `tests/design-foundations.test.mjs`; imported-theme failures: `tests/theme-mapper.test.mjs` |
|
|
18
20
|
| Terminal colours | Identity | Owner decision, 2026-11-14: the 16 ANSI colours that terminal captures use are design-system tokens, `--color-terminal-ansi-0` to `-15`, plus `--color-terminal-ansi-4-bg` for a blue background that terminal text reads on. They keep the values `@filipgutica/ui` drew before, so no capture changes. Colours 1 to 15 reach 4.5:1 on `--color-terminal`; black (colour 0) is a background only, and dim text reads colour 8. | Literal defaults in `@filipgutica/ui`: colour data outside the design system, which breaks the rule that the design system owns colours and component libraries only apply them. One token per colour role, such as a success green: terminal programs choose the slot, so the palette must name slots. | contrast: the core `ansi` check in `theme-mapper/engine.js`, which `tests/site/site.spec.ts` "Themes: every contrast check passes" runs for every theme; parity with the 1.x token set: `tests/token-values.test.mjs` |
|
package/language/ui-sdk.css
CHANGED
|
@@ -50,32 +50,32 @@
|
|
|
50
50
|
[data-slot="button"][aria-busy="true"]::before { content: ""; flex: none; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ui-sdk-spin 700ms linear infinite; }
|
|
51
51
|
@keyframes ui-sdk-spin { to { transform: rotate(360deg); } }
|
|
52
52
|
|
|
53
|
-
/* ---------- Field wrapper, input, and
|
|
53
|
+
/* ---------- Field wrapper, input, textarea, and select trigger ---------- */
|
|
54
54
|
[data-slot="field"] { display: grid; gap: 0.375rem; justify-items: start; min-width: 0; }
|
|
55
55
|
[data-slot="field-label"] { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
|
|
56
56
|
[data-slot="field-description"] { font-size: var(--text-sm); color: var(--color-muted); }
|
|
57
57
|
[data-slot="field-error"] { font-size: var(--text-sm); color: var(--color-error); }
|
|
58
|
-
:is([data-slot="input"], [data-slot="textarea"]) { --depth: var(--shadow-field); width: 100%; border: 1px solid var(--color-field-edge); border-radius: var(--radius-field); background: var(--color-field-bg); box-shadow: var(--depth); color: var(--color-text); font: var(--text-md) / 1.35 var(--font-ui); }
|
|
58
|
+
:is([data-slot="input"], [data-slot="textarea"], [data-slot="select-trigger"]) { --depth: var(--shadow-field); width: 100%; border: 1px solid var(--color-field-edge); border-radius: var(--radius-field); background: var(--color-field-bg); box-shadow: var(--depth); color: var(--color-text); font: var(--text-md) / 1.35 var(--font-ui); }
|
|
59
59
|
[data-slot="input"] { height: var(--control-md); padding: 0 0.625rem; }
|
|
60
60
|
[data-slot="input"][data-size="sm"] { height: var(--control-sm); padding-inline: 0.5625rem; font-size: var(--text-sm); }
|
|
61
61
|
[data-slot="input"][data-size="lg"] { height: var(--control-lg); padding-inline: 0.6875rem; font-size: var(--text-lg); }
|
|
62
62
|
[data-slot="textarea"] { display: block; min-height: 5.5rem; padding: 0.625rem; resize: vertical; }
|
|
63
63
|
:is([data-slot="input"], [data-slot="textarea"])::placeholder { color: var(--color-muted); opacity: 1; }
|
|
64
64
|
/* A disabled field drops into the grey well (the same fill as rest in dark) and loses its shadow. */
|
|
65
|
-
:is([data-slot="input"], [data-slot="textarea"]):disabled { background-color: var(--color-well); box-shadow: none; opacity: 0.58; cursor: not-allowed; }
|
|
66
|
-
:is([data-slot="input"], [data-slot="textarea"])[aria-invalid="true"] { border-color: var(--color-error); }
|
|
65
|
+
:is([data-slot="input"], [data-slot="textarea"], [data-slot="select-trigger"]):disabled { background-color: var(--color-well); box-shadow: none; opacity: 0.58; cursor: not-allowed; }
|
|
66
|
+
:is([data-slot="input"], [data-slot="textarea"], [data-slot="select-trigger"])[aria-invalid="true"] { border-color: var(--color-error); }
|
|
67
67
|
/* Fields draw no ring: the edge turns the accent with a muted accent line inside it, and the fill stays. */
|
|
68
|
-
:is([data-slot="input"], [data-slot="textarea"]):focus-visible { outline: none; border-color: var(--color-accent); box-shadow: var(--shadow-field-focus); }
|
|
69
|
-
:is([data-slot="input"], [data-slot="textarea"])[aria-invalid="true"]:focus-visible { border-color: var(--color-error); box-shadow: var(--shadow-field-focus-invalid); }
|
|
68
|
+
:is([data-slot="input"], [data-slot="textarea"], [data-slot="select-trigger"]):focus-visible { outline: none; border-color: var(--color-accent); box-shadow: var(--shadow-field-focus); }
|
|
69
|
+
:is([data-slot="input"], [data-slot="textarea"], [data-slot="select-trigger"])[aria-invalid="true"]:focus-visible { border-color: var(--color-error); box-shadow: var(--shadow-field-focus-invalid); }
|
|
70
70
|
|
|
71
71
|
/* ---------- Checkbox and radio ---------- */
|
|
72
72
|
/* ui-sdk's checkbox and radio are buttons with role="checkbox" or "radio" inside a data-slot="label" label;
|
|
73
73
|
the indicator exists only while the control is checked. */
|
|
74
74
|
[data-slot="radio-group"] { display: flex; flex-wrap: wrap; gap: var(--space-4); }
|
|
75
|
-
[data-slot="label"]:has(> :is([data-slot="checkbox"], [data-slot="radio"])) { display: inline-flex; align-items: center; gap: 0.5625rem; min-height: var(--control-md); cursor: pointer; }
|
|
76
|
-
[data-slot="label"][data-size="sm"]:has(> :is([data-slot="checkbox"], [data-slot="radio"])) { min-height: var(--control-sm); font-size: var(--text-sm); }
|
|
77
|
-
[data-slot="label"][data-size="lg"]:has(> :is([data-slot="checkbox"], [data-slot="radio"])) { min-height: var(--control-lg); font-size: var(--text-lg); }
|
|
78
|
-
[data-slot="label"]:has(> [data-disabled]:is([data-slot="checkbox"], [data-slot="radio"])) { opacity: 0.58; cursor: not-allowed; }
|
|
75
|
+
[data-slot="label"]:has(> :is([data-slot="checkbox"], [data-slot="radio"], [data-slot="switch"])) { display: inline-flex; align-items: center; gap: 0.5625rem; min-height: var(--control-md); cursor: pointer; }
|
|
76
|
+
[data-slot="label"][data-size="sm"]:has(> :is([data-slot="checkbox"], [data-slot="radio"], [data-slot="switch"])) { min-height: var(--control-sm); font-size: var(--text-sm); }
|
|
77
|
+
[data-slot="label"][data-size="lg"]:has(> :is([data-slot="checkbox"], [data-slot="radio"], [data-slot="switch"])) { min-height: var(--control-lg); font-size: var(--text-lg); }
|
|
78
|
+
[data-slot="label"]:has(> [data-disabled]:is([data-slot="checkbox"], [data-slot="radio"], [data-slot="switch"])) { opacity: 0.58; cursor: not-allowed; }
|
|
79
79
|
:is([data-slot="checkbox"], [data-slot="radio"]) { display: grid; place-items: center; flex: none; width: 18px; height: 18px; margin: 0; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-inline); background: var(--color-surface-raised); color: var(--color-accent-text); cursor: inherit; }
|
|
80
80
|
[data-slot="label"][data-size="sm"] > :is([data-slot="checkbox"], [data-slot="radio"]) { width: 16px; height: 16px; }
|
|
81
81
|
[data-slot="label"][data-size="lg"] > :is([data-slot="checkbox"], [data-slot="radio"]) { width: 20px; height: 20px; }
|
|
@@ -90,22 +90,134 @@
|
|
|
90
90
|
/* The radio's thick accent border is its mark. */
|
|
91
91
|
[data-slot="radio-indicator"] { display: none; }
|
|
92
92
|
|
|
93
|
+
/* ---------- Radio card group ---------- */
|
|
94
|
+
/* A <label data-slot="card"> holds a <strong> title, an optional <span> description, and the radio, which
|
|
95
|
+
sits in the top right corner. Depth and a check badge show the choice, without an accent ring. */
|
|
96
|
+
[data-slot="radio-group"]:has(> [data-slot="card"]) { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); }
|
|
97
|
+
[data-slot="card"]:has(> [data-slot="radio"]) { --depth: var(--shadow-raise); position: relative; display: grid; gap: var(--space-1); min-width: 0; padding: var(--space-3); padding-right: var(--space-8); border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--color-surface-raised); box-shadow: var(--depth); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out); }
|
|
98
|
+
[data-slot="card"]:has(> [data-slot="radio"]) > span:not([data-slot]) { color: var(--color-muted); }
|
|
99
|
+
@media (hover: hover) {
|
|
100
|
+
[data-slot="card"]:has(> [data-slot="radio"]):hover:not(:has(> [data-slot="radio"]:is([data-checked], [data-disabled]))) { background: color-mix(in srgb, var(--color-surface-muted) 45%, var(--color-surface-raised)); }
|
|
101
|
+
}
|
|
102
|
+
[data-slot="card"]:has(> [data-slot="radio"][data-checked]) { --depth: var(--shadow-sink); background: var(--color-well); }
|
|
103
|
+
[data-slot="card"]:has(> [data-slot="radio"][data-disabled]) { opacity: 0.58; cursor: not-allowed; }
|
|
104
|
+
[data-slot="card"] > [data-slot="radio"] { position: absolute; top: var(--space-3); right: var(--space-3); width: 16px; height: 16px; }
|
|
105
|
+
[data-slot="card"] > [data-slot="radio"][data-checked] { border-width: 1px; background: var(--color-accent); }
|
|
106
|
+
[data-slot="card"] > [data-slot="radio"][data-checked]::after { content: ""; position: absolute; inset: 2px 4px 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
|
|
107
|
+
|
|
108
|
+
/* ---------- Switch and toggle button ---------- */
|
|
109
|
+
/* ui-sdk's switch button is the track and its thumb the knob. A data-slot="label" label wraps the switch
|
|
110
|
+
and its text, so the whole row is the hit area. A toggle button is a Toggle whose first child is an
|
|
111
|
+
empty ToggleIcon, drawn as the same track; a Toggle with an icon, or one in a ToggleGroup, is unsupported. */
|
|
112
|
+
[data-slot="label"]:has(> [data-slot="switch"]) { gap: var(--space-2); }
|
|
113
|
+
:is([data-slot="switch"], [data-slot="toggle"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty)) { --w: 2.75rem; --h: 1.375rem; --inset: 0.125rem; }
|
|
114
|
+
:is([data-slot="label"][data-size="sm"] > [data-slot="switch"], [data-slot="toggle"][data-size="sm"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty)) { --w: 2.2rem; --h: 1.1rem; --inset: 0.1rem; }
|
|
115
|
+
:is([data-slot="label"][data-size="lg"] > [data-slot="switch"], [data-slot="toggle"][data-size="lg"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty)) { --w: 3.3rem; --h: 1.65rem; --inset: 0.15rem; }
|
|
116
|
+
:is([data-slot="switch"], [data-slot="toggle"]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child) { --depth: var(--shadow-sink); position: relative; flex: none; width: var(--w); height: var(--h); margin: 0; padding: 0; border: 1px solid transparent; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--color-border) 90%, var(--color-well)); box-shadow: var(--depth); cursor: inherit; transition: background-color var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out); }
|
|
117
|
+
[data-slot="switch-thumb"], [data-slot="toggle"]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child::after { content: ""; position: absolute; top: calc(var(--inset) - 1px); left: calc(var(--inset) - 1px); width: calc(var(--h) - 2 * var(--inset)); height: calc(var(--h) - 2 * var(--inset)); border-radius: var(--radius-pill); background: var(--color-surface-raised); box-shadow: var(--shadow-raise); transition: transform var(--duration) var(--ease-out), background-color var(--duration) var(--ease-out); }
|
|
118
|
+
:is([data-slot="switch"][data-checked], [data-slot="toggle"][data-pressed]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child) { border-color: var(--color-accent); background: var(--color-accent); }
|
|
119
|
+
[data-slot="switch-thumb"][data-checked], [data-slot="toggle"][data-pressed]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child::after { background: var(--color-accent-text); transform: translateX(calc(var(--w) - var(--h))); }
|
|
120
|
+
|
|
121
|
+
/* The toggle button is a labelled card: a visible edge and no raise, a named exception in decisions.md. */
|
|
122
|
+
[data-slot="toggle"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty) { display: flex; align-items: center; gap: var(--space-3); min-height: var(--control-md); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-field); background: var(--color-surface-raised); color: var(--color-text); font: var(--text-md) / var(--leading-tight) var(--font-ui); text-align: left; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out); }
|
|
123
|
+
[data-slot="toggle"][data-size="sm"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty) { min-height: var(--control-sm); font-size: var(--text-sm); }
|
|
124
|
+
[data-slot="toggle"][data-size="lg"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty) { min-height: var(--control-lg); font-size: var(--text-lg); }
|
|
125
|
+
@media (hover: hover) {
|
|
126
|
+
[data-slot="toggle"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty):hover:not([data-disabled], [data-pressed]) { border-color: var(--color-border); }
|
|
127
|
+
}
|
|
128
|
+
/* The track carries the on state; the card takes a faint 8% accent tint and an accent hairline. */
|
|
129
|
+
[data-slot="toggle"][data-pressed]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty) { border-color: color-mix(in srgb, var(--color-accent) 35%, transparent); background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface-raised)); }
|
|
130
|
+
[data-slot="toggle"][data-disabled]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty) { opacity: 0.58; cursor: not-allowed; }
|
|
131
|
+
[data-slot="toggle"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty) > span:not([data-slot]) { display: grid; }
|
|
132
|
+
[data-slot="toggle"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty) small { color: var(--color-muted); font-size: var(--text-xs); }
|
|
133
|
+
|
|
134
|
+
/* ---------- Select ---------- */
|
|
135
|
+
/* The trigger takes the field recipe with a thin chevron; the list is a floating layer. ui-sdk positions it.
|
|
136
|
+
The list rules draw only data-presentation="popover"; a sheet is unsupported. */
|
|
137
|
+
[data-slot="select-trigger"] { position: relative; display: flex; align-items: center; height: var(--control-md); padding: 0 1.75rem 0 0.625rem; text-align: start; cursor: pointer; }
|
|
138
|
+
[data-slot="select-trigger"][data-size="sm"] { height: var(--control-sm); padding-left: 0.5625rem; font-size: var(--text-sm); }
|
|
139
|
+
[data-slot="select-trigger"][data-size="lg"] { height: var(--control-lg); padding-left: 0.6875rem; font-size: var(--text-lg); }
|
|
140
|
+
[data-slot="select-trigger"]::after { content: ""; position: absolute; right: var(--space-3); width: var(--space-2); height: var(--space-2); border-right: 1.5px solid var(--color-muted); border-bottom: 1.5px solid var(--color-muted); transform: translateY(-2px) rotate(45deg); }
|
|
141
|
+
[data-slot="select-value"] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
142
|
+
[data-slot="select-value"][data-placeholder] { color: var(--color-muted); }
|
|
143
|
+
[data-slot="select-content"][data-presentation="popover"] { box-sizing: border-box; min-width: var(--anchor-width); max-height: min(20rem, 50dvh, var(--available-height, 50dvh)); overflow: auto; padding: var(--space-1); border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--color-surface-raised); color: var(--color-text); box-shadow: var(--shadow-dialog); font: var(--text-md) / var(--leading) var(--font-ui); }
|
|
144
|
+
/* ui-sdk sets the list's margin inline, so a translate leaves the catalogue's gap to the trigger. */
|
|
145
|
+
[data-slot="select-content"][data-presentation="popover"][data-side="bottom"] { translate: 0 var(--space-1); }
|
|
146
|
+
[data-slot="select-content"][data-presentation="popover"][data-side="top"] { translate: 0 calc(var(--space-1) * -1); }
|
|
147
|
+
[data-slot="select-item"] { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-sm); padding: var(--space-2) var(--space-3); border-radius: calc(var(--radius-panel) - var(--space-1)); cursor: pointer; }
|
|
148
|
+
/* The check carries the state, because the selected fill equals the list's. It sits on the item, so a list
|
|
149
|
+
without SelectItemIndicator still shows it. */
|
|
150
|
+
[data-slot="select-item"][data-selected] { background: var(--color-row-selected); }
|
|
151
|
+
[data-slot="select-item"][data-selected]::after { content: "✓"; margin-left: auto; color: var(--color-accent); }
|
|
152
|
+
[data-slot="select-item-indicator"] { display: none; }
|
|
153
|
+
@media (hover: hover) {
|
|
154
|
+
[data-slot="select-item"][data-highlighted]:not([data-disabled]) { background: var(--color-row-hover); }
|
|
155
|
+
}
|
|
156
|
+
/* Keyboard focus is the ring, inset because the list scrolls. ui-sdk focuses the highlighted option, and its
|
|
157
|
+
data-modality can still say pointer after an arrow key, so the browser's :focus-visible decides. */
|
|
158
|
+
[data-slot="select-item"]:focus-visible { background: var(--color-row-hover); outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
|
|
159
|
+
[data-slot="select-item"][data-disabled] { opacity: 0.58; cursor: not-allowed; }
|
|
160
|
+
@media (pointer: coarse) { [data-slot="select-item"] { min-height: var(--control-lg); } }
|
|
161
|
+
|
|
162
|
+
/* ---------- Dialog ---------- */
|
|
163
|
+
/* A centred panel on the overlay. ui-sdk's behaviour CSS resets the popover's position, so these set it.
|
|
164
|
+
They draw only data-presentation="dialog"; a sheet is unsupported and keeps ui-sdk's own placement.
|
|
165
|
+
The content holds a <header> (the title and description, then the close button), a body that scrolls,
|
|
166
|
+
and an optional <footer> with the actions at the end. Without a <header>, the content itself pads and scrolls. */
|
|
167
|
+
[data-slot="dialog-backdrop"] { position: fixed; inset: 0; background: var(--color-overlay); }
|
|
168
|
+
[data-slot="dialog-content"][data-presentation="dialog"] { position: fixed; inset: 0; display: flex; flex-direction: column; width: min(512px, calc(100% - var(--space-8))); height: fit-content; max-height: min(672px, calc(100dvh - var(--space-8))); margin: auto; overflow: hidden; padding: 0; border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--color-surface-raised); color: var(--color-text); box-shadow: var(--shadow-dialog); }
|
|
169
|
+
[data-slot="dialog-content"][data-presentation="dialog"]:not(:has(> header)) { overflow: auto; padding: var(--space-4); }
|
|
170
|
+
[data-slot="dialog-content"][data-presentation="dialog"] > :is(header, footer) { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-4); }
|
|
171
|
+
[data-slot="dialog-content"][data-presentation="dialog"] > header { border-bottom: 1px solid var(--color-border-subtle); }
|
|
172
|
+
[data-slot="dialog-content"][data-presentation="dialog"]:has(> header) > :not(header, footer) { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--space-4); }
|
|
173
|
+
[data-slot="dialog-content"][data-presentation="dialog"] > footer { justify-content: flex-end; gap: var(--space-2); border-top: 1px solid var(--color-border-subtle); background: var(--color-surface); }
|
|
174
|
+
[data-slot="dialog-title"] { margin: 0; font-size: 1.125rem; font-weight: var(--weight-semibold); letter-spacing: -0.02em; }
|
|
175
|
+
[data-slot="dialog-description"] { margin: var(--space-1) 0 0; color: var(--color-muted); }
|
|
176
|
+
/* The header's close button is a quiet action. A Close rendered as a Button is drawn as that button. */
|
|
177
|
+
[data-slot="dialog-content"] > header > [data-slot="dialog-close"] { display: inline-flex; flex: none; align-items: center; justify-content: center; width: var(--control-lg); min-height: var(--control-lg); padding: 0; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--color-muted); font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
178
|
+
@media (hover: hover) {
|
|
179
|
+
[data-slot="dialog-content"] > header > [data-slot="dialog-close"]:hover { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); }
|
|
180
|
+
}
|
|
181
|
+
[data-slot="dialog-content"] > header > [data-slot="dialog-close"]:active { background: color-mix(in srgb, currentColor 12%, transparent); }
|
|
182
|
+
/* Phones: the dialog becomes a bottom sheet with rounded top corners. */
|
|
183
|
+
@media (max-width: 640px) {
|
|
184
|
+
[data-slot="dialog-content"][data-presentation="dialog"] { width: 100%; margin: auto 0 0; border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
|
|
185
|
+
}
|
|
186
|
+
|
|
93
187
|
/* ---------- Focus ---------- */
|
|
94
188
|
/* One ring for every role, over the control's own raise or sink; the base draws the same ring, and this pins it. */
|
|
95
|
-
|
|
189
|
+
/* It goes on the visible part of a composite control: the switch track and the radio card. */
|
|
190
|
+
/* A comma list rather than one :is(), so each selector keeps its own specificity and the forced-colours
|
|
191
|
+
outline-color rules below still win. */
|
|
192
|
+
:is([data-slot="button"], [data-slot="checkbox"], [data-slot="radio"], [data-slot="switch"]):focus-visible,
|
|
193
|
+
[data-slot="toggle"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty):focus-visible,
|
|
194
|
+
[data-slot="dialog-content"] > header > [data-slot="dialog-close"]:focus-visible,
|
|
195
|
+
[data-slot="dialog-content"][data-presentation="dialog"]:focus-visible,
|
|
196
|
+
[data-slot="card"]:has(> [data-slot="radio"]:focus-visible) { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
|
|
197
|
+
/* The card draws the ring, so the radio inside it does not. */
|
|
198
|
+
[data-slot="card"] > [data-slot="radio"]:focus-visible { outline: none; }
|
|
96
199
|
|
|
97
200
|
/* Touch: at tablet width and below, unsized controls grow to --control-lg, as the catalogue's do. */
|
|
98
201
|
@media (max-width: 800px) {
|
|
99
202
|
[data-slot="button"]:not([data-size]) { min-height: var(--control-lg); }
|
|
100
203
|
[data-slot="input"]:not([data-size]) { height: var(--control-lg); }
|
|
101
|
-
[data-slot="label"]:not([data-size]):has(> :is([data-slot="checkbox"], [data-slot="radio"])) { min-height: var(--control-lg); }
|
|
204
|
+
[data-slot="label"]:not([data-size]):has(> :is([data-slot="checkbox"], [data-slot="radio"], [data-slot="switch"])) { min-height: var(--control-lg); }
|
|
205
|
+
[data-slot="toggle"]:not([data-size], [data-orientation]):has(> [data-slot="toggle-icon"]:empty) { min-height: var(--control-lg); }
|
|
206
|
+
[data-slot="select-trigger"]:not([data-size]) { height: var(--control-lg); }
|
|
102
207
|
}
|
|
103
208
|
|
|
104
209
|
@media (forced-colors: active) {
|
|
105
210
|
/* The inset accent line drops, so a focused field draws the system ring just inside its edge. */
|
|
106
|
-
:is([data-slot="input"], [data-slot="textarea"]):focus-visible { outline: var(--focus-width) solid Highlight; outline-offset: -1px; }
|
|
211
|
+
:is([data-slot="input"], [data-slot="textarea"], [data-slot="select-trigger"]):focus-visible { outline: var(--focus-width) solid Highlight; outline-offset: -1px; }
|
|
107
212
|
[data-slot="checkbox"][data-checked] { forced-color-adjust: none; border-color: Highlight; background: Highlight; color: HighlightText; }
|
|
108
213
|
[data-slot="radio"][data-checked] { forced-color-adjust: none; border-color: Highlight; background: HighlightText; }
|
|
109
214
|
:is([data-slot="checkbox"], [data-slot="radio"]):focus-visible { outline-color: CanvasText; }
|
|
215
|
+
[data-slot="card"] > [data-slot="radio"][data-checked] { background: Highlight; color: HighlightText; }
|
|
216
|
+
/* The tracks opt out of adjustment, so the switch's ring takes the system text colour too. */
|
|
217
|
+
:is([data-slot="switch"], [data-slot="toggle"]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child) { forced-color-adjust: none; border-color: ButtonText; background: Canvas; }
|
|
218
|
+
[data-slot="switch-thumb"], [data-slot="toggle"]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child::after { forced-color-adjust: none; background: ButtonText; }
|
|
219
|
+
:is([data-slot="switch"][data-checked], [data-slot="toggle"][data-pressed]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child) { border-color: Highlight; background: Highlight; }
|
|
220
|
+
[data-slot="switch-thumb"][data-checked], [data-slot="toggle"][data-pressed]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child::after { background: HighlightText; }
|
|
221
|
+
[data-slot="switch"]:focus-visible { outline-color: CanvasText; }
|
|
110
222
|
}
|
|
111
223
|
}
|