@primer/doctocat-nextjs 0.0.0-20251204173624 → 0.0.0-20251216135626

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,27 +1,12 @@
1
1
  # @primer/doctocat-nextjs
2
2
 
3
- ## 0.0.0-20251204173624
3
+ ## 0.0.0-20251216135626
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Fake entry to force publishing
8
8
 
9
- ## 0.0.0-20251204173622
10
-
11
- ### Minor Changes
12
-
13
- - [#73](https://github.com/primer/doctocat-nextjs/pull/73) [`8e57e27`](https://github.com/primer/doctocat-nextjs/commit/8e57e272cb57b63e77b184f3e6a74410c97d9fd2) Thanks [@danielguillan](https://github.com/danielguillan)! - Add React 19 support
14
-
15
- 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.
16
- - Updated React peer dependency to support React 19
17
- - Updated @primer/react from v37.11.2 to v38.3.0
18
- - Updated `@primer/react-brand` from v0.54.0 to v0.60.1
19
- - Updated `framer-motion` from v12.4.0 to v12.23.24
20
- - Updated `react-focus-on` from v3.9.4 to v3.10.0
21
- - Migrated `Label` components to `Token` for React 19 compatibility
22
- - Fixed type errors in `ReactCodeBlock` and `getRelatedPages` for stricter React 19 types
23
- - Added explicit `as="button"` to `IconButton` and `as="input"` to `TextInput` components
24
- - Updated Next.js and related packages from v15.5.2 to v15.5.7
9
+ ## 0.0.0-20251216135624
25
10
 
26
11
  ### Patch Changes
27
12
 
@@ -32,6 +17,7 @@
32
17
  ### Minor Changes
33
18
 
34
19
  - [#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
20
+
35
21
  - **Next.js v15.5.2**: Upgraded to latest stable version across all workspaces
36
22
  - **Nextra v4 compatibility**: Updated type definitions for `ReactNode` titles
37
23
  - **Fixed code block rendering**: Added client-side rendering for interactive code examples to handle React lazy components properly
@@ -89,6 +75,7 @@
89
75
  ```
90
76
 
91
77
  - [#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.
78
+
92
79
  - Increased spacing below React code blocks, which was previously too small.
93
80
 
94
81
  - [#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
@@ -106,6 +93,7 @@
106
93
  ### Patch Changes
107
94
 
108
95
  - [#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.
96
+
109
97
  - Added active header link as sidebar heading.
110
98
  - Made active header the root item of breadcrumbs, if available.
111
99
  - Made sidebar group headlines link to the index page.
@@ -129,6 +117,7 @@
129
117
  ### Minor Changes
130
118
 
131
119
  - [#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.
120
+
132
121
  - Updated the header navigation to more closely visually align it with the existing Primer docs navigation.
133
122
  - Removed `_meta.global.ts` and instead directly pass header and sidebar links into the Doctocat `Theme` component.
134
123
 
@@ -158,6 +147,7 @@
158
147
  ### Patch Changes
159
148
 
160
149
  - [#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:
150
+
161
151
  - Sidebar offset added to prevent links being trapped under fixed header
162
152
  - Narrow viewport overflow bug fixed
163
153
  - Table of contents presentation fixed on narrow viewport, and has improved presentation on wider breakpoints.
@@ -206,6 +196,7 @@
206
196
  ### Minor Changes
207
197
 
208
198
  - [#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
199
+
209
200
  - [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)
210
201
 
211
202
  ## 0.1.0
@@ -215,6 +206,7 @@
215
206
  - [#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).
216
207
 
217
208
  To migrate Doctocat to this release, follow these steps:
209
+
218
210
  1. Install the latest version `npm i @primer/doctocat-nextjs@0.1.0`
219
211
  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:
220
212
 
@@ -290,6 +282,7 @@
290
282
  - [`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
291
283
 
292
284
  - [#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
285
+
293
286
  - Added anchor links to headings to match current functionality on primer.style
294
287
 
295
288
  - [`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,6 +1,10 @@
1
1
  .reviewedLabel {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: var(--base-size-8);
2
5
  background-color: var(--base-color-scale-purple-0);
3
- color: var(--brand-color-text-default) !important;
6
+ border-color: transparent;
7
+ color: var(--brand-color-text-default);
4
8
  font-weight: var(--brand-text-weight-300);
5
9
  }
6
10
 
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- import {Token} from '@primer/react'
2
+ import {Label} from '@primer/react'
3
3
  import {AccessibilityInsetIcon} from '@primer/octicons-react'
4
4
  import React from 'react'
5
5
 
@@ -11,12 +11,9 @@ type AccessibilityLabelProps = {
11
11
 
12
12
  export function AccessibilityLabel({short}: AccessibilityLabelProps) {
13
13
  return (
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
- />
14
+ <Label size="large" className={styles.reviewedLabel}>
15
+ <AccessibilityInsetIcon className={styles.icon} />
16
+ {short ? 'Reviewed' : 'Reviewed for accessibility'}
17
+ </Label>
21
18
  )
22
19
  }
@@ -1,6 +1,10 @@
1
1
  .label {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: var(--base-size-8);
2
5
  background-color: var(--base-color-scale-green-0);
3
- color: var(--brand-color-text-default) !important;
6
+ border-color: transparent;
7
+ color: var(--brand-color-text-default);
4
8
  font-weight: var(--brand-text-weight-300);
5
9
  }
6
10
 
@@ -1,18 +1,15 @@
1
1
  'use client'
2
2
  import React from 'react'
3
- import {Token} from '@primer/react'
3
+ import {Label} 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
- <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
- />
10
+ <Label size="large" className={styles.label}>
11
+ <CheckIcon className={styles.icon} />
12
+ Ready to use
13
+ </Label>
17
14
  )
18
15
  }
@@ -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
208
211
  const extractText = (node: React.ReactNode): string => {
209
212
  if (typeof node === 'string') return node
210
213
  if (Array.isArray(node)) return node.map(extractText).join('')
211
- if (React.isValidElement(node)) {
212
- const element = node as React.ReactElement<{children?: React.ReactNode}>
213
- return extractText(element.props.children)
214
- }
214
+ if (React.isValidElement(node) && node.props?.children) return extractText(node.props.children)
215
215
  return ''
216
216
  }
217
217
 
@@ -170,7 +170,6 @@ export const GlobalSearch = forwardRef<HTMLInputElement, GlobalSearchProps>(
170
170
  <FormControl>
171
171
  <FormControl.Label visuallyHidden>Search</FormControl.Label>
172
172
  <TextInput
173
- as="input"
174
173
  contrast
175
174
  type="search"
176
175
  className={styles.GlobalSearch__searchInput}
@@ -109,13 +109,7 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
109
109
  <Text as="p" size="300" weight="semibold">
110
110
  Search
111
111
  </Text>
112
- <IconButton
113
- as="button"
114
- icon={XIcon}
115
- variant="invisible"
116
- aria-label="Close search"
117
- onClick={closeSearch}
118
- />
112
+ <IconButton icon={XIcon} variant="invisible" aria-label="Close search" onClick={closeSearch} />
119
113
  </Stack>
120
114
  </div>
121
115
  </FocusOn>
@@ -123,14 +117,12 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
123
117
  <div>
124
118
  <Stack direction="horizontal" padding="none" gap={4}>
125
119
  <IconButton
126
- as="button"
127
120
  icon={colorMode === 'light' ? SunIcon : MoonIcon}
128
121
  variant="invisible"
129
122
  aria-label={`Switch to ${colorMode === 'light' ? 'dark' : 'light'} mode`}
130
123
  onClick={() => setColorMode(colorMode === 'light' ? 'dark' : 'light')}
131
124
  />
132
125
  <IconButton
133
- as="button"
134
126
  ref={searchTriggerRef}
135
127
  className={styles.Header__searchButton}
136
128
  icon={SearchIcon}
@@ -140,7 +132,6 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
140
132
  />
141
133
  <div className={styles.Header__navDrawerContainer}>
142
134
  <IconButton
143
- as="button"
144
135
  icon={ThreeBarsIcon}
145
136
  variant="invisible"
146
137
  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 as="button" icon={XIcon} aria-label="Close" onClick={onDismiss} variant="invisible" />
29
+ <IconButton 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,11 +66,8 @@ 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)) {
70
- const element = child as React.ReactElement<{children?: React.ReactNode}>
71
- if (element.props.children) {
72
- return titleToString(element.props.children)
73
- }
69
+ if (React.isValidElement(child) && child.props.children) {
70
+ return titleToString(child.props.children)
74
71
  }
75
72
  return ''
76
73
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/doctocat-nextjs",
3
- "version": "0.0.0-20251204173624",
3
+ "version": "0.0.0-20251216135626",
4
4
  "description": "A Next.js theme for building Primer documentation sites",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,14 +25,16 @@
25
25
  "react-dom": ">=18.0.0 <20.0.0"
26
26
  },
27
27
  "dependencies": {
28
- "@next/mdx": "15.5.7",
28
+ "@next/mdx": "15.5.2",
29
29
  "@primer/octicons-react": "19.15.1",
30
- "@primer/react": "^38.3.0",
30
+ "@primer/react": "^38.0.0",
31
31
  "@types/lodash.debounce": "^4.0.9",
32
- "framer-motion": "12.23.24",
32
+ "framer-motion": "12.4.0",
33
33
  "lodash.debounce": "^4.0.8",
34
34
  "nextra": "4.4.0",
35
- "react-focus-on": "^3.10.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",
36
38
  "react-live": "^4.1.8"
37
39
  },
38
40
  "devDependencies": {
@@ -42,15 +44,19 @@
42
44
  "@testing-library/react": "^16.1.0",
43
45
  "@testing-library/user-event": "^14.5.2",
44
46
  "@types/node": "^20.19.0",
45
- "@types/react": "^19.2.7",
46
- "@types/react-dom": "^19.2.3",
47
+ "@types/react": "18.3.12",
48
+ "@types/react-dom": "18.3.1",
47
49
  "@vitejs/plugin-react": "^4.3.3",
48
50
  "@vitest/coverage-v8": "^3.2.4",
49
51
  "@vitest/ui": "^3.2.4",
50
52
  "clsx": "2.1.1",
51
53
  "jsdom": "^26.0.1",
52
- "next": "15.5.7",
54
+ "next": "15.5.2",
53
55
  "styled-components": "5.3.11",
54
56
  "vitest": "^3.2.4"
57
+ },
58
+ "overrides": {
59
+ "@types/react": "18.3.12",
60
+ "@types/react-dom": "18.3.1"
55
61
  }
56
62
  }