@micha.bigler/ui-core-micha 2.31.1 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WORK_ORDERS.md +2 -0
- package/dev/entries.jsx +47 -0
- package/dev/main.jsx +11 -5
- package/dist/components/MobileBottomNav.js +34 -0
- package/dist/components/charts/ChartFrame.js +2 -2
- package/dist/index.js +1 -0
- package/dist/theme/createAppTheme.js +16 -0
- package/dist/theme/themeCompleteness.js +20 -0
- package/dist/theme/tokens.js +26 -0
- package/package.json +1 -1
- package/src/components/MobileBottomNav.jsx +68 -0
- package/src/components/charts/ChartFrame.jsx +2 -1
- package/src/index.js +1 -0
- package/src/theme/createAppTheme.js +16 -0
- package/src/theme/themeCompleteness.js +20 -0
- package/src/theme/tokens.js +26 -0
- package/tests/ChartFrame.test.jsx +42 -0
- package/tests/MobileBottomNav.test.jsx +220 -0
- package/tests/NotificationsProvider.test.jsx +5 -1
- package/tests/createAppTheme.test.js +17 -0
- package/tests/themeCompleteness.test.js +22 -0
- package/work-orders/CHART-7.md +175 -0
- package/work-orders/SHELL-3.md +359 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { cleanup, fireEvent, render, screen, within } from '@testing-library/react';
|
|
5
|
+
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
|
6
|
+
|
|
7
|
+
import { MobileBottomNav } from '../src/components/MobileBottomNav';
|
|
8
|
+
import { createAppTheme } from '../src/theme/createAppTheme';
|
|
9
|
+
|
|
10
|
+
const theme = createAppTheme({ palette: { primary: { main: '#0F62FE' } } });
|
|
11
|
+
|
|
12
|
+
function Icon() {
|
|
13
|
+
return <svg aria-hidden="true" data-testid="destination-icon" />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const destinations = [
|
|
17
|
+
{ route: '/first', label: 'First', icon: Icon },
|
|
18
|
+
{ route: '/second', label: 'Second', icon: Icon },
|
|
19
|
+
{ route: '/third', label: 'Third', icon: Icon },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function setMediaQueryMatches(matches) {
|
|
23
|
+
window.matchMedia = vi.fn().mockImplementation((query) => ({
|
|
24
|
+
matches: typeof matches === 'function' ? matches(query) : matches,
|
|
25
|
+
media: query,
|
|
26
|
+
onchange: null,
|
|
27
|
+
addEventListener: vi.fn(),
|
|
28
|
+
removeEventListener: vi.fn(),
|
|
29
|
+
addListener: vi.fn(),
|
|
30
|
+
removeListener: vi.fn(),
|
|
31
|
+
dispatchEvent: vi.fn(),
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function setViewportWidth(width) {
|
|
36
|
+
setMediaQueryMatches((query) => {
|
|
37
|
+
const minWidth = query.match(/min-width:(\d+)px/)?.[1];
|
|
38
|
+
return minWidth ? width >= Number(minWidth) : false;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function renderNav(props = {}) {
|
|
43
|
+
return render(
|
|
44
|
+
<ThemeProvider theme={theme}>
|
|
45
|
+
<MobileBottomNav
|
|
46
|
+
destinations={destinations}
|
|
47
|
+
activeRoute="/first"
|
|
48
|
+
onNavigate={vi.fn()}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
</ThemeProvider>,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('MobileBottomNav', () => {
|
|
56
|
+
beforeEach(() => setMediaQueryMatches(false));
|
|
57
|
+
|
|
58
|
+
afterEach(() => {
|
|
59
|
+
cleanup();
|
|
60
|
+
vi.restoreAllMocks();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('renders one action per destination, in order, with visible labels', () => {
|
|
64
|
+
renderNav();
|
|
65
|
+
|
|
66
|
+
expect(screen.getAllByRole('button').map((action) => action.textContent)).toEqual([
|
|
67
|
+
'First',
|
|
68
|
+
'Second',
|
|
69
|
+
'Third',
|
|
70
|
+
]);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('selects exactly the matching route and tolerates no match', () => {
|
|
74
|
+
const { rerender } = renderNav({ activeRoute: '/second' });
|
|
75
|
+
const selected = () => screen.getAllByRole('button')
|
|
76
|
+
.filter((action) => action.classList.contains('Mui-selected'));
|
|
77
|
+
|
|
78
|
+
expect(selected()).toHaveLength(1);
|
|
79
|
+
expect(selected()[0].textContent).toBe('Second');
|
|
80
|
+
expect(selected()[0].getAttribute('aria-current')).toBe('page');
|
|
81
|
+
expect(screen.getAllByRole('button').filter((action) => action.hasAttribute('aria-current')))
|
|
82
|
+
.toHaveLength(1);
|
|
83
|
+
|
|
84
|
+
rerender(
|
|
85
|
+
<ThemeProvider theme={theme}>
|
|
86
|
+
<MobileBottomNav
|
|
87
|
+
destinations={destinations}
|
|
88
|
+
activeRoute="/not-in-the-bar"
|
|
89
|
+
onNavigate={vi.fn()}
|
|
90
|
+
/>
|
|
91
|
+
</ThemeProvider>,
|
|
92
|
+
);
|
|
93
|
+
expect(selected()).toHaveLength(0);
|
|
94
|
+
expect(screen.getAllByRole('button').some((action) => action.hasAttribute('aria-current')))
|
|
95
|
+
.toBe(false);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('calls onNavigate with the selected destination route', () => {
|
|
99
|
+
const onNavigate = vi.fn();
|
|
100
|
+
renderNav({ onNavigate });
|
|
101
|
+
|
|
102
|
+
fireEvent.click(screen.getByRole('button', { name: 'Second' }));
|
|
103
|
+
|
|
104
|
+
expect(onNavigate).toHaveBeenCalledOnce();
|
|
105
|
+
expect(onNavigate).toHaveBeenCalledWith('/second');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('renders a positive badge only on its own destination', () => {
|
|
109
|
+
renderNav({
|
|
110
|
+
destinations: [
|
|
111
|
+
{ route: '/inbox', label: 'Inbox', icon: Icon, badgeCount: 4 },
|
|
112
|
+
{ route: '/empty', label: 'Empty', icon: Icon, badgeCount: 0 },
|
|
113
|
+
{ route: '/unset', label: 'Unset', icon: Icon },
|
|
114
|
+
],
|
|
115
|
+
activeRoute: '/inbox',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const actions = screen.getAllByRole('button');
|
|
119
|
+
expect(within(actions[0]).getByText('4')).toBeTruthy();
|
|
120
|
+
expect(actions[0].querySelectorAll('.MuiBadge-root')).toHaveLength(1);
|
|
121
|
+
expect(actions[1].querySelector('.MuiBadge-root')).toBeNull();
|
|
122
|
+
expect(actions[2].querySelector('.MuiBadge-root')).toBeNull();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('uses shortLabel when present and label when it is absent', () => {
|
|
126
|
+
renderNav({
|
|
127
|
+
destinations: [
|
|
128
|
+
{ route: '/registrations', label: 'My registrations', shortLabel: 'Mine', icon: Icon },
|
|
129
|
+
{ route: '/messages', label: 'Messages', icon: Icon },
|
|
130
|
+
],
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
expect(screen.getAllByRole('button').map((action) => action.textContent)).toEqual([
|
|
134
|
+
'Mine',
|
|
135
|
+
'Messages',
|
|
136
|
+
]);
|
|
137
|
+
expect(screen.getByRole('button', { name: 'My registrations' }).textContent).toBe('Mine');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('resolves its surface and action colours from both baseline and plain MUI themes', () => {
|
|
141
|
+
const themes = [
|
|
142
|
+
createAppTheme({
|
|
143
|
+
palette: {
|
|
144
|
+
primary: { main: '#123456' },
|
|
145
|
+
background: { paper: '#F1F2F3' },
|
|
146
|
+
text: { secondary: '#445566' },
|
|
147
|
+
},
|
|
148
|
+
}),
|
|
149
|
+
createTheme({
|
|
150
|
+
palette: {
|
|
151
|
+
primary: { main: '#654321' },
|
|
152
|
+
background: { paper: '#E7E8E9' },
|
|
153
|
+
text: { secondary: '#665544' },
|
|
154
|
+
},
|
|
155
|
+
}),
|
|
156
|
+
];
|
|
157
|
+
const expected = [
|
|
158
|
+
{ background: 'rgb(241, 242, 243)', selected: 'rgb(18, 52, 86)', rest: 'rgb(68, 85, 102)' },
|
|
159
|
+
{ background: 'rgb(231, 232, 233)', selected: 'rgb(101, 67, 33)', rest: 'rgb(102, 85, 68)' },
|
|
160
|
+
];
|
|
161
|
+
|
|
162
|
+
themes.forEach((currentTheme, index) => {
|
|
163
|
+
const { container } = render(
|
|
164
|
+
<ThemeProvider theme={currentTheme}>
|
|
165
|
+
<MobileBottomNav
|
|
166
|
+
destinations={destinations}
|
|
167
|
+
activeRoute="/first"
|
|
168
|
+
onNavigate={vi.fn()}
|
|
169
|
+
/>
|
|
170
|
+
</ThemeProvider>,
|
|
171
|
+
);
|
|
172
|
+
const actions = screen.getAllByRole('button');
|
|
173
|
+
|
|
174
|
+
expect(getComputedStyle(container.firstElementChild).backgroundColor)
|
|
175
|
+
.toBe(expected[index].background);
|
|
176
|
+
expect(getComputedStyle(actions[0]).color).toBe(expected[index].selected);
|
|
177
|
+
expect(getComputedStyle(actions[1]).color).toBe(expected[index].rest);
|
|
178
|
+
cleanup();
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('renders nothing at and above hideAbove', () => {
|
|
183
|
+
setMediaQueryMatches((query) => query === '(min-width:900px)');
|
|
184
|
+
const { container } = renderNav();
|
|
185
|
+
|
|
186
|
+
expect(window.matchMedia).toHaveBeenCalledWith('(min-width:900px)');
|
|
187
|
+
expect(container.childElementCount).toBe(0);
|
|
188
|
+
expect(screen.queryByRole('navigation')).toBeNull();
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('declares safe-area bottom padding on the fixed bar', () => {
|
|
192
|
+
const { container } = renderNav();
|
|
193
|
+
const nav = container.firstElementChild;
|
|
194
|
+
|
|
195
|
+
expect(nav.classList.contains('MuiBottomNavigation-root')).toBe(true);
|
|
196
|
+
// jsdom drops env() declarations while parsing CSS, so assert the sx
|
|
197
|
+
// declaration before browser CSS parsing instead of a computed inset.
|
|
198
|
+
expect(MobileBottomNav.toString()).toContain('env(safe-area-inset-bottom)');
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('renders the five-item, two-badge specimen at 375px and nothing at 1280px', () => {
|
|
202
|
+
const specimen = [
|
|
203
|
+
{ route: '/triage', label: 'Triage', icon: Icon, badgeCount: 7 },
|
|
204
|
+
{ route: '/board', label: 'Board', icon: Icon, badgeCount: 3 },
|
|
205
|
+
{ route: '/chat', label: 'Chat', icon: Icon },
|
|
206
|
+
{ route: '/status', label: 'Status', icon: Icon },
|
|
207
|
+
{ route: '/more', label: 'More', icon: Icon, emphasis: true },
|
|
208
|
+
];
|
|
209
|
+
|
|
210
|
+
setViewportWidth(375);
|
|
211
|
+
renderNav({ destinations: specimen, activeRoute: '/triage' });
|
|
212
|
+
expect(screen.getAllByRole('button')).toHaveLength(5);
|
|
213
|
+
expect(document.querySelectorAll('.MuiBadge-root')).toHaveLength(2);
|
|
214
|
+
|
|
215
|
+
cleanup();
|
|
216
|
+
setViewportWidth(1280);
|
|
217
|
+
renderNav({ destinations: specimen, activeRoute: '/triage' });
|
|
218
|
+
expect(screen.queryByRole('button')).toBeNull();
|
|
219
|
+
});
|
|
220
|
+
});
|
|
@@ -90,7 +90,11 @@ describe('NotificationsProvider', () => {
|
|
|
90
90
|
expect.objectContaining({ id: 1, notification_id: 101, seen: false }),
|
|
91
91
|
expect.objectContaining({ id: 2, notification_id: 102, dismissed: false }),
|
|
92
92
|
]));
|
|
93
|
-
|
|
93
|
+
// `seeded` (which gates the socket connect) flips in refresh()'s .finally(),
|
|
94
|
+
// one tick after unreadCount is set -- so the socket can still be unopened
|
|
95
|
+
// right when the unread-count waitFor above resolves. Wait for it directly
|
|
96
|
+
// instead of asserting synchronously.
|
|
97
|
+
await waitFor(() => expect(MockWebSocket.instances).toHaveLength(1));
|
|
94
98
|
});
|
|
95
99
|
|
|
96
100
|
it('prepends a new notification push and increments the unread count', async () => {
|
|
@@ -12,6 +12,23 @@ describe('createAppTheme', () => {
|
|
|
12
12
|
expect(theme.typography.body1.fontSize).toBe('14px');
|
|
13
13
|
expect(theme.shape.borderRadius).toBe(3);
|
|
14
14
|
expect(theme.components.MuiPaper.defaultProps).toMatchObject({ elevation: 0, variant: 'outlined' });
|
|
15
|
+
expect(theme.components.MuiBottomNavigationAction.styleOverrides.label).toMatchObject({
|
|
16
|
+
fontSize: '12px',
|
|
17
|
+
fontWeight: 500,
|
|
18
|
+
lineHeight: 1.2,
|
|
19
|
+
maxWidth: '100%',
|
|
20
|
+
whiteSpace: 'nowrap',
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
textOverflow: 'ellipsis',
|
|
23
|
+
'&.Mui-selected': { fontSize: '12px' },
|
|
24
|
+
});
|
|
25
|
+
expect(theme.components.MuiBottomNavigationAction.styleOverrides.root).toMatchObject({
|
|
26
|
+
minWidth: 0,
|
|
27
|
+
maxWidth: 'none',
|
|
28
|
+
padding: '0 2px',
|
|
29
|
+
gap: '2px',
|
|
30
|
+
'& .MuiSvgIcon-root': { width: '22px', height: '22px' },
|
|
31
|
+
});
|
|
15
32
|
expect(theme.palette.dataSeries.categorical).toHaveLength(6);
|
|
16
33
|
expect(theme.palette.primary.light).not.toBe(createTheme().palette.primary.light);
|
|
17
34
|
// MUI's createTheme(options, ...args) only augments the FIRST argument's
|
|
@@ -19,6 +19,28 @@ describe('theme completeness', () => {
|
|
|
19
19
|
expect(assertThemeComplete(createTheme({ components: { MuiButton: {} } })).findings
|
|
20
20
|
.map(({ surface }) => surface))
|
|
21
21
|
.toContain('components.MuiButton.styleOverrides.root.minHeight');
|
|
22
|
+
expect(bare.findings.map(({ surface }) => surface)).toEqual(expect.arrayContaining([
|
|
23
|
+
'components.MuiBottomNavigation.styleOverrides.root.borderTop',
|
|
24
|
+
'components.MuiBottomNavigation.styleOverrides.root.boxShadow',
|
|
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
|
+
'components.MuiBottomNavigationAction.styleOverrides.root.padding',
|
|
30
|
+
'components.MuiBottomNavigationAction.styleOverrides.root.gap',
|
|
31
|
+
'components.MuiBottomNavigationAction.styleOverrides.root.& .MuiSvgIcon-root.width',
|
|
32
|
+
'components.MuiBottomNavigationAction.styleOverrides.root.& .MuiSvgIcon-root.height',
|
|
33
|
+
'components.MuiBottomNavigationAction.styleOverrides.root.color',
|
|
34
|
+
'components.MuiBottomNavigationAction.styleOverrides.label.fontSize',
|
|
35
|
+
'components.MuiBottomNavigationAction.styleOverrides.label.fontWeight',
|
|
36
|
+
'components.MuiBottomNavigationAction.styleOverrides.label.lineHeight',
|
|
37
|
+
'components.MuiBottomNavigationAction.styleOverrides.label.maxWidth',
|
|
38
|
+
'components.MuiBottomNavigationAction.styleOverrides.label.whiteSpace',
|
|
39
|
+
'components.MuiBottomNavigationAction.styleOverrides.label.overflow',
|
|
40
|
+
'components.MuiBottomNavigationAction.styleOverrides.label.textOverflow',
|
|
41
|
+
'components.MuiBottomNavigationAction.styleOverrides.label.&.Mui-selected.fontSize',
|
|
42
|
+
'components.MuiBottomNavigationAction.styleOverrides.root.&.Mui-selected.color',
|
|
43
|
+
]));
|
|
22
44
|
expect(baseline.findings).toEqual([]);
|
|
23
45
|
});
|
|
24
46
|
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# CHART-7 — `ChartFrame` gains a `titleVariant` prop
|
|
2
|
+
|
|
3
|
+
**Target repo:** `ui-core-micha` (branch `main` — this repo has no `develop`)
|
|
4
|
+
**Tier:** 2 (shared core)
|
|
5
|
+
**Review:** independent `reviewer` **and** `ui_reviewer` — spawned concurrently, both mandatory before commit
|
|
6
|
+
**Version target:** `2.32.0` — minor: a new public prop is additive API under semver, consistent with how `SHELL-2` classified `extraTabs` gaining a field
|
|
7
|
+
**Precondition of:** `fitness-monitor`'s `FM-12` (DS-10)
|
|
8
|
+
|
|
9
|
+
Short-form WO: one prop, one default, no design question.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## A. Envelope
|
|
14
|
+
|
|
15
|
+
### Goal
|
|
16
|
+
|
|
17
|
+
`ChartFrame` hard-codes its title as `<Typography variant="h6">` (`src/components/charts/ChartFrame.jsx:74`)
|
|
18
|
+
and exposes no way to change it. Add a `titleVariant` prop, defaulting to `'h6'` so nothing changes for
|
|
19
|
+
any existing caller.
|
|
20
|
+
|
|
21
|
+
### Why this is a kit gap and not one app's problem
|
|
22
|
+
|
|
23
|
+
A card title and a **panel-grid** title are different typographic jobs. In a dense grid the titles must
|
|
24
|
+
recede so they do not compete with the one chart that matters; at `h6` they do not. Concretely:
|
|
25
|
+
fitness-monitor renders six body-composition panels next to one hero chart, and its accepted prototype
|
|
26
|
+
specifies `13px/600` for those six against `15px/600` for the hero
|
|
27
|
+
(`fitness-monitor/work-orders/assets/FM-8-redesign.html:237` vs `:184`). Today all seven render at the
|
|
28
|
+
same `h6`, and **six oversized titles beside a hero chart was one of the original "reads heavier and
|
|
29
|
+
older" findings** that started this programme.
|
|
30
|
+
|
|
31
|
+
The app cannot reach it: there is no prop, and `ChartFrame`'s title is not exposed through `slotProps`
|
|
32
|
+
either. Any app with a dense panel grid hits the same wall — hram's results tabs are the obvious next
|
|
33
|
+
one — so this belongs in the kit rather than being worked around per app.
|
|
34
|
+
|
|
35
|
+
### Scope
|
|
36
|
+
|
|
37
|
+
- `ChartFrame` accepts `titleVariant`, forwarded to the title `Typography`. **Default `'h6'`.**
|
|
38
|
+
- Keep it minimal: **one prop, not a `slotProps.title` system.** There is one known need; a general slot
|
|
39
|
+
mechanism for one consumer is the speculative generality this estate's promotion discipline rejects.
|
|
40
|
+
If a second, different need appears, that is when the shape gets revisited.
|
|
41
|
+
|
|
42
|
+
### Non-goals / do not touch
|
|
43
|
+
|
|
44
|
+
- The subtitle, toolbar, controls, loading/error/empty slots and the export footer — untouched.
|
|
45
|
+
- `ChartFrame`'s `p: 2` padding and its foot row: **byte-for-byte unchanged.** 16 panels depend on them.
|
|
46
|
+
- The baseline's `h6` value (16px/600). This WO changes *which* variant a caller may pick, not what the
|
|
47
|
+
variants are.
|
|
48
|
+
- The chart wrappers. No `LineChart`/`BarChart`/`TimeSeriesChart` change.
|
|
49
|
+
- No behaviour, permission or data-contract change.
|
|
50
|
+
|
|
51
|
+
### Risks
|
|
52
|
+
|
|
53
|
+
- **`ChartFrame` is the estate's most-used chart primitive** — five of hram's six hand-drawn panels use
|
|
54
|
+
it, plus every wrapper chart. The default must remain `'h6'`; a changed default would silently restyle
|
|
55
|
+
every title in the estate on the next pin bump.
|
|
56
|
+
- **No staging net.** A push to `main` touching `src/**` publishes to npm at once; the independent review
|
|
57
|
+
is the only gate and is not back-fillable.
|
|
58
|
+
|
|
59
|
+
### Required tests to WRITE
|
|
60
|
+
|
|
61
|
+
Extend the existing `ChartFrame` spec rather than adding a file.
|
|
62
|
+
|
|
63
|
+
1. With no `titleVariant`, the title renders as `h6` — **prove non-vacuity** by changing the default and
|
|
64
|
+
confirming this fails. This is the regression guard for all 16 existing panels.
|
|
65
|
+
2. `titleVariant="subtitle2"` renders the title at that variant.
|
|
66
|
+
3. The subtitle, toolbar and footer render unchanged in both cases.
|
|
67
|
+
|
|
68
|
+
Plus `tsc -p tsconfig.build.json --noEmit` clean.
|
|
69
|
+
|
|
70
|
+
**No full-suite run.** Affected-areas set is the `ChartFrame` spec.
|
|
71
|
+
|
|
72
|
+
### Verification
|
|
73
|
+
|
|
74
|
+
The rendered two-width side-by-side per DS-1, showing a `ChartFrame` at the default and one with an
|
|
75
|
+
overridden variant side by side — so the "default unchanged" claim is visible and not only asserted.
|
|
76
|
+
|
|
77
|
+
### Preconditions
|
|
78
|
+
|
|
79
|
+
None. `THEME-2` (`2.31.1`) is the current published version.
|
|
80
|
+
|
|
81
|
+
### Parity guardrail
|
|
82
|
+
|
|
83
|
+
Purely additive. Every existing caller must render identically — that is what test 1 guards.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## B. Implementation map
|
|
88
|
+
|
|
89
|
+
*Filled by the Orchestrator on `git pull` — see AGENTS.md → "Work Order".*
|
|
90
|
+
|
|
91
|
+
### Execution directive (read this first)
|
|
92
|
+
|
|
93
|
+
> **If you are the implementer reading this work order as your own specification: this section is
|
|
94
|
+
> NOT addressed to you.** It tells the Orchestrator how to invoke you. **You ARE that invocation —
|
|
95
|
+
> do NOT shell out to `codex exec`.**
|
|
96
|
+
>
|
|
97
|
+
> Implement through `codex exec` in the background — invoked directly via Bash (never the
|
|
98
|
+
> `debugger`/`*_coder` Agent wrappers) with BOTH flags `--skip-git-repo-check` and
|
|
99
|
+
> `--dangerously-bypass-approvals-and-sandbox`. **Pass the WO via stdin, not as a positional
|
|
100
|
+
> argument** — `cat work-orders/CHART-7.md | codex exec --skip-git-repo-check
|
|
101
|
+
> --dangerously-bypass-approvals-and-sandbox -` (a positional arg hits Windows' command-line length
|
|
102
|
+
> limit — proven repeatedly in this repo). Fallback to direct Claude implementation only on Codex
|
|
103
|
+
> quota/rate-limit/non-zero exit.
|
|
104
|
+
|
|
105
|
+
### Context package
|
|
106
|
+
|
|
107
|
+
Verified 2026-08-10, current state: `src/components/charts/ChartFrame.jsx:17-35` (prop destructure)
|
|
108
|
+
and `:74` (the hardcoded title):
|
|
109
|
+
```jsx
|
|
110
|
+
export function ChartFrame({
|
|
111
|
+
title,
|
|
112
|
+
subtitle,
|
|
113
|
+
toolbar,
|
|
114
|
+
...
|
|
115
|
+
variant = 'outlined',
|
|
116
|
+
sx,
|
|
117
|
+
}) {
|
|
118
|
+
...
|
|
119
|
+
<Typography id={titleId} variant="h6">{title}</Typography>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Named file to change:** add `titleVariant = 'h6'` to the destructured props (alongside `variant =
|
|
123
|
+
'outlined'`, same style) and change line 74 to `<Typography id={titleId} variant={titleVariant}>
|
|
124
|
+
{title}</Typography>`. That is the entire implementation — no other file needs to change (the WO is
|
|
125
|
+
explicit: no `slotProps` system, no wrapper changes).
|
|
126
|
+
|
|
127
|
+
**Test file:** `tests/ChartFrame.test.jsx` — extend, don't create a new file. Read the file in full
|
|
128
|
+
first (it already has an i18n/theme harness at the top, shown above) and follow its existing render
|
|
129
|
+
helper/assertion style. Add the 3 required tests: (1) default renders `variant="h6"` on the title
|
|
130
|
+
`Typography` — assert via the rendered DOM (e.g. the title element's tag is `<h6>` or its MUI class
|
|
131
|
+
contains `MuiTypography-h6`), proven non-vacuous by temporarily changing the default to something
|
|
132
|
+
else and confirming the test fails, then restoring it; (2) `titleVariant="subtitle2"` renders the
|
|
133
|
+
title at that variant; (3) subtitle/toolbar/footer render unchanged in both the default and
|
|
134
|
+
overridden case (a plain equality/snapshot-style check between the two renders' non-title markup, or
|
|
135
|
+
explicit assertions that subtitle/toolbar/footer content and structure are present and identical —
|
|
136
|
+
your call on the exact mechanism, the WO doesn't prescribe one).
|
|
137
|
+
|
|
138
|
+
### Do-not-touch / invariants
|
|
139
|
+
|
|
140
|
+
- `ChartFrame`'s `p: 2` padding and its foot row — byte-for-byte unchanged.
|
|
141
|
+
- The baseline's `h6` value itself (16px/600, from THEME-1) — untouched; this WO changes which
|
|
142
|
+
variant a caller may pick, not what the variants are.
|
|
143
|
+
- No `LineChart`/`BarChart`/`TimeSeriesChart` change.
|
|
144
|
+
- Subtitle, toolbar, controls, loading/error/empty slots, export footer — untouched behaviour.
|
|
145
|
+
|
|
146
|
+
### Target repo working directory (absolute)
|
|
147
|
+
|
|
148
|
+
`C:\Users\biglmi\Documents\webapps\ui-core-micha`
|
|
149
|
+
|
|
150
|
+
### Required tests to WRITE (Codex writes them; the Orchestrator runs them)
|
|
151
|
+
|
|
152
|
+
Exactly the 3 tests above in `tests/ChartFrame.test.jsx`, plus `tsc -p tsconfig.build.json --noEmit`
|
|
153
|
+
clean. No full-suite run — affected-areas set is the `ChartFrame` spec alone.
|
|
154
|
+
|
|
155
|
+
### Preamble (append verbatim)
|
|
156
|
+
|
|
157
|
+
> The text above is the COMPLETE spec — the committed WO file's content, not a plan to refine; there
|
|
158
|
+
> is no separate plan file. Read the nearest `AGENTS.md`, the relevant `.codex/skills/<role>/SKILL.md`, and the
|
|
159
|
+
> app `MEMORY.md` ONLY for conventions. Stay in scope; do not touch auth/permissions/deps/schema/CI
|
|
160
|
+
> unless the spec says so; do not update `MEMORY.md`. Do NOT `git add`/`commit`/`push` — leave every
|
|
161
|
+
> change uncommitted in the working tree for the orchestrator's independent review. WRITE the tests
|
|
162
|
+
> the `Required tests` section calls for AND **RUN the tests you just wrote** to confirm they execute
|
|
163
|
+
> and pass — that is the ONLY test run you do (NOT the app's affected/full suite, NOT any review).
|
|
164
|
+
> The orchestrator re-runs the authoritative set + does the independent review after you finish —
|
|
165
|
+
> those are the gate; your own run does not count as the gate.
|
|
166
|
+
>
|
|
167
|
+
> Narrate continuously: a `PLAN: <step1> | <step2> | …` line up front, then a single-line
|
|
168
|
+
> `PROGRESS: [<n>/<total>] <present-tense action>` before every relevant action (and `… done` on
|
|
169
|
+
> completion), spaced so no gap exceeds ~2 min, stdout unbuffered, plus exactly one final
|
|
170
|
+
> `RESULT: DONE|BLOCKED <reason>`.
|
|
171
|
+
|
|
172
|
+
### Mini-handover
|
|
173
|
+
|
|
174
|
+
Repo: `ui-core-micha` (`C:\Users\biglmi\Documents\webapps\ui-core-micha`), branch `main`. WO:
|
|
175
|
+
`work-orders/CHART-7.md`. Follow `orchestrate-codex`.
|