@docusaurus/theme-classic 0.0.0-4624 → 0.0.0-4625

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,7 +4,7 @@
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, {useState, useRef, memo} from 'react';
7
+ import React, {useState, useRef, useEffect, memo} from 'react';
8
8
  import {useThemeConfig} from '@docusaurus/theme-common';
9
9
  import useIsBrowser from '@docusaurus/useIsBrowser';
10
10
  import {translate} from '@docusaurus/Translate';
@@ -17,6 +17,9 @@ const ToggleComponent = memo(
17
17
  const [checked, setChecked] = useState(defaultChecked);
18
18
  const [focused, setFocused] = useState(false);
19
19
  const inputRef = useRef(null);
20
+ useEffect(() => {
21
+ setChecked(defaultChecked);
22
+ }, [defaultChecked]);
20
23
  return (
21
24
  <div
22
25
  className={clsx(styles.toggle, className, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4624",
3
+ "version": "0.0.0-4625",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -21,15 +21,15 @@
21
21
  "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
22
22
  },
23
23
  "dependencies": {
24
- "@docusaurus/core": "0.0.0-4624",
25
- "@docusaurus/plugin-content-blog": "0.0.0-4624",
26
- "@docusaurus/plugin-content-docs": "0.0.0-4624",
27
- "@docusaurus/plugin-content-pages": "0.0.0-4624",
28
- "@docusaurus/theme-common": "0.0.0-4624",
29
- "@docusaurus/theme-translations": "0.0.0-4624",
30
- "@docusaurus/utils": "0.0.0-4624",
31
- "@docusaurus/utils-common": "0.0.0-4624",
32
- "@docusaurus/utils-validation": "0.0.0-4624",
24
+ "@docusaurus/core": "0.0.0-4625",
25
+ "@docusaurus/plugin-content-blog": "0.0.0-4625",
26
+ "@docusaurus/plugin-content-docs": "0.0.0-4625",
27
+ "@docusaurus/plugin-content-pages": "0.0.0-4625",
28
+ "@docusaurus/theme-common": "0.0.0-4625",
29
+ "@docusaurus/theme-translations": "0.0.0-4625",
30
+ "@docusaurus/utils": "0.0.0-4625",
31
+ "@docusaurus/utils-common": "0.0.0-4625",
32
+ "@docusaurus/utils-validation": "0.0.0-4625",
33
33
  "@mdx-js/react": "^1.6.22",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
@@ -42,8 +42,8 @@
42
42
  "rtlcss": "^3.3.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@docusaurus/module-type-aliases": "0.0.0-4624",
46
- "@docusaurus/types": "0.0.0-4624",
45
+ "@docusaurus/module-type-aliases": "0.0.0-4625",
46
+ "@docusaurus/types": "0.0.0-4625",
47
47
  "@types/mdx-js__react": "^1.5.5",
48
48
  "@types/prismjs": "^1.26.0",
49
49
  "@types/rtlcss": "^3.1.2",
@@ -59,5 +59,5 @@
59
59
  "engines": {
60
60
  "node": ">=14"
61
61
  },
62
- "gitHead": "2973b9893d7369100eda9f94b62aeb0055da99ad"
62
+ "gitHead": "db97af5476fb6b852ff07b1147a8d5a10a102e10"
63
63
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, {useState, useRef, memo} from 'react';
8
+ import React, {useState, useRef, useEffect, memo} from 'react';
9
9
  import type {Props} from '@theme/Toggle';
10
10
  import {useThemeConfig, type ColorModeConfig} from '@docusaurus/theme-common';
11
11
  import useIsBrowser from '@docusaurus/useIsBrowser';
@@ -31,6 +31,10 @@ const ToggleComponent = memo(
31
31
  const [focused, setFocused] = useState(false);
32
32
  const inputRef = useRef<HTMLInputElement>(null);
33
33
 
34
+ useEffect(() => {
35
+ setChecked(defaultChecked);
36
+ }, [defaultChecked]);
37
+
34
38
  return (
35
39
  <div
36
40
  className={clsx(styles.toggle, className, {