@docusaurus/theme-classic 0.0.0-5049 → 0.0.0-5052

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.
@@ -42,7 +42,7 @@ export default function NavbarContent() {
42
42
  const mobileSidebar = useNavbarMobileSidebar();
43
43
  const items = useNavbarItems();
44
44
  const [leftItems, rightItems] = splitNavbarItems(items);
45
- const autoAddSearchBar = !items.some((item) => item.type === 'search');
45
+ const searchBarItem = items.find((item) => item.type === 'search');
46
46
  return (
47
47
  <NavbarContentLayout
48
48
  left={
@@ -59,7 +59,7 @@ export default function NavbarContent() {
59
59
  <>
60
60
  <NavbarItems items={rightItems} />
61
61
  <NavbarColorModeToggle className={styles.colorModeToggle} />
62
- {autoAddSearchBar && (
62
+ {!searchBarItem && (
63
63
  <NavbarSearch>
64
64
  <SearchBar />
65
65
  </NavbarSearch>
@@ -6,4 +6,4 @@
6
6
  */
7
7
  /// <reference types="react" />
8
8
  import type { Props } from '@theme/Navbar/Search';
9
- export default function NavbarSearch({ children }: Props): JSX.Element;
9
+ export default function NavbarSearch({ children, className, }: Props): JSX.Element;
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
+ import clsx from 'clsx';
8
9
  import styles from './styles.module.css';
9
- export default function NavbarSearch({children}) {
10
- return <div className={styles.searchBox}>{children}</div>;
10
+ export default function NavbarSearch({children, className}) {
11
+ return <div className={clsx(className, styles.searchBox)}>{children}</div>;
11
12
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
  /// <reference types="react" />
8
8
  import type { Props } from '@theme/NavbarItem/SearchNavbarItem';
9
- export default function SearchNavbarItem({ mobile }: Props): JSX.Element | null;
9
+ export default function SearchNavbarItem({ mobile, className, }: Props): JSX.Element | null;
@@ -7,12 +7,12 @@
7
7
  import React from 'react';
8
8
  import SearchBar from '@theme/SearchBar';
9
9
  import NavbarSearch from '@theme/Navbar/Search';
10
- export default function SearchNavbarItem({mobile}) {
10
+ export default function SearchNavbarItem({mobile, className}) {
11
11
  if (mobile) {
12
12
  return null;
13
13
  }
14
14
  return (
15
- <NavbarSearch>
15
+ <NavbarSearch className={className}>
16
16
  <SearchBar />
17
17
  </NavbarSearch>
18
18
  );
@@ -177,6 +177,7 @@ const LocaleDropdownNavbarItemSchema = NavbarItemBaseSchema.append({
177
177
  });
178
178
  const SearchItemSchema = utils_validation_1.Joi.object({
179
179
  type: utils_validation_1.Joi.string().equal('search').required(),
180
+ className: utils_validation_1.Joi.string(),
180
181
  });
181
182
  const NavbarItemSchema = utils_validation_1.Joi.object({
182
183
  position: NavbarItemPosition,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-5049",
3
+ "version": "0.0.0-5052",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,15 +20,15 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "0.0.0-5049",
24
- "@docusaurus/plugin-content-blog": "0.0.0-5049",
25
- "@docusaurus/plugin-content-docs": "0.0.0-5049",
26
- "@docusaurus/plugin-content-pages": "0.0.0-5049",
27
- "@docusaurus/theme-common": "0.0.0-5049",
28
- "@docusaurus/theme-translations": "0.0.0-5049",
29
- "@docusaurus/utils": "0.0.0-5049",
30
- "@docusaurus/utils-common": "0.0.0-5049",
31
- "@docusaurus/utils-validation": "0.0.0-5049",
23
+ "@docusaurus/core": "0.0.0-5052",
24
+ "@docusaurus/plugin-content-blog": "0.0.0-5052",
25
+ "@docusaurus/plugin-content-docs": "0.0.0-5052",
26
+ "@docusaurus/plugin-content-pages": "0.0.0-5052",
27
+ "@docusaurus/theme-common": "0.0.0-5052",
28
+ "@docusaurus/theme-translations": "0.0.0-5052",
29
+ "@docusaurus/utils": "0.0.0-5052",
30
+ "@docusaurus/utils-common": "0.0.0-5052",
31
+ "@docusaurus/utils-validation": "0.0.0-5052",
32
32
  "@mdx-js/react": "^1.6.22",
33
33
  "clsx": "^1.1.1",
34
34
  "copy-text-to-clipboard": "^3.0.1",
@@ -43,8 +43,8 @@
43
43
  "tslib": "^2.4.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@docusaurus/module-type-aliases": "0.0.0-5049",
47
- "@docusaurus/types": "0.0.0-5049",
46
+ "@docusaurus/module-type-aliases": "0.0.0-5052",
47
+ "@docusaurus/types": "0.0.0-5052",
48
48
  "@types/mdx-js__react": "^1.5.5",
49
49
  "@types/nprogress": "^0.2.0",
50
50
  "@types/prismjs": "^1.26.0",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=14"
62
62
  },
63
- "gitHead": "527b2a01c46b67483327a1a6873fccf81bc19e2c"
63
+ "gitHead": "4a38a12418dc0d2bfa287bd38392fabf04222556"
64
64
  }
@@ -56,7 +56,7 @@ export default function NavbarContent(): JSX.Element {
56
56
  const items = useNavbarItems();
57
57
  const [leftItems, rightItems] = splitNavbarItems(items);
58
58
 
59
- const autoAddSearchBar = !items.some((item) => item.type === 'search');
59
+ const searchBarItem = items.find((item) => item.type === 'search');
60
60
 
61
61
  return (
62
62
  <NavbarContentLayout
@@ -74,7 +74,7 @@ export default function NavbarContent(): JSX.Element {
74
74
  <>
75
75
  <NavbarItems items={rightItems} />
76
76
  <NavbarColorModeToggle className={styles.colorModeToggle} />
77
- {autoAddSearchBar && (
77
+ {!searchBarItem && (
78
78
  <NavbarSearch>
79
79
  <SearchBar />
80
80
  </NavbarSearch>
@@ -6,10 +6,14 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
+ import clsx from 'clsx';
9
10
  import type {Props} from '@theme/Navbar/Search';
10
11
 
11
12
  import styles from './styles.module.css';
12
13
 
13
- export default function NavbarSearch({children}: Props): JSX.Element {
14
- return <div className={styles.searchBox}>{children}</div>;
14
+ export default function NavbarSearch({
15
+ children,
16
+ className,
17
+ }: Props): JSX.Element {
18
+ return <div className={clsx(className, styles.searchBox)}>{children}</div>;
15
19
  }
@@ -10,13 +10,16 @@ import SearchBar from '@theme/SearchBar';
10
10
  import NavbarSearch from '@theme/Navbar/Search';
11
11
  import type {Props} from '@theme/NavbarItem/SearchNavbarItem';
12
12
 
13
- export default function SearchNavbarItem({mobile}: Props): JSX.Element | null {
13
+ export default function SearchNavbarItem({
14
+ mobile,
15
+ className,
16
+ }: Props): JSX.Element | null {
14
17
  if (mobile) {
15
18
  return null;
16
19
  }
17
20
 
18
21
  return (
19
- <NavbarSearch>
22
+ <NavbarSearch className={className}>
20
23
  <SearchBar />
21
24
  </NavbarSearch>
22
25
  );
@@ -777,6 +777,7 @@ declare module '@theme/Navbar/Search' {
777
777
 
778
778
  export interface Props {
779
779
  readonly children: ReactNode;
780
+ readonly className?: string;
780
781
  }
781
782
 
782
783
  export default function NavbarSearch(props: Props): JSX.Element;
@@ -834,6 +835,7 @@ declare module '@theme/NavbarItem/DropdownNavbarItem' {
834
835
  declare module '@theme/NavbarItem/SearchNavbarItem' {
835
836
  export interface Props {
836
837
  readonly mobile?: boolean;
838
+ readonly className?: string;
837
839
  }
838
840
 
839
841
  export default function SearchNavbarItem(props: Props): JSX.Element;
@@ -1032,10 +1034,10 @@ declare module '@theme/Tabs' {
1032
1034
  readonly lazy?: boolean;
1033
1035
  readonly block?: boolean;
1034
1036
  readonly children: readonly ReactElement<TabItemProps>[];
1035
- readonly defaultValue?: string | number | null;
1037
+ readonly defaultValue?: string | null;
1036
1038
  readonly values?: readonly {
1037
- value: string | number;
1038
- label?: string | number;
1039
+ value: string;
1040
+ label?: string;
1039
1041
  attributes?: {[key: string]: unknown};
1040
1042
  }[];
1041
1043
  readonly groupId?: string;
@@ -200,6 +200,7 @@ const LocaleDropdownNavbarItemSchema = NavbarItemBaseSchema.append({
200
200
 
201
201
  const SearchItemSchema = Joi.object({
202
202
  type: Joi.string().equal('search').required(),
203
+ className: Joi.string(),
203
204
  });
204
205
 
205
206
  const NavbarItemSchema = Joi.object({