@docusaurus/theme-classic 3.7.0-canary-6243 → 3.7.0-canary-6244

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.
@@ -4,17 +4,28 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React from 'react';
7
+ import React, {version} from 'react';
8
8
  import clsx from 'clsx';
9
9
  import {useNavbarSecondaryMenu} from '@docusaurus/theme-common/internal';
10
10
  import {ThemeClassNames} from '@docusaurus/theme-common';
11
- function NavbarMobileSidebarPanel({children}) {
11
+ // TODO Docusaurus v4: remove temporary inert workaround
12
+ // See https://github.com/facebook/react/issues/17157
13
+ // See https://github.com/radix-ui/themes/pull/509
14
+ function inertProps(inert) {
15
+ const isBeforeReact19 = parseInt(version.split('.')[0], 10) < 19;
16
+ if (isBeforeReact19) {
17
+ return {inert: inert ? '' : undefined};
18
+ }
19
+ return {inert};
20
+ }
21
+ function NavbarMobileSidebarPanel({children, inert}) {
12
22
  return (
13
23
  <div
14
24
  className={clsx(
15
25
  ThemeClassNames.layout.navbar.mobileSidebar.panel,
16
26
  'navbar-sidebar__item menu',
17
- )}>
27
+ )}
28
+ {...inertProps(inert)}>
18
29
  {children}
19
30
  </div>
20
31
  );
@@ -36,8 +47,12 @@ export default function NavbarMobileSidebarLayout({
36
47
  className={clsx('navbar-sidebar__items', {
37
48
  'navbar-sidebar__items--show-secondary': secondaryMenuShown,
38
49
  })}>
39
- <NavbarMobileSidebarPanel>{primaryMenu}</NavbarMobileSidebarPanel>
40
- <NavbarMobileSidebarPanel>{secondaryMenu}</NavbarMobileSidebarPanel>
50
+ <NavbarMobileSidebarPanel inert={secondaryMenuShown}>
51
+ {primaryMenu}
52
+ </NavbarMobileSidebarPanel>
53
+ <NavbarMobileSidebarPanel inert={!secondaryMenuShown}>
54
+ {secondaryMenu}
55
+ </NavbarMobileSidebarPanel>
41
56
  </div>
42
57
  </div>
43
58
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "3.7.0-canary-6243",
3
+ "version": "3.7.0-canary-6244",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,19 +20,19 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "3.7.0-canary-6243",
24
- "@docusaurus/logger": "3.7.0-canary-6243",
25
- "@docusaurus/mdx-loader": "3.7.0-canary-6243",
26
- "@docusaurus/module-type-aliases": "3.7.0-canary-6243",
27
- "@docusaurus/plugin-content-blog": "3.7.0-canary-6243",
28
- "@docusaurus/plugin-content-docs": "3.7.0-canary-6243",
29
- "@docusaurus/plugin-content-pages": "3.7.0-canary-6243",
30
- "@docusaurus/theme-common": "3.7.0-canary-6243",
31
- "@docusaurus/theme-translations": "3.7.0-canary-6243",
32
- "@docusaurus/types": "3.7.0-canary-6243",
33
- "@docusaurus/utils": "3.7.0-canary-6243",
34
- "@docusaurus/utils-common": "3.7.0-canary-6243",
35
- "@docusaurus/utils-validation": "3.7.0-canary-6243",
23
+ "@docusaurus/core": "3.7.0-canary-6244",
24
+ "@docusaurus/logger": "3.7.0-canary-6244",
25
+ "@docusaurus/mdx-loader": "3.7.0-canary-6244",
26
+ "@docusaurus/module-type-aliases": "3.7.0-canary-6244",
27
+ "@docusaurus/plugin-content-blog": "3.7.0-canary-6244",
28
+ "@docusaurus/plugin-content-docs": "3.7.0-canary-6244",
29
+ "@docusaurus/plugin-content-pages": "3.7.0-canary-6244",
30
+ "@docusaurus/theme-common": "3.7.0-canary-6244",
31
+ "@docusaurus/theme-translations": "3.7.0-canary-6244",
32
+ "@docusaurus/types": "3.7.0-canary-6244",
33
+ "@docusaurus/utils": "3.7.0-canary-6244",
34
+ "@docusaurus/utils-common": "3.7.0-canary-6244",
35
+ "@docusaurus/utils-validation": "3.7.0-canary-6244",
36
36
  "@mdx-js/react": "^3.0.0",
37
37
  "clsx": "^2.0.0",
38
38
  "copy-text-to-clipboard": "^3.2.0",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=18.0"
64
64
  },
65
- "gitHead": "230bf7b323faac13ba6bf0bca875d222efdab11a"
65
+ "gitHead": "07a2717f32b6bafc0c89156355b1f58e877ea3b2"
66
66
  }
@@ -5,19 +5,37 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, {type ReactNode} from 'react';
8
+ import React, {version, type ReactNode} from 'react';
9
9
  import clsx from 'clsx';
10
10
  import {useNavbarSecondaryMenu} from '@docusaurus/theme-common/internal';
11
11
  import {ThemeClassNames} from '@docusaurus/theme-common';
12
12
  import type {Props} from '@theme/Navbar/MobileSidebar/Layout';
13
13
 
14
- function NavbarMobileSidebarPanel({children}: {children: ReactNode}) {
14
+ // TODO Docusaurus v4: remove temporary inert workaround
15
+ // See https://github.com/facebook/react/issues/17157
16
+ // See https://github.com/radix-ui/themes/pull/509
17
+ function inertProps(inert: boolean) {
18
+ const isBeforeReact19 = parseInt(version!.split('.')[0]!, 10) < 19;
19
+ if (isBeforeReact19) {
20
+ return {inert: inert ? '' : undefined};
21
+ }
22
+ return {inert};
23
+ }
24
+
25
+ function NavbarMobileSidebarPanel({
26
+ children,
27
+ inert,
28
+ }: {
29
+ children: ReactNode;
30
+ inert: boolean;
31
+ }) {
15
32
  return (
16
33
  <div
17
34
  className={clsx(
18
35
  ThemeClassNames.layout.navbar.mobileSidebar.panel,
19
36
  'navbar-sidebar__item menu',
20
- )}>
37
+ )}
38
+ {...inertProps(inert)}>
21
39
  {children}
22
40
  </div>
23
41
  );
@@ -40,8 +58,12 @@ export default function NavbarMobileSidebarLayout({
40
58
  className={clsx('navbar-sidebar__items', {
41
59
  'navbar-sidebar__items--show-secondary': secondaryMenuShown,
42
60
  })}>
43
- <NavbarMobileSidebarPanel>{primaryMenu}</NavbarMobileSidebarPanel>
44
- <NavbarMobileSidebarPanel>{secondaryMenu}</NavbarMobileSidebarPanel>
61
+ <NavbarMobileSidebarPanel inert={secondaryMenuShown}>
62
+ {primaryMenu}
63
+ </NavbarMobileSidebarPanel>
64
+ <NavbarMobileSidebarPanel inert={!secondaryMenuShown}>
65
+ {secondaryMenu}
66
+ </NavbarMobileSidebarPanel>
45
67
  </div>
46
68
  </div>
47
69
  );