@elastic/eui-docusaurus-theme 2.0.0
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/LICENSE.txt +6 -0
- package/README.md +292 -0
- package/lib/.tsbuildinfo-client +1 -0
- package/lib/components/badge/index.d.ts +1 -0
- package/lib/components/badge/index.js +9 -0
- package/lib/components/codesandbox_icon/codesandbox_icon.d.ts +4 -0
- package/lib/components/codesandbox_icon/codesandbox_icon.js +2 -0
- package/lib/components/codesandbox_icon/index.d.ts +1 -0
- package/lib/components/codesandbox_icon/index.js +8 -0
- package/lib/components/demo/actions_bar/actions_bar.d.ts +10 -0
- package/lib/components/demo/actions_bar/actions_bar.js +34 -0
- package/lib/components/demo/actions_bar/index.d.ts +1 -0
- package/lib/components/demo/actions_bar/index.js +8 -0
- package/lib/components/demo/code_transformer.d.ts +18 -0
- package/lib/components/demo/code_transformer.js +39 -0
- package/lib/components/demo/codesandbox/find_external_dependencies.d.ts +5 -0
- package/lib/components/demo/codesandbox/find_external_dependencies.js +30 -0
- package/lib/components/demo/codesandbox/index.d.ts +1 -0
- package/lib/components/demo/codesandbox/index.js +8 -0
- package/lib/components/demo/codesandbox/open_action.d.ts +16 -0
- package/lib/components/demo/codesandbox/open_action.js +91 -0
- package/lib/components/demo/context.d.ts +14 -0
- package/lib/components/demo/context.js +13 -0
- package/lib/components/demo/create_demo.d.ts +5 -0
- package/lib/components/demo/create_demo.js +13 -0
- package/lib/components/demo/demo.d.ts +23 -0
- package/lib/components/demo/demo.js +61 -0
- package/lib/components/demo/editor/editor.d.ts +1 -0
- package/lib/components/demo/editor/editor.js +39 -0
- package/lib/components/demo/editor/index.d.ts +1 -0
- package/lib/components/demo/editor/index.js +8 -0
- package/lib/components/demo/index.d.ts +3 -0
- package/lib/components/demo/index.js +10 -0
- package/lib/components/demo/preview/index.d.ts +1 -0
- package/lib/components/demo/preview/index.js +8 -0
- package/lib/components/demo/preview/preview.d.ts +7 -0
- package/lib/components/demo/preview/preview.js +36 -0
- package/lib/components/demo/scope.d.ts +1 -0
- package/lib/components/demo/scope.js +12 -0
- package/lib/components/demo/source/get_source_from_children.d.ts +11 -0
- package/lib/components/demo/source/get_source_from_children.js +42 -0
- package/lib/components/demo/source/index.d.ts +1 -0
- package/lib/components/demo/source/index.js +8 -0
- package/lib/components/demo/source/source.d.ts +6 -0
- package/lib/components/demo/source/source.js +25 -0
- package/lib/components/figma_embed/index.d.ts +5 -0
- package/lib/components/figma_embed/index.js +36 -0
- package/lib/components/guideline/guideline.d.ts +10 -0
- package/lib/components/guideline/guideline.js +68 -0
- package/lib/components/guideline/guideline_text.d.ts +6 -0
- package/lib/components/guideline/guideline_text.js +28 -0
- package/lib/components/guideline/index.d.ts +2 -0
- package/lib/components/guideline/index.js +9 -0
- package/lib/components/guideline/types.d.ts +1 -0
- package/lib/components/guideline/types.js +8 -0
- package/lib/components/high_contrast_mode_toggle/index.d.ts +1 -0
- package/lib/components/high_contrast_mode_toggle/index.js +15 -0
- package/lib/components/icon/index.d.ts +1 -0
- package/lib/components/icon/index.js +9 -0
- package/lib/components/index.d.ts +7 -0
- package/lib/components/index.js +14 -0
- package/lib/components/navbar_item/index.d.ts +19 -0
- package/lib/components/navbar_item/index.js +84 -0
- package/lib/components/prop_table/definition_types.d.ts +43 -0
- package/lib/components/prop_table/definition_types.js +8 -0
- package/lib/components/prop_table/extended_types.d.ts +5 -0
- package/lib/components/prop_table/extended_types.js +27 -0
- package/lib/components/prop_table/extended_types_info.d.ts +26 -0
- package/lib/components/prop_table/extended_types_info.js +34 -0
- package/lib/components/prop_table/index.d.ts +1 -0
- package/lib/components/prop_table/index.js +8 -0
- package/lib/components/prop_table/prop_table.d.ts +8 -0
- package/lib/components/prop_table/prop_table.js +115 -0
- package/lib/components/theme_context/index.d.ts +16 -0
- package/lib/components/theme_context/index.js +103 -0
- package/lib/components/theme_context/theme_overrides.d.ts +2 -0
- package/lib/components/theme_context/theme_overrides.js +12 -0
- package/lib/components/version_switcher/index.d.ts +23 -0
- package/lib/components/version_switcher/index.js +51 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/theme/Admonition/Types.d.ts +3 -0
- package/lib/theme/Admonition/Types.js +51 -0
- package/lib/theme/CodeBlock/index.d.ts +3 -0
- package/lib/theme/CodeBlock/index.js +35 -0
- package/lib/theme/ColorModeToggle/index.d.ts +10 -0
- package/lib/theme/ColorModeToggle/index.js +51 -0
- package/lib/theme/Demo/actions.d.ts +8 -0
- package/lib/theme/Demo/actions.js +8 -0
- package/lib/theme/Demo/default_scope.d.ts +3 -0
- package/lib/theme/Demo/default_scope.js +17 -0
- package/lib/theme/DocBreadcrumbs/Items/Home/index.d.ts +2 -0
- package/lib/theme/DocBreadcrumbs/Items/Home/index.js +15 -0
- package/lib/theme/DocBreadcrumbs/Items/item.styles.d.ts +5 -0
- package/lib/theme/DocBreadcrumbs/Items/item.styles.js +40 -0
- package/lib/theme/DocBreadcrumbs/index.d.ts +2 -0
- package/lib/theme/DocBreadcrumbs/index.js +63 -0
- package/lib/theme/DocItem/Content/index.d.ts +3 -0
- package/lib/theme/DocItem/Content/index.js +44 -0
- package/lib/theme/DocItem/Footer/index.d.ts +2 -0
- package/lib/theme/DocItem/Footer/index.js +17 -0
- package/lib/theme/DocItem/Layout/index.d.ts +3 -0
- package/lib/theme/DocItem/Layout/index.js +71 -0
- package/lib/theme/DocItem/Metadata/index.d.ts +2 -0
- package/lib/theme/DocItem/Metadata/index.js +7 -0
- package/lib/theme/DocItem/Paginator/index.d.ts +6 -0
- package/lib/theme/DocItem/Paginator/index.js +11 -0
- package/lib/theme/DocItem/TOC/Desktop/index.d.ts +2 -0
- package/lib/theme/DocItem/TOC/Desktop/index.js +8 -0
- package/lib/theme/DocItem/TOC/Mobile/index.d.ts +2 -0
- package/lib/theme/DocItem/TOC/Mobile/index.js +17 -0
- package/lib/theme/DocItem/index.d.ts +3 -0
- package/lib/theme/DocItem/index.js +10 -0
- package/lib/theme/DocPaginator/index.d.ts +3 -0
- package/lib/theme/DocPaginator/index.js +19 -0
- package/lib/theme/DocRoot/Layout/Main/index.d.ts +3 -0
- package/lib/theme/DocRoot/Layout/Main/index.js +35 -0
- package/lib/theme/DocRoot/Layout/Sidebar/index.d.ts +3 -0
- package/lib/theme/DocRoot/Layout/Sidebar/index.js +81 -0
- package/lib/theme/DocRoot/Layout/index.d.ts +3 -0
- package/lib/theme/DocRoot/Layout/index.js +47 -0
- package/lib/theme/DocSidebarItem/Category/index.d.ts +3 -0
- package/lib/theme/DocSidebarItem/Category/index.js +146 -0
- package/lib/theme/DocSidebarItem/Link/index.d.ts +3 -0
- package/lib/theme/DocSidebarItem/Link/index.js +39 -0
- package/lib/theme/DocSidebarItem/index.d.ts +3 -0
- package/lib/theme/DocSidebarItem/index.js +15 -0
- package/lib/theme/DocSidebarItems/index.d.ts +5 -0
- package/lib/theme/DocSidebarItems/index.js +17 -0
- package/lib/theme/EditThisPage/index.d.ts +3 -0
- package/lib/theme/EditThisPage/index.js +17 -0
- package/lib/theme/Footer/index.d.ts +2 -0
- package/lib/theme/Footer/index.js +43 -0
- package/lib/theme/Heading/index.d.ts +3 -0
- package/lib/theme/Heading/index.js +49 -0
- package/lib/theme/Logo/index.d.ts +3 -0
- package/lib/theme/Logo/index.js +80 -0
- package/lib/theme/MDXComponents/A.d.ts +6 -0
- package/lib/theme/MDXComponents/A.js +17 -0
- package/lib/theme/MDXComponents/Blockquote.d.ts +2 -0
- package/lib/theme/MDXComponents/Blockquote.js +18 -0
- package/lib/theme/MDXComponents/Code.d.ts +6 -0
- package/lib/theme/MDXComponents/Code.js +35 -0
- package/lib/theme/MDXComponents/Heading.d.ts +4 -0
- package/lib/theme/MDXComponents/Heading.js +4 -0
- package/lib/theme/MDXComponents/ListItem.d.ts +2 -0
- package/lib/theme/MDXComponents/ListItem.js +5 -0
- package/lib/theme/MDXComponents/OrderedList.d.ts +2 -0
- package/lib/theme/MDXComponents/OrderedList.js +11 -0
- package/lib/theme/MDXComponents/Paragraph.d.ts +2 -0
- package/lib/theme/MDXComponents/Paragraph.js +18 -0
- package/lib/theme/MDXComponents/Table.d.ts +2 -0
- package/lib/theme/MDXComponents/Table.js +3 -0
- package/lib/theme/MDXComponents/TableBody.d.ts +2 -0
- package/lib/theme/MDXComponents/TableBody.js +3 -0
- package/lib/theme/MDXComponents/TableDataCell.d.ts +2 -0
- package/lib/theme/MDXComponents/TableDataCell.js +3 -0
- package/lib/theme/MDXComponents/TableHeader.d.ts +2 -0
- package/lib/theme/MDXComponents/TableHeader.js +3 -0
- package/lib/theme/MDXComponents/TableHeaderCell.d.ts +2 -0
- package/lib/theme/MDXComponents/TableHeaderCell.js +3 -0
- package/lib/theme/MDXComponents/TableRow.d.ts +2 -0
- package/lib/theme/MDXComponents/TableRow.js +3 -0
- package/lib/theme/MDXComponents/UnorderedList.d.ts +2 -0
- package/lib/theme/MDXComponents/UnorderedList.js +11 -0
- package/lib/theme/MDXComponents/index.d.ts +2 -0
- package/lib/theme/MDXComponents/index.js +46 -0
- package/lib/theme/MDXContent/index.d.ts +6 -0
- package/lib/theme/MDXContent/index.js +4 -0
- package/lib/theme/Navbar/Content/index.d.ts +7 -0
- package/lib/theme/Navbar/Content/index.js +149 -0
- package/lib/theme/Navbar/Layout/index.d.ts +6 -0
- package/lib/theme/Navbar/Layout/index.js +59 -0
- package/lib/theme/Navbar/MobileSidebar/Header/index.d.ts +7 -0
- package/lib/theme/Navbar/MobileSidebar/Header/index.js +46 -0
- package/lib/theme/Navbar/MobileSidebar/Layout/index.d.ts +6 -0
- package/lib/theme/Navbar/MobileSidebar/Layout/index.js +26 -0
- package/lib/theme/Navbar/MobileSidebar/index.d.ts +7 -0
- package/lib/theme/Navbar/MobileSidebar/index.js +14 -0
- package/lib/theme/NavbarItem/DropdownNavbarItem/index.d.ts +3 -0
- package/lib/theme/NavbarItem/DropdownNavbarItem/index.js +94 -0
- package/lib/theme/NavbarItem/NavbarNavLink.d.ts +7 -0
- package/lib/theme/NavbarItem/NavbarNavLink.js +48 -0
- package/lib/theme/PaginatorNavLink/index.d.ts +3 -0
- package/lib/theme/PaginatorNavLink/index.js +43 -0
- package/lib/theme/Root.d.ts +3 -0
- package/lib/theme/Root.js +66 -0
- package/lib/theme/Root.styles.d.ts +2 -0
- package/lib/theme/Root.styles.js +111 -0
- package/lib/theme/TOCCollapsible/CollapseButton/index.d.ts +3 -0
- package/lib/theme/TOCCollapsible/CollapseButton/index.js +23 -0
- package/lib/theme/TOCItems/Tree.d.ts +5 -0
- package/lib/theme/TOCItems/Tree.js +80 -0
- package/lib/theme/infima.styles.d.ts +1 -0
- package/lib/theme/infima.styles.js +1456 -0
- package/lib/theme/reset.styles.d.ts +2 -0
- package/lib/theme/reset.styles.js +79 -0
- package/package.json +61 -0
- package/src/components/badge/index.ts +11 -0
- package/src/components/codesandbox_icon/codesandbox_icon.tsx +24 -0
- package/src/components/codesandbox_icon/index.ts +9 -0
- package/src/components/demo/actions_bar/actions_bar.tsx +95 -0
- package/src/components/demo/actions_bar/index.ts +9 -0
- package/src/components/demo/code_transformer.ts +44 -0
- package/src/components/demo/codesandbox/find_external_dependencies.ts +34 -0
- package/src/components/demo/codesandbox/index.ts +9 -0
- package/src/components/demo/codesandbox/open_action.tsx +132 -0
- package/src/components/demo/context.ts +30 -0
- package/src/components/demo/create_demo.tsx +17 -0
- package/src/components/demo/demo.tsx +143 -0
- package/src/components/demo/editor/editor.tsx +51 -0
- package/src/components/demo/editor/index.ts +9 -0
- package/src/components/demo/index.ts +11 -0
- package/src/components/demo/preview/index.ts +9 -0
- package/src/components/demo/preview/preview.tsx +77 -0
- package/src/components/demo/scope.ts +14 -0
- package/src/components/demo/source/get_source_from_children.ts +59 -0
- package/src/components/demo/source/index.ts +9 -0
- package/src/components/demo/source/source.tsx +36 -0
- package/src/components/figma_embed/index.tsx +57 -0
- package/src/components/guideline/guideline.tsx +121 -0
- package/src/components/guideline/guideline_text.tsx +51 -0
- package/src/components/guideline/index.ts +10 -0
- package/src/components/guideline/types.ts +9 -0
- package/src/components/high_contrast_mode_toggle/index.tsx +28 -0
- package/src/components/icon/index.ts +11 -0
- package/src/components/index.ts +15 -0
- package/src/components/navbar_item/index.tsx +164 -0
- package/src/components/prop_table/definition_types.ts +53 -0
- package/src/components/prop_table/extended_types.tsx +66 -0
- package/src/components/prop_table/extended_types_info.ts +35 -0
- package/src/components/prop_table/index.ts +9 -0
- package/src/components/prop_table/prop_table.tsx +235 -0
- package/src/components/theme_context/index.tsx +156 -0
- package/src/components/theme_context/theme_overrides.ts +15 -0
- package/src/components/version_switcher/index.tsx +144 -0
- package/src/index.ts +21 -0
- package/src/theme/Admonition/Types.tsx +85 -0
- package/src/theme/CodeBlock/index.tsx +57 -0
- package/src/theme/ColorModeToggle/index.tsx +93 -0
- package/src/theme/Demo/actions.tsx +20 -0
- package/src/theme/Demo/default_scope.ts +19 -0
- package/src/theme/DocBreadcrumbs/Items/Home/index.tsx +38 -0
- package/src/theme/DocBreadcrumbs/Items/item.styles.ts +43 -0
- package/src/theme/DocBreadcrumbs/index.tsx +144 -0
- package/src/theme/DocItem/Content/index.tsx +75 -0
- package/src/theme/DocItem/Footer/index.tsx +59 -0
- package/src/theme/DocItem/Layout/index.tsx +112 -0
- package/src/theme/DocItem/Metadata/index.tsx +23 -0
- package/src/theme/DocItem/Paginator/index.tsx +20 -0
- package/src/theme/DocItem/TOC/Desktop/index.tsx +24 -0
- package/src/theme/DocItem/TOC/Mobile/index.tsx +35 -0
- package/src/theme/DocItem/index.tsx +30 -0
- package/src/theme/DocPaginator/index.tsx +64 -0
- package/src/theme/DocRoot/Layout/Main/index.tsx +61 -0
- package/src/theme/DocRoot/Layout/Sidebar/index.tsx +124 -0
- package/src/theme/DocRoot/Layout/index.tsx +72 -0
- package/src/theme/DocSidebarItem/Category/index.tsx +266 -0
- package/src/theme/DocSidebarItem/Link/index.tsx +86 -0
- package/src/theme/DocSidebarItem/index.tsx +29 -0
- package/src/theme/DocSidebarItems/index.tsx +30 -0
- package/src/theme/EditThisPage/index.tsx +50 -0
- package/src/theme/Footer/index.tsx +67 -0
- package/src/theme/Heading/index.tsx +94 -0
- package/src/theme/Logo/index.tsx +146 -0
- package/src/theme/MDXComponents/A.tsx +33 -0
- package/src/theme/MDXComponents/Blockquote.tsx +35 -0
- package/src/theme/MDXComponents/Code.tsx +60 -0
- package/src/theme/MDXComponents/Heading.tsx +16 -0
- package/src/theme/MDXComponents/ListItem.tsx +20 -0
- package/src/theme/MDXComponents/OrderedList.tsx +26 -0
- package/src/theme/MDXComponents/Paragraph.tsx +33 -0
- package/src/theme/MDXComponents/Table.tsx +16 -0
- package/src/theme/MDXComponents/TableBody.tsx +16 -0
- package/src/theme/MDXComponents/TableDataCell.tsx +20 -0
- package/src/theme/MDXComponents/TableHeader.tsx +16 -0
- package/src/theme/MDXComponents/TableHeaderCell.tsx +20 -0
- package/src/theme/MDXComponents/TableRow.tsx +16 -0
- package/src/theme/MDXComponents/UnorderedList.tsx +26 -0
- package/src/theme/MDXComponents/index.ts +61 -0
- package/src/theme/MDXContent/index.tsx +22 -0
- package/src/theme/Navbar/Content/index.tsx +262 -0
- package/src/theme/Navbar/Layout/index.tsx +100 -0
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +89 -0
- package/src/theme/Navbar/MobileSidebar/Layout/index.tsx +44 -0
- package/src/theme/Navbar/MobileSidebar/index.tsx +46 -0
- package/src/theme/NavbarItem/DropdownNavbarItem/index.tsx +200 -0
- package/src/theme/NavbarItem/NavbarNavLink.tsx +141 -0
- package/src/theme/PaginatorNavLink/index.tsx +72 -0
- package/src/theme/Root.styles.ts +122 -0
- package/src/theme/Root.tsx +106 -0
- package/src/theme/TOCCollapsible/CollapseButton/index.tsx +53 -0
- package/src/theme/TOCItems/Tree.tsx +114 -0
- package/src/theme/infima.styles.ts +1458 -0
- package/src/theme/reset.styles.ts +82 -0
- package/src/theme/theme.d.ts +598 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import OriginalMDXComponents from '@theme-init/MDXComponents';
|
|
10
|
+
import {
|
|
11
|
+
Badge,
|
|
12
|
+
Demo,
|
|
13
|
+
DemoSource,
|
|
14
|
+
FigmaEmbed,
|
|
15
|
+
Guideline,
|
|
16
|
+
GuidelineText,
|
|
17
|
+
Icon,
|
|
18
|
+
PropTable,
|
|
19
|
+
} from '../../components';
|
|
20
|
+
|
|
21
|
+
import { ListItem } from './ListItem';
|
|
22
|
+
import { Blockquote } from './Blockquote';
|
|
23
|
+
import { Paragraph } from './Paragraph';
|
|
24
|
+
import { UnorderedList } from './UnorderedList';
|
|
25
|
+
import { OrderedList } from './OrderedList';
|
|
26
|
+
import { Table } from './Table';
|
|
27
|
+
import { TableBody } from './TableBody';
|
|
28
|
+
import { TableHeader } from './TableHeader';
|
|
29
|
+
import { TableHeaderCell } from './TableHeaderCell';
|
|
30
|
+
import { TableRow } from './TableRow';
|
|
31
|
+
import { TableDataCell } from './TableDataCell';
|
|
32
|
+
|
|
33
|
+
const MDXComponents = {
|
|
34
|
+
...OriginalMDXComponents,
|
|
35
|
+
// Base content components
|
|
36
|
+
p: Paragraph,
|
|
37
|
+
li: ListItem,
|
|
38
|
+
ul: UnorderedList,
|
|
39
|
+
ol: OrderedList,
|
|
40
|
+
blockquote: Blockquote,
|
|
41
|
+
|
|
42
|
+
// Tables
|
|
43
|
+
table: Table,
|
|
44
|
+
tbody: TableBody,
|
|
45
|
+
thead: TableHeader,
|
|
46
|
+
tr: TableRow,
|
|
47
|
+
th: TableHeaderCell,
|
|
48
|
+
td: TableDataCell,
|
|
49
|
+
|
|
50
|
+
// Custom components
|
|
51
|
+
Badge,
|
|
52
|
+
Demo,
|
|
53
|
+
DemoSource,
|
|
54
|
+
FigmaEmbed,
|
|
55
|
+
Guideline,
|
|
56
|
+
GuidelineText,
|
|
57
|
+
Icon,
|
|
58
|
+
PropTable,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default MDXComponents;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { JSX } from 'react';
|
|
10
|
+
import OriginalMDXContent from '@theme-init/MDXContent';
|
|
11
|
+
import type MDXContentType from '@theme-init/MDXContent';
|
|
12
|
+
import type { WrapperProps } from '@docusaurus/types';
|
|
13
|
+
|
|
14
|
+
type Props = WrapperProps<typeof MDXContentType>;
|
|
15
|
+
|
|
16
|
+
const MDXContent = (props: Props): JSX.Element => (
|
|
17
|
+
<div data-search-children={true}>
|
|
18
|
+
<OriginalMDXContent {...props} />
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default MDXContent;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { type ReactNode, JSX } from 'react';
|
|
10
|
+
import { css, Global } from '@emotion/react';
|
|
11
|
+
import { useThemeConfig, ErrorCauseBoundary } from '@docusaurus/theme-common';
|
|
12
|
+
import {
|
|
13
|
+
splitNavbarItems,
|
|
14
|
+
useNavbarMobileSidebar,
|
|
15
|
+
} from '@docusaurus/theme-common/internal';
|
|
16
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
17
|
+
import { useLocation } from '@docusaurus/router';
|
|
18
|
+
import NavbarItem, {
|
|
19
|
+
type Props as NavbarItemConfig,
|
|
20
|
+
} from '@theme-original/NavbarItem';
|
|
21
|
+
import NavbarColorModeToggle from '@theme-original/Navbar/ColorModeToggle';
|
|
22
|
+
import SearchBar from '@theme-original/SearchBar';
|
|
23
|
+
import NavbarMobileSidebarToggle from '@theme-original/Navbar/MobileSidebar/Toggle';
|
|
24
|
+
import NavbarLogo from '@theme-original/Navbar/Logo';
|
|
25
|
+
import NavbarSearch from '@theme-original/Navbar/Search';
|
|
26
|
+
import {
|
|
27
|
+
euiFocusRing,
|
|
28
|
+
euiTextTruncate,
|
|
29
|
+
useEuiMemoizedStyles,
|
|
30
|
+
UseEuiTheme,
|
|
31
|
+
} from '@elastic/eui';
|
|
32
|
+
import {
|
|
33
|
+
euiFormControlText,
|
|
34
|
+
euiFormVariables,
|
|
35
|
+
// @ts-ignore - reusing form styles as we don't have access to the plugin component yet
|
|
36
|
+
} from '@elastic/eui/lib/components/form/form.styles';
|
|
37
|
+
|
|
38
|
+
import {
|
|
39
|
+
VersionSwitcher,
|
|
40
|
+
VersionSwitcherProps,
|
|
41
|
+
} from '../../../components/version_switcher';
|
|
42
|
+
import { HighContrastModeToggle } from '../../../components/high_contrast_mode_toggle';
|
|
43
|
+
|
|
44
|
+
const DOCS_PATH = '/docs';
|
|
45
|
+
|
|
46
|
+
const placeHolderStyles = (content: string) => `
|
|
47
|
+
&::-webkit-input-placeholder { ${content} }
|
|
48
|
+
&::-moz-placeholder { ${content} }
|
|
49
|
+
&:-moz-placeholder { ${content} }
|
|
50
|
+
&::placeholder { ${content} }
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
const getStyles = (euiThemeContext: UseEuiTheme) => {
|
|
54
|
+
const { euiTheme } = euiThemeContext;
|
|
55
|
+
const form = euiFormVariables(euiThemeContext);
|
|
56
|
+
const iconColor = encodeURIComponent(euiTheme.colors.text);
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
navbarItems: css`
|
|
60
|
+
--ifm-navbar-item-padding-horizontal: 0;
|
|
61
|
+
--ifm-navbar-item-padding-vertical: 0;
|
|
62
|
+
|
|
63
|
+
.navbar__item,
|
|
64
|
+
[class*='colorModeToggle'] {
|
|
65
|
+
@media (max-width: 996px) {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.navbar__toggle {
|
|
71
|
+
border-radius: ${euiTheme.border.radius.small};
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
background-color: var(--ifm-color-emphasis-200);
|
|
75
|
+
color: currentColor;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`,
|
|
79
|
+
navbarItemsLeft: css`
|
|
80
|
+
gap: ${euiTheme.size.s};
|
|
81
|
+
|
|
82
|
+
@media (min-width: 997px) {
|
|
83
|
+
gap: ${euiTheme.size.l};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.navbar__link {
|
|
87
|
+
${euiTextTruncate()}
|
|
88
|
+
}
|
|
89
|
+
`,
|
|
90
|
+
navbarItemsRight: css`
|
|
91
|
+
gap: ${euiTheme.size.s};
|
|
92
|
+
`,
|
|
93
|
+
actions: css`
|
|
94
|
+
@media (max-width: 996px) {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
`,
|
|
98
|
+
search: css`
|
|
99
|
+
.navbar__search-input {
|
|
100
|
+
// TODO: update search input styles or try to use EUI component
|
|
101
|
+
--ifm-navbar-search-input-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="16px" width="16px"><path fill="${iconColor}" d="M11.2709852,11.9779932 L15.14275,15.85075 C15.24075,15.94775 15.36875,15.99675 15.49675,15.99675 C15.62475,15.99675 15.75275,15.94775 15.85075,15.85075 C16.04575,15.65475 16.04575,15.33875 15.85075,15.14275 L12.2861494,11.5790625 C14.6668581,8.83239759 14.5527289,4.65636993 11.9437617,2.04675 C9.21444459,-0.68225 4.77355568,-0.68225 2.04623804,2.04675 C-0.682079347,4.77575 -0.682079347,9.21775 2.04623804,11.94675 C3.36890712,13.26875 5.12646738,13.99675 6.99499989,13.99675 C7.27093085,13.99675 7.49487482,13.77275 7.49487482,13.49675 C7.49487482,13.22075 7.27093085,12.99675 6.99499989,12.99675 C5.39240085,12.99675 3.88677755,12.37275 2.7530612,11.23975 C0.414646258,8.89975 0.414646258,5.09375 2.7530612,2.75375 C5.09047639,0.41375 8.89552438,0.41475 11.2369386,2.75375 C13.5753535,5.09375 13.5753535,8.89975 11.2369386,11.23975 C11.0419873,11.43475 11.0419873,11.75175 11.2369386,11.94675 C11.2479153,11.9577858 11.2592787,11.9682002 11.2709852,11.9779932 Z" /></svg>');
|
|
102
|
+
--ifm-navbar-search-input-background-color: ${form.backgroundColor};
|
|
103
|
+
--ifm-navbar-search-input-color: ${euiTheme.colors.text};
|
|
104
|
+
|
|
105
|
+
${euiFormControlText(euiThemeContext)};
|
|
106
|
+
block-size: ${form.controlCompressedHeight};
|
|
107
|
+
padding-block: ${form.controlCompressedPadding};
|
|
108
|
+
|
|
109
|
+
border: ${euiTheme.border.width.thin} solid ${form.borderColor};
|
|
110
|
+
border-radius: ${form.controlBorderRadius};
|
|
111
|
+
|
|
112
|
+
${placeHolderStyles(`
|
|
113
|
+
color: ${form.controlPlaceholderText};
|
|
114
|
+
opacity: 1;
|
|
115
|
+
`)}
|
|
116
|
+
|
|
117
|
+
${euiFocusRing(euiThemeContext, 'outset', { color: 'primary' })}
|
|
118
|
+
|
|
119
|
+
&:disabled {
|
|
120
|
+
border-color: ${form.borderDisabledColor};
|
|
121
|
+
background-color: ${form.backgroundDisabledColor};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&[readOnly] {
|
|
125
|
+
background-color: ${form.backgroundReadOnlyColor};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@media (min-width: 400px) {
|
|
129
|
+
inline-size: 100%;
|
|
130
|
+
max-inline-size: 25rem;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media (min-width: 997px) {
|
|
134
|
+
min-inline-size: 15rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@media (min-width: 1200px) {
|
|
138
|
+
min-inline-size: 25rem;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`,
|
|
142
|
+
versionSwitcher: css`
|
|
143
|
+
@media (max-width: 996px) {
|
|
144
|
+
display: none;
|
|
145
|
+
}
|
|
146
|
+
`,
|
|
147
|
+
themeSwitcher: css`
|
|
148
|
+
@media (max-width: 996px) {
|
|
149
|
+
display: none;
|
|
150
|
+
}
|
|
151
|
+
`,
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
function useNavbarItems() {
|
|
156
|
+
// TODO temporary casting until ThemeConfig type is improved
|
|
157
|
+
return useThemeConfig().navbar.items as NavbarItemConfig[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function NavbarItems({ items }: { items: NavbarItemConfig[] }): JSX.Element {
|
|
161
|
+
return (
|
|
162
|
+
<>
|
|
163
|
+
{items.map((item, i) => (
|
|
164
|
+
<ErrorCauseBoundary
|
|
165
|
+
key={i}
|
|
166
|
+
onError={(error) =>
|
|
167
|
+
new Error(
|
|
168
|
+
`A theme navbar item failed to render.
|
|
169
|
+
Please double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:
|
|
170
|
+
${JSON.stringify(item, null, 2)}`,
|
|
171
|
+
{ cause: error }
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
>
|
|
175
|
+
<NavbarItem {...item} />
|
|
176
|
+
</ErrorCauseBoundary>
|
|
177
|
+
))}
|
|
178
|
+
</>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function NavbarContentLayout({
|
|
183
|
+
left,
|
|
184
|
+
right,
|
|
185
|
+
}: {
|
|
186
|
+
left: ReactNode;
|
|
187
|
+
right: ReactNode;
|
|
188
|
+
}) {
|
|
189
|
+
const styles = useEuiMemoizedStyles(getStyles);
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<div className="navbar__inner" css={styles.navbarItems}>
|
|
193
|
+
<div className="navbar__items" css={styles.navbarItemsLeft}>
|
|
194
|
+
{left}
|
|
195
|
+
</div>
|
|
196
|
+
<div
|
|
197
|
+
className="navbar__items navbar__items--right"
|
|
198
|
+
css={styles.navbarItemsRight}
|
|
199
|
+
>
|
|
200
|
+
{right}
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
type Props = {
|
|
207
|
+
versionSwitcherOptions?: VersionSwitcherProps;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export default function NavbarContent({
|
|
211
|
+
versionSwitcherOptions,
|
|
212
|
+
}: Props): JSX.Element {
|
|
213
|
+
const isBrowser = useIsBrowser();
|
|
214
|
+
const mobileSidebar = useNavbarMobileSidebar();
|
|
215
|
+
const location = useLocation();
|
|
216
|
+
const items = useNavbarItems();
|
|
217
|
+
const [leftItems, rightItems] = splitNavbarItems(items);
|
|
218
|
+
|
|
219
|
+
const styles = useEuiMemoizedStyles(getStyles);
|
|
220
|
+
|
|
221
|
+
const searchBarItem = items.find((item) => item.type === 'search');
|
|
222
|
+
const isRoot = !location?.pathname.includes(DOCS_PATH);
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<>
|
|
226
|
+
{/* adding search styles globally to ensure they are available for usage on
|
|
227
|
+
homepage as well without duplication. NOTE: swizzle/wrap does not work for
|
|
228
|
+
the plugin SearchBar component */}
|
|
229
|
+
<Global styles={styles.search} />
|
|
230
|
+
<NavbarContentLayout
|
|
231
|
+
left={
|
|
232
|
+
<>
|
|
233
|
+
{!mobileSidebar.disabled && <NavbarMobileSidebarToggle />}
|
|
234
|
+
<NavbarLogo />
|
|
235
|
+
<div css={styles.versionSwitcher}>
|
|
236
|
+
{isBrowser && versionSwitcherOptions && (
|
|
237
|
+
<VersionSwitcher {...versionSwitcherOptions} />
|
|
238
|
+
)}
|
|
239
|
+
</div>
|
|
240
|
+
<NavbarItems items={leftItems} />
|
|
241
|
+
</>
|
|
242
|
+
}
|
|
243
|
+
right={
|
|
244
|
+
<>
|
|
245
|
+
{!searchBarItem && !isRoot && (
|
|
246
|
+
<NavbarSearch>
|
|
247
|
+
<SearchBar />
|
|
248
|
+
</NavbarSearch>
|
|
249
|
+
)}
|
|
250
|
+
<NavbarColorModeToggle className="colorModeToggle" />
|
|
251
|
+
{isBrowser && (
|
|
252
|
+
<div css={styles.themeSwitcher}>
|
|
253
|
+
<HighContrastModeToggle />
|
|
254
|
+
</div>
|
|
255
|
+
)}
|
|
256
|
+
<NavbarItems items={rightItems} />
|
|
257
|
+
</>
|
|
258
|
+
}
|
|
259
|
+
/>
|
|
260
|
+
</>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { type ComponentProps, JSX } from 'react';
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
import { css } from '@emotion/react';
|
|
12
|
+
import { useThemeConfig } from '@docusaurus/theme-common';
|
|
13
|
+
import {
|
|
14
|
+
useHideableNavbar,
|
|
15
|
+
useNavbarMobileSidebar,
|
|
16
|
+
} from '@docusaurus/theme-common/internal';
|
|
17
|
+
import { translate } from '@docusaurus/Translate';
|
|
18
|
+
import type { Props } from '@theme-original/Navbar/Layout';
|
|
19
|
+
import { useEuiMemoizedStyles, UseEuiTheme } from '@elastic/eui';
|
|
20
|
+
|
|
21
|
+
import NavbarMobileSidebar from '../MobileSidebar';
|
|
22
|
+
import { VersionSwitcherProps } from '../../../components/version_switcher';
|
|
23
|
+
|
|
24
|
+
const getStyles = ({ euiTheme }: UseEuiTheme) => {
|
|
25
|
+
return {
|
|
26
|
+
navbar: css`
|
|
27
|
+
--ifm-navbar-padding-horizontal: ${euiTheme.size.m};
|
|
28
|
+
--ifm-navbar-padding-vertical: ${euiTheme.size.s};
|
|
29
|
+
--ifm-navbar-item-padding-horizontal: 0;
|
|
30
|
+
--ifm-navbar-item-padding-vertical: 0;
|
|
31
|
+
|
|
32
|
+
--ifm-navbar-background-color: ${euiTheme.colors.textInverse};
|
|
33
|
+
|
|
34
|
+
flex-grow: 0;
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
|
|
37
|
+
&,
|
|
38
|
+
.navbar-sidebar__brand {
|
|
39
|
+
border-block-end: ${euiTheme.border.thin};
|
|
40
|
+
box-shadow: none;
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
navbarHideable: css`
|
|
44
|
+
transition: transform var(--ifm-transition-fast) ease;
|
|
45
|
+
`,
|
|
46
|
+
navbarHidden: css`
|
|
47
|
+
transform: translate3d(0, calc(-100% - 2px), 0);
|
|
48
|
+
`,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function NavbarBackdrop(props: ComponentProps<'div'>) {
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
role="presentation"
|
|
56
|
+
{...props}
|
|
57
|
+
className={clsx('navbar-sidebar__backdrop', props.className)}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default function NavbarLayout({
|
|
63
|
+
children,
|
|
64
|
+
versionSwitcherOptions,
|
|
65
|
+
}: Props & { versionSwitcherOptions?: VersionSwitcherProps }): JSX.Element {
|
|
66
|
+
const {
|
|
67
|
+
navbar: { hideOnScroll, style },
|
|
68
|
+
} = useThemeConfig();
|
|
69
|
+
const mobileSidebar = useNavbarMobileSidebar();
|
|
70
|
+
const { navbarRef, isNavbarVisible } = useHideableNavbar(hideOnScroll);
|
|
71
|
+
|
|
72
|
+
const styles = useEuiMemoizedStyles(getStyles);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<nav
|
|
76
|
+
ref={navbarRef}
|
|
77
|
+
aria-label={translate({
|
|
78
|
+
id: 'theme.NavBar.navAriaLabel',
|
|
79
|
+
message: 'Main',
|
|
80
|
+
description: 'The ARIA label for the main navigation',
|
|
81
|
+
})}
|
|
82
|
+
className={clsx('navbar', 'navbar--fixed-top', {
|
|
83
|
+
'navbar--dark': style === 'dark',
|
|
84
|
+
'navbar--primary': style === 'primary',
|
|
85
|
+
'navbar-sidebar--show': mobileSidebar.shown,
|
|
86
|
+
})}
|
|
87
|
+
css={[
|
|
88
|
+
styles.navbar,
|
|
89
|
+
hideOnScroll && [
|
|
90
|
+
styles.navbarHideable,
|
|
91
|
+
!isNavbarVisible && styles.navbarHidden,
|
|
92
|
+
],
|
|
93
|
+
]}
|
|
94
|
+
>
|
|
95
|
+
{children}
|
|
96
|
+
<NavbarBackdrop onClick={mobileSidebar.toggle} />
|
|
97
|
+
<NavbarMobileSidebar versionSwitcherOptions={versionSwitcherOptions} />
|
|
98
|
+
</nav>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { JSX } from 'react';
|
|
10
|
+
import { useNavbarMobileSidebar } from '@docusaurus/theme-common/internal';
|
|
11
|
+
import { translate } from '@docusaurus/Translate';
|
|
12
|
+
import NavbarColorModeToggle from '@theme-original/Navbar/ColorModeToggle';
|
|
13
|
+
import NavbarLogo from '@theme-original/Navbar/Logo';
|
|
14
|
+
import { EuiIcon, useEuiMemoizedStyles, UseEuiTheme } from '@elastic/eui';
|
|
15
|
+
import { css } from '@emotion/react';
|
|
16
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
VersionSwitcher,
|
|
20
|
+
VersionSwitcherProps,
|
|
21
|
+
} from '../../../../components/version_switcher';
|
|
22
|
+
import { HighContrastModeToggle } from '../../../../components/high_contrast_mode_toggle';
|
|
23
|
+
|
|
24
|
+
const getStyles = ({ euiTheme }: UseEuiTheme) => ({
|
|
25
|
+
sidebar: css`
|
|
26
|
+
gap: ${euiTheme.size.s};
|
|
27
|
+
|
|
28
|
+
> :first-child {
|
|
29
|
+
border-right: ${euiTheme.border.thin};
|
|
30
|
+
}
|
|
31
|
+
`,
|
|
32
|
+
close: css`
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
width: ${euiTheme.size.xl};
|
|
37
|
+
height: ${euiTheme.size.xl};
|
|
38
|
+
border-radius: ${euiTheme.border.radius.small};
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
background-color: var(--ifm-color-emphasis-200);
|
|
42
|
+
color: currentColor;
|
|
43
|
+
}
|
|
44
|
+
`,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
function CloseButton() {
|
|
48
|
+
const mobileSidebar = useNavbarMobileSidebar();
|
|
49
|
+
const styles = useEuiMemoizedStyles(getStyles);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<button
|
|
53
|
+
type="button"
|
|
54
|
+
aria-label={translate({
|
|
55
|
+
id: 'theme.docs.sidebar.closeSidebarButtonAriaLabel',
|
|
56
|
+
message: 'Close navigation bar',
|
|
57
|
+
description: 'The ARIA label for close button of mobile sidebar',
|
|
58
|
+
})}
|
|
59
|
+
className="clean-btn navbar-sidebar__close"
|
|
60
|
+
css={styles.close}
|
|
61
|
+
onClick={() => mobileSidebar.toggle()}
|
|
62
|
+
>
|
|
63
|
+
<EuiIcon type="cross" size="l" />
|
|
64
|
+
</button>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type Props = {
|
|
69
|
+
versionSwitcherOptions?: VersionSwitcherProps;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default function NavbarMobileSidebarHeader({
|
|
73
|
+
versionSwitcherOptions,
|
|
74
|
+
}: Props): JSX.Element {
|
|
75
|
+
const isBrowser = useIsBrowser();
|
|
76
|
+
const styles = useEuiMemoizedStyles(getStyles);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div className="navbar-sidebar__brand" css={styles.sidebar}>
|
|
80
|
+
<NavbarLogo />
|
|
81
|
+
{isBrowser && versionSwitcherOptions && (
|
|
82
|
+
<VersionSwitcher {...versionSwitcherOptions} />
|
|
83
|
+
)}
|
|
84
|
+
<NavbarColorModeToggle />
|
|
85
|
+
{isBrowser && <HighContrastModeToggle />}
|
|
86
|
+
<CloseButton />
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { JSX } from 'react';
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import Layout from '@theme-init/Navbar/MobileSidebar/Layout';
|
|
12
|
+
import type LayoutType from '@theme-init/Navbar/MobileSidebar/Layout';
|
|
13
|
+
import type { WrapperProps } from '@docusaurus/types';
|
|
14
|
+
|
|
15
|
+
type Props = WrapperProps<typeof LayoutType>;
|
|
16
|
+
|
|
17
|
+
const styles = {
|
|
18
|
+
mobileSidebar: css`
|
|
19
|
+
--ifm-navbar-sidebar-width: 100vw;
|
|
20
|
+
|
|
21
|
+
@media (min-width: 400px) {
|
|
22
|
+
--ifm-navbar-sidebar-width: 75vw;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (min-width: 600px) {
|
|
26
|
+
--ifm-navbar-sidebar-width: 50vw;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.navbar-sidebar__back {
|
|
30
|
+
font-size: var(--eui-font-size-s);
|
|
31
|
+
line-height: var(--eui-fline-height-xs);
|
|
32
|
+
padding-block: var(--eui-size-m);
|
|
33
|
+
padding-inline: var(--eui-size-s);
|
|
34
|
+
}
|
|
35
|
+
`,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default function LayoutWrapper(props: Props): JSX.Element {
|
|
39
|
+
return (
|
|
40
|
+
<div css={styles.mobileSidebar}>
|
|
41
|
+
<Layout {...props} />
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { type ReactNode } from 'react';
|
|
10
|
+
import {
|
|
11
|
+
useLockBodyScroll,
|
|
12
|
+
useNavbarMobileSidebar,
|
|
13
|
+
} from '@docusaurus/theme-common/internal';
|
|
14
|
+
import NavbarMobileSidebarLayout from '@theme-original/Navbar/MobileSidebar/Layout';
|
|
15
|
+
import NavbarMobileSidebarHeader from './Header';
|
|
16
|
+
import NavbarMobileSidebarPrimaryMenu from '@theme-original/Navbar/MobileSidebar/PrimaryMenu';
|
|
17
|
+
import NavbarMobileSidebarSecondaryMenu from '@theme-original/Navbar/MobileSidebar/SecondaryMenu';
|
|
18
|
+
|
|
19
|
+
import { VersionSwitcherProps } from '../../../components/version_switcher';
|
|
20
|
+
|
|
21
|
+
type Props = {
|
|
22
|
+
versionSwitcherOptions?: VersionSwitcherProps;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default function NavbarMobileSidebar({
|
|
26
|
+
versionSwitcherOptions,
|
|
27
|
+
}: Props): ReactNode {
|
|
28
|
+
const mobileSidebar = useNavbarMobileSidebar();
|
|
29
|
+
useLockBodyScroll(mobileSidebar.shown);
|
|
30
|
+
|
|
31
|
+
if (!mobileSidebar.shouldRender) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<NavbarMobileSidebarLayout
|
|
37
|
+
header={
|
|
38
|
+
<NavbarMobileSidebarHeader
|
|
39
|
+
versionSwitcherOptions={versionSwitcherOptions}
|
|
40
|
+
/>
|
|
41
|
+
}
|
|
42
|
+
primaryMenu={<NavbarMobileSidebarPrimaryMenu />}
|
|
43
|
+
secondaryMenu={<NavbarMobileSidebarSecondaryMenu />}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|