@momoi-labs/kiso 0.9.0 → 0.11.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.
@@ -0,0 +1,102 @@
1
+ # Form
2
+
3
+ ## Purpose
4
+
5
+ Form composes fields and their submission actions in a native HTML form.
6
+ Every form with explicit submission includes [FormActions](form-actions.md).
7
+ The action can sign in, create, save, search, or apply a choice.
8
+
9
+ Immediate preferences and automatic filters do not need a submit action.
10
+ Use the existing Switch and search patterns for those interactions.
11
+
12
+ ## Anatomy
13
+
14
+ 1. A native `form`, optionally named by a heading with `aria-labelledby`.
15
+ 2. A content region containing FormFields, sections, or fieldsets.
16
+ 3. FormActions after the content, with one primary submit Button and any
17
+ secondary actions the task needs.
18
+
19
+ ```tsx
20
+ <Form onSubmit={handleSubmit} aria-labelledby="project-title">
21
+ <div className="form-body">
22
+ <h2 id="project-title">Create project</h2>
23
+ <FormField label="Project name" name="name" required />
24
+ </div>
25
+ <FormActions>
26
+ <Button type="submit" variant="primary">Create project</Button>
27
+ </FormActions>
28
+ </Form>
29
+ ```
30
+
31
+ The `form-body` CSS class provides content padding and field spacing. It can
32
+ be applied to a div or fieldset. Products can instead compose content from
33
+ Cards and existing layout utilities. Form adds no padding around its actions.
34
+ Do not wrap FormActions in a padded content region or another footer.
35
+
36
+ ## React API
37
+
38
+ Form accepts native form props, including `action`, `method`, `onSubmit`,
39
+ `id`, `ref`, and ARIA attributes. It forwards them to the form element and
40
+ merges `className` with `form`.
41
+
42
+ Form does not create buttons, enforce its children at runtime, intercept
43
+ submission, select a validation library, or track values and dirty state.
44
+ The application owns those behaviors. Explicit-submit forms must follow the
45
+ composition contract even though the React component accepts arbitrary content.
46
+
47
+ ## Layouts
48
+
49
+ - Short forms keep FormActions in normal flow.
50
+ - Long forms use sticky FormActions on a page or inside a scrolling panel.
51
+ - A form in a bounded panel fills at least the panel height, so actions also
52
+ reach the panel bottom when content is short.
53
+ - A form can contain multiple Cards. A Card is not required for Form.
54
+ - In Dialog, compose DialogHeader and a Form containing its fields and
55
+ FormActions. Use `form-scroll` on the form when the dialog constrains its
56
+ height. Keep the dialog's existing focus and dismissal behavior.
57
+
58
+ See [FormActions](form-actions.md) for scroll ownership, padded containers,
59
+ responsive actions, and status announcements.
60
+
61
+ ## States and ownership
62
+
63
+ | State | Application behavior |
64
+ | --- | --- |
65
+ | Initial | Provide fields and an explicit submit action; a status message is optional. |
66
+ | Dirty | Compare current values with the last saved values. Show feedback and Discard when useful. |
67
+ | Invalid | Preserve entries, show field errors, and focus the first invalid field. |
68
+ | Submitting | Show loading on the submit Button and prevent duplicate requests. |
69
+ | Failed | Keep entries and show a recoverable message. Use field errors for field failures. |
70
+ | Saved | Update the saved baseline and clear dirty state. Confirm inline or navigate as appropriate. |
71
+
72
+ Discard restores the saved baseline. Native reset restores initial defaults,
73
+ which may differ after a successful save. Cancel leaves the task; it does not
74
+ necessarily mean Discard. The application handles navigation and any warning
75
+ needed before losing material edits.
76
+
77
+ ## Accessibility
78
+
79
+ Preserve native submit and validation behavior. Use `type="submit"` on the
80
+ primary Button and `type="button"` on other buttons. Never nest forms.
81
+ Group related controls with fieldset and legend when they share a question.
82
+ FormField continues to own label, help, and field-error associations.
83
+
84
+ DOM order is content followed by actions. Sticky placement must not obscure
85
+ focused controls or their errors; verify keyboard use and zoom in the actual
86
+ scroll container. Do not announce the whole form as a live region.
87
+
88
+ ## Tokens
89
+
90
+ `form-body` uses `--spacing-lg` padding and `--spacing-xl` gaps. Form delegates
91
+ surfaces and borders to its container, and action styling to FormActions.
92
+
93
+ ## Related contracts
94
+
95
+ - [FormField](form-field.md) for one labeled control.
96
+ - [FormActions](form-actions.md) for submission controls and feedback.
97
+ - [CRUD](../patterns/crud.md) and [Settings](../patterns/settings.md) for flows.
98
+
99
+ ## Radix/shadcn mapping
100
+
101
+ Form uses native HTML semantics. It introduces no Radix primitive or form-state
102
+ library dependency.
@@ -0,0 +1,37 @@
1
+ # Meter and Progress
2
+
3
+ ## Purpose
4
+
5
+ Meter shows a measurement against a known limit, such as 64 connections out
6
+ of 100. Progress shows completion of work. A task's completion is not a meter.
7
+
8
+ ## Anatomy and states
9
+
10
+ Both have a visible label, a value above a thin horizontal track. Meter takes
11
+ `value`, `min` (default 0), and `max` (default 100). Progress takes an optional
12
+ `value` and positive `max` (default 100). `valueText` supplies units or context.
13
+
14
+ Bounds must be finite and ordered. Clip the filled width and ARIA value to the
15
+ bounds, while retaining the original measurement in the visible value and
16
+ accessible value text. Do not hide an over-limit measurement by changing it
17
+ to the maximum. Compose a labelled Badge if that measurement is a warning.
18
+
19
+ A null or nonfinite Meter value reads "Not collected" with an unfilled hatch
20
+ track. It has no fabricated numeric ARIA state. An omitted, null, or nonfinite
21
+ Progress value means indeterminate work, reads "In progress", and has a static
22
+ hatch track. Zero is a known empty track; the maximum is a full track.
23
+
24
+ ## Accessibility
25
+
26
+ Known measurements use `role="meter"` with name, minimum, maximum, current
27
+ value, and value text. Progress uses `role="progressbar"`; omit its current
28
+ value while indeterminate. Neither adds a tab stop or announces every update.
29
+ Keep the label and value visible for touch and assistive technology.
30
+ No information depends on animation or color.
31
+
32
+ ## Tokens and implementation
33
+
34
+ The 6px track combines `--spacing-xs` and `--spacing-2xs`, with `--radius-xs`, and `--color-secondary`.
35
+ Meter fill uses `--color-secondary-foreground`; Progress uses `--color-chart-1`. Labels use `--type-size-label` and
36
+ `--color-foreground`. Unknown tracks use the existing hatch tokens. This
37
+ contract adds `.meter-track`; legacy `.progress` rules remain compatible.
@@ -44,12 +44,14 @@ line.
44
44
 
45
45
  | State | Behavior |
46
46
  | --- | --- |
47
- | fewer than two samples | Renders nothing. A flat rule across a cell reads as a border, not as a measurement. Keep the cell's number; reserve height with the surrounding layout. |
47
+ | fewer than two finite measurements | Renders nothing. A flat rule across a cell reads as a border, not as a measurement. Keep the cell's number; reserve height with the surrounding layout. |
48
48
  | loading | [Skeleton](skeleton.md) at the same height the Sparkline will occupy. |
49
49
  | error | Show the last known number as text; the shape is optional, the value is not. |
50
50
 
51
- The component takes plain values and does not model gaps. A series with holes
52
- is the caller's data problem; interpolate or truncate before passing it in.
51
+ The component accepts numbers and null gaps on an evenly spaced window.
52
+ Null and nonfinite values break the line and fill; they never become zero.
53
+ Keep every expected sample position. Domains use finite measurements only.
54
+ Do not interpolate or remove missing positions before passing them in.
53
55
 
54
56
  ## Accessibility
55
57
 
@@ -78,7 +80,7 @@ No keymap and no tab stop. A Sparkline is never an action.
78
80
  ## When NOT to use
79
81
 
80
82
  - Analysis that needs an axis, a legend, or crosshair reading. A framed,
81
- interactive chart is a separate, still-deferred contract.
83
+ interactive [Chart](chart.md) has its own contract.
82
84
  - Multi-series overlays. Stack several Sparklines only as separate rows with
83
85
  their own labels, never as one drawing with a homemade legend.
84
86
  - A single value with no history. Use [Stat](stat.md) alone.
@@ -89,5 +91,4 @@ No Radix primitive exists for this. The component composes Recharts
89
91
  `ResponsiveContainer`, `AreaChart`, and `Area` with animation, dots, and
90
92
  axes off. Color reaches the path through `currentColor` from the
91
93
  `.sparkline` rules in `ui.css`; never pass a hex value or invent a
92
- categorical palette. The framed `.chart` rules in `ui.css` stay reserved for
93
- the later interactive chart contract.
94
+ categorical palette. Use [Chart](chart.md) for categorical multi-series data.
@@ -0,0 +1,57 @@
1
+ # StepBar
2
+
3
+ ## Purpose
4
+
5
+ StepBar summarises a run in one row: one segment per step, coloured by the
6
+ step's state. It answers "how far" and "where it stopped" at a glance, in the
7
+ places a [StepList](step-list.md) does not fit: a summary tab, a table cell,
8
+ a Toast. [Progress](meter.md) shows a continuous ratio; StepBar shows discrete
9
+ steps, so a failure is visible as a red segment in its place.
10
+
11
+ ## Anatomy
12
+
13
+ ```
14
+ StepBar (role="img", named)
15
+ └── segment (repeated, one per step)
16
+ ```
17
+
18
+ The bar is the whole component. The product places the count ("4 of 11"),
19
+ the current step's label, or the last output line beside it in its own
20
+ markup; StepBar does not render text.
21
+
22
+ ## States
23
+
24
+ Segments take the same five states as StepList: pending in
25
+ `--color-secondary`, running and done in `--color-success`, skipped hatched in
26
+ `--color-success`, failed in `--color-danger`. A running segment may show a
27
+ partial fill from `progress` (0 to 1); without it, running fills fully.
28
+
29
+ ## Sizes
30
+
31
+ One height, `--spacing-xs`. Width comes from the container. In a table cell,
32
+ give the cell a fixed width and keep the bar to one line beside the Badge;
33
+ do not add the ticker there. Hide the bar when the machine is not running and
34
+ has not failed; the Badge alone says "Stopped".
35
+
36
+ ## Accessibility
37
+
38
+ `role="img"` with a name that says the count and the current step, such as
39
+ "Create: step 4 of 11, running System packages" or
40
+ "Create: failed at step 4 of 11, System packages". The segments are
41
+ decorative. Nothing depends on colour alone.
42
+
43
+ ## Tokens and implementation
44
+
45
+ Segments use `--radius-xs` and a `--spacing-2xs` gap. The hatch for a skipped
46
+ segment reuses the existing hatch tokens. No Radix primitive.
47
+
48
+ ## When to use
49
+
50
+ - A machine's summary tab or card while an action runs or after it fails.
51
+ - A machines table, one line per row, next to the status Badge.
52
+ - A progress Toast for a run started from another screen.
53
+
54
+ ## When NOT to use
55
+
56
+ - The run's own page. Use StepList there; the bar would repeat it.
57
+ - A continuous measurement. Use Meter or Progress.
@@ -0,0 +1,86 @@
1
+ # StepList
2
+
3
+ ## Purpose
4
+
5
+ StepList shows the steps of a run a machine walks through, one row per step,
6
+ with a state, a label, and a timing. While the run goes it is the progress;
7
+ afterwards it is the account of what happened. The reader does not walk the
8
+ steps; the machine does, and the reader reads how it went.
9
+
10
+ It is not the [Pagination](pagination.md) step indicator. That one shows a
11
+ person's position in a flow they drive. StepList has a state per step, a
12
+ timing, and an output the reader may open.
13
+
14
+ ## Anatomy
15
+
16
+ ```
17
+ StepList (ordered list, labelled)
18
+ └── Step (repeated)
19
+ ├── rail: connector and mark, with a text alternative
20
+ ├── label
21
+ ├── meta (mono, muted)
22
+ └── detail (optional slot, below the row)
23
+ ```
24
+
25
+ The rail is one vertical line through every mark. Each mark is a dot; the
26
+ connector above it takes the colour of the step's state, so the line fills as
27
+ the run advances and the list is itself the progress. Nothing else measures
28
+ completion: do not add a Progress track above a StepList.
29
+
30
+ Each row is a button when the list has `onSelect`; the product then shows the
31
+ selected step's output beside the list, usually in the second [Pane](split.md)
32
+ of a Split with a [LogView](log-view.md) filling it. On a narrow viewport,
33
+ where the Split cannot fit, pass the output as the selected step's `detail`
34
+ and it renders under the row.
35
+
36
+ ## States
37
+
38
+ | State | Mark | Default meta |
39
+ | --- | --- | --- |
40
+ | pending | empty dot, muted row | none; the product passes "Not run" after a failure |
41
+ | running | dot ringed in `--color-success`, pulsing, bold label | "Running" |
42
+ | done | filled `--color-success` dot | none; the product passes the duration |
43
+ | skipped | hollow `--color-success` dot, muted label | "Not needed" |
44
+ | failed | filled `--color-danger` dot, bold label in `--color-danger` | none; the product passes the duration |
45
+
46
+ The running step is `aria-current="step"`. Five states, not a status badge's
47
+ tones: running is alive, so it is the success colour; neutral is what is not
48
+ happening; danger is what stopped the run.
49
+
50
+ The product owns which step is selected. Follow the running step by default,
51
+ keep a step the reader chose, and offer a way back to the current one.
52
+
53
+ ## Accessibility
54
+
55
+ An `ol` with an accessible name, one `li` per step. Each mark carries its
56
+ state as text (`role="img"` with the state as its name), so colour is never
57
+ the only signal. Rows that select are native buttons with `aria-pressed`;
58
+ rows that do not are plain text. The connector is decorative and hidden.
59
+ Under reduced motion the running mark does not pulse.
60
+
61
+ ### Keyboard
62
+
63
+ No custom keymap. Tab reaches each selectable row; Enter or Space selects it.
64
+
65
+ ## Tokens and implementation
66
+
67
+ Rail and marks use `--color-border-strong`, `--color-success`,
68
+ `--color-success-surface`, and `--color-danger`. Labels use
69
+ `--type-size-label`; the running and failed labels use
70
+ `--type-weight-semibold`. Meta uses `--font-mono`, `--type-size-label`, and
71
+ `--color-muted-foreground`. Rows are spaced with `--spacing-sm`; the rail
72
+ column is `--spacing-xl` wide, room for the running mark's glow. Focus uses `--color-focus`. No Radix
73
+ primitive is involved.
74
+
75
+ ## When to use
76
+
77
+ - A lifecycle action on a machine: create, update, or a bootstrap with a
78
+ known list of stages.
79
+ - An image build or a collection whose phases are known before it starts.
80
+
81
+ ## When NOT to use
82
+
83
+ - A flow the person walks through. Use Pagination's step indicator.
84
+ - A plan that is not known before it runs. Append rows as they happen, and
85
+ pair the list with an indeterminate Progress rather than a [StepBar](step-bar.md).
86
+ - A single indeterminate wait. Use Spinner.
@@ -104,11 +104,13 @@ server round-trip to repaint, and do not show a Toast for it.
104
104
  which is the default and the most common choice.
105
105
  - A theme entry buried inside a DropdownMenu as the only access point. A menu
106
106
  may mirror the control, but the setting lives in a settings row.
107
- - Any control that offers colour options beyond these three. Kiso has two
108
- themes.
107
+ - Any control that offers colour scheme options beyond these three. Kiso has
108
+ two themes. The accent is a separate axis with its own control,
109
+ [AccentSelector](accent-selector.md).
109
110
 
110
111
  ## Related
111
112
 
112
113
  - [tokens](../tokens.md) — how `light-dark()` and `color-scheme` resolve.
113
114
  - [Settings](../patterns/settings.md#theme) — where the row lives.
115
+ - [AccentSelector](accent-selector.md) — the other appearance row.
114
116
  - [Switch](switch.md) — for actual booleans.
@@ -0,0 +1,48 @@
1
+ # TimeRangeControl
2
+
3
+ ## Purpose and anatomy
4
+
5
+ Select the visible interval within a collected run. A labelled Button opens a
6
+ compact Popover with a vertical preset list. Custom range reveals exact
7
+ start/end fields. This control scopes an
8
+ artifact's timestamps, not a live polling schedule or date-only calendar.
9
+
10
+ ## Data and behavior
11
+
12
+ `bounds` and controlled `value` are `{ from, to }` epoch-millisecond pairs.
13
+ Both must be finite, valid dates with start before end; value must fit inside
14
+ bounds. `onValueChange` receives an applied range. The consumer filters panels
15
+ and recalculates their summaries from that interval.
16
+
17
+ Presets default to the last 5, 15, and 30 minutes relative to the end of the
18
+ run. Durations are positive milliseconds; clip their start to the run start.
19
+ "Entire run" restores bounds. Selecting a preset applies it and closes the
20
+ popover. Custom fields are explicitly UTC, including milliseconds; local
21
+ machine timezone and daylight-saving changes cannot shift the selection.
22
+
23
+ Editing a field does not apply it. Apply validates that the start precedes
24
+ the end and both fit inside the collection window. Invalid input keeps the
25
+ popover open with field-associated feedback. Escape or outside dismissal
26
+ cancels edits. Reopening starts with the applied value. `disabled` disables
27
+ the trigger while a run is unavailable.
28
+
29
+ ## Accessibility
30
+
31
+ Compose [Button](button.md), [Popover](popover.md), and labelled
32
+ [Input](input.md) controls. Tab follows the visible preset buttons or custom form fields and Apply. Native
33
+ date/time inputs retain platform keyboard behavior. Escape dismisses; Radix
34
+ restores focus to the trigger. Errors use an alert and field descriptions.
35
+ The trigger shows a short interval and UTC. Its accessible name includes
36
+ both full timestamps; visible dates appear when the interval crosses a day. Touch can use every action.
37
+
38
+ ## Tokens and implementation
39
+
40
+ Use existing Button, Input, and Popover tokens. Use `--spacing-xs` between
41
+ presets and `--spacing-md` between regions. The trigger wraps long ranges;
42
+ the popover fits the viewport. No new calendar, timezone, or date dependency.
43
+
44
+ ## Custom range form
45
+
46
+ The custom range editor composes [Form](form.md) with
47
+ [FormActions](form-actions.md). Apply range is the explicit submit action;
48
+ validation stays next to the range fields. Presets still apply immediately.
@@ -10,22 +10,28 @@ the system needs them. This is the honest roadmap for those choices.
10
10
  | --- | --- | --- |
11
11
  | **Component implementation code** | V1 ships Markdown contracts and tokens, not React components. Keeping the specification separate lets product needs shape an implementation instead of freezing an assumed API. This boundary was set in [epic #3](https://github.com/momoi-labs/blueprint/issues/3). | When repeated product implementations make a stable reference API evident. Build it as Kiso v2 or in a separate `kiso-ui` repository, using shadcn/Radix behavior adapted to Kiso rather than copied unchanged. |
12
12
  | **Radio / RadioGroup** | Select and Switch cover the v1 choice cases, so [epic #3](https://github.com/momoi-labs/blueprint/issues/3) did not add another selection primitive without a product need. | When a product genuinely needs mutually exclusive selection from a small, fixed set whose options should remain visible. |
13
- | **Interactive framed charts** | [#84](https://github.com/momoi-labs/blueprint/issues/84) shipped [Sparkline](components/sparkline.md) for the single-series metric shapes products actually had. No product has yet needed an axis, a legend, or crosshair reading. | When a product needs exploratory reading of a series: axes, multi-series overlays, or hover inspection. Settle the framed `.chart` contract then. |
14
13
  | **Figma Tokens Studio integration** | [Epic #2](https://github.com/momoi-labs/blueprint/issues/2) kept the token pipeline focused on its committed outputs. Tokens Studio is a Figma plugin workflow built through Style Dictionary and `@tokens-studio/sd-transforms`, not a standalone emitter. | When design-to-code synchronization through Figma becomes a real team workflow rather than a hypothetical integration. |
15
14
  | **DTCG 2025.10 Resolver module** | The multiple-context and theme Resolver considered in [epic #2](https://github.com/momoi-labs/blueprint/issues/2) is a preview draft marked “do not implement.” V1 uses an explicit, stable theme model instead. | When the Resolver module reaches stable status and Kiso has a concrete context or theme problem it would solve. |
16
15
  | **`--shadow-lg`** | The elevation scale intentionally stops at `--shadow-sm` and `--shadow-md`; [#25](https://github.com/momoi-labs/blueprint/issues/25) fixed component references without inventing a larger elevation. | When a real overlay or hierarchy cannot be expressed clearly with `--shadow-md`. Propose the token in the source, then regenerate its outputs. |
17
- | **A dedicated multi-step-flow pattern** | [#26](https://github.com/momoi-labs/blueprint/issues/26) added step indication as a Pagination variant, which satisfies the current bounded-flow need without another pattern. | When recurring multi-step flows need behavior, composition, or guidance beyond Pagination's scope. |
16
+ | **A dedicated multi-step-flow pattern** | [#26](https://github.com/momoi-labs/blueprint/issues/26) added step indication as a Pagination variant, which satisfies the current bounded-flow need without another pattern. [#98](https://github.com/momoi-labs/blueprint/issues/98) added StepList for the other case, a run a machine walks and a person reads; person-driven flows still use Pagination. | When recurring person-driven flows need behavior, composition, or guidance beyond Pagination's scope. |
18
17
  | **Additional patterns** | The pattern set from [epic #4](https://github.com/momoi-labs/blueprint/issues/4) is an intentionally lean cut of roughly 21 recurring product structures. Speculative completeness would encode guesses. | When a real product exposes a repeated structure that the current patterns cannot express without an ad-hoc solution. |
19
18
  | **Additional components** | The roughly 28-component cut from [epic #3](https://github.com/momoi-labs/blueprint/issues/3) covers the intended v1 product surface. Adding primitives in anticipation would enlarge the interface before their contracts are understood. | When a need recurs across products. Propose a component and its contract; do not invent one locally or copy one in unchanged. |
20
19
  | **Heavy governance** | A two-person lab does not need a contribution bureaucracy or design-review board. For v1, the propose-don't-copy rule in [`kiso/AGENTS.md`](../AGENTS.md) is the governance mechanism, as scoped by [epic #5](https://github.com/momoi-labs/blueprint/issues/5). | When more contributors, products, or incompatible proposals make ownership and decision-making unclear. Add only the process needed to resolve an observed coordination problem. |
21
20
 
22
21
  ## Accepted additions
23
22
 
23
+ [Issue #93](https://github.com/momoi-labs/blueprint/issues/93) opens the framed
24
+ chart deferral with pg-probe collection data. Chart, ChartLegend, Meter,
25
+ Progress, BarGauge, Disclosure, TimeRangeControl, DashboardGrid, and Sparkline
26
+ gaps now cover that workflow. Five categorical slots cover the demonstrated
27
+ maximum. More slots require a product case and palette review.
28
+
24
29
  The growth model below is not theory. What it has produced so far:
25
30
 
26
31
  | What | Evidence | Where |
27
32
  | --- | --- | --- |
28
33
  | **[ChipInput](components/chip-input.md)** | A self-hosted console had to collect a development image's dependencies: a list a person types, where every entry carries a backend, a version, and installer options. One form section per entry grew without limit and buried the list. | Added as a component contract with the segmented chip, the in-place value, and one segment per option. |
34
+ | **[StepList](components/step-list.md) and [StepBar](components/step-bar.md)** | The self-host console's Last run tab walks a machine through eleven lifecycle steps over several minutes and wrote its own list of steps with a state each, replacing a progress bar and a two-thousand-line log to search. An image build and the Host's own bootstrap were about to copy it. [#98](https://github.com/momoi-labs/blueprint/issues/98) records the evidence. | Added as two contracts: the list inside a Split with the step's LogView beside it, and the bar for a summary, a table cell, or a toast. |
29
35
  | **[Sparkline](components/sparkline.md)** | The self-host console collects metrics in-process, one sample per tick on an evenly spaced window, and needed the same shape three times over: a trend cell per application row, context under a KPI value, and one series per container. [#84](https://github.com/momoi-labs/blueprint/issues/84) records the evidence. | Added as a component contract and a Recharts-based component, single series, neutral by default, primary only for the series a tile is about. |
30
36
 
31
37
  ## Growth model: grow with real products
@@ -21,7 +21,7 @@ specified separately and must still run before destruction.
21
21
  | Page framing | [PageHeader](../components/page-header.md) | Title ("New connection", "Edit connection"); optional cancel secondary action |
22
22
  | Fields | [FormField](../components/form-field.md) | Each field = [Label](../components/label.md) + control ([Input](../components/input.md), [Textarea](../components/textarea.md), [Select](../components/select.md), [Checkbox](../components/checkbox.md), …) + optional [HelperText](../components/helper-text.md) + [ValidationMessage](../components/validation-message.md) |
23
23
  | Grouping | [Card](../components/card.md) or section headings | Related field groups (connection, credentials, advanced) |
24
- | Primary actions | [Button](../components/button.md) | Save / Create (primary); Cancel (secondary/ghost) |
24
+ | Primary actions | [FormActions](../components/form-actions.md) + [Button](../components/button.md) | Save / Create (primary); Cancel (secondary/ghost) |
25
25
  | Overlays | [Modal / Dialog](../components/modal-dialog.md) or [Drawer](../components/drawer.md) | Compact create/edit; Drawer preferred on small viewports for the same task |
26
26
  | Inline errors | [ValidationMessage](../components/validation-message.md) on FormField | Field-level recovery; page [Alert](../components/alert.md) is for non-field failures |
27
27
  | Form / load errors | [Alert](../components/alert.md) | Submit or load failures that are not field-local (what / why / now) |
@@ -36,6 +36,19 @@ invalid fields and ValidationMessage use `--color-danger`, focus
36
36
  `--color-focus`, destructive Buttons use `--color-danger` per the Button
37
37
  contract.
38
38
 
39
+ ## Form actions
40
+
41
+ Every explicit-submit form composes [Form](../components/form.md) and
42
+ [FormActions](../components/form-actions.md). Place one primary submit action
43
+ and any secondary actions after the fields. Use sticky actions when the form
44
+ extends beyond the page or panel viewport. Follow the FormActions contract for
45
+ scroll ownership, optional messages, and responsive layout.
46
+
47
+ The product owns dirty tracking, validation, submission, and navigation.
48
+ Discard restores the last saved values; Cancel leaves the task. Keep entries
49
+ on failure. Announce feedback in the message region, not around the buttons.
50
+ Immediate preferences and automatic filters do not require FormActions.
51
+
39
52
  ## Flow
40
53
 
41
54
  ### Create
@@ -87,7 +100,7 @@ Full-page create/edit:
87
100
 
88
101
  ```text
89
102
  ┌──────────────────────────────────────────────────────────────────────┐
90
- │ PageHeader: Edit connection [Cancel] [Save] │
103
+ │ PageHeader: Edit connection │
91
104
  ├──────────────────────────────────────────────────────────────────────┤
92
105
  │ Alert (only if submit/load error — what / why / now) │
93
106
  │ │
@@ -16,7 +16,7 @@ tables, or dedicated tool routes.
16
16
 
17
17
  | Region | Compose with | Role |
18
18
  | --- | --- | --- |
19
- | Page framing | [PageHeader](../components/page-header.md) | Dashboard title; optional time-range or environment [Select](../components/select.md); optional refresh [IconButton](../components/icon-button.md) / [Button](../components/button.md) |
19
+ | Page framing | [PageHeader](../components/page-header.md) | Dashboard title; optional [TimeRangeControl](../components/time-range-control.md) or environment [Select](../components/select.md); optional refresh [IconButton](../components/icon-button.md) / [Button](../components/button.md) |
20
20
  | Widget unit | [Card](../components/card.md) | One concern per Card (metric cluster, short table, status list) |
21
21
  | Status | [Badge](../components/badge.md) | Compact health/severity labels inside Cards |
22
22
  | Dense lists | [Table / DataTable](../components/table.md) | Short "needs attention" tables — still compose Search/EmptyState/Pagination only when those behaviors are truly present |
@@ -36,8 +36,11 @@ semantic colors, focus `--color-focus`. Prefer quiet surfaces and strong
36
36
  hierarchy ([principles](../principles.md)).
37
37
 
38
38
  [Sparkline](../components/sparkline.md) carries metric shape inside Cards and
39
- table cells; it composes like any other widget payload. An interactive framed
40
- chart remains deferred.
39
+ table cells; it composes like any other widget payload. Use
40
+ [Chart](../components/chart.md) with its legend and exact-values table for
41
+ exploratory metrics. Share a timestamp grid, time range, and syncId across
42
+ related panels. Compose [DashboardGrid](../components/dashboard-grid.md) and
43
+ [Disclosure](../components/disclosure.md) for responsive panel groups.
41
44
 
42
45
  ## Flow
43
46
 
@@ -15,13 +15,13 @@ immediate vs deferred persistence, and unambiguous save feedback.
15
15
 
16
16
  | Region | Compose with | Role |
17
17
  | --- | --- | --- |
18
- | Page framing | [PageHeader](../components/page-header.md) | "Settings" or section title; optional save actions when the page uses explicit save |
18
+ | Page framing | [PageHeader](../components/page-header.md) | "Settings" or section title; section context; submit actions belong in FormActions |
19
19
  | Section nav | [Tabs](../components/tabs.md) or Sidebar sub-nav [Link](../components/link.md)s | Split General / Notifications / API, etc. |
20
20
  | Groups | [Card](../components/card.md) | One settings group per Card |
21
21
  | Text / choice fields | [FormField](../components/form-field.md) | [Label](../components/label.md) + [Input](../components/input.md) / [Select](../components/select.md) / [Textarea](../components/textarea.md) + [HelperText](../components/helper-text.md) + [ValidationMessage](../components/validation-message.md) |
22
22
  | Repeated values with their own options | [ChipInput](../components/chip-input.md) | One field for a list a person types, such as dependencies or scopes, instead of a form section per entry |
23
23
  | Booleans | [Switch](../components/switch.md) (immediate) or [Checkbox](../components/checkbox.md) inside FormField (part of a saved form) | Switch for single immediate preferences; Checkbox when the value submits with Save |
24
- | Actions | [Button](../components/button.md) | Save (primary), Reset/Cancel (secondary) for explicit-save sections |
24
+ | Actions | [FormActions](../components/form-actions.md) + [Button](../components/button.md) | Save (primary), Reset/Cancel (secondary) for explicit-save sections |
25
25
  | Feedback | [Toast](../components/toast.md), [Alert](../components/alert.md), [ValidationMessage](../components/validation-message.md) | Saved confirmation; section errors; field errors |
26
26
  | Shell | [Application shell](application-shell.md) | Authenticated framing |
27
27
 
@@ -50,8 +50,27 @@ Three points bind here rather than there:
50
50
  ```text
51
51
  Card: Appearance
52
52
  Theme [ ▣ ][ ☀ ][ ☾ ]
53
+ Accent [ ● ][ ● ][ ● ][ ● ]
53
54
  ```
54
55
 
56
+ The accent is the second row of the same card, with
57
+ [AccentSelector](../components/accent-selector.md). It follows the same three
58
+ points: `violet` is the default, the choice is local and instant, and it
59
+ persists under `kiso-accent` outside the section's Save button.
60
+
61
+ ## Form actions
62
+
63
+ Every explicit-submit form composes [Form](../components/form.md) and
64
+ [FormActions](../components/form-actions.md). Place one primary submit action
65
+ and any secondary actions after the fields. Use sticky actions when the form
66
+ extends beyond the page or panel viewport. Follow the FormActions contract for
67
+ scroll ownership, optional messages, and responsive layout.
68
+
69
+ The product owns dirty tracking, validation, submission, and navigation.
70
+ Discard restores the last saved values; Cancel leaves the task. Keep entries
71
+ on failure. Announce feedback in the message region, not around the buttons.
72
+ Immediate preferences and automatic filters do not require FormActions.
73
+
55
74
  ## Flow
56
75
 
57
76
  ### Explicit save (default for multi-field sections)
@@ -157,10 +157,68 @@ dark because `dark.500` misses the 3:1 non-text and large-text gates on
157
157
  `dark.800` and `dark.700`; they share a step on dark exactly as they share
158
158
  `neutral.500` on light.
159
159
 
160
+ ## Accents
161
+
162
+ The accent is a second axis over the same custom properties, orthogonal to the
163
+ theme. Five accents ship: `violet` (the default), `terracotta`, `teal`,
164
+ `cobalt`, and `nocturne`. The first four are hue turns: each is a primitive
165
+ ramp (`color.violet.*`, `color.terracotta.*`, and so on) with the same
166
+ lightness per step, so every role keeps the contrast it was gated at.
167
+ `color.accent.*` is the *active* ramp: an alias layer that points at violet by
168
+ default.
169
+
170
+ `nocturne` is different in kind. It is the marketing site's palette: the
171
+ violet ramp and ink over cool slate neutrals (hue 278) instead of the warm
172
+ ones. It is the one accent that restates the neutral roles, surfaces, text,
173
+ borders, and neutral fills alike, because the slate is the palette, not a
174
+ tint on it. A hue accent nested inside a nocturne container keeps the slate
175
+ and changes only the accent. Its surface, text, and accent values are the
176
+ site's own, gated like every other accent; the roles the site never named are
177
+ Kiso's lightness in the slate hue.
178
+
179
+ An accent is chosen with `data-accent` on `<html>`, or on any container:
180
+
181
+ ```html
182
+ <html data-accent="teal">
183
+ ```
184
+
185
+ No attribute means violet. The build emits one `[data-accent="<name>"]` block
186
+ per accent from the `accent.<name>` group in `tokens/tokens.json`. That block
187
+ restates only the roles that follow the hue:
188
+
189
+ - the active ramp, `--color-accent-50` to `--color-accent-950` and
190
+ `--color-accent-base`, remapped to the named ramp. `link`, `focus`, `ring`,
191
+ `accent`, and the light-theme tints alias the ramp, so they follow without
192
+ being restated;
193
+ - the raw-hex dark fills: `primary`, `primary-hover`, `primary-foreground`,
194
+ `accent-surface`, `accent-surface-hover`, and `selected`.
195
+
196
+ The neutral roles are not restated. The warm grey carries the interface under
197
+ every hue accent, and only the accent changes: a teal product and a violet
198
+ product share the same canvas, text, and borders. Tinting the neutrals toward
199
+ the hue was tried and rejected; at any visible strength it reads as a filter
200
+ over the screen rather than as a colour choice.
201
+
202
+ Values inside the block still use `light-dark()`, so accent and theme compose
203
+ without a cross product: five accents and two themes are five blocks, not
204
+ ten. Nesting resets cleanly: a `data-accent="violet"` container inside a
205
+ teal page is violet again.
206
+
207
+ Chart series do not follow the accent. `chart-1` is pinned to the violet ink
208
+ because a terracotta, teal, or cobalt series collapses into the warning, success,
209
+ or info series; see [Categorical chart colors](#categorical-chart-colors).
210
+ Status roles do not follow it either. Red, amber, and green were rejected as
211
+ accents for the same reason: a primary button in the danger hue reads as
212
+ destructive.
213
+
214
+ Applications own the choice and its persistence, exactly as with the theme.
215
+ Use [AccentSelector](components/accent-selector.md) for the control.
216
+
160
217
  ## AA gate
161
218
 
162
219
  `scripts/check-contrast.mjs` is the build-time AA gate. In both dark and light
163
- themes it resolves the semantic aliases and checks:
220
+ themes, for the default and for every accent, it resolves the semantic aliases
221
+ and checks:
164
222
 
165
223
  - `foreground`, `muted-foreground`, `link`, `accent`, `success`, `warning`,
166
224
  `danger`, and `info` at **4.5:1** or better against `background`, `surface`,
@@ -311,3 +369,31 @@ Published releases expose the artifacts as `@momoi-labs/kiso/tokens.css`,
311
369
  `@momoi-labs/kiso/tokens.d.ts`. Kiso's Markdown contracts are available below
312
370
  `@momoi-labs/kiso/contracts/` so consumers can pin the contracts and generated
313
371
  tokens to the same version.
372
+
373
+ ## Categorical chart colors
374
+
375
+ Issue #93 adds `--color-chart-1` through `--color-chart-5` for series identity.
376
+ The roles derive from violet.base, status.success, status.warning, status.info,
377
+ and status.danger, in that order. `chart-1` is the violet ink under every
378
+ accent, not the active accent: a series must stay distinguishable from the
379
+ status series whatever the product's accent is. Their meaning inside a chart is categorical,
380
+ never health or severity. Existing status roles keep their meaning elsewhere.
381
+
382
+ Each slot meets 3:1 on background, surface, and elevated-surface in both
383
+ themes, enforced by the contrast gate. Lines use full-opacity strokes; area
384
+ fills are secondary at 0.2 opacity. Every series also has a numbered label,
385
+ an interactive highlight, a legend value, and exact sample values. Do not
386
+ use filled bands or hue alone to identify data. Five slots cover pg-probe;
387
+ the epic's proposed eight-slot headroom is deferred until needed.
388
+
389
+ The palette gate also checks Oklab lightness bands (0.40 to 0.65 in light mode,
390
+ 0.70 to 0.90 in dark mode), chroma of at least 0.08, all-pair normal-vision
391
+ distance of at least 0.10, and adjacent-pair distance of at least 0.05 under
392
+ full protanopia and deuteranopia simulation. These are product regression
393
+ floors, not accessibility standards or a guarantee of hue discrimination.
394
+ Keep the canonical slot order in stacks; changing adjacency needs review.
395
+
396
+ The calculation uses [Oklab](https://bottosson.github.io/posts/oklab/) and
397
+ [Machado's simulation model](https://pubmed.ncbi.nlm.nih.gov/19834201/).
398
+ Run `node scripts/check-chart-palette.mjs` for both themes and every accent. Numbered labels,
399
+ highlighting, and tables remain required even when these checks pass.