@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
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Source code in this repository is covered by (i) a dual license under the Server
|
|
2
|
+
Side Public License, v 1 and the Elastic License 2.0 or (ii) an Apache License
|
|
3
|
+
2.0 compatible license or (iii) solely under the Elastic License 2.0, in each
|
|
4
|
+
case, as noted in the applicable header. The default throughout the repository
|
|
5
|
+
is a dual license under the Server Side Public License, v 1 and the Elastic
|
|
6
|
+
License 2.0, unless the header specifies another license.
|
package/README.md
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# `@elastic/eui-docusaurus-theme`
|
|
2
|
+
|
|
3
|
+
EUI custom [Docusaurus](https://docusaurus.io/) theme made for the EUI [documentation website](https://eui.elastic.co).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
The EUI theme uses the [Swizzling](https://docusaurus.io/docs/swizzling/) technique to swap the theme component with
|
|
8
|
+
custom implementation that includes EUI components and tokens.
|
|
9
|
+
|
|
10
|
+
### Prerequisites
|
|
11
|
+
|
|
12
|
+
Before you get started with installing the preset, update your Docusaurus setup to be compatible
|
|
13
|
+
with `@elastic/eui-docusaurus-theme`:
|
|
14
|
+
|
|
15
|
+
1. Install required packages
|
|
16
|
+
|
|
17
|
+
```shell
|
|
18
|
+
yarn add @emotion/react @emotion/css @elastic/charts
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Configure TypeScript
|
|
22
|
+
|
|
23
|
+
You need to add `jsxImportSource` and `moduleResolution` to your project's `tsconfig.json`:
|
|
24
|
+
|
|
25
|
+
```diff
|
|
26
|
+
{
|
|
27
|
+
// This file is not used in compilation. It is here just for a nice editor experience.
|
|
28
|
+
"extends": "@docusaurus/tsconfig",
|
|
29
|
+
"compilerOptions": {
|
|
30
|
+
"baseUrl": ".",
|
|
31
|
+
+ "jsxImportSource": "@emotion/react",
|
|
32
|
+
+ "moduleResolution": "nodenext"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
3. Configure Babel
|
|
38
|
+
|
|
39
|
+
Add `@babel/preset-react` to allow Emotion to handle `importSource`.
|
|
40
|
+
|
|
41
|
+
```diff
|
|
42
|
+
module.exports = {
|
|
43
|
+
presets: [
|
|
44
|
+
require.resolve('@docusaurus/core/lib/babel/preset'),
|
|
45
|
+
+ [
|
|
46
|
+
+ '@babel/preset-react',
|
|
47
|
+
+ { runtime: 'automatic', importSource: '@emotion/react' },
|
|
48
|
+
+ ],
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Installing the preset (recommended)
|
|
54
|
+
|
|
55
|
+
```shell
|
|
56
|
+
# npm
|
|
57
|
+
npm install @elastic/eui-docusaurus-preset
|
|
58
|
+
|
|
59
|
+
# pnpm
|
|
60
|
+
pnpm add @elastic/eui-docusaurus-preset
|
|
61
|
+
|
|
62
|
+
# Yarn
|
|
63
|
+
yarn add @elastic/eui-docusaurus-preset
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
and in your `docusaurus.config.ts` file, add:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
const config: Config = {
|
|
70
|
+
// ...
|
|
71
|
+
presets: [
|
|
72
|
+
require.resolve('@elastic/eui-docusaurus-preset'),
|
|
73
|
+
// ...
|
|
74
|
+
],
|
|
75
|
+
// ...
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Theme only
|
|
80
|
+
|
|
81
|
+
Docusaurus uses Infima, its default CSS framework, to style the classic theme (`@docusaurus/theme-classic`). The EUI Docusaurus theme is based on the classic theme, but Infima's global styles often override or conflict with EUI's design system, leading to inconsistent appearance. The `ignore-styles-plugin` disables Infima's styles, ensuring the EUI theme displays correctly. For this reason, we highly recommend using the preset rather than the standalone theme.
|
|
82
|
+
|
|
83
|
+
If you prefer to use only the theme, install the package:
|
|
84
|
+
|
|
85
|
+
```shell
|
|
86
|
+
# npm
|
|
87
|
+
npm install @elastic/eui-docusaurus-theme
|
|
88
|
+
|
|
89
|
+
# pnpm
|
|
90
|
+
pnpm add @elastic/eui-docusaurus-theme
|
|
91
|
+
|
|
92
|
+
# Yarn
|
|
93
|
+
yarn add @elastic/eui-docusaurus-theme
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
and in your `docusaurus.config.ts` file, add:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
const config: Config = {
|
|
100
|
+
// ...
|
|
101
|
+
themes: [
|
|
102
|
+
require.resolve('@docusaurus/theme-classic'), // Required for compatibility
|
|
103
|
+
require.resolve('@elastic/eui-docusaurus-theme'),
|
|
104
|
+
],
|
|
105
|
+
// ...
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Features
|
|
110
|
+
|
|
111
|
+
### Right-side nav links
|
|
112
|
+
|
|
113
|
+
To achieve similar right-side nav links as on the [EUI docs](https://eui.elastic.co/), you have to use the `component` property that has a value of `"changelog" | "github" | "figma"`.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
themeConfig: {
|
|
117
|
+
// ...
|
|
118
|
+
navbar: {
|
|
119
|
+
// ...
|
|
120
|
+
items: [
|
|
121
|
+
// ...
|
|
122
|
+
// Use component: "changelog" | "github" | "figma"
|
|
123
|
+
{
|
|
124
|
+
href: "https://github.com/elastic/eui/tree/main/packages/eui/changelogs",
|
|
125
|
+
label: "EUI Changelog",
|
|
126
|
+
position: "right",
|
|
127
|
+
component: "changelog",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
href: "https://github.com/elastic/eui",
|
|
131
|
+
label: "GitHub",
|
|
132
|
+
position: "right",
|
|
133
|
+
component: "github",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
href: "https://www.figma.com/community/file/964536385682658129",
|
|
137
|
+
label: "Figma",
|
|
138
|
+
position: "right",
|
|
139
|
+
component: "figma",
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
// ...
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Local development
|
|
148
|
+
|
|
149
|
+
### Prerequisites
|
|
150
|
+
|
|
151
|
+
This package requires:
|
|
152
|
+
|
|
153
|
+
- Node.js (check current version in [.nvmrc](../../.nvmrc)),
|
|
154
|
+
- [corepack](https://nodejs.org/api/corepack.html).
|
|
155
|
+
|
|
156
|
+
### Installing dependencies
|
|
157
|
+
|
|
158
|
+
Install dependencies by running:
|
|
159
|
+
|
|
160
|
+
```shell
|
|
161
|
+
yarn
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Building the package
|
|
165
|
+
|
|
166
|
+
```shell
|
|
167
|
+
yarn build
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Building in watch mode
|
|
171
|
+
|
|
172
|
+
Run the following command to build this package whenever a file is edited:
|
|
173
|
+
|
|
174
|
+
```shell
|
|
175
|
+
yarn start
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
:::warning
|
|
179
|
+
Please note that this package is configured to do incremental builds and sometimes `tsc` may not update the `lib` directory with your latest changes if you rename or delete files.
|
|
180
|
+
|
|
181
|
+
If that's the case please run `yarn build`.
|
|
182
|
+
:::
|
|
183
|
+
|
|
184
|
+
### Test with EUI documentation website
|
|
185
|
+
|
|
186
|
+
Run the following command from the root of the mono-repository to run the website:
|
|
187
|
+
|
|
188
|
+
```shell
|
|
189
|
+
yarn workspace @elastic/eui-website start
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
You can pair it with the watch mode when modifying the Docusaurus theme.
|
|
193
|
+
|
|
194
|
+
### Test locally with your own Docusaurus project
|
|
195
|
+
|
|
196
|
+
You should have a Docusaurus project running. If you want to test EUI theme with a fresh project, you should create a [Docusaurus scaffolded project website](https://docusaurus.io/docs/installation).
|
|
197
|
+
|
|
198
|
+
Run the following command to create a Docusaurus project:
|
|
199
|
+
|
|
200
|
+
```shell
|
|
201
|
+
npx create-docusaurus@latest my-website classic --typescript
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Install `yalc` globally if you haven't already:
|
|
205
|
+
|
|
206
|
+
```shell
|
|
207
|
+
npm install -g yalc
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
In the root of the mono-repository, run the following commands to build and publish the preset locally:
|
|
211
|
+
|
|
212
|
+
```shell
|
|
213
|
+
yarn workspace @elastic/eui-docusaurus-preset build
|
|
214
|
+
|
|
215
|
+
# Publish the preset locally
|
|
216
|
+
cd packages/docusaurus-preset
|
|
217
|
+
yalc publish
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
In your project, install EUI dependencies:
|
|
221
|
+
|
|
222
|
+
```shell
|
|
223
|
+
# npm
|
|
224
|
+
npm install @elastic/eui @elastic/charts @emotion/react @emotion/css moment
|
|
225
|
+
|
|
226
|
+
# pnpm
|
|
227
|
+
pnpm add @elastic/eui @elastic/charts @emotion/react @emotion/css moment
|
|
228
|
+
|
|
229
|
+
# Yarn
|
|
230
|
+
yarn add @elastic/eui @elastic/charts @emotion/react @emotion/css moment
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
and add the locally published packages:
|
|
234
|
+
|
|
235
|
+
```shell
|
|
236
|
+
yalc add @elastic/eui-docusaurus-preset
|
|
237
|
+
|
|
238
|
+
# npm
|
|
239
|
+
npm install
|
|
240
|
+
|
|
241
|
+
# pnpm
|
|
242
|
+
pnpm install
|
|
243
|
+
|
|
244
|
+
# Yarn
|
|
245
|
+
yarn
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Configure Docusaurus to use the locally built preset as outlined in the [Usage section](#usage).
|
|
249
|
+
|
|
250
|
+
#### Making changes
|
|
251
|
+
|
|
252
|
+
When you make changes to the theme, rebuild and republish the packages:
|
|
253
|
+
|
|
254
|
+
```shell
|
|
255
|
+
# From the mono-repository root
|
|
256
|
+
yarn workspace @elastic/eui-docusaurus-theme build
|
|
257
|
+
yarn workspace @elastic/eui-docusaurus-preset build
|
|
258
|
+
|
|
259
|
+
cd packages/docusaurus-preset
|
|
260
|
+
yalc publish --push
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
The `--push` flag automatically updates all projects using these packages.
|
|
264
|
+
|
|
265
|
+
Restart your Docusaurus development server:
|
|
266
|
+
|
|
267
|
+
```shell
|
|
268
|
+
# npm
|
|
269
|
+
npm run start
|
|
270
|
+
|
|
271
|
+
# pnpm
|
|
272
|
+
pnpm start
|
|
273
|
+
|
|
274
|
+
# Yarn
|
|
275
|
+
yarn start
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
When you're done testing, remove the locally published packages from your project:
|
|
279
|
+
|
|
280
|
+
```shell
|
|
281
|
+
# In your project
|
|
282
|
+
yalc remove @elastic/eui-docusaurus-preset
|
|
283
|
+
|
|
284
|
+
# npm
|
|
285
|
+
npm install
|
|
286
|
+
|
|
287
|
+
# pnpm
|
|
288
|
+
pnpm install
|
|
289
|
+
|
|
290
|
+
# Yarn
|
|
291
|
+
yarn
|
|
292
|
+
```
|