@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,115 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
import { EuiBasicTable, EuiMarkdownFormat, EuiTextColor, EuiFlexGroup, EuiCode, useEuiMemoizedStyles, EuiLink, EuiPanel, } from '@elastic/eui';
|
|
10
|
+
import { useCallback, useMemo } from 'react';
|
|
11
|
+
import { css } from '@emotion/react';
|
|
12
|
+
import Heading from '@theme/Heading';
|
|
13
|
+
import { PropTableExtendedTypes } from './extended_types';
|
|
14
|
+
const getPropId = (prop, componentName) => `${encodeURIComponent(componentName)}-prop-${prop.name}`;
|
|
15
|
+
const getPropTableStyles = ({ euiTheme }) => ({
|
|
16
|
+
propTable: css `
|
|
17
|
+
margin-block: ${euiTheme.size.xl};
|
|
18
|
+
`,
|
|
19
|
+
header: css `
|
|
20
|
+
// Increased specificity is needed here to override default
|
|
21
|
+
// content heading styles
|
|
22
|
+
&& h1,
|
|
23
|
+
&& h2,
|
|
24
|
+
&& h3,
|
|
25
|
+
&& h4,
|
|
26
|
+
&& h5,
|
|
27
|
+
&& h6 {
|
|
28
|
+
margin-block: 0;
|
|
29
|
+
}
|
|
30
|
+
`,
|
|
31
|
+
table: css `
|
|
32
|
+
vertical-align: top;
|
|
33
|
+
`,
|
|
34
|
+
propName: css `
|
|
35
|
+
font-family: ${euiTheme.font.familyCode};
|
|
36
|
+
font-weight: ${euiTheme.font.weight.semiBold};
|
|
37
|
+
`,
|
|
38
|
+
description: css `
|
|
39
|
+
p,
|
|
40
|
+
ul {
|
|
41
|
+
font-size: var(--eui-font-size-s);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
p {
|
|
45
|
+
margin-block-end: var(--eui-size-s);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
p:first-child {
|
|
49
|
+
margin-block-start: 0;
|
|
50
|
+
}
|
|
51
|
+
`,
|
|
52
|
+
required: css `
|
|
53
|
+
font-family: ${euiTheme.font.familyCode};
|
|
54
|
+
color: ${euiTheme.colors.textDanger};
|
|
55
|
+
`,
|
|
56
|
+
type: css `
|
|
57
|
+
font-weight: ${euiTheme.font.weight.semiBold};
|
|
58
|
+
`,
|
|
59
|
+
tableNameLink: css `
|
|
60
|
+
display: none;
|
|
61
|
+
margin-inline-start: ${euiTheme.size.xs};
|
|
62
|
+
`,
|
|
63
|
+
tableRow: css `
|
|
64
|
+
scroll-margin-block-start: calc(var(--ifm-navbar-height) + 0.5rem);
|
|
65
|
+
|
|
66
|
+
&:hover .propLink {
|
|
67
|
+
display: inline-block;
|
|
68
|
+
}
|
|
69
|
+
`,
|
|
70
|
+
tableCell: css `
|
|
71
|
+
vertical-align: text-top;
|
|
72
|
+
`,
|
|
73
|
+
});
|
|
74
|
+
export const PropTable = ({ definition, headingLevel = 'h3', showTitle = true, parseDescription, }) => {
|
|
75
|
+
const styles = useEuiMemoizedStyles(getPropTableStyles);
|
|
76
|
+
const tableItems = useMemo(() => Object.values(definition.props).sort((a, b) => +(b.isRequired ?? false) - +(a.isRequired ?? false)), [definition.props]);
|
|
77
|
+
const columns = useMemo(() => [
|
|
78
|
+
{
|
|
79
|
+
field: 'name',
|
|
80
|
+
name: 'Prop',
|
|
81
|
+
width: '150',
|
|
82
|
+
render(value, prop) {
|
|
83
|
+
return (_jsxs("span", { css: styles.propName, children: [value, _jsx(EuiLink, { href: `#${getPropId(prop, definition.displayName)}`, css: styles.tableNameLink, className: "propLink", "aria-label": `Direct link to the ${prop.name} prop`, title: `Direct link to the ${prop.name} prop`, children: "#" })] }));
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
field: 'description',
|
|
88
|
+
name: 'Description and type',
|
|
89
|
+
render(value, prop) {
|
|
90
|
+
const result = parseDescription ? parseDescription(value) : value;
|
|
91
|
+
return (_jsxs(EuiFlexGroup, { direction: "column", alignItems: "flexStart", gutterSize: "s", children: [result && (_jsx(EuiMarkdownFormat, { css: styles.description, children: result })), prop.type && (_jsxs("span", { css: styles.type, children: ["Type:", ' ', _jsx(EuiCode, { language: "ts", children: prop.type.raw || prop.type.name })] }))] }));
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
field: 'defaultValue',
|
|
96
|
+
name: 'Default value',
|
|
97
|
+
width: '120',
|
|
98
|
+
render(value, prop) {
|
|
99
|
+
if (prop.isRequired && !value?.trim().length) {
|
|
100
|
+
return _jsx(EuiTextColor, { css: styles.required, children: "Required" });
|
|
101
|
+
}
|
|
102
|
+
return value && _jsx(EuiCode, { children: value });
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
], []);
|
|
106
|
+
const rowProps = useCallback((item) => ({
|
|
107
|
+
id: getPropId(item, definition.displayName),
|
|
108
|
+
css: styles.tableRow,
|
|
109
|
+
}), [definition.displayName]);
|
|
110
|
+
const cellProps = useCallback((item) => ({
|
|
111
|
+
id: getPropId(item, definition.displayName),
|
|
112
|
+
css: styles.tableCell,
|
|
113
|
+
}), [definition.displayName]);
|
|
114
|
+
return (_jsxs(EuiFlexGroup, { "aria-label": `Component properties table for ${definition.displayName}`, gutterSize: "s", direction: "column", css: styles.propTable, children: [_jsxs("header", { css: styles.header, children: [showTitle && (_jsx(Heading, { as: headingLevel, id: definition.displayName, children: definition.displayName })), _jsx(PropTableExtendedTypes, { definition: definition })] }), _jsx(EuiPanel, { color: "plain", hasBorder: true, children: _jsx(EuiBasicTable, { css: styles.table, width: "100%", items: tableItems, columns: columns, rowProps: rowProps, cellProps: cellProps, compressed: true }) })] }));
|
|
115
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FunctionComponent, PropsWithChildren } from 'react';
|
|
2
|
+
import { EuiThemeColorMode } from '@elastic/eui';
|
|
3
|
+
import { type EUI_THEME } from '@elastic/eui-theme-common';
|
|
4
|
+
export declare const AVAILABLE_THEMES: EUI_THEME[];
|
|
5
|
+
export interface AppThemeContextData {
|
|
6
|
+
colorMode: EuiThemeColorMode;
|
|
7
|
+
highContrastMode: boolean | undefined;
|
|
8
|
+
theme: EUI_THEME;
|
|
9
|
+
changeColorMode: (colorMode: EuiThemeColorMode) => void;
|
|
10
|
+
changeHighContrastMode: (highContrastMode: boolean) => void;
|
|
11
|
+
changeTheme: (themeValue: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const cssGlobalCache: import("@emotion/cache").EmotionCache;
|
|
14
|
+
export declare const AppThemeContext: import("react").Context<AppThemeContextData>;
|
|
15
|
+
export declare const useAppTheme: () => AppThemeContextData;
|
|
16
|
+
export declare const AppThemeProvider: FunctionComponent<PropsWithChildren>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
import { createContext, useContext, useEffect, useState, } from 'react';
|
|
10
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
11
|
+
import createCache from '@emotion/cache';
|
|
12
|
+
import { CacheProvider } from '@emotion/react';
|
|
13
|
+
import { EuiProvider } from '@elastic/eui';
|
|
14
|
+
import { EuiThemeBorealis } from '@elastic/eui-theme-borealis';
|
|
15
|
+
import { EuiThemeOverrides } from './theme_overrides';
|
|
16
|
+
export const AVAILABLE_THEMES = [
|
|
17
|
+
{
|
|
18
|
+
text: 'Borealis',
|
|
19
|
+
value: EuiThemeBorealis.key,
|
|
20
|
+
provider: EuiThemeBorealis,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
const EUI_COLOR_MODES = ['light', 'dark'];
|
|
24
|
+
/**
|
|
25
|
+
* Get the initial color mode: localStorage | light
|
|
26
|
+
*/
|
|
27
|
+
const getInitialColorMode = () => {
|
|
28
|
+
const storedColorMode = localStorage.getItem('colorMode');
|
|
29
|
+
if (storedColorMode === 'light' || storedColorMode === 'dark') {
|
|
30
|
+
return storedColorMode;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return defaultState.colorMode;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const defaultState = {
|
|
37
|
+
colorMode: EUI_COLOR_MODES[0],
|
|
38
|
+
highContrastMode: undefined,
|
|
39
|
+
theme: AVAILABLE_THEMES[0],
|
|
40
|
+
changeColorMode: () => { },
|
|
41
|
+
changeHighContrastMode: () => { },
|
|
42
|
+
changeTheme: () => { },
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Creating a cache and passing it to EuiProvider ensures that injected
|
|
46
|
+
* Emotion style tags dev mode are in an expected order (global css before component css).
|
|
47
|
+
* This only applies for @emotion/react css styles, @emotion/css styles are separate.
|
|
48
|
+
*/
|
|
49
|
+
const cssCache = createCache({
|
|
50
|
+
key: 'website-css',
|
|
51
|
+
prepend: false,
|
|
52
|
+
});
|
|
53
|
+
export const cssGlobalCache = createCache({
|
|
54
|
+
key: 'website-css',
|
|
55
|
+
prepend: true,
|
|
56
|
+
});
|
|
57
|
+
export const AppThemeContext = createContext(defaultState);
|
|
58
|
+
export const useAppTheme = () => {
|
|
59
|
+
return useContext(AppThemeContext);
|
|
60
|
+
};
|
|
61
|
+
export const AppThemeProvider = ({ children, }) => {
|
|
62
|
+
const isBrowser = useIsBrowser();
|
|
63
|
+
const [colorMode, setColorMode] = useState(() => {
|
|
64
|
+
if (isBrowser)
|
|
65
|
+
return getInitialColorMode();
|
|
66
|
+
return defaultState.colorMode;
|
|
67
|
+
});
|
|
68
|
+
const [highContrastMode, setHighContrastMode] = useState(false);
|
|
69
|
+
const getHighContrastModeSetting = () => {
|
|
70
|
+
return localStorage?.getItem('highContrastMode')
|
|
71
|
+
? localStorage?.getItem('highContrastMode') === 'true'
|
|
72
|
+
: defaultState.highContrastMode;
|
|
73
|
+
};
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (isBrowser) {
|
|
76
|
+
setHighContrastMode(getHighContrastModeSetting());
|
|
77
|
+
}
|
|
78
|
+
}, [isBrowser]);
|
|
79
|
+
const [theme, setTheme] = useState(defaultState.theme);
|
|
80
|
+
const handleChangeTheme = (themeValue) => {
|
|
81
|
+
const matchedTheme = AVAILABLE_THEMES.find((t) => t.value === themeValue);
|
|
82
|
+
setTheme((currentTheme) => matchedTheme ?? currentTheme);
|
|
83
|
+
};
|
|
84
|
+
const handleChangeHighContrastMode = (highContrastMode) => {
|
|
85
|
+
localStorage.setItem('highContrastMode', highContrastMode.toString());
|
|
86
|
+
setHighContrastMode(highContrastMode);
|
|
87
|
+
};
|
|
88
|
+
const handleColorMode = (colorMode) => {
|
|
89
|
+
localStorage.setItem('colorMode', colorMode);
|
|
90
|
+
setColorMode(colorMode);
|
|
91
|
+
};
|
|
92
|
+
return (_jsx(AppThemeContext.Provider, { value: {
|
|
93
|
+
colorMode,
|
|
94
|
+
highContrastMode,
|
|
95
|
+
theme,
|
|
96
|
+
changeColorMode: handleColorMode,
|
|
97
|
+
changeHighContrastMode: handleChangeHighContrastMode,
|
|
98
|
+
changeTheme: handleChangeTheme,
|
|
99
|
+
}, children: _jsx(EuiProvider, { modify: EuiThemeOverrides, colorMode: colorMode, theme: theme.provider, highContrastMode: highContrastMode, cache: {
|
|
100
|
+
default: cssCache,
|
|
101
|
+
global: cssGlobalCache,
|
|
102
|
+
}, children: _jsx(CacheProvider, { value: cssCache, children: children }) }) }));
|
|
103
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
export const EuiThemeOverrides = {
|
|
9
|
+
font: {
|
|
10
|
+
lineHeightMultiplier: 1.75,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { EuiListGroupItem } from '@elastic/eui';
|
|
3
|
+
export type VersionSwitcherProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Aria label for the version switcher popover
|
|
6
|
+
*/
|
|
7
|
+
ariaLabel: string;
|
|
8
|
+
currentVersion: string;
|
|
9
|
+
/**
|
|
10
|
+
* Extra action to be displayed in the version switcher
|
|
11
|
+
*/
|
|
12
|
+
extraAction?: (version?: string) => ComponentProps<typeof EuiListGroupItem>['extraAction'];
|
|
13
|
+
/**
|
|
14
|
+
* URL to the previous version of the documentation
|
|
15
|
+
* E.g. https://eui.elastic.co
|
|
16
|
+
*/
|
|
17
|
+
previousVersionUrl?: string;
|
|
18
|
+
/**
|
|
19
|
+
* List of available versions to switch to
|
|
20
|
+
*/
|
|
21
|
+
versions: string[];
|
|
22
|
+
};
|
|
23
|
+
export declare const VersionSwitcher: ({ ariaLabel, currentVersion, extraAction, previousVersionUrl, versions, }: VersionSwitcherProps) => import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { FixedSizeList } from 'react-window';
|
|
12
|
+
import { EuiButtonEmpty, euiFocusRing, EuiListGroupItem, EuiPopover, useEuiMemoizedStyles, } from '@elastic/eui';
|
|
13
|
+
const getStyles = (euiThemeContext) => {
|
|
14
|
+
const { euiTheme } = euiThemeContext;
|
|
15
|
+
return {
|
|
16
|
+
button: css `
|
|
17
|
+
font-weight: ${euiTheme.font.weight.bold};
|
|
18
|
+
color: ${euiTheme.colors.primary};
|
|
19
|
+
`,
|
|
20
|
+
listItem: css `
|
|
21
|
+
.euiListGroupItem__button:focus-visible {
|
|
22
|
+
// overriding the global "outset" style to ensure the focus style is not cut off
|
|
23
|
+
${euiFocusRing(euiThemeContext, 'inset', {
|
|
24
|
+
color: euiTheme.colors.primary,
|
|
25
|
+
})};
|
|
26
|
+
}
|
|
27
|
+
`,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Addresses NVDA pronunciation issue
|
|
32
|
+
*/
|
|
33
|
+
const pronounceVersion = (version) => {
|
|
34
|
+
return `version ${version.replaceAll('.', ' point ')}`;
|
|
35
|
+
};
|
|
36
|
+
export const VersionSwitcher = ({ ariaLabel, currentVersion, extraAction, previousVersionUrl, versions, }) => {
|
|
37
|
+
const [isPopoverOpen, setPopoverOpen] = useState(false);
|
|
38
|
+
const styles = useEuiMemoizedStyles(getStyles);
|
|
39
|
+
if (!versions)
|
|
40
|
+
return null;
|
|
41
|
+
const button = (_jsxs(EuiButtonEmpty, { size: "s", color: "text", iconType: "arrowDown", iconSide: "right", css: styles.button, onClick: () => setPopoverOpen((isOpen) => !isOpen), "aria-label": `${pronounceVersion(currentVersion)}. Click to switch versions`, children: ["v", currentVersion] }));
|
|
42
|
+
return (_jsx(EuiPopover, { isOpen: isPopoverOpen, closePopover: () => setPopoverOpen(false), button: button, repositionOnScroll: true, panelPaddingSize: "xs", "aria-label": ariaLabel, children: _jsx(FixedSizeList, { className: "eui-yScroll", itemCount: versions.length, itemSize: 24, height: 200, width: 120, innerElementType: "ul", children: ({ index, style }) => {
|
|
43
|
+
const version = versions[index];
|
|
44
|
+
const isCurrentVersion = version === currentVersion;
|
|
45
|
+
const screenReaderVersion = pronounceVersion(version);
|
|
46
|
+
const url = isCurrentVersion
|
|
47
|
+
? '/'
|
|
48
|
+
: `${previousVersionUrl}/v${version}/`;
|
|
49
|
+
return (_jsx(EuiListGroupItem, { css: styles.listItem, style: style, size: "xs", label: `v${version}`, "aria-label": screenReaderVersion, href: url, isActive: isCurrentVersion, color: isCurrentVersion ? 'primary' : 'text', extraAction: extraAction?.(version) }));
|
|
50
|
+
} }) }));
|
|
51
|
+
};
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
export default function euiDocusaurusTheme() {
|
|
9
|
+
return {
|
|
10
|
+
name: 'eui-docusaurus-theme',
|
|
11
|
+
getThemePath() {
|
|
12
|
+
return '../lib/theme';
|
|
13
|
+
},
|
|
14
|
+
getTypeScriptThemePath() {
|
|
15
|
+
return '../src/theme';
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,CAAC,OAAO,UAAU,kBAAkB;IACxC,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,YAAY;YACV,OAAO,cAAc,CAAC;QACxB,CAAC;QACD,sBAAsB;YACpB,OAAO,cAAc,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { EuiCallOut } from '@elastic/eui';
|
|
11
|
+
const VARIANT_TO_PROPS_MAP = {
|
|
12
|
+
note: { iconType: 'paperClip', color: 'accent' },
|
|
13
|
+
tip: { iconType: 'faceHappy', color: 'success' },
|
|
14
|
+
info: { iconType: 'info', color: 'primary' },
|
|
15
|
+
accessibility: { iconType: 'accessibility', color: 'primary' },
|
|
16
|
+
warning: { iconType: 'alert', color: 'warning' },
|
|
17
|
+
danger: { iconType: 'error', color: 'danger' },
|
|
18
|
+
// Undocumented legacy admonition type aliases
|
|
19
|
+
secondary: {},
|
|
20
|
+
important: {},
|
|
21
|
+
success: {},
|
|
22
|
+
caution: {},
|
|
23
|
+
};
|
|
24
|
+
// MDXComponents/Paragraph wraps <p> in <EuiText>,
|
|
25
|
+
// this is a workaround to keep styles from <EuiText> in the admonition
|
|
26
|
+
const nestedParagraphStyleReset = css `
|
|
27
|
+
p.euiText {
|
|
28
|
+
font-size: inherit;
|
|
29
|
+
line-height: inherit;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const Callout = ({ title, type, children }) => {
|
|
33
|
+
const variantProps = VARIANT_TO_PROPS_MAP[type];
|
|
34
|
+
return (_jsx(EuiCallOut, { title: title, iconType: "info", color: "primary", ...variantProps, css: css `
|
|
35
|
+
margin-block: var(--eui-theme-content-vertical-spacing);
|
|
36
|
+
${nestedParagraphStyleReset}
|
|
37
|
+
`, children: children }));
|
|
38
|
+
};
|
|
39
|
+
const admonitionTypes = {
|
|
40
|
+
note: Callout,
|
|
41
|
+
tip: Callout,
|
|
42
|
+
info: Callout,
|
|
43
|
+
accessibility: Callout,
|
|
44
|
+
warning: Callout,
|
|
45
|
+
danger: Callout,
|
|
46
|
+
secondary: Callout,
|
|
47
|
+
important: Callout,
|
|
48
|
+
success: Callout,
|
|
49
|
+
caution: Callout,
|
|
50
|
+
};
|
|
51
|
+
export default admonitionTypes;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
import React, { isValidElement } from 'react';
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { EuiCodeBlock } from '@elastic/eui';
|
|
12
|
+
import { Demo } from '../../components/demo';
|
|
13
|
+
/**
|
|
14
|
+
* Best attempt to make the children a plain string so it is copyable. If there
|
|
15
|
+
* are react elements, we will not be able to copy the content, and it will
|
|
16
|
+
* return `children` as-is; otherwise, it concatenates the string children
|
|
17
|
+
* together.
|
|
18
|
+
*/
|
|
19
|
+
function maybeStringifyChildren(children) {
|
|
20
|
+
if (React.Children.toArray(children).some((el) => isValidElement(el))) {
|
|
21
|
+
return children;
|
|
22
|
+
}
|
|
23
|
+
// The children is now guaranteed to be one/more plain strings
|
|
24
|
+
return Array.isArray(children) ? children.join('') : children;
|
|
25
|
+
}
|
|
26
|
+
export default function CodeBlock({ children: rawChildren, metastring, className, ...props }) {
|
|
27
|
+
const children = maybeStringifyChildren(rawChildren);
|
|
28
|
+
const language = className?.replace('language-', '') || undefined;
|
|
29
|
+
if (metastring?.startsWith('interactive')) {
|
|
30
|
+
return _jsx(Demo, { ...props, children: children });
|
|
31
|
+
}
|
|
32
|
+
return (_jsx(EuiCodeBlock, { ...props, fontSize: "m", overflowHeight: 450, language: language, isCopyable: true, css: css `
|
|
33
|
+
word-break: break-word;
|
|
34
|
+
`, children: children }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import type ColorModeToggleType from '@theme-init/ColorModeToggle';
|
|
3
|
+
import type { WrapperProps } from '@docusaurus/types';
|
|
4
|
+
type WrappedProps = WrapperProps<typeof ColorModeToggleType>;
|
|
5
|
+
/**
|
|
6
|
+
* Additional wrapper to connect Docusaurus color mode with EUI theme
|
|
7
|
+
*/
|
|
8
|
+
declare function ColorModeToggle({ value, onChange, ...rest }: WrappedProps): JSX.Element;
|
|
9
|
+
declare const _default: React.MemoExoticComponent<typeof ColorModeToggle>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
import React, { useCallback, useContext, useEffect } from 'react';
|
|
10
|
+
import { translate } from '@docusaurus/Translate';
|
|
11
|
+
import { NavbarItem } from '../../components/navbar_item';
|
|
12
|
+
import { AppThemeContext } from '../../components/theme_context';
|
|
13
|
+
/**
|
|
14
|
+
* Additional wrapper to connect Docusaurus color mode with EUI theme
|
|
15
|
+
*/
|
|
16
|
+
function ColorModeToggle({ value, onChange, ...rest }) {
|
|
17
|
+
const { colorMode, changeColorMode } = useContext(AppThemeContext);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
changeColorMode(value);
|
|
20
|
+
}, [value, colorMode, changeColorMode]);
|
|
21
|
+
const handleOnChange = (colorMode) => {
|
|
22
|
+
changeColorMode(colorMode);
|
|
23
|
+
onChange?.(colorMode);
|
|
24
|
+
};
|
|
25
|
+
return (_jsx(OriginalColorModeToggle, { value: colorMode, onChange: handleOnChange, ...rest }));
|
|
26
|
+
}
|
|
27
|
+
function OriginalColorModeToggle({ className, value, onChange, }) {
|
|
28
|
+
const isDarkMode = value === 'dark';
|
|
29
|
+
const title = translate({
|
|
30
|
+
message: 'Switch between dark and light mode (currently {mode})',
|
|
31
|
+
id: 'theme.colorToggle.ariaLabel',
|
|
32
|
+
description: 'The ARIA label for the navbar color mode toggle',
|
|
33
|
+
}, {
|
|
34
|
+
mode: value === 'dark'
|
|
35
|
+
? translate({
|
|
36
|
+
message: 'dark mode',
|
|
37
|
+
id: 'theme.colorToggle.ariaLabel.mode.dark',
|
|
38
|
+
description: 'The name for the dark color mode',
|
|
39
|
+
})
|
|
40
|
+
: translate({
|
|
41
|
+
message: 'light mode',
|
|
42
|
+
id: 'theme.colorToggle.ariaLabel.mode.light',
|
|
43
|
+
description: 'The name for the light color mode',
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
const handleOnChange = useCallback(() => {
|
|
47
|
+
onChange(value === 'dark' ? 'light' : 'dark');
|
|
48
|
+
}, [value, onChange]);
|
|
49
|
+
return (_jsx(NavbarItem, { className: className, title: title, icon: isDarkMode ? 'sun' : 'moon', isMenuItem: false, onClick: handleOnChange }));
|
|
50
|
+
}
|
|
51
|
+
export default React.memo(ColorModeToggle);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { DemoSourceMeta } from '../../components/demo/demo';
|
|
3
|
+
export type ActionComponentProps = {
|
|
4
|
+
activeSource: DemoSourceMeta | null;
|
|
5
|
+
sources: DemoSourceMeta[];
|
|
6
|
+
};
|
|
7
|
+
export type ActionComponent = ComponentType<ActionComponentProps>;
|
|
8
|
+
export declare const extraActions: ActionComponent[];
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
export const extraActions = [];
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
* A custom client-side require() alternative to inform users it's not available
|
|
10
|
+
* in our demo environment
|
|
11
|
+
*/
|
|
12
|
+
const clientSideRequire = () => {
|
|
13
|
+
throw new Error('require() is not accessible in the interactive demo environment! All EUI and React exports are available in the global scope for you to use without the need to import them.');
|
|
14
|
+
};
|
|
15
|
+
export const demoDefaultScope = {
|
|
16
|
+
require: clientSideRequire,
|
|
17
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import Link from '@docusaurus/Link';
|
|
3
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
4
|
+
import { translate } from '@docusaurus/Translate';
|
|
5
|
+
import { EuiIcon, useEuiMemoizedStyles } from '@elastic/eui';
|
|
6
|
+
import { getItemStyles } from '../item.styles';
|
|
7
|
+
export default function HomeBreadcrumbItem() {
|
|
8
|
+
const homeHref = useBaseUrl('/');
|
|
9
|
+
const styles = useEuiMemoizedStyles(getItemStyles);
|
|
10
|
+
return (_jsxs("li", { className: "breadcrumbs__item", css: styles.item, children: [_jsx(Link, { "aria-label": translate({
|
|
11
|
+
id: 'theme.docs.breadcrumbs.home',
|
|
12
|
+
message: 'Home page',
|
|
13
|
+
description: 'The ARIA label for the home page in the breadcrumbs',
|
|
14
|
+
}), className: "breadcrumbs__link", href: homeHref, children: "EUI" }), _jsx(EuiIcon, { type: "arrowRight", size: "s", css: styles.icon })] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
import { css } from '@emotion/react';
|
|
9
|
+
export const getItemStyles = ({ euiTheme }) => ({
|
|
10
|
+
item: css `
|
|
11
|
+
--ifm-breadcrumb-item-background: transparent;
|
|
12
|
+
--ifm-breadcrumb-item-background-active: transparent;
|
|
13
|
+
|
|
14
|
+
// overwrite global styles
|
|
15
|
+
&.breadcrumbs__item:not(:last-child):after {
|
|
16
|
+
content: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.breadcrumbs__link {
|
|
20
|
+
padding: 0 ${euiTheme.size.m};
|
|
21
|
+
font-size: var(--eui-font-size-xs);
|
|
22
|
+
line-height: var(--eui-line-height-m);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
a.breadcrumbs__link {
|
|
26
|
+
color: ${euiTheme.colors.link};
|
|
27
|
+
font-weight: ${euiTheme.font.weight.bold};
|
|
28
|
+
text-decoration: underline;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.breadcrumbs__item--active .breadcrumbs__link {
|
|
32
|
+
color: ${euiTheme.colors.text};
|
|
33
|
+
}
|
|
34
|
+
`,
|
|
35
|
+
icon: css `
|
|
36
|
+
block-size: ${euiTheme.size.s};
|
|
37
|
+
inline-size: ${euiTheme.size.s};
|
|
38
|
+
fill: ${euiTheme.colors.text};
|
|
39
|
+
`,
|
|
40
|
+
});
|