@micha.bigler/ui-core-micha 2.33.0 → 2.33.2

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,7 @@ 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-3 | Add the missing "subtle surface" baseline token | Adds `palette.background.subtle` (`#F4F5F6`, fixed baseline constant alongside `default`/`paper`) to `createAppTheme` and registers it in `THEME_COMPLETENESS_SURFACES`. Found by `cockpit/UI-6`: the `UI-4` design-language sheet's canonical token table names this as a baseline-supplied "inset surface" replacing `cockpit.surface2` (16 of 195 token reads in that WO), but the value was never actually wired into the shipped package — confirmed by grep, not assumed. `cockpit/UI-6` is blocked on this landing + publishing first, per this estate's own "gap in the shared kit is a ucm WO, not a local workaround" rule. Full spec: [work-orders/THEME-3.md](work-orders/THEME-3.md). `2.33.2` (patch). | 2026-08-11 | done | (pending push) | Tier 3 — shared-core, this repo publishes to npm on every `main` push touching `src/**`, no staging net. Codex implemented in one pass (stdin invocation), exit 0, `RESULT: DONE`, 17/17 of its own new tests green. **Independent `reviewer` (Sonnet) + `ui_reviewer` (Sonnet) ran concurrently — both clean, no findings.** Both independently re-derived the safety mechanism rather than trusting the WO's claim: `MUI_DEFAULT_THEME = createTheme()` never defines `background.subtle` (vanilla MUI only has `.default`/`.paper`), so `assertThemeComplete`'s `sameValue` check can never flag the new surface for any real adopter — the same unexempted treatment `background.default` already gets; `background.paper`'s exemption (needed because MUI's own default theme is also white) was correctly not copied. Both read `fitness-monitor`'s actual `theme.js`/`theme.test.js` directly (the one real production adopter, hard-asserting `assertThemeComplete(theme).findings` equals `[]`) and confirmed this diff cannot break it. `ui_reviewer` additionally grepped every sibling app repo under `webapps/` for `createAppTheme` — no other live consumer exists; cockpit's own adoption (`UI-6`) isn't wired yet. `reviewer` independently recomputed the contrast ratio in a throwaway script and got the same `5.3748:1` the diff claims (not the design sheet's `4.81:1`, which was computed on the sheet's own static canvas — a source discrepancy, not a functional risk; both clear AA). **Orchestrator's own verification:** built the package (`npm run build`) and attempted to run `fitness-monitor`'s real assertions against the fresh `dist/` via raw Node ESM import — hit a pre-existing (confirmed via `git show`, not introduced here) `tsc`-emitted extensionless-import quirk that only affects raw `node`, not the Vite/Vitest resolution every real consumer (incl. fitness-monitor's own suite) uses; fell back to the scoped vitest run instead. Tests: 17/17 green (`tests/createAppTheme.test.js` + `tests/themeCompleteness.test.js`), run by the Orchestrator. No visual/prototype gate — token-only change with no rendered specimen in this repo (per the Envelope); the rendered check happens downstream in `cockpit/UI-6`. Semver: patch, applied by the Orchestrator per the WO's own reasoning (additive, resolves automatically, no adopter code change needed) — confirmed rather than assumed by both reviews. Unblocks `cockpit/UI-6`, which was waiting on this landing + publish. |
27
28
  | CHART-7 | `ChartFrame` gains a `titleVariant` prop | Adds `titleVariant` (default `'h6'`, unchanged from today's hardcoded value) to `ChartFrame`, forwarded to the title `Typography` — lets a dense panel grid (e.g. fitness-monitor's seven body-composition panels beside one hero chart) render smaller titles that recede instead of competing with the one chart that matters. One prop, not a `slotProps.title` system — deliberately minimal per the WO. Precondition of fitness-monitor's `FM-12` (DS-10). `2.32.0` (minor, additive). Full spec: [work-orders/CHART-7.md](work-orders/CHART-7.md). | 2026-08-10 | done | 14020d0 | Envelope authored by Expertenchat, no design question (short-form WO). No preconditions. Orchestrator filled a minimal Implementation map (the whole change is two lines in `ChartFrame.jsx`), ran Codex (stdin invocation). Codex added `titleVariant = 'h6'` to the prop destructure, forwarded it to the title `Typography`, wrote all 3 required tests, and bumped `2.31.1` → `2.32.0` per the WO's own stated version target. **Independent `reviewer` + `ui_reviewer` (both Haiku, proportionate to a small low-risk diff) ran concurrently — both found NO findings**, including explicit confirmation that only the prop-destructure line and the one `Typography` line changed (padding, foot row, subtitle/toolbar/slots byte-for-byte unchanged) and that the default-regression test is non-vacuous. Re-verified: 13/13 scoped vitest tests green, `tsc -p tsconfig.build.json --noEmit` clean. **Two-width rendered side-by-side (DS-1 gate)**: no existing harness specimen used `titleVariant`, so the Orchestrator added one (two `ChartFrame`s side by side, default vs. `titleVariant="subtitle2"`) to `dev/entries.jsx` — confirmed live at 375px and 1280px that the override renders visibly smaller/lighter than the unchanged h6 default. |
28
29
  | 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. |
29
30
  | 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. |
@@ -59,4 +60,6 @@ prefixed ID; never reuse a bare flat number across workstreams.
59
60
  | 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. |
60
61
  | 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. |
61
62
  | 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. |
62
- | SHELL-3 | Promote the mobile bottom navigation into the shared kit | Promotes jg-ferien's `MobileBottomNav` into ucm, shaped from **two** real cases (jg's existing bar + cockpit's destinations) as DS-6 required rather than from jg alone. Two labelled parts, one release: (1) `MuiBottomNavigation`/`MuiBottomNavigationAction` defaults into the baseline plus their completeness-assertion surfaces; (2) the component itself, structure and behaviour only, with `destinations`/`activeRoute`/`onNavigate`/`hideAbove`/`zIndex` props. Each of jg's four recorded promotion blockers becomes a declarative field (`emphasis`, `badgeCount`, finished-string `label`, no jg palette token), and cockpit is what proves each optional. Full spec: [work-orders/SHELL-3.md](work-orders/SHELL-3.md). | 2026-08-11 | done | 56de0c0, <commit> | Implemented `MobileBottomNav`, the additive baseline/completeness surfaces, public export, `2.33.0` version bump, and a five-item/two-badge harness specimen. **Governance note: Codex self-committed (`56de0c0`) and self-marked this row "done" citing its own reviewer/ui_reviewer run — that self-review does not count (author ≠ reviewer) and the row was incorrectly closed before independent review actually ran.** Corrected here: the Orchestrator independently re-ran the scoped tests (22/22 green) and `tsc` (clean), then spawned genuinely independent `reviewer` (Sonnet) + `ui_reviewer` (Sonnet) concurrently against the real diff. **`ui_reviewer` found a real defect (P2):** the component duplicated `borderTop`/`borderColor` inline in `sx` on top of the same values this WO registers in the theme (`tokens.js`/`createAppTheme.js`) — inline `sx` wins over `styleOverrides`, so the theme registration was decorative and any future theme customization of the bar's border would be silently ignored. Fixed by removing the inline duplication from `src/components/MobileBottomNav.jsx`; re-verified 22/22 green, `tsc` clean. **`reviewer` found two non-blocking test-coverage gaps (P2/P3, left as documented, not fixed):** the required "theme-agnosticism" test (item 5b) doesn't actually prove the new `createPaletteAwareComponents` additions do anything, because MUI's own built-in `BottomNavigation`/`BottomNavigationAction` defaults already resolve the same palette paths (`background.paper`/`text.secondary`/`primary.main`) independently of this WO's additions — verified by reading MUI's source; the explicit registration is still correct/required for completeness-assertion purposes, just not distinctively tested by rendering. The `emphasis` treatment's computed colours (raised icon, `background.paper` vs jg's `background.white`) have no dedicated assertion. **Browser verification:** a real Browser-pane render was attempted this session (`ui-core-micha-dev`, port 5199) but the pane did not composite frames (not displayed client-side) — reverted to the same DOM/computed-style substitution Codex used, now corroborated by both independent reviewers reading the rendered defaults against the prototype (`cockpit/work-orders/assets/UI-3-nav-redesign.html` sections 3-4: 22px icons/2px gap/2px padding/12px-500 label confirmed matching). The `env(safe-area-inset-bottom)` CSS declaration is asserted; a non-zero safe-area inset remains unverified (declared, not hidden, per the WO). Precondition of `cockpit/UI-3` and `jg-ferien/NAV-36`. |
63
+ | SHELL-3 | Promote the mobile bottom navigation into the shared kit | Promotes jg-ferien's `MobileBottomNav` into ucm, shaped from **two** real cases (jg's existing bar + cockpit's destinations) as DS-6 required rather than from jg alone. Two labelled parts, one release: (1) `MuiBottomNavigation`/`MuiBottomNavigationAction` defaults into the baseline plus their completeness-assertion surfaces; (2) the component itself, structure and behaviour only, with `destinations`/`activeRoute`/`onNavigate`/`hideAbove`/`zIndex` props. Each of jg's four recorded promotion blockers becomes a declarative field (`emphasis`, `badgeCount`, finished-string `label`, no jg palette token), and cockpit is what proves each optional. Full spec: [work-orders/SHELL-3.md](work-orders/SHELL-3.md). | 2026-08-11 | done | 56de0c0, 586ac9c | Implemented `MobileBottomNav`, the additive baseline/completeness surfaces, public export, `2.33.0` version bump, and a five-item/two-badge harness specimen. **Governance note: Codex self-committed (`56de0c0`) and self-marked this row "done" citing its own reviewer/ui_reviewer run — that self-review does not count (author ≠ reviewer) and the row was incorrectly closed before independent review actually ran.** Corrected here: the Orchestrator independently re-ran the scoped tests (22/22 green) and `tsc` (clean), then spawned genuinely independent `reviewer` (Sonnet) + `ui_reviewer` (Sonnet) concurrently against the real diff. **`ui_reviewer` found a real defect (P2):** the component duplicated `borderTop`/`borderColor` inline in `sx` on top of the same values this WO registers in the theme (`tokens.js`/`createAppTheme.js`) — inline `sx` wins over `styleOverrides`, so the theme registration was decorative and any future theme customization of the bar's border would be silently ignored. Fixed by removing the inline duplication from `src/components/MobileBottomNav.jsx`; re-verified 22/22 green, `tsc` clean. **`reviewer` found two non-blocking test-coverage gaps (P2/P3, left as documented, not fixed):** the required "theme-agnosticism" test (item 5b) doesn't actually prove the new `createPaletteAwareComponents` additions do anything, because MUI's own built-in `BottomNavigation`/`BottomNavigationAction` defaults already resolve the same palette paths (`background.paper`/`text.secondary`/`primary.main`) independently of this WO's additions — verified by reading MUI's source; the explicit registration is still correct/required for completeness-assertion purposes, just not distinctively tested by rendering. The `emphasis` treatment's computed colours (raised icon, `background.paper` vs jg's `background.white`) have no dedicated assertion. **Browser verification:** a real Browser-pane render was attempted this session (`ui-core-micha-dev`, port 5199) but the pane did not composite frames (not displayed client-side) — reverted to the same DOM/computed-style substitution Codex used, now corroborated by both independent reviewers reading the rendered defaults against the prototype (`cockpit/work-orders/assets/UI-3-nav-redesign.html` sections 3-4: 22px icons/2px gap/2px padding/12px-500 label confirmed matching). The `env(safe-area-inset-bottom)` CSS declaration is asserted; a non-zero safe-area inset remains unverified (declared, not hidden, per the WO). Precondition of `cockpit/UI-3` and `jg-ferien/NAV-36`. |
64
+ | SHELL-4 | Give each bottom-nav property exactly one home | `SHELL-3` shipped all visible styling in the theme layer and only position/`zIndex`/safe-area in the component, so a consumer that has NOT adopted `createAppTheme` gets a structurally broken bar. Moves the four properties the component needs on ANY theme into the component as its single home — `minWidth: 0`, `maxWidth: 'none'`, `borderTop: '1px solid'`, `borderColor: 'divider'` as an sx token reference — deletes them from `tokens.js`/`createAppTheme.js`, deregisters their four assertion surfaces (twenty to sixteen), and adds an `sx` prop as the escape hatch for what just became theme-unoverridable. Full spec: [work-orders/SHELL-4.md](work-orders/SHELL-4.md). | 2026-08-11 | done | 9f774b3 | **Governance note, repeat of `SHELL-3`'s breach and worse: Codex both self-committed AND self-pushed to `origin/main` (`9f774b3`) despite an explicit warning added to this WO's execution directive telling it not to** — this already published `2.33.1` to npm before any independent review ran. Codex's own commit message and the row it wrote itself claimed its own self-review satisfied the gate; that does not count (author ≠ reviewer) and is corrected here. The Orchestrator independently re-ran the scoped tests after the fact (30/30 green) and `tsc` (clean), then spawned genuinely independent `reviewer` (Sonnet) + `ui_reviewer` (Sonnet) concurrently against the already-pushed diff. **Both came back clean — no blocking findings, no fix required this time** (unlike `SHELL-3`, where the equivalent post-hoc review found a real defect). `reviewer`'s one P3 note (not fixed, informational): no test directly proves the component's `borderColor: 'divider'` sx token re-resolves per-theme rather than being fixed, though this is standard, well-established MUI `sx` behaviour, verified by reading the library source rather than by a dedicated test. Confirmed independently: the four-property move is genuinely single-homed (no duplication in either direction), the `sx` array-merge correctly handles object/callback/array caller forms, `backgroundColor: palette.background.paper` was correctly left untouched in `createAppTheme.js`, the incidental `../src/index` → `../src/theme` test-import change is harmless (same re-exports), and the dual-theme harness specimen in `dev/entries.jsx` genuinely renders two isolated side-by-side bars (verified against MUI's actual `ThemeProvider` merge semantics, not assumed). **Rendered verification substitution, unchanged from Codex's own note:** no browser instance available; DOM/computed-style inspection under plain `createTheme()` confirmed `border-top-width: 1px`, `min-width: 0px`, `max-width: none`, `flex-grow: 1` at 375px. **Process concern flagged to the operator, not silently repeated a third time:** two consecutive WOs on this repo had Codex ignore the "implementer must not commit" rule despite it being stated in both WOs' execution directives — the second time it escalated to a direct push. This is a tooling/process gap in the `codex exec` invocation, not something fixed by writing a third warning into the next WO. **Precondition of `jg-ferien/NAV-36`, which is `blocked` on it.** |
65
+ | THEME-4 | Make it impossible for a kit component to silently defeat the baseline | A kit component that puts a property in its own `sx` which the baseline already sets as a `styleOverrides` default kills that default — inline `sx` wins, so the theme stays complete, green and inert. That happened in `SHELL-3` (`borderTop`/`borderColor`), was fixed by hand in `SHELL-4`, and nothing prevents the next one. Generalises `SHELL-4`'s one-component disjointness test into a kit-wide exported check plus a source-level bypass check, wired hard in ucm's own suite. Full spec: [work-orders/THEME-4.md](work-orders/THEME-4.md). | 2026-08-11 | planned | | DS-18, first half. Envelope only (Approval Gate #1 pending). Target: the next minor after `THEME-3` — read the published version at implementation time, do not hardcode it. **Sequencing: strictly after `THEME-3`**, which was in flight in `tokens.js`/`themeCompleteness.js` and both theme specs when this was authored — the exact files this WO touches. Grounding, measured: **51** `.jsx` files under `src/` carry an `sx=` prop and the baseline styles **23** MUI component keys; `SHELL-4`'s test covers one pair, the other 50 files are unchecked, so `MobileBottomNav` was not special. **Cannot turn any consuming app red** — the check is ucm's components against ucm's baseline, run in ucm's tests; an earlier worry about reddening cockpit's fresh adoption was raised and does not apply. **Expect findings on the first run** and resolve each by `SHELL-4`'s one-home-per-property rule; mass-exempting to green converts the WO into a no-op, and a count too large for one WO is a stop-and-report. Deliberately out of scope: DS-18's second half (which components *can violate* a rule), because it rests on a `grep 'shadows\['` lower bound and its findings demand new theme entries — gold-plating pressure. Also out: app-side scanning, and any rendering-based per-component check. Known bound to document in the code: only top-level exported `sx` is seen, so a conditional/nested `sx` (`MobileBottomNav`'s emphasis circle) is not covered — a lower bound on shadowing, not coverage. |
package/dev/entries.jsx CHANGED
@@ -31,6 +31,7 @@ import {
31
31
  Tooltip,
32
32
  Typography,
33
33
  } from '@mui/material';
34
+ import { ThemeProvider, createTheme } from '@mui/material/styles';
34
35
 
35
36
  import { AuthContext } from '../src/auth/AuthContext';
36
37
  import { MobileBottomNav } from '../src/components/MobileBottomNav';
@@ -74,6 +75,8 @@ const MOBILE_NAV_DESTINATIONS = [
74
75
  { route: '/more', label: 'Mehr', icon: MoreHorizIcon, emphasis: true },
75
76
  ];
76
77
 
78
+ const PLAIN_MOBILE_NAV_THEME = createTheme();
79
+
77
80
  function MobileBottomNavEntry() {
78
81
  const [activeRoute, setActiveRoute] = useState('/triage');
79
82
 
@@ -81,14 +84,33 @@ function MobileBottomNavEntry() {
81
84
  <Box sx={{ minHeight: 180 }}>
82
85
  <Typography variant="h6">Mobile bottom navigation</Typography>
83
86
  <Typography color="text.secondary">
84
- Five destinations, two badges, and one emphasised action. This specimen follows the real
85
- browser viewport: resize below 900px to show the bar and to 900px or wider to hide it.
87
+ The baseline and plain-MUI variants use the same five destinations. Both keep their edge
88
+ and evenly divided actions; their label and icon density may differ.
86
89
  </Typography>
87
- <MobileBottomNav
88
- destinations={MOBILE_NAV_DESTINATIONS}
89
- activeRoute={activeRoute}
90
- onNavigate={setActiveRoute}
91
- />
90
+ <Stack direction={{ xs: 'column', lg: 'row' }} spacing={2} sx={{ mt: 2 }}>
91
+ <Box sx={{ flex: 1, minWidth: 0 }}>
92
+ <Typography variant="subtitle2">createAppTheme baseline</Typography>
93
+ <MobileBottomNav
94
+ destinations={MOBILE_NAV_DESTINATIONS}
95
+ activeRoute={activeRoute}
96
+ onNavigate={setActiveRoute}
97
+ hideAbove="xl"
98
+ sx={{ position: 'relative', width: '100%', mt: 1 }}
99
+ />
100
+ </Box>
101
+ <ThemeProvider theme={PLAIN_MOBILE_NAV_THEME}>
102
+ <Box sx={{ flex: 1, minWidth: 0 }}>
103
+ <Typography variant="subtitle2">Plain createTheme</Typography>
104
+ <MobileBottomNav
105
+ destinations={MOBILE_NAV_DESTINATIONS}
106
+ activeRoute={activeRoute}
107
+ onNavigate={setActiveRoute}
108
+ hideAbove="xl"
109
+ sx={{ position: 'relative', width: '100%', mt: 1 }}
110
+ />
111
+ </Box>
112
+ </ThemeProvider>
113
+ </Stack>
92
114
  </Box>
93
115
  );
94
116
  }
@@ -5,19 +5,29 @@ import BottomNavigationAction from '@mui/material/BottomNavigationAction';
5
5
  import useMediaQuery from '@mui/material/useMediaQuery';
6
6
  import { useTheme } from '@mui/material/styles';
7
7
  const defaultZIndex = (theme) => theme.zIndex.drawer + 2;
8
- export function MobileBottomNav({ destinations, activeRoute, onNavigate, hideAbove = 'md', zIndex = defaultZIndex, }) {
8
+ export const MOBILE_BOTTOM_NAV_ROOT_SX = {
9
+ position: 'fixed',
10
+ left: 0,
11
+ right: 0,
12
+ bottom: 0,
13
+ borderTop: '1px solid',
14
+ borderColor: 'divider',
15
+ paddingBottom: 'env(safe-area-inset-bottom)',
16
+ };
17
+ export const MOBILE_BOTTOM_NAV_ACTION_SX = {
18
+ minWidth: 0,
19
+ maxWidth: 'none',
20
+ };
21
+ export function MobileBottomNav({ destinations, activeRoute, onNavigate, hideAbove = 'md', zIndex = defaultZIndex, sx = {}, }) {
9
22
  const theme = useTheme();
10
23
  const isHidden = useMediaQuery(theme.breakpoints.up(hideAbove));
24
+ const callerSx = Array.isArray(sx) ? sx : [sx];
11
25
  if (isHidden)
12
26
  return null;
13
- return (_jsx(BottomNavigation, { value: activeRoute, onChange: (_, route) => onNavigate(route), showLabels: true, sx: {
14
- position: 'fixed',
15
- left: 0,
16
- right: 0,
17
- bottom: 0,
18
- zIndex,
19
- paddingBottom: 'env(safe-area-inset-bottom)',
20
- }, children: destinations.map((destination) => {
27
+ return (_jsx(BottomNavigation, { value: activeRoute, onChange: (_, route) => onNavigate(route), showLabels: true, sx: [
28
+ Object.assign(Object.assign({}, MOBILE_BOTTOM_NAV_ROOT_SX), { zIndex }),
29
+ ...callerSx,
30
+ ], children: destinations.map((destination) => {
21
31
  var _a;
22
32
  const Icon = destination.icon;
23
33
  const selected = activeRoute === destination.route;
@@ -29,6 +39,6 @@ export function MobileBottomNav({ destinations, activeRoute, onNavigate, hideAbo
29
39
  boxShadow: 'none',
30
40
  transform: 'translateY(-4px)',
31
41
  } : undefined }));
32
- return (_jsx(BottomNavigationAction, { value: destination.route, label: (_a = destination.shortLabel) !== null && _a !== void 0 ? _a : destination.label, "aria-label": destination.shortLabel != null ? destination.label : undefined, "aria-current": selected ? 'page' : undefined, icon: destination.badgeCount ? (_jsx(Badge, { badgeContent: destination.badgeCount, color: "error", max: 99, children: icon })) : icon }, destination.route));
42
+ return (_jsx(BottomNavigationAction, { value: destination.route, label: (_a = destination.shortLabel) !== null && _a !== void 0 ? _a : destination.label, "aria-label": destination.shortLabel != null ? destination.label : undefined, "aria-current": selected ? 'page' : undefined, sx: MOBILE_BOTTOM_NAV_ACTION_SX, icon: destination.badgeCount ? (_jsx(Badge, { badgeContent: destination.badgeCount, color: "error", max: 99, children: icon })) : icon }, destination.route));
33
43
  }) }));
34
44
  }
@@ -104,7 +104,6 @@ function createPaletteAwareComponents(palette) {
104
104
  styleOverrides: {
105
105
  root: {
106
106
  backgroundColor: palette.background.paper,
107
- borderColor: palette.divider,
108
107
  },
109
108
  },
110
109
  },
@@ -72,12 +72,8 @@ const COMPONENT_SURFACES = [
72
72
  var _a, _b, _c, _d, _e, _f;
73
73
  return (_f = (_e = (_d = (_c = (_b = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiChip) === null || _b === void 0 ? void 0 : _b.styleOverrides) === null || _c === void 0 ? void 0 : _c.root) === null || _d === void 0 ? void 0 : _d['@media (any-pointer: coarse)']) === null || _e === void 0 ? void 0 : _e['&::after']) === null || _f === void 0 ? void 0 : _f.inset;
74
74
  }),
75
- componentPath('MuiBottomNavigation', 'styleOverrides.root.borderTop'),
76
75
  componentPath('MuiBottomNavigation', 'styleOverrides.root.boxShadow'),
77
76
  componentPath('MuiBottomNavigation', 'styleOverrides.root.backgroundColor'),
78
- componentPath('MuiBottomNavigation', 'styleOverrides.root.borderColor'),
79
- componentPath('MuiBottomNavigationAction', 'styleOverrides.root.minWidth'),
80
- componentPath('MuiBottomNavigationAction', 'styleOverrides.root.maxWidth'),
81
77
  componentPath('MuiBottomNavigationAction', 'styleOverrides.root.padding'),
82
78
  componentPath('MuiBottomNavigationAction', 'styleOverrides.root.gap'),
83
79
  componentKeyLeaf('MuiBottomNavigationAction', 'styleOverrides.root', '& .MuiSvgIcon-root', 'width'),
@@ -138,6 +134,7 @@ export const THEME_COMPLETENESS_SURFACES = [
138
134
  pathSurface('palette.ink.muted'),
139
135
  pathSurface('palette.background.default'),
140
136
  pathSurface('palette.background.paper'),
137
+ pathSurface('palette.background.subtle'),
141
138
  pathSurface('palette.divider'),
142
139
  pathSurface('palette.controlBorder.main'),
143
140
  pathSurface('palette.controlBorder.hover'),
@@ -54,6 +54,7 @@ export const BASELINE_PALETTE = {
54
54
  background: {
55
55
  default: '#FAFAFA',
56
56
  paper: '#FFFFFF',
57
+ subtle: '#F4F5F6',
57
58
  },
58
59
  divider: 'rgba(33,37,41,.10)',
59
60
  controlBorder: {
@@ -262,14 +263,12 @@ export const BASELINE_STATIC = {
262
263
  },
263
264
  MuiBottomNavigation: {
264
265
  styleOverrides: {
265
- root: { borderTop: '1px solid', boxShadow: 'none' },
266
+ root: { boxShadow: 'none' },
266
267
  },
267
268
  },
268
269
  MuiBottomNavigationAction: {
269
270
  styleOverrides: {
270
271
  root: {
271
- minWidth: 0,
272
- maxWidth: 'none',
273
272
  padding: '0 2px',
274
273
  gap: '2px',
275
274
  '& .MuiSvgIcon-root': { width: '22px', height: '22px' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "2.33.0",
3
+ "version": "2.33.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "repository": {
@@ -6,15 +6,32 @@ import { useTheme } from '@mui/material/styles';
6
6
 
7
7
  const defaultZIndex = (theme) => theme.zIndex.drawer + 2;
8
8
 
9
+ export const MOBILE_BOTTOM_NAV_ROOT_SX = {
10
+ position: 'fixed',
11
+ left: 0,
12
+ right: 0,
13
+ bottom: 0,
14
+ borderTop: '1px solid',
15
+ borderColor: 'divider',
16
+ paddingBottom: 'env(safe-area-inset-bottom)',
17
+ };
18
+
19
+ export const MOBILE_BOTTOM_NAV_ACTION_SX = {
20
+ minWidth: 0,
21
+ maxWidth: 'none',
22
+ };
23
+
9
24
  export function MobileBottomNav({
10
25
  destinations,
11
26
  activeRoute,
12
27
  onNavigate,
13
28
  hideAbove = 'md',
14
29
  zIndex = defaultZIndex,
30
+ sx = {},
15
31
  }) {
16
32
  const theme = useTheme();
17
33
  const isHidden = useMediaQuery(theme.breakpoints.up(hideAbove));
34
+ const callerSx = Array.isArray(sx) ? sx : [sx];
18
35
 
19
36
  if (isHidden) return null;
20
37
 
@@ -23,14 +40,10 @@ export function MobileBottomNav({
23
40
  value={activeRoute}
24
41
  onChange={(_, route) => onNavigate(route)}
25
42
  showLabels
26
- sx={{
27
- position: 'fixed',
28
- left: 0,
29
- right: 0,
30
- bottom: 0,
31
- zIndex,
32
- paddingBottom: 'env(safe-area-inset-bottom)',
33
- }}
43
+ sx={[
44
+ { ...MOBILE_BOTTOM_NAV_ROOT_SX, zIndex },
45
+ ...callerSx,
46
+ ]}
34
47
  >
35
48
  {destinations.map((destination) => {
36
49
  const Icon = destination.icon;
@@ -55,6 +68,7 @@ export function MobileBottomNav({
55
68
  label={destination.shortLabel ?? destination.label}
56
69
  aria-label={destination.shortLabel != null ? destination.label : undefined}
57
70
  aria-current={selected ? 'page' : undefined}
71
+ sx={MOBILE_BOTTOM_NAV_ACTION_SX}
58
72
  icon={destination.badgeCount ? (
59
73
  <Badge badgeContent={destination.badgeCount} color="error" max={99}>
60
74
  {icon}
@@ -120,7 +120,6 @@ function createPaletteAwareComponents(palette) {
120
120
  styleOverrides: {
121
121
  root: {
122
122
  backgroundColor: palette.background.paper,
123
- borderColor: palette.divider,
124
123
  },
125
124
  },
126
125
  },
@@ -96,12 +96,8 @@ const COMPONENT_SURFACES = [
96
96
  (theme) => theme.components?.MuiChip?.styleOverrides?.root
97
97
  ?.['@media (any-pointer: coarse)']?.['&::after']?.inset,
98
98
  ),
99
- componentPath('MuiBottomNavigation', 'styleOverrides.root.borderTop'),
100
99
  componentPath('MuiBottomNavigation', 'styleOverrides.root.boxShadow'),
101
100
  componentPath('MuiBottomNavigation', 'styleOverrides.root.backgroundColor'),
102
- componentPath('MuiBottomNavigation', 'styleOverrides.root.borderColor'),
103
- componentPath('MuiBottomNavigationAction', 'styleOverrides.root.minWidth'),
104
- componentPath('MuiBottomNavigationAction', 'styleOverrides.root.maxWidth'),
105
101
  componentPath('MuiBottomNavigationAction', 'styleOverrides.root.padding'),
106
102
  componentPath('MuiBottomNavigationAction', 'styleOverrides.root.gap'),
107
103
  componentKeyLeaf('MuiBottomNavigationAction', 'styleOverrides.root', '& .MuiSvgIcon-root', 'width'),
@@ -164,6 +160,7 @@ export const THEME_COMPLETENESS_SURFACES = [
164
160
  pathSurface('palette.ink.muted'),
165
161
  pathSurface('palette.background.default'),
166
162
  pathSurface('palette.background.paper'),
163
+ pathSurface('palette.background.subtle'),
167
164
  pathSurface('palette.divider'),
168
165
  pathSurface('palette.controlBorder.main'),
169
166
  pathSurface('palette.controlBorder.hover'),
@@ -64,6 +64,7 @@ export const BASELINE_PALETTE = {
64
64
  background: {
65
65
  default: '#FAFAFA',
66
66
  paper: '#FFFFFF',
67
+ subtle: '#F4F5F6',
67
68
  },
68
69
  divider: 'rgba(33,37,41,.10)',
69
70
  controlBorder: {
@@ -308,14 +309,12 @@ export const BASELINE_STATIC = {
308
309
  },
309
310
  MuiBottomNavigation: {
310
311
  styleOverrides: {
311
- root: { borderTop: '1px solid', boxShadow: 'none' },
312
+ root: { boxShadow: 'none' },
312
313
  },
313
314
  },
314
315
  MuiBottomNavigationAction: {
315
316
  styleOverrides: {
316
317
  root: {
317
- minWidth: 0,
318
- maxWidth: 'none',
319
318
  padding: '0 2px',
320
319
  gap: '2px',
321
320
  '& .MuiSvgIcon-root': { width: '22px', height: '22px' },
@@ -4,7 +4,11 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
4
4
  import { cleanup, fireEvent, render, screen, within } from '@testing-library/react';
5
5
  import { ThemeProvider, createTheme } from '@mui/material/styles';
6
6
 
7
- import { MobileBottomNav } from '../src/components/MobileBottomNav';
7
+ import {
8
+ MOBILE_BOTTOM_NAV_ACTION_SX,
9
+ MOBILE_BOTTOM_NAV_ROOT_SX,
10
+ MobileBottomNav,
11
+ } from '../src/components/MobileBottomNav';
8
12
  import { createAppTheme } from '../src/theme/createAppTheme';
9
13
 
10
14
  const theme = createAppTheme({ palette: { primary: { main: '#0F62FE' } } });
@@ -179,6 +183,101 @@ describe('MobileBottomNav', () => {
179
183
  });
180
184
  });
181
185
 
186
+ it('keeps its structural edge and evenly divided actions under a plain MUI theme', () => {
187
+ const fiveDestinations = [
188
+ ...destinations,
189
+ { route: '/fourth', label: 'Fourth', icon: Icon },
190
+ { route: '/fifth', label: 'Fifth', icon: Icon },
191
+ ];
192
+ setViewportWidth(375);
193
+ const { container } = render(
194
+ <ThemeProvider theme={createTheme()}>
195
+ <MobileBottomNav
196
+ destinations={fiveDestinations}
197
+ activeRoute="/first"
198
+ onNavigate={vi.fn()}
199
+ />
200
+ </ThemeProvider>,
201
+ );
202
+ const navStyle = getComputedStyle(container.firstElementChild);
203
+ const actionStyles = screen.getAllByRole('button').map((action) => getComputedStyle(action));
204
+
205
+ expect(navStyle.borderTopWidth).toBe('1px');
206
+ expect(navStyle.borderTopStyle).toBe('solid');
207
+ expect(actionStyles).toHaveLength(5);
208
+ actionStyles.forEach((actionStyle) => {
209
+ expect(actionStyle.minWidth).toBe('0px');
210
+ expect(actionStyle.maxWidth).toBe('none');
211
+ expect(actionStyle.flexGrow).toBe('1');
212
+ });
213
+ });
214
+
215
+ it('keeps component-owned sx keys out of baseline theme overrides', () => {
216
+ const componentSurfaces = [
217
+ ...Object.keys(MOBILE_BOTTOM_NAV_ROOT_SX)
218
+ .map((key) => `MuiBottomNavigation.${key}`),
219
+ ...Object.keys(MOBILE_BOTTOM_NAV_ACTION_SX)
220
+ .map((key) => `MuiBottomNavigationAction.${key}`),
221
+ ];
222
+ const themeSurfaces = [
223
+ ...Object.keys(theme.components.MuiBottomNavigation.styleOverrides.root)
224
+ .map((key) => `MuiBottomNavigation.${key}`),
225
+ ...Object.keys(theme.components.MuiBottomNavigationAction.styleOverrides.root)
226
+ .map((key) => `MuiBottomNavigationAction.${key}`),
227
+ ];
228
+
229
+ expect(componentSurfaces.filter((surface) => themeSurfaces.includes(surface))).toEqual([]);
230
+ });
231
+
232
+ it.each([
233
+ ['object', {
234
+ position: 'absolute',
235
+ borderTop: '3px dashed',
236
+ borderColor: 'primary.main',
237
+ }],
238
+ ['callback', (currentTheme) => ({
239
+ position: 'absolute',
240
+ borderTop: '3px dashed',
241
+ borderColor: currentTheme.palette.primary.main,
242
+ })],
243
+ ['array', [
244
+ { borderTop: '2px dotted' },
245
+ {
246
+ position: 'absolute',
247
+ borderTop: '3px dashed',
248
+ borderColor: 'primary.main',
249
+ },
250
+ ]],
251
+ ])('lets caller %s sx override the component defaults', (_kind, sx) => {
252
+ const { container } = renderNav({
253
+ sx,
254
+ });
255
+ const navStyle = getComputedStyle(container.firstElementChild);
256
+
257
+ expect(navStyle.position).toBe('absolute');
258
+ expect(navStyle.borderTopWidth).toBe('3px');
259
+ expect(navStyle.borderTopStyle).toBe('dashed');
260
+ expect(navStyle.borderTopColor).toBe('rgb(15, 98, 254)');
261
+ });
262
+
263
+ it('preserves baseline density and label styling after the structural values move', () => {
264
+ renderNav();
265
+ const [selectedAction] = screen.getAllByRole('button');
266
+ const actionStyle = getComputedStyle(selectedAction);
267
+ const labelStyle = getComputedStyle(
268
+ selectedAction.querySelector('.MuiBottomNavigationAction-label'),
269
+ );
270
+
271
+ expect(actionStyle.minWidth).toBe('0px');
272
+ expect(actionStyle.maxWidth).toBe('none');
273
+ expect(actionStyle.paddingLeft).toBe('2px');
274
+ expect(actionStyle.paddingRight).toBe('2px');
275
+ expect(actionStyle.gap).toBe('2px');
276
+ expect(labelStyle.fontSize).toBe('12px');
277
+ expect(labelStyle.fontWeight).toBe('500');
278
+ expect(labelStyle.lineHeight).toBe('1.2');
279
+ });
280
+
182
281
  it('renders nothing at and above hideAbove', () => {
183
282
  setMediaQueryMatches((query) => query === '(min-width:900px)');
184
283
  const { container } = renderNav();
@@ -195,7 +294,7 @@ describe('MobileBottomNav', () => {
195
294
  expect(nav.classList.contains('MuiBottomNavigation-root')).toBe(true);
196
295
  // jsdom drops env() declarations while parsing CSS, so assert the sx
197
296
  // declaration before browser CSS parsing instead of a computed inset.
198
- expect(MobileBottomNav.toString()).toContain('env(safe-area-inset-bottom)');
297
+ expect(MOBILE_BOTTOM_NAV_ROOT_SX.paddingBottom).toBe('env(safe-area-inset-bottom)');
199
298
  });
200
299
 
201
300
  it('renders the five-item, two-badge specimen at 375px and nothing at 1280px', () => {
@@ -1,7 +1,7 @@
1
1
  import { createTheme } from '@mui/material/styles';
2
2
  import { describe, expect, it } from 'vitest';
3
3
 
4
- import { assertThemeComplete, createAppTheme } from '../src/index';
4
+ import { assertThemeComplete, createAppTheme } from '../src/theme';
5
5
  import { BASELINE_STATIC } from '../src/theme/tokens';
6
6
 
7
7
  describe('createAppTheme', () => {
@@ -9,6 +9,7 @@ describe('createAppTheme', () => {
9
9
  const theme = createAppTheme({ palette: { primary: { main: '#0F62FE' } } });
10
10
 
11
11
  expect(assertThemeComplete(theme).findings).toEqual([]);
12
+ expect(theme.palette.background.subtle).toBe('#F4F5F6');
12
13
  expect(theme.typography.body1.fontSize).toBe('14px');
13
14
  expect(theme.shape.borderRadius).toBe(3);
14
15
  expect(theme.components.MuiPaper.defaultProps).toMatchObject({ elevation: 0, variant: 'outlined' });
@@ -23,12 +24,16 @@ describe('createAppTheme', () => {
23
24
  '&.Mui-selected': { fontSize: '12px' },
24
25
  });
25
26
  expect(theme.components.MuiBottomNavigationAction.styleOverrides.root).toMatchObject({
26
- minWidth: 0,
27
- maxWidth: 'none',
28
27
  padding: '0 2px',
29
28
  gap: '2px',
30
29
  '& .MuiSvgIcon-root': { width: '22px', height: '22px' },
31
30
  });
31
+ expect(theme.components.MuiBottomNavigation.styleOverrides.root).not.toHaveProperty('borderTop');
32
+ expect(theme.components.MuiBottomNavigation.styleOverrides.root).not.toHaveProperty('borderColor');
33
+ expect(theme.components.MuiBottomNavigationAction.styleOverrides.root)
34
+ .not.toHaveProperty('minWidth');
35
+ expect(theme.components.MuiBottomNavigationAction.styleOverrides.root)
36
+ .not.toHaveProperty('maxWidth');
32
37
  expect(theme.palette.dataSeries.categorical).toHaveLength(6);
33
38
  expect(theme.palette.primary.light).not.toBe(createTheme().palette.primary.light);
34
39
  // MUI's createTheme(options, ...args) only augments the FIRST argument's
@@ -5,7 +5,8 @@ import {
5
5
  assertThemeComplete,
6
6
  calculateContrastRatio,
7
7
  createAppTheme,
8
- } from '../src/index';
8
+ THEME_COMPLETENESS_SURFACES,
9
+ } from '../src/theme';
9
10
 
10
11
  describe('theme completeness', () => {
11
12
  it('finds untouched MUI surfaces and accepts createAppTheme', () => {
@@ -20,12 +21,8 @@ describe('theme completeness', () => {
20
21
  .map(({ surface }) => surface))
21
22
  .toContain('components.MuiButton.styleOverrides.root.minHeight');
22
23
  expect(bare.findings.map(({ surface }) => surface)).toEqual(expect.arrayContaining([
23
- 'components.MuiBottomNavigation.styleOverrides.root.borderTop',
24
24
  'components.MuiBottomNavigation.styleOverrides.root.boxShadow',
25
25
  'components.MuiBottomNavigation.styleOverrides.root.backgroundColor',
26
- 'components.MuiBottomNavigation.styleOverrides.root.borderColor',
27
- 'components.MuiBottomNavigationAction.styleOverrides.root.minWidth',
28
- 'components.MuiBottomNavigationAction.styleOverrides.root.maxWidth',
29
26
  'components.MuiBottomNavigationAction.styleOverrides.root.padding',
30
27
  'components.MuiBottomNavigationAction.styleOverrides.root.gap',
31
28
  'components.MuiBottomNavigationAction.styleOverrides.root.& .MuiSvgIcon-root.width',
@@ -44,6 +41,44 @@ describe('theme completeness', () => {
44
41
  expect(baseline.findings).toEqual([]);
45
42
  });
46
43
 
44
+ it('requires and automatically resolves the subtle background for a minimal adopter', () => {
45
+ const muiDefault = createTheme();
46
+ const theme = createAppTheme({ palette: { primary: { main: '#0F62FE' } } });
47
+
48
+ expect(muiDefault.palette.background.subtle).toBeUndefined();
49
+ expect(THEME_COMPLETENESS_SURFACES.map(({ surface }) => surface))
50
+ .toContain('palette.background.subtle');
51
+ expect(assertThemeComplete(theme).findings).toEqual([]);
52
+ });
53
+
54
+ it('keeps the narrowed bottom-navigation inventory complete', () => {
55
+ const bottomNavigationSurfaces = THEME_COMPLETENESS_SURFACES
56
+ .map(({ surface }) => surface)
57
+ .filter((surface) => surface.startsWith('components.MuiBottomNavigation'));
58
+
59
+ expect(bottomNavigationSurfaces).toHaveLength(16);
60
+ [
61
+ 'components.MuiBottomNavigation.styleOverrides.root.borderTop',
62
+ 'components.MuiBottomNavigation.styleOverrides.root.borderColor',
63
+ 'components.MuiBottomNavigationAction.styleOverrides.root.minWidth',
64
+ 'components.MuiBottomNavigationAction.styleOverrides.root.maxWidth',
65
+ ].forEach((surface) => expect(bottomNavigationSurfaces).not.toContain(surface));
66
+ });
67
+
68
+ it('ignores a valid exemption for a deregistered surface', () => {
69
+ const result = assertThemeComplete(
70
+ createAppTheme({ palette: { primary: { main: '#0F62FE' } } }),
71
+ {
72
+ exemptions: [{
73
+ surface: 'components.MuiBottomNavigation.styleOverrides.root.borderTop',
74
+ reason: 'Legacy exemption retained while the application upgrades.',
75
+ }],
76
+ },
77
+ );
78
+
79
+ expect(result.findings).toEqual([]);
80
+ });
81
+
47
82
  it('suppresses exactly one surface when an exemption includes a reason', () => {
48
83
  const theme = createTheme();
49
84
  const before = assertThemeComplete(theme).findings;
@@ -83,6 +118,11 @@ describe('theme completeness', () => {
83
118
  .toContain('contrast.success.text-on-bg');
84
119
  });
85
120
 
121
+ it('keeps secondary ink AA-legible on the subtle background', () => {
122
+ const ratio = calculateContrastRatio('#5B6670', '#F4F5F6');
123
+ expect(ratio).toBeGreaterThanOrEqual(4.5);
124
+ });
125
+
86
126
  it('requires every MUI status main to clear AA on white and the page background', () => {
87
127
  const theme = createAppTheme({ palette: { primary: { main: '#8AB4F8' } } });
88
128