@primer/doctocat-nextjs 0.0.0-20251127164228 → 0.0.0-20251128093545
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 +2 -2
- package/components/layout/article/AccessibilityLabel.module.css +1 -5
- package/components/layout/article/AccessibilityLabel.tsx +8 -5
- package/components/layout/article/ReadinessLabel.module.css +1 -5
- package/components/layout/article/ReadinessLabel.tsx +8 -5
- package/components/layout/code-block/ReactCodeBlock.tsx +4 -4
- package/components/layout/global-search/GlobalSearch.tsx +1 -1
- package/components/layout/header/Header.tsx +19 -16
- package/components/layout/nav-drawer/NavDrawer.tsx +1 -1
- package/components/layout/related-content-links/getRelatedPages.tsx +5 -2
- package/package.json +5 -11
package/CHANGELOG.md
CHANGED
|
@@ -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
|
-
|
|
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 {
|
|
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
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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)
|
|
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
|
|
|
@@ -169,7 +169,7 @@ export const GlobalSearch = forwardRef<HTMLInputElement, GlobalSearchProps>(
|
|
|
169
169
|
<div ref={searchResultsRef}>
|
|
170
170
|
<FormControl>
|
|
171
171
|
<FormControl.Label visuallyHidden>Search</FormControl.Label>
|
|
172
|
-
<TextInput
|
|
172
|
+
<TextInput as="input"
|
|
173
173
|
contrast
|
|
174
174
|
type="search"
|
|
175
175
|
className={styles.GlobalSearch__searchInput}
|
|
@@ -109,7 +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
|
-
|
|
112
|
+
<IconButton as="button" icon={XIcon} variant="invisible" aria-label="Close search" onClick={closeSearch} />
|
|
113
113
|
</Stack>
|
|
114
114
|
</div>
|
|
115
115
|
</FocusOn>
|
|
@@ -117,27 +117,30 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
|
|
|
117
117
|
<div>
|
|
118
118
|
<Stack direction="horizontal" padding="none" gap={4}>
|
|
119
119
|
<IconButton
|
|
120
|
+
as="button"
|
|
120
121
|
icon={colorMode === 'light' ? SunIcon : MoonIcon}
|
|
121
122
|
variant="invisible"
|
|
122
123
|
aria-label={`Switch to ${colorMode === 'light' ? 'dark' : 'light'} mode`}
|
|
123
124
|
onClick={() => setColorMode(colorMode === 'light' ? 'dark' : 'light')}
|
|
124
125
|
/>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
<IconButton
|
|
127
|
+
as="button"
|
|
128
|
+
ref={searchTriggerRef}
|
|
129
|
+
className={styles.Header__searchButton}
|
|
130
|
+
icon={SearchIcon}
|
|
131
|
+
variant="invisible"
|
|
132
|
+
aria-label={`Open search`}
|
|
133
|
+
onClick={() => setIsSearchOpen(true)}
|
|
134
|
+
/>
|
|
133
135
|
<div className={styles.Header__navDrawerContainer}>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
<IconButton
|
|
137
|
+
as="button"
|
|
138
|
+
icon={ThreeBarsIcon}
|
|
139
|
+
variant="invisible"
|
|
140
|
+
aria-label="Menu"
|
|
141
|
+
aria-expanded={isNavDrawerOpen}
|
|
142
|
+
onClick={() => setIsNavDrawerOpen(true)}
|
|
143
|
+
/>
|
|
141
144
|
<NavDrawer isOpen={isNavDrawerOpen} onDismiss={() => setIsNavDrawerOpen(false)} pageMap={pageMap} />
|
|
142
145
|
</div>
|
|
143
146
|
</Stack>
|
|
@@ -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)
|
|
70
|
-
|
|
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.0.0-
|
|
3
|
+
"version": "0.0.0-20251128093545",
|
|
4
4
|
"description": "A Next.js theme for building Primer documentation sites",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -29,12 +29,10 @@
|
|
|
29
29
|
"@primer/octicons-react": "19.15.1",
|
|
30
30
|
"@primer/react": "^38.0.0",
|
|
31
31
|
"@types/lodash.debounce": "^4.0.9",
|
|
32
|
-
"framer-motion": "12.
|
|
32
|
+
"framer-motion": "12.23.24",
|
|
33
33
|
"lodash.debounce": "^4.0.8",
|
|
34
34
|
"nextra": "4.4.0",
|
|
35
|
-
"react": "
|
|
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,8 +42,8 @@
|
|
|
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": "
|
|
48
|
-
"@types/react-dom": "
|
|
45
|
+
"@types/react": "^19.0.0",
|
|
46
|
+
"@types/react-dom": "^19.0.0",
|
|
49
47
|
"@vitejs/plugin-react": "^4.3.3",
|
|
50
48
|
"@vitest/coverage-v8": "^3.2.4",
|
|
51
49
|
"@vitest/ui": "^3.2.4",
|
|
@@ -54,9 +52,5 @@
|
|
|
54
52
|
"next": "15.5.2",
|
|
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
|
}
|