@micha.bigler/ui-core-micha 2.30.0 → 2.31.1

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/WORK_ORDERS.md CHANGED
@@ -24,6 +24,8 @@ prefixed ID; never reuse a bare flat number across workstreams.
24
24
 
25
25
  | ID | Titel | Beschreibung | Datum | Status | Commit(s) | Notiz |
26
26
  |---|---|---|---|---|---|---|
27
+ | THEME-2 | Two defects from the THEME-1/CHART-6 landings: `warning.main` contrast, `grid` replacing instead of merging | Fixes `palette.warning.main` (`#C08A2C`, 3.038:1 on white — fails AA) to `#976100` (the existing `text` tone, ~5.2:1), `contrastText` to `#FFFFFF`; `warning.fill`/`.text`/`.fillText`/`.bg` unchanged. Adds a completeness-assertion rule checking every status channel's `.main` against `#FFFFFF` and `background.default` at 4.5:1. Fixes `BarChart`/`LineChart`'s `grid` prop silently replacing (not merging) a caller's partial grid object; the required audit of sibling object-valued defaults found a second live instance (`legendPosition`, same bug class) and fixed it too. `2.31.1` (patch). Full spec: [work-orders/THEME-2.md](work-orders/THEME-2.md). | 2026-08-10 | done | 7d5039f | Envelope authored by Expertenchat, both defects fully diagnosed up front (no design question). Preconditions (THEME-1 `2.30.0`, CHART-6 `2.31.0`) verified. Orchestrator filled the Implementation map with the exact current-state code pointers for both defects, then ran Codex (stdin invocation). Codex's own audit (per the WO's "close the mechanism" instruction) found the `legendPosition` partial-override bug beyond the named `grid` fix and fixed it too, exactly as the WO anticipated ("fix that too and say so"). **Independent `reviewer` (Sonnet) + `ui_reviewer` (Haiku) ran concurrently — both found NO findings**, including the reviewer's own hand-computed contrast check confirming `#976100` clears 4.5:1 against both `#FFFFFF` (~5.22:1) and `background.default` (~5.00:1). One thing the Orchestrator itself fixed (not a reviewer finding): a pre-existing THEME-1 regression test (`tests/createAppTheme.test.js`) asserted `palette[status].main === palette[status].fill` for all four status channels — THEME-2 deliberately breaks that equality for `warning` only (the whole point of the fix), so the assertion was updated to special-case `warning` against its new intended invariant (`main === text`, `contrastText === '#FFFFFF'`) while `success`/`error`/`info` keep the original assertion. Re-verified after the fix: 58/58 scoped + adjacent vitest tests green (`tests/themeCompleteness.test.js`, `tests/chartDefaults.test.js`, `tests/createAppTheme.test.js`, `tests/chartsPalette.test.js`, `tests/BarChart.test.jsx`, `tests/LineChart.test.jsx`, `tests/TimeSeriesChart.test.jsx`), `tsc -p tsconfig.build.json --noEmit` clean. **Two-width rendered side-by-side (DS-1 gate)** run in the dev harness's "Theme / Shared baseline" entry — the WO's own point was that no existing specimen exercised `.main` (the `StatusChip`'s `sx={{bgcolor:'...fill'}}` and the `MuiAlert` `standardWarning` override both bypass it), so a new Button/Chip/`Alert variant="filled"` specimen row was added and confirmed live at 375px and 1280px: the warning tone now renders visibly darker (brown, white text) than the still-unchanged lighter-amber `fill`-based chip beside it. The "Caller overrides" `LineChart` specimen's `grid` prop was also changed from a complete `{horizontal:true,vertical:true}` object (which wouldn't have visually proven the merge) to a genuinely partial `{vertical:true}` one — confirmed live at both widths showing BOTH grid directions post-fix. |
28
+ | CHART-6 | Chart-chrome defaults in the three wrappers, plus two generic fixes hoisted up | Closes the chart-chrome default surface in `BarChart`/`LineChart`/`TimeSeriesChart`: baseline tick font size (from `theme.typography.caption`), a horizontal grid, `showMark:false` with a filled-marker fix when a caller opts markers back in, automatic bottom-margin growth for rotated tick labels, a new `legendPosition` prop (default bottom-start), and `TimeSeriesChart`'s own toolbar becoming the sole legend (MUI's redundant second legend removed). Hoists `chartLabels.js` (short granularity-aware tick-label formatters) and a generalised `yearTickInterval` from fitness-monitor. `2.31.0`. Full spec: [work-orders/CHART-6.md](work-orders/CHART-6.md). | 2026-08-10 | done | 6dedc62 | Envelope authored by Expertenchat (DS-4). Precondition (THEME-1 landed + published `2.30.0`) verified before start. Orchestrator filled the Implementation map with concrete MUI X-Charts source pointers (installed `8.29.2`, not the WO's stated `8.28.2` — flagged and verified against the actual installed source throughout), then ran Codex (stdin invocation, same as THEME-1). Codex implemented `src/components/charts/{chartDefaults,chartLabels,yearTickInterval}.js`, wired all three wrappers, wrote the 10 required tests, and used a wrapper-level `slots.mark` composition for the filled-marker fix (a deliberate, now-documented deviation from the WO's named `MuiMarkElement` theme-token mechanism — the wrapper-level fix applies to all 14 consumers immediately on this version bump, not only to apps that separately adopt `createAppTheme`). **Independent `reviewer` (Sonnet) + `ui_reviewer` (Haiku) ran concurrently.** `reviewer` found **R1 (P2)** — the marker-fill deviation from the WO's specified mechanism was undocumented; fixed with an explanatory code comment (functionally correct either way, this was a disclosure gap, not a bug). `ui_reviewer` found **U1 (P3)** — `SeriesToggleDot`'s 12px dot used hardcoded pixels instead of `theme.spacing()`; fixed. Both reviewers otherwise found the six highest-risk invariants (default-vs-caller-override merge order, filled markers, rotated-tick margin math, the double-legend fix, `yearTickInterval`'s generalisation, `skipAnimation` passthrough) correct and non-vacuously tested. **A third, more serious bug was found by the Orchestrator's own DS-1 two-width rendered check (not by either reviewer, since both are static-diff reviews)**: `withAxisDefaults` in `chartDefaults.js` only applied `defaults.scaleType` when the caller passed NO `xAxis`/`yAxis` array at all — a caller-supplied axis with `data` but no explicit `scaleType` (exactly what the new dev-harness "Chart defaults" `LineChart` specimen used) silently lost the wrapper's `'point'`/`'band'` scale default entirely, leaving MUI's scale undefined and every rendered line/point position `NaN` (`<path> attribute d: Expected number, "MNaN,...`, confirmed live via `read_console_messages` and only reproducible through a real MUI scale computation — a mocked prop-assertion test structurally cannot catch it, the same class of bug CHART-1/3/4/5 have each found before in this kit). Fixed by spreading `defaults` before `axis` in the per-axis merge (caller's own explicit `scaleType`, if any, still wins); a new regression test added (`tests/chartDefaults.test.js`, "keeps the default scaleType on a caller-supplied axis that does not set one"), confirmed against both `BarChart`'s `'band'` and `LineChart`'s `'point'` defaults. Re-verified after all three fixes: 44/44 scoped vitest tests green (10 new + 34 existing adjacent chart tests, no regressions), `tsc -p tsconfig.build.json --noEmit` clean. **Two-width rendered side-by-side (DS-1 gate)** run in the dev harness's "Theme / Shared baseline" entry (which now also carries the two new `LineChart` chart-chrome specimens per the WO's "at least one chart that set the props and one that did not" requirement) at 375px and 1280px — confirmed live: correct line rendering (post-fix), filled markers on the caller-override chart, horizontal grid, bottom-start vs. caller-chosen legend position, and rotated tick labels with adequate margin at 1280px. |
27
29
  | THEME-1 | Shared MUI theme baseline: `createAppTheme` factory + completeness assertion | Ships `createAppTheme(appConfig)` (palette-first merge of a fixed light-mode baseline with the app's own `palette`/`typography`/`components`; throws without `palette.primary`; throws on a function anywhere in `appConfig.components.*.styleOverrides`), an exported `assertThemeComplete` completeness assertion with an exemption arm and contrast checks (status text-on-own-tint, `controlBorder` on white + page background), a non-breaking chart-ramp fallback in `useNeutralChartPalette` (adopters get the theme's `dataSeries` ramp, non-adopters see byte-identical output), a new "Shared theme baseline" dev-harness entry, and `DESIGN.md` principles 1/8 reworded per the accepted policy change (ucm now ships a shared theme; the data-colour layer has a shared default). Full spec: [work-orders/THEME-1.md](work-orders/THEME-1.md). | 2026-08-10 | done | b329b39, 96992cf | Envelope authored by Expertenchat from the accepted reference sheet (`work-orders/assets/THEME-1-baseline-reference-sheet.html`, DS-2 decisions 1–23). Orchestrator filled the Implementation map, then ran Codex (stdin, not positional arg — the WO text exceeded Windows' command-line length limit via the npm shim, "Argument list too long"; `codex exec ... -` reading the WO from stdin is the working invocation for large WOs on this platform). Codex implemented `src/theme/{tokens,createAppTheme,themeCompleteness,index}.js`, wrote all 13 required tests + extended `tests/chartsPalette.test.js`, updated `src/index.js` exports, `DESIGN.md`, `package.json` (2.29.2→2.30.0, new `@fontsource/dm-sans` dependency — WO-scoped, no separate approval needed), and the dev harness. **Independent `reviewer` (Sonnet) + `ui_reviewer` (Haiku) ran concurrently. `ui_reviewer`: no findings.** `reviewer` found three, all confirmed real and fixed by the Orchestrator: **R1 (P2)** — MUI's `createTheme(options, ...args)` only runs palette augmentation on the FIRST argument; every later arg (how the baseline was layered in) is deep-merged raw, so `success`/`warning`/`error`/`info` — which had `text`/`fill`/`fillText`/`bg` but no `main`/`contrastText` — silently kept MUI's own stock hues for any standard `color="success"` usage. Verified live via a Node repro (`createTheme({...},{palette:BASELINE_PALETTE},{...})` on the pre-fix baseline produced `success.main:'#2e7d32'`, MUI's stock green, not the canonical `#1B8038`). Fixed: explicit `main`/`light`/`dark`/`contrastText` added to all four status channels (`light`/`dark` computed via MUI's own `lighten`/`darken` at the same 0.2/0.3 tonal offsets `augmentColor` uses), plus a new regression assertion in `tests/createAppTheme.test.js`. **R2 (P3)** — `controlBorder.focus` was derived to clear 3:1 only against `background.paper`, while `assertThemeComplete`'s own contrast check tests it against `#FFFFFF` and `background.default` — an app overriding either background could pass the derivation and still fail the assertion. Fixed: derivation now targets both surfaces. **R3 (P3)** — `MuiOutlinedInput`'s `variants` array was nested inside `styleOverrides.root` instead of as a sibling key; MUI never reads `variants` from inside `styleOverrides` (it's matched by `props` independently), so the entry was inert dead code, and it also meant the function-in-`styleOverrides` guard's own suggested escape hatch ("use MUI variants") was structurally unreachable from inside `styleOverrides`. Fixed: moved to the correct sibling placement; updated the one test and the one completeness-surface path that referenced the old (wrong) location. Re-verified after fixes: 15/15 scoped vitest tests green (`tests/createAppTheme.test.js`, `tests/themeCompleteness.test.js`, `tests/chartsPalette.test.js`), `tsc -p tsconfig.build.json --noEmit` clean. Orchestrator's own security/scope pass: no findings (only the WO-approved `@fontsource/dm-sans` dependency addition, no secrets, no scope creep). **Two-width rendered side-by-side (DS-1 gate)** run in the dev harness's new "Theme / Shared baseline" entry at 375px and 1280px — both screenshots confirm radius (3/8), no resting shadow on Paper/Card, correct status fill/text/bg tones, and the six-colour series ramp, consistent with the reference sheet. No app pin bumps in this WO — all 14 consumers pin exact versions and pick this up on their own adoption WO. |
28
30
  | CHART-5 | Dual y-axis + always-visible x-axis ticks on `TimeSeriesChart` | Opt-in second y-axis via a new per-series `axis: 'secondary'` field (backward-compatible, off by default) with auto-detected integer-only tick labels per axis group; deterministic x-axis `tickLabelInterval` so bucket labels never all vanish under MUI's default collision-avoidance (the live symptom: zero x-axis labels with 24 hourly buckets). Reverses CHART-2's deliberate "no second y-axis" choice on fresh operator instruction; `DESIGN.md` #8 updated to record the scoped exception. Full spec: [work-orders/CHART-5.md](work-orders/CHART-5.md). | 2026-08-07 | done | 839e6c5, 84c37ac, 0dd3bac, f4e5586, 4a12a71 | Operator-requested after seeing the shipped chart live: y-axis showed decimal ticks (0.2, 0.4, ...) for an integer user-count series sharing an axis with fractional hours; x-axis showed no time labels at all. **Codex out of credits, known up front** — implemented directly (author-flip, independent review mandatory). Independent `reviewer` + `ui_reviewer` ran concurrently: **`reviewer` found R1 (P1, real bug)** — used `yAxisKey` (removed in MUI X-Charts v7, per the installed v8.29.2's own CHANGELOG and `useBarPlotData.mjs` source, which reads `series[i].yAxisId`) instead of `yAxisId`; the WO explicitly asked to verify this passthrough against real MUI behaviour rather than assume, and the first pass didn't — the dual-axis feature would have silently plotted every series on the primary axis in production despite all mocked tests passing (a mocked-prop test structurally cannot catch a wrong-field-name bug, since it only checks whatever the code itself sets). Fixed (`yAxisKey` → `yAxisId`, verified against `node_modules` source directly, not just the mock) and the pre-existing `tests/BarChart.test.jsx` "dual axis" case corrected too (R2 — it used the same wrong field name and was cited by the WO as precedent, giving false confidence). **`ui_reviewer` found U1 (P1, real bug)** — `tickLabelInterval`'s `index % step === 0` systematically dropped the LAST x-axis bucket unless it landed exactly on a step boundary (e.g. 24 labels/step 3 → indices 0..21, never 23), exactly the failure mode the WO's own SCOPE C explicitly warned to check for; fixed by force-including `index === lastIndex`, with a new `it.each([24,12,7,1])` regression test, confirmed non-vacuous by reverting the fix. **U2 (P2)**: `DESIGN.md` #8's "Never dual-axis" now contradicted the shipped code — updated to record dual-axis as a scoped, opt-in exception (CHART-5) rather than a general rule change. U3 (P3, fixed `MAX_X_TICKS` under-displays low-density ranges e.g. 12 monthly buckets showing only 6) and U4 (P3, no UI indication of which axis a toggle's series plots against) both accepted, not fixed — informational, no code change. Re-verified after fixes: 31/31 scoped vitest tests (`TimeSeriesChart.test.jsx` + `BarChart.test.jsx`) green, `tsc` build clean. Published: ucm 2.29.0 (minor — new optional per-series field + prop, additive, no breaking change). **Third bug found post-publish (2.29.1 patch)**: after jg-ferien adopted it (ACT-7) the operator reported live that the secondary axis was "obviously there but invisible" and x-axis labels were still missing. Investigated by adding a new DX-1 harness entry (`dev/entries.jsx` `TimeSeriesChartEntry`, previously missing — this component had NEVER been visually verified in a real browser through CHART-2/3/4/5) and reading the real rendered DOM directly. X-axis confirmed working (9 evenly-spread labels for 24 buckets) — the live report was very likely a stale PWA service-worker cache on jg-ferien's side, not a code defect. Y-axis confirmed broken: only 1 of 2 `yAxis` entries rendered in the DOM. Root cause traced to the installed MUI X-Charts source (`defaultizeAxis.js`): `defaultPosition = index === 0 ? 'left' : 'none'` — every yAxis array entry past the first silently renders nothing unless given an explicit `position`, a class of bug no mocked-`BarChart` test can catch (the mock never runs MUI's own defaulting logic). Fixed by setting `position: 'left'`/`'right'` explicitly on the primary/secondary entries; independent `reviewer` traced the fix against the same MUI source and confirmed no second gating layer exists. Live-reverified in the dev harness after the fix: both axes render with independent scales (primary `0,1,2`; secondary `0.0,0.5,1.0,1.5,2.0`). 32/32 tests green, build clean. Published: ucm 2.29.1 (patch). **Fourth report, root cause NOT in ucm**: operator reported x-axis labels still empty even after 2.29.1. Extensive live investigation (scoped DOM queries, computed-style checks, a real-browser-DOM comparison against this repo's own dev harness in both dev and production-build mode, a DM-Sans-not-loaded font test) could not reproduce it anywhere in ucm with the exact real bucket data — ruled out: stale cache, MUI axis config, container width, dev-vs-prod build, font-loading timing. Root cause found via web search: a known, unfixed upstream MUI X-Charts bug (mui/mui-x#18768, duplicate of #18399) where insufficient measured space makes its `ellipsize` logic collapse an ENTIRE tick label to `''` instead of shortening it, confirmed live via a `<tspan>` with correct styling but zero text content — triggered by jg-ferien's verbose label format ("08/05, 10:00 AM", 16 chars) combined with its actual DM Sans font metrics (not reproducible with this repo's default Roboto-based harness). Fixed in jg-ferien (ACT-9: short, granularity-aware labels), not in ucm — `TimeSeriesChart` itself has no defect here, it's a host-side label-length choice interacting with an upstream MUI bug. This repo's DX-1 harness entry (`TimeSeriesChartEntry`) updated to model the correct short-label pattern so it doesn't teach the risky verbose format. |
29
31
  | CHART-4 | Fix `TimeSeriesChart` chart canvas rendering at zero height | Neither `ChartFrame` nor `BarChart` ever receive a height from `TimeSeriesChart` — MUI X-Charts' responsive container measures a zero-height parent and draws no bars/axes, while the legend (sized by its own content) renders regardless, which is why the live symptom was "legend shows, chart canvas doesn't". Fix supplies a preset default height (`CHART_HEIGHT = 320`, `minHeight` on `ChartFrame` + `height` forwarded to the real `MuiBarChart`), matching the working `dev/entries.jsx` reference pattern. Full spec: [work-orders/CHART-4.md](work-orders/CHART-4.md). | 2026-08-07 | done | f0953a1, fcb289b | Second, independent bug found live in jg-ferien immediately after CHART-3 + the ucm pin bump landed — CHART-3's own fix is what let this one become visible for the first time (it was previously masked by the permanently-empty-chart bug). Root cause of it shipping twice undetected: every test in `tests/TimeSeriesChart.test.jsx`/`tests/BarChart.test.jsx` mocks the real `@mui/x-charts/BarChart`, so no test has ever mounted the real chart and observed its size. **Codex out of credits, known up front** — implemented directly (author-flip, independent review mandatory). **Test-writing pitfall found and self-corrected during implementation**: first wrote an *unmocked* render test asserting the real chart SVG's `viewBox` height was non-zero — verified vacuous (stays green even fully reverting the fix, since jsdom's `ResizeObserver`/layout handling doesn't reproduce the real zero-height-parent browser behavior this bug depends on). Deleted; replaced with a `chartSpy`-mocked prop assertion (`props.height` non-zero) matching the file's existing convention, confirmed non-vacuous (fails pre-fix with `props.height` undefined). Independent `reviewer` + `ui_reviewer` ran concurrently: `reviewer` verified the fix mechanism end-to-end (no prop-name collision between `BarChart`'s own `minHeight`/`aspect` and the forwarded `height`) and the test's non-vacuity claim, no findings. `ui_reviewer`: two P3 informational notes, neither blocking — (U1) the fixed 320px height is a deliberate, documented exception to `DESIGN.md` #14 ("responsive = container-sized, not fixed px"), needed specifically because MUI X-Charts' own `ResizeObserver`-based height measurement is what caused CHART-4 in the first place; a code comment was added warning future readers not to "fix" this back to a responsive height without re-verifying the underlying MUI bug is resolved. (U2) `CHART_HEIGHT` uses 320 for both `ChartFrame.minHeight` and `BarChart.height`, vs. `dev/entries.jsx`'s 360/320 split — functionally harmless (WO explicitly permits one fixed value), no change made. 13/13 scoped vitest tests green, `tsc` build clean. Published: ucm 2.28.2 (patch, no interface change). No app pin bumps in this WO — jg-ferien picks it up on its next ucm bump. |
@@ -56,5 +58,3 @@ prefixed ID; never reuse a bare flat number across workstreams.
56
58
  | AUTH-2 | Translate backend auth error codes (stop leaking raw codes) | ucm surfaces raw backend/allauth error **codes**, not text: `apiClient.jsx:107` extracts `err.code`, components do `t(err.code)`/`setErrorKey(err.code)`, but the catalogue has no entries → users see literal `email_password_mismatch` / `password_too_short`. Affects **all** rendering auth screens (login/change-pw/MFA/profile). Fix = add de/fr/en i18n entries **keyed by the enumerated codes** → the existing `t(err.code)` resolves, **zero component/app change**. Does NOT reach the delegating invitation `PasswordSetForm` (that's AUTH-1). Full spec: [work-orders/AUTH-2.md](work-orders/AUTH-2.md). | 2026-08-06 | done | 84387cf, 103a252 | Tier 2 (shared-core). Same Codex→Claude fallback and reviewer pairing as AUTH-1 (one combined diff, both WOs landed together). **Keying decided: raw-code (drop-in)**, per the WO's own stated preference — no operator request for the namespaced `i18nKey` alternative. **Codes enumerated by reading the installed allauth/Django source directly** (not guessed): `email_password_mismatch`/`username_password_mismatch`/`phone_password_mismatch` (`allauth/headless/account/inputs.py` `LoginInput.clean`), `too_many_login_attempts`/`invalid_login`/`account_inactive`/`enter_current_password` (`allauth/account/adapter.py` error_messages + `allauth/headless/account/inputs.py` `ChangePasswordInput.clean_current_password` — confirmed this genuinely means "wrong current password", not merely "field left blank"), `incorrect_code` (`allauth/mfa/**`), `password_too_short`/`password_too_common`/`password_entirely_numeric`/`password_too_similar` (Django `contrib/auth/password_validation.py`, matching dcm's `AUTH_PASSWORD_VALIDATORS` baseline). Added de/fr/en/**sw** (file's established 4-locale convention, honoured over the WO text's literal "de/fr/en"). **`ui_reviewer` + `reviewer`: no AUTH-2-specific findings** (both spot-checked the code spellings independently against the same installed packages; no key collisions with existing `Auth.*` keys; `authErrorCodeRendering.test.jsx` proves a mapped code renders human text via a real i18next instance and a genuinely-uncoded error still falls back to the existing generic `Auth.PASSWORD_CHANGE_FAILED`). Gate: shared with AUTH-1 — full suite 322/322, `tsc` clean. **Published version correction**: see AUTH-1's row — the 2.28.0 tag was skipped by a CI runner backlog and never published; verified present in the npm tarball from **2.28.1** onward (currently 2.29.1). Companion: AUTH-1. |
57
59
  | AUTH-3 | SignUpPage showed the access-code-specific success message for every signup mode | Operator-observed live bug 2026-08-07: open self-registration (no access code) showed "Falls der Zugangscode für dieses Projekt gültig ist, wurde ein Einladungslink an X gesendet" — nonsensical when there is no code at all. Root cause: `SignUpPage.jsx`'s `handleSubmit` hardcoded `Auth.INVITE_REQUEST_SUCCESS` for every mode (open/access-code/email-domain/QR) regardless of the backend's actual response. | 2026-08-07 | done | 599e73d, b4e1fe7 | No WO file — operator-reported bug, fixed directly, same convention as MSG-6c/MSG-6d/MSG-6j. Tier 2 (shared-core). **Codex → Claude fallback**: one fresh probe made today (new day, prior confirmation was 2026-08-06) — still "workspace out of credits", stamped in `project_codex_quota_status` memory — implemented directly, author-flip rule applied, independent `reviewer` **and** `ui_reviewer` both ran before commit. **Root cause confirmed against the actual backend** (`django-core-micha` `register_request` view + `validate_access_code_or_error`): every signup mode's success response already carries a mode-agnostic, accurate `code: "Auth.INVITE_SENT"`; an invalid access code is never silently accepted, it raises a distinct 400 (`Auth.ACCESS_CODE_INVALID_OR_INACTIVE`) — so the old key's "if valid…" ambiguity never matched backend reality for any mode, not just the ones reported. Fix: `setSuccessKey(res?.code || 'Auth.INVITE_SENT')`, using the backend's own code; no component/app change beyond this. **Both reviewers independently flagged the same P3**: switching away from the old key silently dropped the `{{email}}` confirmation (`Auth.INVITE_SENT` had none). Fixed before commit — extended `Auth.INVITE_SENT`'s text to include `{{email}}` in all 4 locales (safe: it had exactly one consumer, this call site, confirmed by grep). `Auth.INVITE_REQUEST_SUCCESS` is now dead/orphaned (both reviewers flagged as P3, tracked here, not removed — out of this fix's scope). Gate: `tests/SignUpPage.test.jsx` 13/13 (3 new, proving the backend code wins over the old hardcoded key, and the no-code fallback); full suite 342/342, `tsc` clean. |
58
60
  | SHELL-2 | AccountPage: from a horizontal tab strip to a grouped sidebar + mobile drawer | Measured live at 375 px on 2026-08-08 (running cockpit, host header neutralised so the numbers describe ucm alone): `AccountPage` does **not** break the layout -- all six sections render at document width 375. What fails is discoverability and the users table. The tab strip scroller is 343 px visible against 589 px of content with `overflow-x: auto`, 246 px of travel, and **`scrollButtons: 0`** -- Support and any consumer-injected section sit off screen with no arrow, no fade, no hint they exist (they do respond to a horizontal swipe, so this is a discoverability failure, not a reachability one -- unlike cockpit's own header tabs, which are `width: 0px` + `overflow: hidden` and genuinely unreachable). The users table renders 1045 px inside a 341 px `MuiTableContainer`; one third is visible and the `Aktionen` column sits ~700 px to the right. Adopts jg-ferien's `EventInfoPage` pattern (`SectionSwitcher.jsx`, driven from `EventInfoPage.jsx:1126-1159`) in **both** halves -- sticky grouped 280 px sidebar at `md`+, bottom drawer below `md` -- plus an in-page trigger bar, which the reference does not supply because jg's trigger lives in that app's own page header and `AccountPage` has none. | 2026-08-08 | blocked | | **Held back 2026-08-08 — reshaped into DS-11** (see `webapp-management/DESIGN_SYSTEM_PROGRAM.md`): do NOT implement this WO as written; the Envelope will be revised (open: keep the SHELL-2 ID or mint a new SHELL-* ID). Known corrections for the revision: publishing is version-gated, not per-push (this row's "publishes immediately" is imprecise), and the grouped-shell part becomes an inheritable ucm component with `AccountPage` as first consumer. Envelope: [work-orders/SHELL-2.md](work-orders/SHELL-2.md). Prototype: [work-orders/assets/SHELL-2-account-navigation.html](work-orders/assets/SHELL-2-account-navigation.html). Tier 2 (shared core) -- independent `reviewer` (Sonnet, full) **and** `ui_reviewer` concurrently, both mandatory before commit. **Operator decisions, settled 2026-08-08 and not to be renegotiated by implementer or reviewer:** both halves of the pattern, so the horizontal tab strip disappears **on desktop too** (asked explicitly, chosen deliberately, in full knowledge that 14 consumers inherit the desktop change on their next pin bump); fixed groups `Mein Konto` / `Verwaltung` / `Hilfe` / `Weitere`, with `extraTabs` gaining an **optional** `group` field, additive and backward compatible; no standalone "Uebersicht" entry above the groups (jg-ferien has one, `AccountPage` has no overview screen for it to point at, so none is invented); users table becomes a card list below `md` and stays a table at `md`+; the mobile trigger bar is the **sole** carrier of the current section name, so the section heading below it is **removed**, not merely undrawn -- desktop keeps its heading because it has no trigger bar. **Two contracts that must survive and are currently untested:** the `?tab=` URL contract incl. fallback to `profile` on an unknown *or* unpermitted value (`AccountPage.jsx:60`, `:180-186`) -- cockpit's `/user-management`, `/profile` and `/change-password` redirects all hang off it -- and the full `extraTabs` shape (`:146-155`), whose `label` may be a **function** and which supports `visible(context)`. `AccountPage` and `UserListComponent` have **zero tests today** (none of the 20 files under `tests/` touches either), so both test files are new, not extensions. **No staging net:** this repo has no `develop`; a push to `main` touching `src/**` or `package.json` publishes to npm immediately via `publish.yml`, so the independent review is the only gate and is not back-fillable. Version target `2.30.0` (minor -- `extraTabs` gains a public field; additive API is a minor under semver). Explicit non-goals: pagination/filtering for the user list, the sections' internal content, the six auth pages (measured clean at 375 px), and **cockpit's header** -- that toolbar is what inflates the document to 498 px on every route including `/account`, and it is a separate WO in the cockpit repo, sequenced after this one at the operator's choice. Carried-over trap from the reference: jg-ferien uses `env(safe-area-inset-bottom)` while its `index.html` omits `viewport-fit=cover`, so those insets resolve to zero there -- copy the padding, do not assume it does anything. |
59
- | THEME-1 | Shared MUI theme baseline: `createAppTheme` factory + completeness assertion | Every app theme sets a handful of values and leaves the rest at MUI's defaults, so implementations drift toward Material Design 2014 (uppercase buttons, 20px h6, 16px body, elevation shadows). The baseline was distilled from 13 prototype artifacts across 5 repos plus 5 app themes, and settled with the operator over two review rounds against a rendered reference sheet. | 2026-08-09 | planned | | Reference sheet (visual + token spec, live WCAG contrast checks): [work-orders/assets/THEME-1-baseline-reference-sheet.html](work-orders/assets/THEME-1-baseline-reference-sheet.html). Its canonical token table is the value source — the Envelope references it rather than restating the numbers. Envelope: [work-orders/THEME-1.md](work-orders/THEME-1.md) (authored 2026-08-10, Approval Gate #1 pending). Version target 2.30.0; DS-4 follows as 2.31.0. Program context: `webapp-management/DESIGN_SYSTEM_PROGRAM.md` (DS-2). |
60
- | CHART-6 | Chart-chrome defaults in the three wrappers + the two generic fixes hoisted up | The kit's `LineChart`/`BarChart`/`TimeSeriesChart` are ~18 lines of logic each and set no tick font, grid, margin or marker styling, so MUI X-Charts' own visual language shows through untouched. Hand discipline does not close it: hram, the exemplar, sets `tickLabelStyle.fontSize` at only 4 of 9 call sites. Also resolves `TimeSeriesChart`'s double legend and hoists fitness-monitor's label-collapse workaround (two consumers) plus `yearTickInterval`. | 2026-08-10 | planned | | Envelope: [work-orders/CHART-6.md](work-orders/CHART-6.md) (Approval Gate #1 pending). **Hard precondition: THEME-1 must land and publish as 2.30.0 first** — both touch `src/index.js` and `src/components/charts/`, and this repo publishes on every push. Version target 2.31.0. Legend auto-placement is deliberately out of scope (own strand — the in-plot overlay path is unverified in X-Charts 8.28.2). Program context: `webapp-management/DESIGN_SYSTEM_PROGRAM.md` (DS-4). |
package/dev/entries.jsx CHANGED
@@ -30,6 +30,7 @@ import {
30
30
  import { AuthContext } from '../src/auth/AuthContext';
31
31
  import { BarChart } from '../src/components/charts/BarChart';
32
32
  import { ChartFrame } from '../src/components/charts/ChartFrame';
33
+ import { LineChart } from '../src/components/charts/LineChart';
33
34
  import { TimeSeriesChart } from '../src/components/charts/TimeSeriesChart';
34
35
  import { NotificationBell } from '../src/notifications/NotificationBell';
35
36
  import { NotificationsProvider } from '../src/notifications/NotificationsProvider';
@@ -76,6 +77,8 @@ function StatusChip({ label, tone }) {
76
77
  );
77
78
  }
78
79
 
80
+ const MUI_STATUS_TONES = ['success', 'warning', 'error', 'info'];
81
+
79
82
  function ThemeBaselineEntry() {
80
83
  return (
81
84
  <Stack spacing={3}>
@@ -119,6 +122,25 @@ function ThemeBaselineEntry() {
119
122
  <StatusChip label="Stale" tone="stale" />
120
123
  </Stack>
121
124
 
125
+ <Stack spacing={1}>
126
+ <Typography variant="subtitle2">MUI status colours using palette main</Typography>
127
+ <Stack direction="row" spacing={1} useFlexGap flexWrap="wrap">
128
+ {MUI_STATUS_TONES.map((tone) => (
129
+ <Button key={tone} color={tone} variant="contained">{tone}</Button>
130
+ ))}
131
+ </Stack>
132
+ <Stack direction="row" spacing={1} useFlexGap flexWrap="wrap">
133
+ {MUI_STATUS_TONES.map((tone) => (
134
+ <Chip key={tone} color={tone} label={tone} />
135
+ ))}
136
+ </Stack>
137
+ <Stack direction="row" spacing={1} useFlexGap flexWrap="wrap">
138
+ {MUI_STATUS_TONES.map((tone) => (
139
+ <Alert key={tone} severity={tone} variant="filled">{tone}</Alert>
140
+ ))}
141
+ </Stack>
142
+ </Stack>
143
+
122
144
  <Stack direction="column" spacing={2} alignItems="flex-start" sx={{ '@container (min-width: 900px)': { flexDirection: 'row' } }}>
123
145
  <TextField label="Project name" defaultValue="Baseline harness" fullWidth />
124
146
  <FormControl fullWidth>
@@ -165,6 +187,42 @@ function ThemeBaselineEntry() {
165
187
  height={320}
166
188
  />
167
189
  </ChartFrame>
190
+
191
+ <Stack
192
+ direction="column"
193
+ spacing={2}
194
+ sx={{ '@container (min-width: 900px)': { flexDirection: 'row' } }}
195
+ >
196
+ <ChartFrame title="Chart defaults" subtitle="No caller chrome props" minHeight={360}>
197
+ <LineChart
198
+ xAxis={[{ data: ['Jan', 'Feb', 'Mar', 'Apr'] }]}
199
+ series={[
200
+ { label: 'Observed', data: [8, 12, 10, 16] },
201
+ { label: 'Forecast', data: [7, 11, 13, 15] },
202
+ ]}
203
+ xAxisLabel="Month"
204
+ yAxisLabel="Cases"
205
+ height={320}
206
+ />
207
+ </ChartFrame>
208
+ <ChartFrame title="Caller overrides" subtitle="Tuned ticks, marks, grid and legend" minHeight={360}>
209
+ <LineChart
210
+ xAxis={[{
211
+ data: ['Jan', 'Feb', 'Mar', 'Apr'],
212
+ tickLabelStyle: { fontSize: 14, angle: -25 },
213
+ }]}
214
+ series={[
215
+ { label: 'Observed', data: [8, 12, 10, 16], showMark: true },
216
+ { label: 'Forecast', data: [7, 11, 13, 15], showMark: true },
217
+ ]}
218
+ xAxisLabel="Month"
219
+ yAxisLabel="Cases"
220
+ grid={{ vertical: true }}
221
+ legendPosition={{ vertical: 'top', horizontal: 'end' }}
222
+ height={320}
223
+ />
224
+ </ChartFrame>
225
+ </Stack>
168
226
  </Stack>
169
227
  );
170
228
  }
@@ -12,21 +12,23 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React from 'react';
14
14
  import { Box } from '@mui/material';
15
+ import { useTheme } from '@mui/material/styles';
15
16
  import { BarChart as MuiBarChart } from '@mui/x-charts/BarChart';
16
17
  import { useNeutralChartPalette } from './palette';
17
- function labelledAxis(axes, label, defaults) {
18
- const values = (axes === null || axes === void 0 ? void 0 : axes.length) ? axes : [defaults];
19
- return values.map((axis) => (Object.assign(Object.assign({}, axis), { label: axis.label || label })));
20
- }
18
+ import { DEFAULT_LEGEND_POSITION, spaceForRotatedTicks, withAxisDefaults, withChartSlotDefaults, withGridDefaults, } from './chartDefaults';
21
19
  /**
22
20
  * Responsive MUI X-Charts bar preset. xAxisLabel and yAxisLabel (including units) are required.
23
21
  * It supplies labelled axes, tooltips, and an automatic multi-series legend.
24
22
  */
25
23
  export function BarChart(_a) {
26
- var { series = [], xAxisLabel, yAxisLabel, xAxis, yAxis, palette, minHeight, aspect } = _a, chartProps = __rest(_a, ["series", "xAxisLabel", "yAxisLabel", "xAxis", "yAxis", "palette", "minHeight", "aspect"]);
24
+ var { series = [], xAxisLabel, yAxisLabel, xAxis, yAxis, palette, minHeight, aspect, grid, hideLegend = series.length <= 1, legendPosition = DEFAULT_LEGEND_POSITION, margin, slotProps } = _a, chartProps = __rest(_a, ["series", "xAxisLabel", "yAxisLabel", "xAxis", "yAxis", "palette", "minHeight", "aspect", "grid", "hideLegend", "legendPosition", "margin", "slotProps"]);
25
+ const theme = useTheme();
27
26
  const neutralPalette = useNeutralChartPalette();
28
27
  if (!xAxisLabel || !yAxisLabel) {
29
28
  throw new Error('BarChart requires xAxisLabel and yAxisLabel.');
30
29
  }
31
- return (_jsx(Box, { "data-testid": "bar-chart-container", sx: { width: '100%', minHeight, aspectRatio: aspect }, children: _jsx(MuiBarChart, Object.assign({}, chartProps, { series: series, xAxis: labelledAxis(xAxis, xAxisLabel, { scaleType: 'band', data: [] }), yAxis: labelledAxis(yAxis, yAxisLabel, { scaleType: 'linear' }), colors: palette || neutralPalette.categorical, hideLegend: series.length <= 1, slotProps: { tooltip: { trigger: 'axis' } } })) }));
30
+ const labelledXAxis = withAxisDefaults(xAxis, xAxisLabel, { scaleType: 'band', data: [] }, theme.typography.caption.fontSize);
31
+ const labelledYAxis = withAxisDefaults(yAxis, yAxisLabel, { scaleType: 'linear' }, theme.typography.caption.fontSize);
32
+ const rotatedTickSpace = spaceForRotatedTicks(labelledXAxis, margin, theme.typography.caption.lineHeight);
33
+ return (_jsx(Box, { "data-testid": "bar-chart-container", sx: { width: '100%', minHeight, aspectRatio: aspect }, children: _jsx(MuiBarChart, Object.assign({}, chartProps, { series: series, xAxis: rotatedTickSpace.xAxis, yAxis: labelledYAxis, colors: palette || neutralPalette.categorical, grid: withGridDefaults(grid), hideLegend: hideLegend, margin: rotatedTickSpace.margin, slotProps: withChartSlotDefaults(slotProps, legendPosition) })) }));
32
34
  }
@@ -12,21 +12,38 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React from 'react';
14
14
  import { Box } from '@mui/material';
15
- import { LineChart as MuiLineChart } from '@mui/x-charts/LineChart';
15
+ import { useTheme } from '@mui/material/styles';
16
+ import { LineChart as MuiLineChart, MarkElement as MuiMarkElement, } from '@mui/x-charts/LineChart';
16
17
  import { useNeutralChartPalette } from './palette';
17
- function labelledAxis(axes, label, defaults) {
18
- const values = (axes === null || axes === void 0 ? void 0 : axes.length) ? axes : [defaults];
19
- return values.map((axis) => (Object.assign(Object.assign({}, axis), { label: axis.label || label })));
18
+ import { DEFAULT_LEGEND_POSITION, spaceForRotatedTicks, withAxisDefaults, withChartSlotDefaults, withGridDefaults, } from './chartDefaults';
19
+ // Fixes MUI's hollow `background.paper`-filled marker (MarkElement.js's own
20
+ // `styled()` default). CHART-6's WO named a `MuiMarkElement` theme-token
21
+ // override in src/theme/tokens.js as the preferred mechanism, with a
22
+ // per-wrapper slots/sx override as the documented fallback. This uses the
23
+ // fallback deliberately, not because the theme route was infeasible: a
24
+ // wrapper-level fix applies to every consumer immediately on this version
25
+ // bump, including the 14 apps that haven't adopted `createAppTheme` yet
26
+ // (THEME-1 is a separate, optional pin bump) -- a theme-token override would
27
+ // only take effect for apps on the new baseline theme. Composes correctly
28
+ // with a caller's own `slots.mark` (spread after this default, so it wins).
29
+ function FilledMarkElement(_a) {
30
+ var { color, style } = _a, props = __rest(_a, ["color", "style"]);
31
+ return _jsx(MuiMarkElement, Object.assign({}, props, { color: color, style: Object.assign({ fill: color }, style) }));
20
32
  }
21
33
  /**
22
34
  * Responsive MUI X-Charts line preset. xAxisLabel and yAxisLabel (including units) are required.
23
35
  * It supplies labelled axes, tooltips, and an automatic multi-series legend.
24
36
  */
25
37
  export function LineChart(_a) {
26
- var { series = [], xAxisLabel, yAxisLabel, xAxis, yAxis, palette, minHeight, aspect } = _a, chartProps = __rest(_a, ["series", "xAxisLabel", "yAxisLabel", "xAxis", "yAxis", "palette", "minHeight", "aspect"]);
38
+ var { series = [], xAxisLabel, yAxisLabel, xAxis, yAxis, palette, minHeight, aspect, grid, hideLegend = series.length <= 1, legendPosition = DEFAULT_LEGEND_POSITION, margin, slots, slotProps } = _a, chartProps = __rest(_a, ["series", "xAxisLabel", "yAxisLabel", "xAxis", "yAxis", "palette", "minHeight", "aspect", "grid", "hideLegend", "legendPosition", "margin", "slots", "slotProps"]);
39
+ const theme = useTheme();
27
40
  const neutralPalette = useNeutralChartPalette();
28
41
  if (!xAxisLabel || !yAxisLabel) {
29
42
  throw new Error('LineChart requires xAxisLabel and yAxisLabel.');
30
43
  }
31
- return (_jsx(Box, { "data-testid": "line-chart-container", sx: { width: '100%', minHeight, aspectRatio: aspect }, children: _jsx(MuiLineChart, Object.assign({}, chartProps, { series: series, xAxis: labelledAxis(xAxis, xAxisLabel, { scaleType: 'point', data: [] }), yAxis: labelledAxis(yAxis, yAxisLabel, { scaleType: 'linear' }), colors: palette || neutralPalette.categorical, hideLegend: series.length <= 1, slotProps: { tooltip: { trigger: 'axis' } } })) }));
44
+ const labelledXAxis = withAxisDefaults(xAxis, xAxisLabel, { scaleType: 'point', data: [] }, theme.typography.caption.fontSize);
45
+ const labelledYAxis = withAxisDefaults(yAxis, yAxisLabel, { scaleType: 'linear' }, theme.typography.caption.fontSize);
46
+ const rotatedTickSpace = spaceForRotatedTicks(labelledXAxis, margin, theme.typography.caption.lineHeight);
47
+ const defaultedSeries = series.map((item) => (Object.assign({ showMark: false, labelMarkType: 'square' }, item)));
48
+ return (_jsx(Box, { "data-testid": "line-chart-container", sx: { width: '100%', minHeight, aspectRatio: aspect }, children: _jsx(MuiLineChart, Object.assign({}, chartProps, { series: defaultedSeries, xAxis: rotatedTickSpace.xAxis, yAxis: labelledYAxis, colors: palette || neutralPalette.categorical, grid: withGridDefaults(grid), hideLegend: hideLegend, margin: rotatedTickSpace.margin, slots: Object.assign({ mark: FilledMarkElement }, slots), slotProps: withChartSlotDefaults(slotProps, legendPosition) })) }));
32
49
  }
@@ -66,6 +66,15 @@ const RANGE_OPTIONS = [
66
66
  { key: '1m', granularity: 'day', labelKey: 'TimeSeriesChart.RANGE_1_MONTH' },
67
67
  { key: '1y', granularity: 'month', labelKey: 'TimeSeriesChart.RANGE_1_YEAR' },
68
68
  ];
69
+ function SeriesToggleDot({ color, active }) {
70
+ return (_jsx(Box, { component: "span", "data-testid": "series-colour-dot", sx: {
71
+ width: (theme) => theme.spacing(1.5),
72
+ height: (theme) => theme.spacing(1.5),
73
+ borderRadius: '50%',
74
+ bgcolor: color,
75
+ opacity: active ? 1 : 0.35,
76
+ } }));
77
+ }
69
78
  /**
70
79
  * A time-series preset on ChartFrame + BarChart: a range picker (emits the
71
80
  * selected range AND its mapped granularity to the host) and series toggle
@@ -81,7 +90,7 @@ const RANGE_OPTIONS = [
81
90
  * (requires `secondaryYAxisLabel`). Omit `axis` (or set it to `'primary'`)
82
91
  * on every series for today's single-shared-axis behaviour, unchanged.
83
92
  */
84
- export function TimeSeriesChart({ title, subtitle, xAxisLabel, yAxisLabel, secondaryYAxisLabel, data, loading = false, error = false, onRangeChange, defaultRange = '1w', }) {
93
+ export function TimeSeriesChart({ title, subtitle, xAxisLabel, yAxisLabel, secondaryYAxisLabel, data, loading = false, error = false, onRangeChange, defaultRange = '1w', skipAnimation, }) {
85
94
  const { t } = useTranslation();
86
95
  const palette = useNeutralChartPalette().categorical;
87
96
  const seriesConfig = (data === null || data === void 0 ? void 0 : data.series) || [];
@@ -153,13 +162,13 @@ export function TimeSeriesChart({ title, subtitle, xAxisLabel, yAxisLabel, secon
153
162
  Object.assign({ id: 'secondary', label: secondaryYAxisLabel, position: 'right' }, (isIntegerAxis(secondaryVisibleSeries) ? { valueFormatter: integerTickFormatter } : {})),
154
163
  ]
155
164
  : (isIntegerAxis(primaryVisibleSeries) ? [{ valueFormatter: integerTickFormatter }] : undefined);
156
- const toolbar = (_jsxs(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: 3, alignItems: 'center' }, children: [_jsx(RadioGroup, { row: true, value: range, onChange: handleRangeChange, "aria-label": t('TimeSeriesChart.RANGE_LABEL'), children: RANGE_OPTIONS.map((option) => (_jsx(FormControlLabel, { value: option.key, control: _jsx(Radio, { size: "small" }), label: t(option.labelKey) }, option.key))) }), seriesConfig.length > 0 && (_jsx(FormGroup, { row: true, "aria-label": t('TimeSeriesChart.SERIES_LABEL'), children: seriesConfig.map((series, index) => (_jsx(FormControlLabel, { control: (_jsx(Checkbox, { size: "small", checked: visibleKeys.has(series.key), onChange: () => toggleSeries(series.key), sx: {
165
+ const toolbar = (_jsxs(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: 3, alignItems: 'center' }, children: [_jsx(RadioGroup, { row: true, value: range, onChange: handleRangeChange, "aria-label": t('TimeSeriesChart.RANGE_LABEL'), children: RANGE_OPTIONS.map((option) => (_jsx(FormControlLabel, { value: option.key, control: _jsx(Radio, { size: "small" }), label: t(option.labelKey) }, option.key))) }), seriesConfig.length > 0 && (_jsx(FormGroup, { row: true, "aria-label": t('TimeSeriesChart.SERIES_LABEL'), children: seriesConfig.map((series, index) => (_jsx(FormControlLabel, { control: (_jsx(Checkbox, { size: "small", checked: visibleKeys.has(series.key), onChange: () => toggleSeries(series.key), icon: _jsx(SeriesToggleDot, { color: palette[index % palette.length], active: false }), checkedIcon: _jsx(SeriesToggleDot, { color: palette[index % palette.length], active: true }), sx: {
157
166
  color: palette[index % palette.length],
158
167
  '&.Mui-checked': { color: palette[index % palette.length] },
159
168
  } })), label: series.label }, series.key))) }))] }));
160
169
  return (_jsx(ChartFrame, { title: title, subtitle: subtitle, toolbar: toolbar, loading: loading, error: error, isEmpty: isDataEmpty, minHeight: CHART_HEIGHT, children: !isDataEmpty && (_jsx(BarChart, { xAxisLabel: xAxisLabel, yAxisLabel: yAxisLabel, xAxis: [{
161
170
  data: (data === null || data === void 0 ? void 0 : data.xLabels) || [],
162
171
  tickLabelInterval: makeTickLabelInterval(((data === null || data === void 0 ? void 0 : data.xLabels) || []).length),
163
- }], yAxis: yAxis, series: visibleSeries.map((series) => (Object.assign({ data: series.data, label: series.label }, (hasSecondaryAxis && series.axis === 'secondary' ? { yAxisId: 'secondary' } : {})))), palette: visiblePalette, height: CHART_HEIGHT })) }));
172
+ }], yAxis: yAxis, series: visibleSeries.map((series) => (Object.assign({ data: series.data, label: series.label }, (hasSecondaryAxis && series.axis === 'secondary' ? { yAxisId: 'secondary' } : {})))), palette: visiblePalette, height: CHART_HEIGHT, hideLegend: seriesConfig.length > 0, skipAnimation: skipAnimation })) }));
164
173
  }
165
174
  export default TimeSeriesChart;
@@ -0,0 +1,85 @@
1
+ export const DEFAULT_LEGEND_POSITION = {
2
+ vertical: 'bottom',
3
+ horizontal: 'start',
4
+ };
5
+ export function withGridDefaults(grid) {
6
+ return Object.assign({ horizontal: true }, grid);
7
+ }
8
+ export function withAxisDefaults(axes, label, defaults, tickFontSize) {
9
+ const values = (axes === null || axes === void 0 ? void 0 : axes.length) ? axes : [defaults];
10
+ return values.map((axis) => (Object.assign(Object.assign(Object.assign({}, defaults), axis), { tickLabelStyle: Object.assign({ fontSize: tickFontSize }, axis.tickLabelStyle), label: axis.label || label })));
11
+ }
12
+ function cssLengthToPixels(value) {
13
+ if (typeof value === 'number')
14
+ return value;
15
+ if (typeof value !== 'string')
16
+ return 0;
17
+ const parsed = Number.parseFloat(value);
18
+ if (!Number.isFinite(parsed))
19
+ return 0;
20
+ if (value.endsWith('rem') || value.endsWith('em'))
21
+ return parsed * 16;
22
+ return parsed;
23
+ }
24
+ const MUI_LABELLED_X_AXIS_HEIGHT = 45;
25
+ const MUI_CHART_MARGIN_BOTTOM = 20;
26
+ const AVERAGE_GLYPH_WIDTH_EM = 0.6;
27
+ function formattedTickText(axis, value) {
28
+ if (!axis.valueFormatter)
29
+ return String(value);
30
+ try {
31
+ return String(axis.valueFormatter(value, { location: 'tick' }));
32
+ }
33
+ catch (_a) {
34
+ // Some formatters require MUI's complete scale context. Falling back to
35
+ // the raw value is conservative: it reserves at least as much space.
36
+ return String(value);
37
+ }
38
+ }
39
+ function rotatedTickMetrics(axis, defaultLineHeight) {
40
+ var _a, _b, _c;
41
+ const angle = Number((_a = axis.tickLabelStyle) === null || _a === void 0 ? void 0 : _a.angle) || 0;
42
+ if (angle === 0)
43
+ return null;
44
+ const fontSize = cssLengthToPixels((_b = axis.tickLabelStyle) === null || _b === void 0 ? void 0 : _b.fontSize);
45
+ if (fontSize === 0)
46
+ return null;
47
+ const lineHeight = Number((_c = axis.tickLabelStyle) === null || _c === void 0 ? void 0 : _c.lineHeight) || defaultLineHeight;
48
+ const longestLabel = (axis.data || []).reduce((longest, value) => {
49
+ const text = formattedTickText(axis, value);
50
+ return text.length > longest.length ? text : longest;
51
+ }, '');
52
+ const textWidth = Math.max(fontSize, longestLabel.length * fontSize * AVERAGE_GLYPH_WIDTH_EM);
53
+ const radians = (angle * Math.PI) / 180;
54
+ const projectedHeight = Math.abs(Math.cos(radians)) * fontSize * lineHeight
55
+ + Math.abs(Math.sin(radians)) * textWidth;
56
+ const extraHeight = Math.max(1, Math.ceil(projectedHeight - fontSize));
57
+ return { extraHeight };
58
+ }
59
+ /**
60
+ * Rotated labels project both their line box and text width vertically.
61
+ * X-Charts uses xAxis.height when deciding whether a label fits, while margin
62
+ * only separates the axis from the SVG edge, so both surfaces must grow.
63
+ * Explicit caller height and bottom-margin values always remain untouched.
64
+ */
65
+ export function spaceForRotatedTicks(xAxis, margin, defaultLineHeight = 1) {
66
+ let largestExtraHeight = 0;
67
+ const spacedXAxis = xAxis.map((axis) => {
68
+ const metrics = rotatedTickMetrics(axis, defaultLineHeight);
69
+ if (!metrics)
70
+ return axis;
71
+ largestExtraHeight = Math.max(largestExtraHeight, metrics.extraHeight);
72
+ if (axis.height != null)
73
+ return axis;
74
+ return Object.assign(Object.assign({}, axis), { height: MUI_LABELLED_X_AXIS_HEIGHT + metrics.extraHeight });
75
+ });
76
+ const callerSetBottom = typeof margin === 'number' || (margin === null || margin === void 0 ? void 0 : margin.bottom) != null;
77
+ const spacedMargin = largestExtraHeight > 0 && !callerSetBottom
78
+ ? Object.assign(Object.assign({}, margin), { bottom: MUI_CHART_MARGIN_BOTTOM + largestExtraHeight }) : margin;
79
+ return { xAxis: spacedXAxis, margin: spacedMargin };
80
+ }
81
+ export function withChartSlotDefaults(slotProps, legendPosition) {
82
+ var _a;
83
+ const position = Object.assign(Object.assign(Object.assign({}, DEFAULT_LEGEND_POSITION), legendPosition), (_a = slotProps === null || slotProps === void 0 ? void 0 : slotProps.legend) === null || _a === void 0 ? void 0 : _a.position);
84
+ return Object.assign(Object.assign({}, slotProps), { tooltip: Object.assign({ trigger: 'axis' }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.tooltip), legend: Object.assign(Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.legend), { position }) });
85
+ }
@@ -0,0 +1,31 @@
1
+ // Short, granularity-aware x-axis tick labels.
2
+ //
3
+ // Not a style choice -- MUI X-Charts has a known, unfixed bug (mui-x#18768,
4
+ // duplicate of #18399): when the measured space for a tick label gets
5
+ // tight, its ellipsize() logic doesn't truncate the text, it collapses it
6
+ // to an empty string (the <tspan> stays in the DOM with no content). It
7
+ // only reproduces with long label text ("08/05, 10:00 AM"-style, ~16
8
+ // characters) combined with this app's actual font metrics (DM Sans) --
9
+ // short labels like "05.08." or "10:00" leave enough margin that the bug
10
+ // never triggers. Same fix already proven in jg-ferien's ActivitySection.
11
+ // `locale` defaults to "de-CH" only as a fallback for callers that don't
12
+ // pass the app's active i18n language (found in review: an earlier version
13
+ // hardcoded "de-CH" always, showing German month names to en/fr users).
14
+ export function formatShortTime(date, locale = 'de-CH') {
15
+ // hour12 forced false regardless of locale -- an English 12-hour label
16
+ // ("10:00 AM") is exactly the longer style that triggered the original
17
+ // collapse bug; staying short is the point, not locale fidelity here.
18
+ return date.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: false });
19
+ }
20
+ export function formatShortDate(date, locale = 'de-CH') {
21
+ return date.toLocaleDateString(locale, { day: '2-digit', month: '2-digit' });
22
+ }
23
+ export function formatShortMonth(date, locale = 'de-CH') {
24
+ return date.toLocaleDateString(locale, { month: 'short', year: '2-digit' });
25
+ }
26
+ // "All" spans years -- day/month labels repeat (e.g. every "01.04." shows up
27
+ // once per year) and read as meaningless noise; a bare year number is the
28
+ // only granularity dense multi-year history can show cleanly.
29
+ export function formatShortYear(date, locale = 'de-CH') {
30
+ return date.toLocaleDateString(locale, { year: 'numeric' });
31
+ }
@@ -0,0 +1,7 @@
1
+ /** Return one January tick for every calendar year represented in dates. */
2
+ export function yearTickInterval(dates) {
3
+ const years = new Set(dates.map((date) => date.getFullYear()));
4
+ return [...years]
5
+ .sort((first, second) => first - second)
6
+ .map((year) => new Date(year, 0, 1));
7
+ }
package/dist/index.js CHANGED
@@ -36,6 +36,8 @@ export { BarChart } from './components/charts/BarChart';
36
36
  export { LineChart } from './components/charts/LineChart';
37
37
  export { TimeSeriesChart } from './components/charts/TimeSeriesChart';
38
38
  export { getNeutralChartPalette, useNeutralChartPalette } from './components/charts/palette';
39
+ export { formatShortTime, formatShortDate, formatShortMonth, formatShortYear, } from './components/charts/chartLabels';
40
+ export { yearTickInterval } from './components/charts/yearTickInterval';
39
41
  export { formatPercentage, formatCompact, formatRatio, createChartFormatters, useChartFormatters, } from './components/charts/formatters';
40
42
  // --- 7. Translations ---
41
43
  export { authTranslations } from './i18n/authTranslations';
@@ -1,2 +1,4 @@
1
1
  export { createAppTheme } from './createAppTheme';
2
2
  export { assertThemeComplete, calculateContrastRatio, reportThemeAdoption, THEME_COMPLETENESS_SURFACES, } from './themeCompleteness';
3
+ export { formatShortTime, formatShortDate, formatShortMonth, formatShortYear, } from '../components/charts/chartLabels';
4
+ export { yearTickInterval } from '../components/charts/yearTickInterval';
@@ -219,7 +219,7 @@ export function calculateContrastRatio(foreground, background) {
219
219
  return (light + 0.05) / (dark + 0.05);
220
220
  }
221
221
  function contrastFindings(theme) {
222
- var _a, _b, _c, _d, _e;
222
+ var _a, _b, _c, _d, _e, _f, _g;
223
223
  const findings = [];
224
224
  for (const status of STATUS_KEYS) {
225
225
  const tokens = (_a = theme.palette) === null || _a === void 0 ? void 0 : _a[status];
@@ -248,8 +248,24 @@ function contrastFindings(theme) {
248
248
  white: '#FFFFFF',
249
249
  page: (_c = (_b = theme.palette) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c.default,
250
250
  };
251
+ for (const status of STATUS_KEYS) {
252
+ const main = (_e = (_d = theme.palette) === null || _d === void 0 ? void 0 : _d[status]) === null || _e === void 0 ? void 0 : _e.main;
253
+ if (!main)
254
+ continue;
255
+ for (const [surface, background] of Object.entries(backgrounds)) {
256
+ const ratio = calculateContrastRatio(main, background);
257
+ if (!Number.isFinite(ratio) || ratio < 4.5) {
258
+ findings.push({
259
+ surface: `contrast.${status}.main-on-${surface}`,
260
+ reason: Number.isFinite(ratio)
261
+ ? `Expected at least 4.5:1; received ${ratio.toFixed(2)}:1.`
262
+ : 'Contrast could not be calculated from the declared colours.',
263
+ });
264
+ }
265
+ }
266
+ }
251
267
  for (const state of ['main', 'hover', 'focus', 'error']) {
252
- const colour = (_e = (_d = theme.palette) === null || _d === void 0 ? void 0 : _d.controlBorder) === null || _e === void 0 ? void 0 : _e[state];
268
+ const colour = (_g = (_f = theme.palette) === null || _f === void 0 ? void 0 : _f.controlBorder) === null || _g === void 0 ? void 0 : _g[state];
253
269
  if (!colour)
254
270
  continue;
255
271
  for (const [surface, background] of Object.entries(backgrounds)) {
@@ -62,7 +62,7 @@ export const BASELINE_PALETTE = {
62
62
  error: '#BF3227',
63
63
  },
64
64
  success: Object.assign(Object.assign({}, withMainShades('#1B8038', '#FFFFFF')), { text: '#35794A', fill: '#1B8038', fillText: '#FFFFFF', bg: '#E5F4E9' }),
65
- warning: Object.assign(Object.assign({}, withMainShades('#C08A2C', '#212529')), { text: '#976100', fill: '#C08A2C', fillText: '#212529', bg: '#FBF0DC' }),
65
+ warning: Object.assign(Object.assign({}, withMainShades('#976100', '#FFFFFF')), { text: '#976100', fill: '#C08A2C', fillText: '#212529', bg: '#FBF0DC' }),
66
66
  error: Object.assign(Object.assign({}, withMainShades('#BF3227', '#FFFFFF')), { text: '#BF3227', fill: '#BF3227', fillText: '#FFFFFF', bg: '#FBEAE8' }),
67
67
  // The canonical sheet introduces no new info hue. These values reuse
68
68
  // MUI's own info.dark/main family while adding the shared status shape.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "2.30.0",
3
+ "version": "2.31.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "repository": {
@@ -1,12 +1,15 @@
1
1
  import React from 'react';
2
2
  import { Box } from '@mui/material';
3
+ import { useTheme } from '@mui/material/styles';
3
4
  import { BarChart as MuiBarChart } from '@mui/x-charts/BarChart';
4
5
  import { useNeutralChartPalette } from './palette';
5
-
6
- function labelledAxis(axes, label, defaults) {
7
- const values = axes?.length ? axes : [defaults];
8
- return values.map((axis) => ({ ...axis, label: axis.label || label }));
9
- }
6
+ import {
7
+ DEFAULT_LEGEND_POSITION,
8
+ spaceForRotatedTicks,
9
+ withAxisDefaults,
10
+ withChartSlotDefaults,
11
+ withGridDefaults,
12
+ } from './chartDefaults';
10
13
 
11
14
  /**
12
15
  * Responsive MUI X-Charts bar preset. xAxisLabel and yAxisLabel (including units) are required.
@@ -21,23 +24,49 @@ export function BarChart({
21
24
  palette,
22
25
  minHeight,
23
26
  aspect,
27
+ grid,
28
+ hideLegend = series.length <= 1,
29
+ legendPosition = DEFAULT_LEGEND_POSITION,
30
+ margin,
31
+ slotProps,
24
32
  ...chartProps
25
33
  }) {
34
+ const theme = useTheme();
26
35
  const neutralPalette = useNeutralChartPalette();
27
36
  if (!xAxisLabel || !yAxisLabel) {
28
37
  throw new Error('BarChart requires xAxisLabel and yAxisLabel.');
29
38
  }
30
39
 
40
+ const labelledXAxis = withAxisDefaults(
41
+ xAxis,
42
+ xAxisLabel,
43
+ { scaleType: 'band', data: [] },
44
+ theme.typography.caption.fontSize,
45
+ );
46
+ const labelledYAxis = withAxisDefaults(
47
+ yAxis,
48
+ yAxisLabel,
49
+ { scaleType: 'linear' },
50
+ theme.typography.caption.fontSize,
51
+ );
52
+ const rotatedTickSpace = spaceForRotatedTicks(
53
+ labelledXAxis,
54
+ margin,
55
+ theme.typography.caption.lineHeight,
56
+ );
57
+
31
58
  return (
32
59
  <Box data-testid="bar-chart-container" sx={{ width: '100%', minHeight, aspectRatio: aspect }}>
33
60
  <MuiBarChart
34
61
  {...chartProps}
35
62
  series={series}
36
- xAxis={labelledAxis(xAxis, xAxisLabel, { scaleType: 'band', data: [] })}
37
- yAxis={labelledAxis(yAxis, yAxisLabel, { scaleType: 'linear' })}
63
+ xAxis={rotatedTickSpace.xAxis}
64
+ yAxis={labelledYAxis}
38
65
  colors={palette || neutralPalette.categorical}
39
- hideLegend={series.length <= 1}
40
- slotProps={{ tooltip: { trigger: 'axis' } }}
66
+ grid={withGridDefaults(grid)}
67
+ hideLegend={hideLegend}
68
+ margin={rotatedTickSpace.margin}
69
+ slotProps={withChartSlotDefaults(slotProps, legendPosition)}
41
70
  />
42
71
  </Box>
43
72
  );