@primer/doctocat-nextjs 0.7.1-rc.bf9f37a → 0.8.0-rc.abeed68

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/CHANGELOG.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # @primer/doctocat-nextjs
2
2
 
3
- ## 0.7.1
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#73](https://github.com/primer/doctocat-nextjs/pull/73) [`a06099d`](https://github.com/primer/doctocat-nextjs/commit/a06099d65d36bdb361fc9a20b2b811990bb6d353) Thanks [@danielguillan](https://github.com/danielguillan)! - Add React 19 support
8
+
9
+ This update is backwards compatible with React 18. However, it upgrades `@primer/react` to v38, which includes breaking changes such as the removal of the `Box` component and `sx` prop. Projects using this theme may need to update their code accordingly.
10
+ - Updated React peer dependency to support React 19
11
+ - Updated @primer/react from v37.11.2 to v38.3.0
12
+ - Updated `@primer/react-brand` from v0.54.0 to v0.60.1
13
+ - Updated `framer-motion` from v12.4.0 to v12.23.24
14
+ - Updated `react-focus-on` from v3.9.4 to v3.10.0
15
+ - Migrated `Label` components to `Token` for React 19 compatibility
16
+ - Fixed type errors in `ReactCodeBlock` and `getRelatedPages` for stricter React 19 types
17
+ - Added explicit `as="button"` to `IconButton` and `as="input"` to `TextInput` components
18
+ - Updated Next.js and related packages from v15.5.2 to v15.5.7
4
19
 
5
20
  ### Patch Changes
6
21
 
@@ -11,7 +26,6 @@
11
26
  ### Minor Changes
12
27
 
13
28
  - [#65](https://github.com/primer/doctocat-nextjs/pull/65) [`dc680ec`](https://github.com/primer/doctocat-nextjs/commit/dc680ec51605bd7a40dedc71cd3bb107632035dd) Thanks [@rezrah](https://github.com/rezrah)! - Updated Next.js compatibility to v15.5.x, Nextra to v4, and fix React code block rendering
14
-
15
29
  - **Next.js v15.5.2**: Upgraded to latest stable version across all workspaces
16
30
  - **Nextra v4 compatibility**: Updated type definitions for `ReactNode` titles
17
31
  - **Fixed code block rendering**: Added client-side rendering for interactive code examples to handle React lazy components properly
@@ -69,7 +83,6 @@
69
83
  ```
70
84
 
71
85
  - [#48](https://github.com/primer/doctocat-nextjs/pull/48) [`ce73c24`](https://github.com/primer/doctocat-nextjs/commit/ce73c24b2e4e924667bf7446a504bd88d8f2ccf0) Thanks [@rezrah](https://github.com/rezrah)! - - Fix inline code font-size in markdown headings. Now inherits size used in the heading.
72
-
73
86
  - Increased spacing below React code blocks, which was previously too small.
74
87
 
75
88
  - [#50](https://github.com/primer/doctocat-nextjs/pull/50) [`5d67989`](https://github.com/primer/doctocat-nextjs/commit/5d679895408c1a58342419692db4234dfddefd80) Thanks [@rezrah](https://github.com/rezrah)! - Add `menu-position` frontmatter support for custom sidebar navigation ordering
@@ -87,7 +100,6 @@
87
100
  ### Patch Changes
88
101
 
89
102
  - [#41](https://github.com/primer/doctocat-nextjs/pull/41) [`e1ffb3a`](https://github.com/primer/doctocat-nextjs/commit/e1ffb3a630c51316a19e25869f731b4ef3660d2b) Thanks [@danielguillan](https://github.com/danielguillan)! - - Updated sidebar styles.
90
-
91
103
  - Added active header link as sidebar heading.
92
104
  - Made active header the root item of breadcrumbs, if available.
93
105
  - Made sidebar group headlines link to the index page.
@@ -111,7 +123,6 @@
111
123
  ### Minor Changes
112
124
 
113
125
  - [#30](https://github.com/primer/doctocat-nextjs/pull/30) [`cdcb65e`](https://github.com/primer/doctocat-nextjs/commit/cdcb65e087d647a6d61c87d9122f105dcda64e35) Thanks [@joshfarrant](https://github.com/joshfarrant)! - - Arbitrary links can now be added to the sidebar and header using the `Theme` component's `headerLinks` and `sidebarLinks` props.
114
-
115
126
  - Updated the header navigation to more closely visually align it with the existing Primer docs navigation.
116
127
  - Removed `_meta.global.ts` and instead directly pass header and sidebar links into the Doctocat `Theme` component.
117
128
 
@@ -141,7 +152,6 @@
141
152
  ### Patch Changes
142
153
 
143
154
  - [#34](https://github.com/primer/doctocat-nextjs/pull/34) [`ccf198c`](https://github.com/primer/doctocat-nextjs/commit/ccf198cca25b1f021c5ae78b8e2760c141a77dcc) Thanks [@rezrah](https://github.com/rezrah)! - Collection of UI bugfixes:
144
-
145
155
  - Sidebar offset added to prevent links being trapped under fixed header
146
156
  - Narrow viewport overflow bug fixed
147
157
  - Table of contents presentation fixed on narrow viewport, and has improved presentation on wider breakpoints.
@@ -190,7 +200,6 @@
190
200
  ### Minor Changes
191
201
 
192
202
  - [#20](https://github.com/primer/doctocat-nextjs/pull/20) [`be8bc6a`](https://github.com/primer/doctocat-nextjs/commit/be8bc6af733ba40bdd4393b876b2653017d7e846) Thanks [@rezrah](https://github.com/rezrah)! - Dropped support for Next.js Pages router in favor of App Router + Nextra v4
193
-
194
203
  - [Read the migration guide from `v0.1.0` to `v0.2.0`](https://github.com/primer/doctocat-nextjs/blob/main/migration-guides/v0.2.0-app-router.md)
195
204
 
196
205
  ## 0.1.0
@@ -200,7 +209,6 @@
200
209
  - [#18](https://github.com/primer/doctocat-nextjs/pull/18) [`bfe68b1`](https://github.com/primer/doctocat-nextjs/commit/bfe68b14e8e3b4383ea41dcbf47373df8a130567) Thanks [@rezrah](https://github.com/rezrah)! - Upgraded internal framework to [Nextra v3](https://the-guild.dev/blog/nextra-3).
201
210
 
202
211
  To migrate Doctocat to this release, follow these steps:
203
-
204
212
  1. Install the latest version `npm i @primer/doctocat-nextjs@0.1.0`
205
213
  2. Rename your `next.config.js` to be `next.config.mjs`. Add `type="module"` to your `package.json` and update the file contents to match the following:
206
214
 
@@ -276,7 +284,6 @@
276
284
  - [`6f21970`](https://github.com/primer/doctocat-nextjs/commit/6f21970c74f7635be89fc4cd20376d7fe5ca35e7) Thanks [@rezrah](https://github.com/rezrah)! - Switch hero image order with description and reduce `h2` block start margin
277
285
 
278
286
  - [#6](https://github.com/primer/doctocat-nextjs/pull/6) [`afd4e17`](https://github.com/primer/doctocat-nextjs/commit/afd4e1762f6294a14942d415c693319a874cd3fb) Thanks [@rezrah](https://github.com/rezrah)! - - Add MDX to HTML overrides mechanism and apply to headings and anchors
279
-
280
287
  - Added anchor links to headings to match current functionality on primer.style
281
288
 
282
289
  - [`b49f218`](https://github.com/primer/doctocat-nextjs/commit/b49f218e9bbc2de720476e21888956bee6081967) Thanks [@rezrah](https://github.com/rezrah)! - Removed sidebar links and added skip to main content a11y link
@@ -1,10 +1,6 @@
1
1
  .reviewedLabel {
2
- display: flex;
3
- align-items: center;
4
- gap: var(--base-size-8);
5
2
  background-color: var(--base-color-scale-purple-0);
6
- border-color: transparent;
7
- color: var(--brand-color-text-default);
3
+ color: var(--brand-color-text-default) !important;
8
4
  font-weight: var(--brand-text-weight-300);
9
5
  }
10
6
 
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- import {Label} from '@primer/react'
2
+ import {Token} from '@primer/react'
3
3
  import {AccessibilityInsetIcon} from '@primer/octicons-react'
4
4
  import React from 'react'
5
5
 
@@ -11,9 +11,12 @@ type AccessibilityLabelProps = {
11
11
 
12
12
  export function AccessibilityLabel({short}: AccessibilityLabelProps) {
13
13
  return (
14
- <Label size="large" className={styles.reviewedLabel}>
15
- <AccessibilityInsetIcon className={styles.icon} />
16
- {short ? 'Reviewed' : 'Reviewed for accessibility'}
17
- </Label>
14
+ <Token
15
+ as="span"
16
+ size="large"
17
+ className={styles.reviewedLabel}
18
+ leadingVisual={() => <AccessibilityInsetIcon className={styles.icon} aria-hidden="true" />}
19
+ text={short ? 'Reviewed' : 'Reviewed for accessibility'}
20
+ />
18
21
  )
19
22
  }
@@ -1,10 +1,6 @@
1
1
  .label {
2
- display: flex;
3
- align-items: center;
4
- gap: var(--base-size-8);
5
2
  background-color: var(--base-color-scale-green-0);
6
- border-color: transparent;
7
- color: var(--brand-color-text-default);
3
+ color: var(--brand-color-text-default) !important;
8
4
  font-weight: var(--brand-text-weight-300);
9
5
  }
10
6
 
@@ -1,15 +1,18 @@
1
1
  'use client'
2
2
  import React from 'react'
3
- import {Label} from '@primer/react'
3
+ import {Token} from '@primer/react'
4
4
  import {CheckIcon} from '@primer/octicons-react'
5
5
 
6
6
  import styles from './ReadinessLabel.module.css'
7
7
 
8
8
  export function ReadinessLabel() {
9
9
  return (
10
- <Label size="large" className={styles.label}>
11
- <CheckIcon className={styles.icon} />
12
- Ready to use
13
- </Label>
10
+ <Token
11
+ as="span"
12
+ size="large"
13
+ className={styles.label}
14
+ leadingVisual={() => <CheckIcon className={styles.icon} aria-hidden="true" />}
15
+ text="Ready to use"
16
+ />
14
17
  )
15
18
  }
@@ -205,13 +205,13 @@ export function ReactCodeBlock(props: ReactCodeBlockProps) {
205
205
  * Helper function to turn Nextra <code> children into plain text
206
206
  */
207
207
  function getCodeFromChildren(children: React.ReactNode) {
208
- if (!React.isValidElement(children) || !children.props?.children) return ''
209
-
210
- // Flattens the nested spans and combine their text content if it's a react child
211
208
  const extractText = (node: React.ReactNode): string => {
212
209
  if (typeof node === 'string') return node
213
210
  if (Array.isArray(node)) return node.map(extractText).join('')
214
- if (React.isValidElement(node) && node.props?.children) return extractText(node.props.children)
211
+ if (React.isValidElement(node)) {
212
+ const element = node as React.ReactElement<{children?: React.ReactNode}>
213
+ return extractText(element.props.children)
214
+ }
215
215
  return ''
216
216
  }
217
217
 
@@ -170,6 +170,7 @@ export const GlobalSearch = forwardRef<HTMLInputElement, GlobalSearchProps>(
170
170
  <FormControl>
171
171
  <FormControl.Label visuallyHidden>Search</FormControl.Label>
172
172
  <TextInput
173
+ as="input"
173
174
  contrast
174
175
  type="search"
175
176
  className={styles.GlobalSearch__searchInput}
@@ -109,7 +109,13 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
109
109
  <Text as="p" size="300" weight="semibold">
110
110
  Search
111
111
  </Text>
112
- <IconButton icon={XIcon} variant="invisible" aria-label="Close search" onClick={closeSearch} />
112
+ <IconButton
113
+ as="button"
114
+ icon={XIcon}
115
+ variant="invisible"
116
+ aria-label="Close search"
117
+ onClick={closeSearch}
118
+ />
113
119
  </Stack>
114
120
  </div>
115
121
  </FocusOn>
@@ -117,12 +123,14 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
117
123
  <div>
118
124
  <Stack direction="horizontal" padding="none" gap={4}>
119
125
  <IconButton
126
+ as="button"
120
127
  icon={colorMode === 'light' ? SunIcon : MoonIcon}
121
128
  variant="invisible"
122
129
  aria-label={`Switch to ${colorMode === 'light' ? 'dark' : 'light'} mode`}
123
130
  onClick={() => setColorMode(colorMode === 'light' ? 'dark' : 'light')}
124
131
  />
125
132
  <IconButton
133
+ as="button"
126
134
  ref={searchTriggerRef}
127
135
  className={styles.Header__searchButton}
128
136
  icon={SearchIcon}
@@ -132,6 +140,7 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
132
140
  />
133
141
  <div className={styles.Header__navDrawerContainer}>
134
142
  <IconButton
143
+ as="button"
135
144
  icon={ThreeBarsIcon}
136
145
  variant="invisible"
137
146
  aria-label="Menu"
@@ -26,7 +26,7 @@ export function NavDrawer({isOpen, onDismiss, pageMap}: NavDrawerProps) {
26
26
  <Link as={NextLink} href="https://primer.style" className={styles.headerLink}>
27
27
  Explore
28
28
  </Link>
29
- <IconButton icon={XIcon} aria-label="Close" onClick={onDismiss} variant="invisible" />
29
+ <IconButton as="button" icon={XIcon} aria-label="Close" onClick={onDismiss} variant="invisible" />
30
30
  </div>
31
31
  </div>
32
32
  <div className={styles.navContainer}>{/* <PrimerNavItems items={primerNavItems} /> */}</div>
@@ -66,8 +66,11 @@ function titleToString(title: React.ReactNode): string {
66
66
  if (typeof child === 'string' || typeof child === 'number') {
67
67
  return child.toString()
68
68
  }
69
- if (React.isValidElement(child) && child.props.children) {
70
- return titleToString(child.props.children)
69
+ if (React.isValidElement(child)) {
70
+ const element = child as React.ReactElement<{children?: React.ReactNode}>
71
+ if (element.props.children) {
72
+ return titleToString(element.props.children)
73
+ }
71
74
  }
72
75
  return ''
73
76
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/doctocat-nextjs",
3
- "version": "0.7.1-rc.bf9f37a",
3
+ "version": "0.8.0-rc.abeed68",
4
4
  "description": "A Next.js theme for building Primer documentation sites",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,16 +25,14 @@
25
25
  "react-dom": ">=18.0.0 <20.0.0"
26
26
  },
27
27
  "dependencies": {
28
- "@next/mdx": "15.5.2",
28
+ "@next/mdx": "15.5.7",
29
29
  "@primer/octicons-react": "19.15.1",
30
- "@primer/react": "^38.0.0",
30
+ "@primer/react": "^38.3.0",
31
31
  "@types/lodash.debounce": "^4.0.9",
32
- "framer-motion": "12.4.0",
32
+ "framer-motion": "12.23.24",
33
33
  "lodash.debounce": "^4.0.8",
34
34
  "nextra": "4.4.0",
35
- "react": ">=18.0.0 <20.0.0",
36
- "react-dom": ">=18.0.0 <20.0.0",
37
- "react-focus-on": "3.9.4",
35
+ "react-focus-on": "^3.10.0",
38
36
  "react-live": "^4.1.8"
39
37
  },
40
38
  "devDependencies": {
@@ -44,19 +42,15 @@
44
42
  "@testing-library/react": "^16.1.0",
45
43
  "@testing-library/user-event": "^14.5.2",
46
44
  "@types/node": "^20.19.0",
47
- "@types/react": "18.3.12",
48
- "@types/react-dom": "18.3.1",
45
+ "@types/react": "^19.2.7",
46
+ "@types/react-dom": "^19.2.3",
49
47
  "@vitejs/plugin-react": "^4.3.3",
50
48
  "@vitest/coverage-v8": "^3.2.4",
51
49
  "@vitest/ui": "^3.2.4",
52
50
  "clsx": "2.1.1",
53
51
  "jsdom": "^26.0.1",
54
- "next": "15.5.2",
52
+ "next": "15.5.7",
55
53
  "styled-components": "5.3.11",
56
54
  "vitest": "^3.2.4"
57
- },
58
- "overrides": {
59
- "@types/react": "18.3.12",
60
- "@types/react-dom": "18.3.1"
61
55
  }
62
56
  }