Document stock visual decisions and operational UI examples

This commit is contained in:
mchus committed 2026-10-03 09:15:31 +03:00
1 parent 714447aa06
commit 08ff987edb
14 files changed
+532 -7

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
# Week-based Gantt example
The [contract](contract.md) captures the active List/Gantt workflow in stok's
`web/static/timeline-views.js` at `f589919`. The calendar implementation is dormant and is
not a default in this pattern. The [source audit](../web-visual-baseline/stock-review-2026-10-03.md)
distinguishes adopted decisions from outstanding implementation gaps.
## Shared geometry
Load canonical `view.css` first. This four-week example demonstrates geometry only; the server
or application computes week columns, bar positions, dates and status from the same records
as the list. Production ranges may contain more weeks and scroll horizontally.
```css
.gantt { max-height: 68vh; overflow: auto; border: 1px solid var(--border); border-radius: 4px; }
.gantt-row { display: grid; grid-template-columns: 260px minmax(224px, 1fr); min-width: 484px; border-bottom: 1px solid var(--border-lite); }
.gantt-header { position: sticky; top: 0; z-index: 3; background: var(--surface-2); }
.gantt-name { position: sticky; left: 0; z-index: 2; padding: 6px 9px; background: var(--surface); border-right: 1px solid var(--border); }
.gantt-weeks { display: grid; grid-template-columns: repeat(4, minmax(56px, 1fr)); }
.gantt-track { position: relative; min-height: 34px; }
.gantt-bar { position: absolute; top: 2px; bottom: 2px; border: 1px solid var(--border); border-radius: 4px; background: var(--accent-bg); color: var(--ink); white-space: nowrap; cursor: pointer; }
.gantt-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.gantt-fact { position: absolute; top: -1px; bottom: -1px; width: 3px; background: currentColor; }
```
```html
<p>2026 · W40–43</p>
<div class="gantt" tabindex="0" role="region" aria-label="Planning timeline">
<div class="gantt-row gantt-header">
<div class="gantt-name">Record</div>
<div class="gantt-weeks"><span>W40</span><span>W41</span><span>W42</span><span>W43</span></div>
</div>
<div class="gantt-row">
<div class="gantt-name">Order DEMO-01</div>
<div class="gantt-track">
<button type="button" class="gantt-bar" style="left:0;width:50%"
aria-label="Edit DEMO-01, 10 units, planned W40–41 of 2026, in transit">
10 units · In transit
</button>
</div>
</div>
</div>
```
For a parent with meaningful children, place a dedicated native button with `aria-expanded`
inside the name cell and wire it to child visibility. Keep that handler separate from the bar's
edit handler. Do not add an expand affordance for a leaf or a child identical to its parent.
An actual-date marker can use `.gantt-fact` with an accessible date in the bar label. Provide
a visible legend for markers and open-ended spans. Never rely on their color alone.
+30
View File
@@ -0,0 +1,30 @@
# Contract: Timeline Views
Version: 1.0
## Scope
An optional Gantt view for dates and parent/child records already represented by an operator
table. Visual styling inherits `web-visual-baseline`; filters inherit `table-management`.
This pattern comes from stok's active List/Gantt workflow. It does not require a calendar view.
## Rules
- Keep the list as the default view. Use a compact joined List/Gantt switcher and retain the
active filters when switching. Persist view/range in URL state when the page is shareable.
- Use ISO weeks for planning, with a visible range title and previous/current/next controls.
Mark the current week; include the ISO year wherever week numbers would be ambiguous.
- Use a bounded scrolling surface, a sticky week header and a sticky name column. Keep
filter popups above it and outside clipping ancestors using the shared dropdown mechanism.
- Parent names expand/collapse meaningful child detail. Timeline bars open the corresponding
record editor. These actions must not trigger each other; both work with the keyboard.
- Keep bar labels concise (identity/quantity), with complete dates/status available on
inspection and through an accessible name. Short bars must not make their labels unreadable;
labels may overflow within a lane if they do not cover another control.
- Display server-supplied status with text/shape as well as color. Distinguish actual-date
markers from planned spans and open-ended spans from completed ones.
- Reuse the same records and filters as the list; do not create separate business calculations
for the chart. Missing dates must not silently become today's date or disappear without an
unscheduled indication or an explicit count/link back to the list.
See [examples](README.md) for geometry and the source decisions.