@prenta/admin 2.9.2 → 2.9.3

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/design-system/tokens.css +2 -1
  3. package/design-system/tokens.json +5 -1
  4. package/design-system/tokens.scss +1 -1
  5. package/dist/__tests__/components/qa-a11y.render.test.d.ts +2 -0
  6. package/dist/__tests__/components/qa-a11y.render.test.d.ts.map +1 -0
  7. package/dist/__tests__/components/qa-a11y.render.test.js +46 -0
  8. package/dist/__tests__/components/qa-a11y.render.test.js.map +1 -0
  9. package/dist/__tests__/components/responsive-tiers.render.test.js +12 -0
  10. package/dist/__tests__/components/responsive-tiers.render.test.js.map +1 -1
  11. package/dist/__tests__/components/ui-primitives.test.js +7 -0
  12. package/dist/__tests__/components/ui-primitives.test.js.map +1 -1
  13. package/dist/__tests__/layout/shell-nav.render.test.js +5 -0
  14. package/dist/__tests__/layout/shell-nav.render.test.js.map +1 -1
  15. package/dist/__tests__/styles/qa-contrast.test.d.ts +2 -0
  16. package/dist/__tests__/styles/qa-contrast.test.d.ts.map +1 -0
  17. package/dist/__tests__/styles/qa-contrast.test.js +78 -0
  18. package/dist/__tests__/styles/qa-contrast.test.js.map +1 -0
  19. package/dist/__tests__/views/ai-settings.render.test.js +21 -0
  20. package/dist/__tests__/views/ai-settings.render.test.js.map +1 -1
  21. package/dist/__tests__/views/appearance-chrome.render.test.js +9 -0
  22. package/dist/__tests__/views/appearance-chrome.render.test.js.map +1 -1
  23. package/dist/__tests__/views/jobs-list.render.test.js +2 -0
  24. package/dist/__tests__/views/jobs-list.render.test.js.map +1 -1
  25. package/dist/__tests__/views/run-with-ai.render.test.js +9 -0
  26. package/dist/__tests__/views/run-with-ai.render.test.js.map +1 -1
  27. package/dist/__tests__/views/script-tags.render.test.js +8 -0
  28. package/dist/__tests__/views/script-tags.render.test.js.map +1 -1
  29. package/dist/__tests__/views/settings-tabs.render.test.js +5 -0
  30. package/dist/__tests__/views/settings-tabs.render.test.js.map +1 -1
  31. package/dist/components/SEOConfigPanel.js +2 -2
  32. package/dist/components/SEOConfigPanel.js.map +1 -1
  33. package/dist/components/forms/EntriesTable.d.ts.map +1 -1
  34. package/dist/components/forms/EntriesTable.js +1 -1
  35. package/dist/components/forms/EntriesTable.js.map +1 -1
  36. package/dist/components/seo/PageAuditPanel.js +2 -2
  37. package/dist/components/seo/PageAuditPanel.js.map +1 -1
  38. package/dist/components/seo/primitives.d.ts +1 -1
  39. package/dist/components/seo/primitives.d.ts.map +1 -1
  40. package/dist/components/seo/primitives.js +10 -1
  41. package/dist/components/seo/primitives.js.map +1 -1
  42. package/dist/components/ui/FilterPill.d.ts.map +1 -1
  43. package/dist/components/ui/FilterPill.js +2 -2
  44. package/dist/components/ui/FilterPill.js.map +1 -1
  45. package/dist/components/ui/PageHeader.d.ts +7 -1
  46. package/dist/components/ui/PageHeader.d.ts.map +1 -1
  47. package/dist/components/ui/PageHeader.js +4 -2
  48. package/dist/components/ui/PageHeader.js.map +1 -1
  49. package/dist/layout/Sidebar.d.ts.map +1 -1
  50. package/dist/layout/Sidebar.js +4 -1
  51. package/dist/layout/Sidebar.js.map +1 -1
  52. package/dist/prenta-admin.css +1 -1
  53. package/dist/views/Jobs.d.ts.map +1 -1
  54. package/dist/views/Jobs.js +1 -1
  55. package/dist/views/Jobs.js.map +1 -1
  56. package/dist/views/MediaBrowser.d.ts.map +1 -1
  57. package/dist/views/MediaBrowser.js +5 -1
  58. package/dist/views/MediaBrowser.js.map +1 -1
  59. package/dist/views/Pages/PagesListView.js +1 -1
  60. package/dist/views/Pages/PagesListView.js.map +1 -1
  61. package/dist/views/Redirects.d.ts.map +1 -1
  62. package/dist/views/Redirects.js +1 -3
  63. package/dist/views/Redirects.js.map +1 -1
  64. package/dist/views/ScriptTags.js +1 -1
  65. package/dist/views/Settings.js +1 -1
  66. package/dist/views/Settings.js.map +1 -1
  67. package/dist/views/header-footer/ChromePreview.d.ts.map +1 -1
  68. package/dist/views/header-footer/ChromePreview.js +12 -6
  69. package/dist/views/header-footer/ChromePreview.js.map +1 -1
  70. package/dist/views/settings/AISettingsTab.js +1 -1
  71. package/dist/views/settings/SecurityStatusCard.js +1 -1
  72. package/dist/views/settings/SecurityStatusCard.js.map +1 -1
  73. package/dist/views/settings/SiteIndexStatusCard.js +1 -1
  74. package/dist/views/settings/SiteIndexStatusCard.js.map +1 -1
  75. package/dist/views/settings/brand-voice/BrandVoiceAlignmentPanel.js +1 -1
  76. package/dist/views/settings/brand-voice/BrandVoiceRulesSections.js +3 -3
  77. package/dist/views/settings/components.d.ts +1 -1
  78. package/dist/views/settings/components.d.ts.map +1 -1
  79. package/dist/views/settings/components.js +1 -1
  80. package/package.json +5 -5
  81. package/src/__tests__/components/qa-a11y.render.test.tsx +72 -0
  82. package/src/__tests__/components/responsive-tiers.render.test.tsx +13 -0
  83. package/src/__tests__/components/ui-primitives.test.tsx +11 -0
  84. package/src/__tests__/layout/shell-nav.render.test.tsx +6 -0
  85. package/src/__tests__/styles/qa-contrast.test.ts +90 -0
  86. package/src/__tests__/views/ai-settings.render.test.tsx +23 -0
  87. package/src/__tests__/views/appearance-chrome.render.test.tsx +12 -0
  88. package/src/__tests__/views/jobs-list.render.test.tsx +2 -0
  89. package/src/__tests__/views/run-with-ai.render.test.tsx +10 -0
  90. package/src/__tests__/views/script-tags.render.test.tsx +11 -0
  91. package/src/__tests__/views/settings-tabs.render.test.tsx +6 -0
  92. package/src/components/SEOConfigPanel.tsx +2 -2
  93. package/src/components/forms/EntriesTable.tsx +1 -0
  94. package/src/components/seo/PageAuditPanel.tsx +2 -2
  95. package/src/components/seo/primitives.tsx +15 -3
  96. package/src/components/ui/FilterPill.tsx +4 -2
  97. package/src/components/ui/PageHeader.tsx +14 -1
  98. package/src/layout/Sidebar.tsx +3 -0
  99. package/src/styles/prenta-tokens.css +2 -1
  100. package/src/views/Jobs.tsx +1 -0
  101. package/src/views/MediaBrowser.tsx +6 -1
  102. package/src/views/Pages/PagesListView.tsx +1 -1
  103. package/src/views/Redirects.tsx +1 -3
  104. package/src/views/ScriptTags.tsx +1 -1
  105. package/src/views/Settings.tsx +1 -1
  106. package/src/views/header-footer/ChromePreview.tsx +18 -8
  107. package/src/views/settings/AISettingsTab.tsx +1 -1
  108. package/src/views/settings/SecurityStatusCard.tsx +1 -1
  109. package/src/views/settings/SiteIndexStatusCard.tsx +1 -1
  110. package/src/views/settings/brand-voice/BrandVoiceAlignmentPanel.tsx +1 -1
  111. package/src/views/settings/brand-voice/BrandVoiceRulesSections.tsx +3 -3
  112. package/src/views/settings/components.tsx +2 -2
@@ -145,6 +145,19 @@ describe('header actions collapse (tablet: icons, AI keeps its text)', () => {
145
145
  // A plain-text subtitle hides on small phones (cms-layouts.css ≤460px).
146
146
  expect(classesOf(screen.getByText('14 pages'))).toContain('[@media(width<461px)]:hidden')
147
147
  })
148
+
149
+ it('keeps a fixed subtitle at 13px on every tier (Jobs `.jb-sub`, Settings `.pg-sub`)', () => {
150
+ render(<PageHeader title="Jobs" subtitle="Background work" fixedSubtitle />)
151
+ const classes = classesOf(screen.getByText('Background work'))
152
+ expect(classes).toContain('text-body')
153
+ for (const tier of [
154
+ '[@media(width<461px)]:hidden',
155
+ 'mobile:text-[12.5px]',
156
+ '4k:text-[14.5px]',
157
+ ]) {
158
+ expect(classes).not.toContain(tier)
159
+ }
160
+ })
148
161
  })
149
162
 
150
163
  describe('Posts list on mobile: FAB and cards', () => {
@@ -46,6 +46,17 @@ describe('FilterPill', () => {
46
46
  expect(screen.getByText('12')).toBeTruthy()
47
47
  expect(screen.getByRole('button', { name: /Admin/ }).getAttribute('aria-pressed')).toBe('false')
48
48
  })
49
+ it('writes active text in --on-acc, never white (ink on Graphite’s light accent)', () => {
50
+ render(
51
+ <FilterPill active count={3}>
52
+ Head
53
+ </FilterPill>,
54
+ )
55
+ const btn = screen.getByRole('button', { name: /Head/ })
56
+ expect(btn.className).toContain('text-[var(--on-acc)]')
57
+ expect(btn.className).not.toMatch(/\btext-white\b/)
58
+ expect(screen.getByText('3').className).toContain('text-[var(--on-acc)]')
59
+ })
49
60
  it('keeps its label on one line', () => {
50
61
  render(<FilterPill>Body start</FilterPill>)
51
62
  expect(screen.getByRole('button', { name: 'Body start' }).className).toContain(
@@ -176,6 +176,12 @@ describe('Sidebar', () => {
176
176
  expect(text.indexOf('Content')).toBeLessThan(text.indexOf('Media'))
177
177
  })
178
178
 
179
+ it('names its landmark, so a screen’s own aside stays a distinct landmark', () => {
180
+ stubWidth(1280)
181
+ renderSidebar('/')
182
+ expect(screen.getByRole('complementary', { name: 'Sidebar' })).toBeTruthy()
183
+ })
184
+
179
185
  it('toggles a parent on click at ≥1025px instead of navigating', () => {
180
186
  stubWidth(1280)
181
187
  const onNavigate = renderSidebar('/', false)
@@ -0,0 +1,90 @@
1
+ import { readdirSync, readFileSync } from 'node:fs'
2
+ import { dirname, join, relative, resolve } from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+ import { describe, expect, it } from 'vitest'
5
+ import { contrastRatio } from '@prenta/core/appearance'
6
+
7
+ /**
8
+ * TRACKING P-22 (QA_CHECKLIST "Text contrast ≥ 4.5:1 … in both modes"): pairings
9
+ * the sign-off pass found below 4.5:1, pinned at the token level.
10
+ */
11
+
12
+ const HERE = dirname(fileURLToPath(import.meta.url))
13
+ const tokens = JSON.parse(readFileSync(resolve(HERE, '../../../design-system/tokens.json'), 'utf8'))
14
+ const color = tokens.color as Record<string, Record<string, Record<string, { value: string }>>>
15
+ const value = (base: string, group: string, name: string) => color[base]![group]![name]!.value
16
+
17
+ describe('code block text', () => {
18
+ // Code surfaces are the same in every base, so the light group covers all three.
19
+ it.each(['code-txt', 'code-cmt', 'code-str', 'code-kw', 'code-err', 'code-file'])(
20
+ '%s clears 4.5:1 on --code-bg',
21
+ (name) => {
22
+ const ratio = contrastRatio(value('light', 'code', name), value('light', 'code', 'code-bg'))
23
+ expect(ratio).toBeGreaterThanOrEqual(4.5)
24
+ },
25
+ )
26
+
27
+ it('the Copy button label clears 4.5:1 on its own fill', () => {
28
+ const ratio = contrastRatio(
29
+ value('light', 'code', 'code-btn-txt'),
30
+ value('light', 'code', 'code-btn-bg'),
31
+ )
32
+ expect(ratio).toBeGreaterThanOrEqual(4.5)
33
+ })
34
+ })
35
+
36
+ describe('text on accent fills', () => {
37
+ // Graphite lightens --acc for dark surfaces, so white on it is ~2.9:1. Accent
38
+ // fills take --on-acc (text-primary-foreground), as the kit's `.btn-p` and
39
+ // `.filter-pill.act` do. These editor-only files are tracked as a P-22 finding.
40
+ const KNOWN = new Set([
41
+ 'components/CoauthorResultPopover.tsx',
42
+ 'components/CommentSidePanel.tsx',
43
+ 'views/page-editor/sections/SectionRenderer.tsx',
44
+ ])
45
+ const FILL = /\b(?:bg-primary|bg-acc|bg-brand|bg-\[var\(--acc\)\])(?![\w/-])/
46
+ const SRC = resolve(HERE, '../..')
47
+
48
+ function sources(dir: string): string[] {
49
+ return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
50
+ const path = join(dir, entry.name)
51
+ if (entry.isDirectory()) return entry.name === '__tests__' ? [] : sources(path)
52
+ return /\.tsx$/.test(entry.name) ? [path] : []
53
+ })
54
+ }
55
+
56
+ it('is never white', () => {
57
+ const offenders: string[] = []
58
+ for (const file of sources(SRC)) {
59
+ const rel = relative(SRC, file).replace(/\\/g, '/')
60
+ if (KNOWN.has(rel)) continue
61
+ const literals = readFileSync(file, 'utf8').match(/(['"`])(?:(?!\1)[^\\\n]|\\.)*\1/g) ?? []
62
+ for (const literal of literals) {
63
+ if (FILL.test(literal) && /\btext-white\b/.test(literal)) {
64
+ offenders.push(`${rel}: ${literal}`)
65
+ }
66
+ }
67
+ }
68
+ expect(offenders).toEqual([])
69
+ })
70
+ })
71
+
72
+ describe('success chips (text-success on bg-suc-l)', () => {
73
+ it.each(['light', 'dark'])('clear 4.5:1 in %s', (base) => {
74
+ const ratio = contrastRatio(value(base, 'semantic', 'suc'), value(base, 'semantic', 'suc-l'))
75
+ expect(ratio).toBeGreaterThanOrEqual(4.5)
76
+ })
77
+
78
+ it('the Settings and SEO chips use that pairing, not a 15% tint (4.43:1)', () => {
79
+ const src = (rel: string) => readFileSync(resolve(HERE, '../..', rel), 'utf8')
80
+ for (const file of [
81
+ 'views/settings/SecurityStatusCard.tsx',
82
+ 'views/settings/SiteIndexStatusCard.tsx',
83
+ 'views/Redirects.tsx',
84
+ 'components/seo/PageAuditPanel.tsx',
85
+ ]) {
86
+ expect(src(file), file).not.toContain('bg-success/15')
87
+ expect(src(file), file).toContain('bg-suc-l text-success')
88
+ }
89
+ })
90
+ })
@@ -162,6 +162,13 @@ describe('AISettingsTab', () => {
162
162
  expect(within(assistant).getByText('200,000 token context')).toBeTruthy()
163
163
  })
164
164
 
165
+ it('titles the add-provider form one level under its h2 card (P-22 heading order)', async () => {
166
+ render(<AISettingsTab role="ADMIN" />)
167
+ await screen.findByText('AI Assistant')
168
+ fireEvent.click(screen.getByRole('button', { name: 'Add provider' }))
169
+ expect(screen.getByRole('heading', { level: 3, name: 'Add a provider' })).toBeTruthy()
170
+ })
171
+
165
172
  it('shows real monthly usage (never a fabricated number)', async () => {
166
173
  render(<AISettingsTab role="ADMIN" />)
167
174
  expect(await screen.findByText('412K tokens used')).toBeTruthy()
@@ -362,6 +369,22 @@ describe('AISettingsTab', () => {
362
369
  expect(within(region).getByRole('button', { name: 'Import .md' })).toBeTruthy()
363
370
  })
364
371
 
372
+ it('nests the brand voice form’s sections one level under its h2 card title', async () => {
373
+ render(<AISettingsTab role="ADMIN" />)
374
+ const region = await screen.findByRole('region', { name: 'Brand voice' })
375
+ expect(within(region).getByRole('heading', { level: 2, name: 'Brand voice' })).toBeTruthy()
376
+ for (const name of [
377
+ 'Vocabulary rules',
378
+ 'Channel overrides',
379
+ 'Worked examples',
380
+ 'Check alignment',
381
+ ]) {
382
+ expect(within(region).getByRole('heading', { level: 3, name })).toBeTruthy()
383
+ }
384
+ // An h4 here would skip a level under the card's h2 (axe heading-order).
385
+ expect(within(region).queryAllByRole('heading', { level: 4 })).toHaveLength(0)
386
+ })
387
+
365
388
  it('disables brand voice fields for non-admins', async () => {
366
389
  render(<AISettingsTab role="EDITOR" />)
367
390
  const region = await screen.findByRole('region', { name: 'Brand voice' })
@@ -605,6 +605,18 @@ describe('Header tab (P-11)', () => {
605
605
  expect(document.querySelector('[data-preview-site]')!.getAttribute('data-viewport')).toBe('mob')
606
606
  })
607
607
 
608
+ it('fills the mock’s brand parts with the light-tuned accent, which keeps white text at 4.5:1 in Graphite', async () => {
609
+ renderScreen('EDITOR', 'header')
610
+ await loaded()
611
+ const bar = document.querySelector('[data-preview-announcement]') as HTMLElement
612
+ expect(bar.className).toContain('bg-[var(--acc-lt,var(--acc-base))]')
613
+ const cta = within(document.querySelector('[data-preview-header]') as HTMLElement).getByText(
614
+ 'Get a free audit',
615
+ )
616
+ expect(cta.className).toContain('bg-[var(--acc-lt,var(--acc-base))]')
617
+ expect(cta.className).not.toMatch(/\bbg-acc\b/)
618
+ })
619
+
608
620
  it('is read-only for a viewer', async () => {
609
621
  renderScreen('VIEWER', 'header')
610
622
  await loaded()
@@ -336,6 +336,8 @@ describe('Jobs list', () => {
336
336
  it('shows the kit’s header, worker strip, alerts and filter counts', async () => {
337
337
  await renderLoaded()
338
338
  expect(screen.getByRole('heading', { level: 1, name: 'Jobs' })).toBeTruthy()
339
+ // The kit's `.jb-sub` stays on small phones, unlike `.page-sub` (P-22).
340
+ expect(screen.getByText(/^Background work that/).className).not.toContain('width<461px')
339
341
  expect(screen.getByRole('button', { name: 'Live', pressed: true })).toBeTruthy()
340
342
  expect(screen.getByRole('button', { name: 'New batch AI job' })).toBeTruthy()
341
343
  expect(screen.getByText(/^Ran 2\ds ago/)).toBeTruthy()
@@ -830,3 +830,13 @@ describe('a link to a job', () => {
830
830
  expect(screen.queryByRole('dialog')).toBeNull()
831
831
  })
832
832
  })
833
+
834
+ /** TRACKING P-22: the grid's scroller is focusable and named (Media.html `.mc-grid-area`). */
835
+ describe('Media grid', () => {
836
+ it('is a focusable region named "Media library", so keyboards can scroll it', async () => {
837
+ render(<MediaBrowser onNavigate={() => {}} role="EDITOR" config={CONFIG} />)
838
+ const grid = await screen.findByRole('region', { name: 'Media library' })
839
+ expect(grid.getAttribute('tabindex')).toBe('0')
840
+ expect(grid.className).toContain('overflow-y-auto')
841
+ })
842
+ })
@@ -205,3 +205,14 @@ describe('ScriptTags header polish', () => {
205
205
  expect(search?.className).toContain('max-w-[260px]')
206
206
  })
207
207
  })
208
+
209
+ /** TRACKING P-22: the empty state's heading follows the page's h1 (axe heading-order). */
210
+ describe('ScriptTags empty state', () => {
211
+ it('titles the empty list with an h2', async () => {
212
+ cmsApi.mockImplementationOnce(async () => ({ data: [] }))
213
+ render(<ScriptTags />)
214
+ expect(
215
+ await screen.findByRole('heading', { level: 2, name: 'No script tags yet' }),
216
+ ).toBeTruthy()
217
+ })
218
+ })
@@ -197,6 +197,12 @@ describe('Settings tabs', () => {
197
197
  expect(selectedTab().textContent).toBe('General')
198
198
  })
199
199
 
200
+ it('keeps its subtitle on small phones, as Settings.html `.pg-sub` does (P-22)', async () => {
201
+ render(<Settings session={ADMIN} />)
202
+ await screen.findByLabelText('Site Title')
203
+ expect(screen.getByText('Manage your CMS configuration').className).not.toContain('width<461px')
204
+ })
205
+
200
206
  it('opens the tab named by ?tab=', async () => {
201
207
  window.history.replaceState(null, '', '/admin/settings?tab=appearance')
202
208
  render(<Settings session={ADMIN} />)
@@ -234,7 +234,7 @@ export function SEOConfigPanel() {
234
234
  <button
235
235
  onClick={handleSave}
236
236
  disabled={saving}
237
- className="bg-primary hover:bg-primary/90 inline-flex shrink-0 items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium text-white shadow-sm disabled:opacity-50"
237
+ className="bg-primary hover:bg-primary/90 text-primary-foreground inline-flex shrink-0 items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium shadow-sm disabled:opacity-50"
238
238
  >
239
239
  {saving ? <Loader2 className="h-4 w-4 animate-spin" /> : <Save className="h-4 w-4" />}
240
240
  Save SEO defaults
@@ -438,7 +438,7 @@ export function SEOConfigPanel() {
438
438
  <button
439
439
  onClick={handleSave}
440
440
  disabled={saving}
441
- className="bg-primary hover:bg-primary/90 inline-flex items-center gap-1.5 rounded-md px-4 py-2 text-sm font-medium text-white shadow-sm disabled:opacity-50"
441
+ className="bg-primary hover:bg-primary/90 text-primary-foreground inline-flex items-center gap-1.5 rounded-md px-4 py-2 text-sm font-medium shadow-sm disabled:opacity-50"
442
442
  >
443
443
  {saving ? <Loader2 className="h-4 w-4 animate-spin" /> : <Save className="h-4 w-4" />}
444
444
  Save SEO defaults
@@ -128,6 +128,7 @@ export function EntriesTable({
128
128
  <div className="flex items-center gap-2">
129
129
  {entry.unread && (
130
130
  <span
131
+ role="img"
131
132
  className="bg-primary h-1.5 w-1.5 shrink-0 rounded-full"
132
133
  aria-label="Unread"
133
134
  />
@@ -76,7 +76,7 @@ function CheckRow({ check }: { check: AuditCheck }) {
76
76
  <span
77
77
  aria-hidden
78
78
  className={`mt-0.5 h-4 w-4 shrink-0 rounded ${
79
- na ? 'bg-muted' : pass ? 'bg-success/15 text-success' : 'bg-warn-l text-warning'
79
+ na ? 'bg-muted' : pass ? 'bg-suc-l text-success' : 'bg-warn-l text-warning'
80
80
  }`}
81
81
  />
82
82
  <div className="min-w-0">
@@ -120,7 +120,7 @@ function CheckGroup({ result, title }: { result: AuditGroupResult; title: string
120
120
  <span
121
121
  className={`rounded-full px-1.5 text-[10px] font-bold tabular-nums ${
122
122
  band === 'good'
123
- ? 'bg-success/15 text-success'
123
+ ? 'bg-suc-l text-success'
124
124
  : band === 'fair'
125
125
  ? 'bg-warn-l text-warning'
126
126
  : band === 'poor'
@@ -5,7 +5,7 @@
5
5
  * the five SEO tabs. No raw palette colours: status uses the theme's
6
6
  * success / warning / destructive / muted tokens.
7
7
  */
8
- import type { ReactNode } from 'react'
8
+ import { useId, type ReactNode } from 'react'
9
9
  import { AlertTriangle, Loader2 } from 'lucide-react'
10
10
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../ui/Card.js'
11
11
  import { StatusBadge, type StatusBadgeTone } from '../ui/StatusBadge.js'
@@ -175,12 +175,24 @@ export function SectionCard({
175
175
  children: ReactNode
176
176
  className?: string
177
177
  }) {
178
+ const titleId = useId()
179
+ // A titled card is a region named by its title (an unnamed region is a
180
+ // duplicate landmark), and its title is the h2 under the page's h1.
178
181
  return (
179
- <Card padding="none" className={className} role="region">
182
+ <Card
183
+ padding="none"
184
+ className={className}
185
+ role={title ? 'region' : undefined}
186
+ aria-labelledby={title ? titleId : undefined}
187
+ >
180
188
  {(title || action) && (
181
189
  <CardHeader className="flex items-center justify-between gap-3">
182
190
  <div className="min-w-0">
183
- {title && <CardTitle>{title}</CardTitle>}
191
+ {title && (
192
+ <CardTitle as="h2" id={titleId}>
193
+ {title}
194
+ </CardTitle>
195
+ )}
184
196
  {description && <CardDescription>{description}</CardDescription>}
185
197
  </div>
186
198
  {action}
@@ -29,14 +29,16 @@ export function FilterPill({
29
29
  className={`inline-flex items-center gap-1.5 rounded-[7px] border px-3 py-1.5 text-[12.5px] font-medium whitespace-nowrap transition-colors duration-[var(--motion-fast)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:outline-none ${
30
30
  active
31
31
  ? // Forced colors drop the fill: the active pill keeps an outline.
32
- 'border-[var(--acc)] bg-[var(--acc)] text-white forced-colors:outline-2 forced-colors:outline-offset-1 forced-colors:outline-solid'
32
+ 'border-[var(--acc)] bg-[var(--acc)] text-[var(--on-acc)] forced-colors:outline-2 forced-colors:outline-offset-1 forced-colors:outline-solid'
33
33
  : 'border-[var(--bdr)] bg-[var(--card)] text-[var(--sub)] hover:border-[var(--acc-m)] hover:text-[var(--acc)]'
34
34
  } ${className ?? ''}`}
35
35
  {...rest}
36
36
  >
37
37
  {children}
38
38
  {count !== undefined && (
39
- <span className={`tabular-nums ${active ? 'text-white/80' : 'text-[var(--muted)]'}`}>
39
+ <span
40
+ className={`tabular-nums ${active ? 'text-[var(--on-acc)] opacity-80' : 'text-[var(--muted)]'}`}
41
+ >
40
42
  {count}
41
43
  </span>
42
44
  )}
@@ -13,6 +13,12 @@ export interface PageHeaderProps {
13
13
  * content (the kit's Jobs and Appearance layouts, `padding: 22px 28px`).
14
14
  */
15
15
  flush?: boolean
16
+ /**
17
+ * Keep a plain-text subtitle at 13px and on screen at every width. The kit's
18
+ * tier rules (12.5px on mobile, 14.5px at 4K, hidden below 461px) only apply
19
+ * to `.page-sub`; Jobs' `.jb-sub` and Settings' `.pg-sub` don't follow them.
20
+ */
21
+ fixedSubtitle?: boolean
16
22
  }
17
23
 
18
24
  /**
@@ -32,6 +38,7 @@ export function PageHeader({
32
38
  actions,
33
39
  breadcrumb,
34
40
  flush = false,
41
+ fixedSubtitle = false,
35
42
  }: PageHeaderProps) {
36
43
  return (
37
44
  <header
@@ -43,7 +50,13 @@ export function PageHeader({
43
50
  {title}
44
51
  </h1>
45
52
  {typeof subtitle === 'string' ? (
46
- <p className="text-body text-sub mobile:text-[12.5px] 4k:text-[14.5px] m-0 mt-[3px] max-w-[640px] leading-[normal] text-pretty [@media(width<461px)]:hidden">
53
+ <p
54
+ className={`text-body text-sub m-0 mt-[3px] max-w-[640px] leading-[normal] text-pretty ${
55
+ fixedSubtitle
56
+ ? ''
57
+ : 'mobile:text-[12.5px] 4k:text-[14.5px] [@media(width<461px)]:hidden'
58
+ }`}
59
+ >
47
60
  {subtitle}
48
61
  </p>
49
62
  ) : subtitle ? (
@@ -150,7 +150,10 @@ export function Sidebar({
150
150
  const navItems = items ?? ownItems
151
151
 
152
152
  return (
153
+ // Named, so it stays a distinct landmark next to a screen's own <aside>
154
+ // (the Dashboard's right column).
153
155
  <aside
156
+ aria-label="Sidebar"
154
157
  className={`bg-sb border-bdr flex h-full flex-col border-r transition-[width] duration-[var(--mo-slow)] ease-[cubic-bezier(.4,0,.2,1)] ${
155
158
  collapsed ? 'w-[var(--sbw-col)]' : 'w-[var(--sbw)]'
156
159
  }`}
@@ -121,7 +121,8 @@
121
121
  /* Code surfaces */
122
122
  --code-bg: #0f1115;
123
123
  --code-txt: #d6dae1;
124
- --code-cmt: #6b7280;
124
+ /* Kit #6B7280 nudged lighter to clear 4.6:1 on --code-bg (kit was 3.9:1) */
125
+ --code-cmt: #7a808d;
125
126
  --code-str: #9fd39b;
126
127
  --code-kw: #c4a7ff;
127
128
  --code-err: #f2b8b5;
@@ -275,6 +275,7 @@ export function Jobs({ onNavigate, currentPath, role = null, userId = null, conf
275
275
  <div className="mobile:px-3.5 mobile:pt-4 mobile:pb-[100px] flex min-w-0 flex-col gap-4 px-7 pt-[22px] pb-24 leading-[normal]">
276
276
  <PageHeader
277
277
  flush
278
+ fixedSubtitle
278
279
  title="Jobs"
279
280
  subtitle="Background work that’s too big to finish in one request: SEO scans, content health checks and batch AI changes. Long jobs run one slice a minute and pick up where they left off."
280
281
  actions={
@@ -849,7 +849,12 @@ export function MediaBrowser({ onNavigate, currentPath, role, config }: MediaBro
849
849
  {viewMode === 'grid' ? (
850
850
  <div
851
851
  ref={gridScrollRef}
852
- tabIndex={-1}
852
+ // The grid's cards aren't focusable yet, so the scroller
853
+ // itself takes Tab and arrow-key scrolling (Media.html
854
+ // `.mc-grid-area`; axe scrollable-region-focusable).
855
+ tabIndex={0}
856
+ role="region"
857
+ aria-label="Media library"
853
858
  className="h-full overflow-y-auto p-2 sm:p-3"
854
859
  >
855
860
  <div className="relative" style={{ height: gridRowCount * 220 }}>
@@ -1137,7 +1137,7 @@ function ColumnsMenu({
1137
1137
  aria-hidden
1138
1138
  className={`flex h-4 w-4 items-center justify-center rounded border ${
1139
1139
  visible
1140
- ? 'bg-primary border-transparent text-white'
1140
+ ? 'bg-primary text-primary-foreground border-transparent'
1141
1141
  : 'border-[var(--bdr)] bg-[var(--card)]'
1142
1142
  }`}
1143
1143
  >
@@ -253,9 +253,7 @@ export function Redirects({ onNavigate }: RedirectsProps) {
253
253
  <td className="px-4 py-3">
254
254
  <span
255
255
  className={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${
256
- redirect.active
257
- ? 'bg-success/15 text-success'
258
- : 'bg-muted text-foreground'
256
+ redirect.active ? 'bg-suc-l text-success' : 'bg-muted text-foreground'
259
257
  }`}
260
258
  >
261
259
  {redirect.active ? 'Active' : 'Inactive'}
@@ -352,7 +352,7 @@ export function ScriptTags({ initialSelectedId, initialNew }: ScriptTagsProps) {
352
352
  {tags.length === 0 && !error ? (
353
353
  <div className="rounded-lg border border-[var(--bdr)] bg-[var(--card)] p-12 text-center">
354
354
  <Code2 className="mx-auto mb-3 h-10 w-10 text-[var(--sub)]" />
355
- <h3 className="text-sm font-medium text-[var(--txt)]">No script tags yet</h3>
355
+ <h2 className="text-sm font-medium text-[var(--txt)]">No script tags yet</h2>
356
356
  <p className="mt-1 text-sm text-[var(--sub)]">
357
357
  Add tracking codes like Google Analytics, Tag Manager, or Facebook Pixel.
358
358
  </p>
@@ -317,7 +317,7 @@ export function Settings({
317
317
  </button>
318
318
  </div>
319
319
  )}
320
- <PageHeader flush title="Settings" subtitle="Manage your CMS configuration" />
320
+ <PageHeader flush fixedSubtitle title="Settings" subtitle="Manage your CMS configuration" />
321
321
  </div>
322
322
 
323
323
  <UnderlineTabs
@@ -99,10 +99,17 @@ function topItems(menu: ChromeMenuOption | undefined): ChromeMenuItem[] {
99
99
  return menu ? menu.items : []
100
100
  }
101
101
 
102
+ /**
103
+ * The mock is a light website in every admin theme, so its brand fills use the
104
+ * accent tuned for light surfaces (`--acc-lt`), which keeps white text at 4.5:1.
105
+ * Graphite's `--acc` is lightened for dark surfaces and would drop it to ~2.9:1.
106
+ */
107
+ const SITE_BRAND = 'bg-[var(--acc-lt,var(--acc-base))]'
108
+
102
109
  const TONE_BACKGROUND: Record<string, string> = {
103
- brand: 'var(--acc)',
104
- dark: 'var(--site-txt)',
105
- alert: 'var(--site-alert)',
110
+ brand: SITE_BRAND,
111
+ dark: 'bg-site-txt',
112
+ alert: 'bg-site-alert',
106
113
  }
107
114
 
108
115
  function MockSite({
@@ -193,7 +200,7 @@ function MockSite({
193
200
  const contact = [textOf(email), textOf(footPhone)].filter(Boolean).join(' · ')
194
201
  const socialLinks = Array.isArray(social?.value) ? (social.value as unknown[]).map(rec) : []
195
202
 
196
- const toneColor = TONE_BACKGROUND[announcement?.tone ?? 'brand'] ?? TONE_BACKGROUND.brand
203
+ const toneClass = TONE_BACKGROUND[announcement?.tone ?? 'brand'] ?? SITE_BRAND
197
204
  const footMuted = light ? 'text-site-sub' : 'text-site-foot-txt'
198
205
  const footStrong = light ? 'text-site-txt' : 'text-site-bg'
199
206
 
@@ -208,8 +215,7 @@ function MockSite({
208
215
  {announcement?.on ? (
209
216
  <div
210
217
  data-preview-announcement=""
211
- className="flex items-center justify-center gap-2.5 px-3 py-[7px] text-center text-[12px] font-semibold text-white"
212
- style={{ background: toneColor }}
218
+ className={`flex items-center justify-center gap-2.5 px-3 py-[7px] text-center text-[12px] font-semibold text-white ${toneClass}`}
213
219
  >
214
220
  <span>{announcement.text}</span>
215
221
  {announcement.linkLabel ? <u className="font-bold">{announcement.linkLabel} →</u> : null}
@@ -256,7 +262,9 @@ function MockSite({
256
262
  {search?.value === true && !minimal ? <span>⌕</span> : null}
257
263
  {phoneValue && !mob ? <span>{phoneValue}</span> : null}
258
264
  {ctaLabel ? (
259
- <span className="bg-acc rounded-7 px-3 py-[7px] text-[12.5px] font-semibold text-white">
265
+ <span
266
+ className={`rounded-7 ${SITE_BRAND} px-3 py-[7px] text-[12.5px] font-semibold text-white`}
267
+ >
260
268
  {ctaLabel}
261
269
  </span>
262
270
  ) : null}
@@ -310,7 +318,9 @@ function MockSite({
310
318
  light ? 'border-site-bdr bg-site-bg' : 'border-white/15 bg-white/8'
311
319
  }`}
312
320
  />
313
- <em className="bg-acc rounded-6 px-[9px] py-1 font-semibold text-white not-italic">
321
+ <em
322
+ className={`rounded-6 ${SITE_BRAND} px-[9px] py-1 font-semibold text-white not-italic`}
323
+ >
314
324
  Subscribe
315
325
  </em>
316
326
  </div>
@@ -382,7 +382,7 @@ function AddProviderForm({
382
382
 
383
383
  return (
384
384
  <div className="border-border bg-background rounded-lg border p-4">
385
- <h4 className="text-foreground mb-3 text-base font-medium">Add a provider</h4>
385
+ <h3 className="text-foreground mb-3 text-base font-medium">Add a provider</h3>
386
386
  <div className="space-y-3">
387
387
  <div>
388
388
  <label htmlFor={providerId} className={LABEL_CLASS}>
@@ -10,7 +10,7 @@ const LEVEL_STYLES: Record<
10
10
  { pill: string; Icon: typeof Shield; word: string }
11
11
  > = {
12
12
  secure: {
13
- pill: 'bg-success/15 text-success border-success/30',
13
+ pill: 'bg-suc-l text-success border-success/30',
14
14
  Icon: ShieldCheck,
15
15
  word: 'Secure',
16
16
  },
@@ -23,7 +23,7 @@ interface SiteIndexStatusCardProps {
23
23
 
24
24
  const SEVERITY_STYLES: Record<SiteIndexStatus['severity'], { pill: string; icon: ReactNode }> = {
25
25
  success: {
26
- pill: 'bg-success/15 text-success border-success/30',
26
+ pill: 'bg-suc-l text-success border-success/30',
27
27
  icon: <CheckCircle2 size={14} aria-hidden="true" />,
28
28
  },
29
29
  warning: {
@@ -88,7 +88,7 @@ export function BrandVoiceAlignmentPanel({
88
88
  return (
89
89
  <div className="border-border space-y-4 rounded-md border border-dashed p-4">
90
90
  <div>
91
- <h4 className="text-foreground text-base font-medium">Check alignment</h4>
91
+ <h3 className="text-foreground text-base font-medium">Check alignment</h3>
92
92
  <p className="text-muted-foreground mt-1 text-sm">
93
93
  Paste draft copy to score it against your vocabulary rules, mechanics, and channel limits.
94
94
  </p>
@@ -57,7 +57,7 @@ export function BrandVoiceRulesSections({
57
57
  <div className="space-y-6">
58
58
  <section className="space-y-3">
59
59
  <div>
60
- <h4 className="text-foreground text-base font-medium">Vocabulary rules</h4>
60
+ <h3 className="text-foreground text-base font-medium">Vocabulary rules</h3>
61
61
  <p className="text-muted-foreground mt-1 text-sm">
62
62
  Banned terms produce deterministic alignment errors. Preferred terms are scored as
63
63
  bonuses.
@@ -164,7 +164,7 @@ export function BrandVoiceRulesSections({
164
164
 
165
165
  <section className="space-y-3">
166
166
  <div>
167
- <h4 className="text-foreground text-base font-medium">Channel overrides</h4>
167
+ <h3 className="text-foreground text-base font-medium">Channel overrides</h3>
168
168
  <p className="text-muted-foreground mt-1 text-sm">
169
169
  Length limits and notes used when scoring copy for a specific channel.
170
170
  </p>
@@ -244,7 +244,7 @@ export function BrandVoiceRulesSections({
244
244
 
245
245
  <section className="space-y-3">
246
246
  <div>
247
- <h4 className="text-foreground text-base font-medium">Worked examples</h4>
247
+ <h3 className="text-foreground text-base font-medium">Worked examples</h3>
248
248
  <p className="text-muted-foreground mt-1 text-sm">
249
249
  Off-brand vs on-brand pairs anchor scoring feedback and the sample copy field.
250
250
  </p>
@@ -30,7 +30,7 @@ export function SettingsCard({
30
30
  actions,
31
31
  children,
32
32
  className,
33
- headingLevel: Heading = 'h3',
33
+ headingLevel: Heading = 'h2',
34
34
  busy = false,
35
35
  }: {
36
36
  title: ReactNode
@@ -39,7 +39,7 @@ export function SettingsCard({
39
39
  actions?: ReactNode
40
40
  children: ReactNode
41
41
  className?: string
42
- /** Override the heading element for correct document outline nesting. */
42
+ /** The card title's heading: h2 under the Settings h1 (Settings.html `.ap-head h2`). */
43
43
  headingLevel?: 'h2' | 'h3'
44
44
  /** Marks the region `aria-busy` while a save/refresh is in flight. */
45
45
  busy?: boolean