@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,42 @@
|
|
|
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 { Children } from 'react';
|
|
9
|
+
import { isElement } from 'react-is';
|
|
10
|
+
/**
|
|
11
|
+
* Get source string from given children.
|
|
12
|
+
*/
|
|
13
|
+
export const getSourceFromChildren = (children) => {
|
|
14
|
+
// Direct (non-MDX) usage almost always passes a string
|
|
15
|
+
if (typeof children === 'string') {
|
|
16
|
+
return children;
|
|
17
|
+
}
|
|
18
|
+
if (Children.count(children) !== 1 || !isElement(children)) {
|
|
19
|
+
// This should never happen
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const element = children;
|
|
23
|
+
const functionName = element.type.name;
|
|
24
|
+
// The code block content could render in either MDXPre (development builds)
|
|
25
|
+
// or pre (optimized production builds)
|
|
26
|
+
if (typeof element.type !== 'function' ||
|
|
27
|
+
(functionName !== 'MDXPre' && functionName !== 'pre')) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if (!isElement(element.props.children)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const codeElement = element.props.children;
|
|
34
|
+
if (!codeElement || !codeElement.props.children) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const code = codeElement.props.children;
|
|
38
|
+
if (typeof code !== 'string') {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return code;
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DemoSource, type DemoSourceProps } from './source';
|
|
@@ -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 { DemoSource } from './source';
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { useEffect } from 'react';
|
|
9
|
+
import { useDemoContext } from '../context';
|
|
10
|
+
import { getSourceFromChildren } from './get_source_from_children';
|
|
11
|
+
export const DemoSource = ({ children, filename, isActive = false }) => {
|
|
12
|
+
const demoContext = useDemoContext();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const source = getSourceFromChildren(children);
|
|
15
|
+
if (source) {
|
|
16
|
+
const transformedSource = source.replace(/\n$/, '');
|
|
17
|
+
demoContext.addSource({
|
|
18
|
+
code: transformedSource,
|
|
19
|
+
isActive,
|
|
20
|
+
filename,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}, [children]);
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IframeHTMLAttributes } from 'react';
|
|
2
|
+
export interface FigmaEmbedProps extends IframeHTMLAttributes<HTMLIFrameElement> {
|
|
3
|
+
url: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const FigmaEmbed: ({ url, ...rest }: FigmaEmbedProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { useMemo } from 'react';
|
|
10
|
+
import { useEuiMemoizedStyles } from '@elastic/eui';
|
|
11
|
+
import { css } from '@emotion/react';
|
|
12
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
13
|
+
const getFigmaEmbedStyles = (euiTheme) => ({
|
|
14
|
+
wrapper: css `
|
|
15
|
+
border: 1px solid ${euiTheme.euiTheme.colors.lightShade};
|
|
16
|
+
border-radius: ${euiTheme.euiTheme.size.s};
|
|
17
|
+
margin: ${euiTheme.euiTheme.size.xl} 0;
|
|
18
|
+
`,
|
|
19
|
+
iframe: css `
|
|
20
|
+
border-radius: ${euiTheme.euiTheme.size.s};
|
|
21
|
+
display: block;
|
|
22
|
+
`,
|
|
23
|
+
});
|
|
24
|
+
export const FigmaEmbed = ({ url, ...rest }) => {
|
|
25
|
+
const baseUrl = useBaseUrl('/', { absolute: true });
|
|
26
|
+
const styles = useEuiMemoizedStyles(getFigmaEmbedStyles);
|
|
27
|
+
const src = useMemo(() => {
|
|
28
|
+
const params = new URLSearchParams({
|
|
29
|
+
embed_host: 'eui.elastic.co',
|
|
30
|
+
embed_origin: baseUrl,
|
|
31
|
+
url,
|
|
32
|
+
});
|
|
33
|
+
return `https://www.figma.com/embed?${params.toString()}`;
|
|
34
|
+
}, [url, baseUrl]);
|
|
35
|
+
return (_jsx("div", { css: styles.wrapper, children: _jsx("iframe", { ...rest, css: styles.iframe, height: "450", width: "100%", src: src, allowFullScreen: true }) }));
|
|
36
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { EuiPanelProps } from '@elastic/eui';
|
|
3
|
+
import { GuidelineType } from './types';
|
|
4
|
+
export interface GuidelineProps extends PropsWithChildren {
|
|
5
|
+
type: GuidelineType;
|
|
6
|
+
text: string | ReactNode;
|
|
7
|
+
panelPadding?: EuiPanelProps['paddingSize'];
|
|
8
|
+
panelStyle?: EuiPanelProps['style'];
|
|
9
|
+
}
|
|
10
|
+
export declare const Guideline: ({ children, text, type, panelPadding, panelStyle, }: GuidelineProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { useMemo } from 'react';
|
|
10
|
+
import { EuiFlexItem, EuiSplitPanel, useEuiMemoizedStyles, highContrastModeStyles, } from '@elastic/eui';
|
|
11
|
+
import { css } from '@emotion/react';
|
|
12
|
+
import { GuidelineText } from './guideline_text';
|
|
13
|
+
const getGuidelineStyles = (euiThemeContext) => {
|
|
14
|
+
const { euiTheme } = euiThemeContext;
|
|
15
|
+
return {
|
|
16
|
+
root: css `
|
|
17
|
+
margin-block: var(--eui-theme-content-vertical-spacing);
|
|
18
|
+
`,
|
|
19
|
+
wrapper: css `
|
|
20
|
+
border-block-end: ${euiTheme.border.thick};
|
|
21
|
+
border-start-start-radius: ${euiTheme.border.radius.medium};
|
|
22
|
+
border-start-end-radius: ${euiTheme.border.radius.medium};
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
|
|
25
|
+
${highContrastModeStyles(euiThemeContext, {
|
|
26
|
+
// Code block is used within a panel which already has a border - skip doubling up
|
|
27
|
+
preferred: `
|
|
28
|
+
& > .euiCodeBlock {
|
|
29
|
+
border: none;
|
|
30
|
+
}
|
|
31
|
+
`,
|
|
32
|
+
})}
|
|
33
|
+
`,
|
|
34
|
+
wrapperDo: css `
|
|
35
|
+
border-color: ${euiTheme.colors.success};
|
|
36
|
+
`,
|
|
37
|
+
wrapperDont: css `
|
|
38
|
+
border-color: ${euiTheme.colors.danger};
|
|
39
|
+
`,
|
|
40
|
+
textWrapper: css `
|
|
41
|
+
margin-block-start: var(--eui-size-xs);
|
|
42
|
+
`,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export const Guideline = ({ children, text, type = 'default', panelPadding = 'm', panelStyle, }) => {
|
|
46
|
+
const styles = useEuiMemoizedStyles(getGuidelineStyles);
|
|
47
|
+
const panelColor = useMemo(() => {
|
|
48
|
+
if (type === 'do') {
|
|
49
|
+
return 'success';
|
|
50
|
+
}
|
|
51
|
+
if (type === 'dont') {
|
|
52
|
+
return 'danger';
|
|
53
|
+
}
|
|
54
|
+
return 'subdued';
|
|
55
|
+
}, [type]);
|
|
56
|
+
const textElement = useMemo(() => {
|
|
57
|
+
if (typeof text === 'string') {
|
|
58
|
+
return _jsx(GuidelineText, { type: type, children: text });
|
|
59
|
+
}
|
|
60
|
+
return text;
|
|
61
|
+
}, [text]);
|
|
62
|
+
const wrapperStyles = [
|
|
63
|
+
styles.wrapper,
|
|
64
|
+
type === 'do' && styles.wrapperDo,
|
|
65
|
+
type === 'dont' && styles.wrapperDont,
|
|
66
|
+
];
|
|
67
|
+
return (_jsx(EuiFlexItem, { css: styles.root, style: { flexBasis: 300 }, children: _jsx(EuiSplitPanel.Outer, { color: "transparent", hasBorder: false, hasShadow: false, children: _jsxs("figure", { children: [_jsx(EuiSplitPanel.Inner, { css: wrapperStyles, color: panelColor, paddingSize: panelPadding, style: panelStyle, children: children }), _jsx(EuiSplitPanel.Inner, { paddingSize: "none", css: styles.textWrapper, children: textElement })] }) }) }));
|
|
68
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { GuidelineType } from './types';
|
|
3
|
+
export interface GuidelineTextProps extends PropsWithChildren {
|
|
4
|
+
type: GuidelineType;
|
|
5
|
+
}
|
|
6
|
+
export declare const GuidelineText: ({ type, children }: GuidelineTextProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, 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 { useMemo } from 'react';
|
|
10
|
+
import { EuiText } from '@elastic/eui';
|
|
11
|
+
export const GuidelineText = ({ type, children }) => {
|
|
12
|
+
const textPrefix = useMemo(() => {
|
|
13
|
+
if (type === 'default') {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx("strong", { children: type === 'do' ? 'Do:' : `Don't:` }), "\u00A0"] }));
|
|
17
|
+
}, [type]);
|
|
18
|
+
const textColor = useMemo(() => {
|
|
19
|
+
if (type === 'do') {
|
|
20
|
+
return 'success';
|
|
21
|
+
}
|
|
22
|
+
if (type === 'dont') {
|
|
23
|
+
return 'danger';
|
|
24
|
+
}
|
|
25
|
+
return 'text';
|
|
26
|
+
}, [type]);
|
|
27
|
+
return (_jsx(EuiText, { size: "s", color: textColor, children: _jsxs("p", { children: [textPrefix, children] }) }));
|
|
28
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
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 { Guideline } from './guideline';
|
|
9
|
+
export { GuidelineText } from './guideline_text';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type GuidelineType = 'do' | 'dont' | 'default';
|
|
@@ -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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HighContrastModeToggle: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { useEuiTheme } from '@elastic/eui';
|
|
4
|
+
import { NavbarItem } from '../navbar_item';
|
|
5
|
+
import { AppThemeContext } from '../theme_context';
|
|
6
|
+
export const HighContrastModeToggle = () => {
|
|
7
|
+
const euiThemeContext = useEuiTheme();
|
|
8
|
+
const appContext = useContext(AppThemeContext);
|
|
9
|
+
const { changeHighContrastMode } = appContext;
|
|
10
|
+
const isForcedContrastMode = euiThemeContext.highContrastMode === 'forced';
|
|
11
|
+
const _highContrastMode = appContext.highContrastMode && !isForcedContrastMode
|
|
12
|
+
? appContext.highContrastMode
|
|
13
|
+
: euiThemeContext.highContrastMode;
|
|
14
|
+
return (_jsx(NavbarItem, { title: 'Toggle high contrast mode', icon: "contrast", isMenuItem: false, isSelected: !!_highContrastMode, onClick: () => changeHighContrastMode(!_highContrastMode) }));
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Icon: import("react").ForwardRefExoticComponent<Omit<import("@elastic/eui").EuiIconProps, "stylesMemoizer"> & import("react").RefAttributes<Omit<import("@elastic/eui").EuiIconProps, "stylesMemoizer">>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
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 { EuiIcon } from '@elastic/eui';
|
|
9
|
+
export const Icon = EuiIcon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AppThemeContext, useAppTheme } from './theme_context';
|
|
2
|
+
export { Badge } from './badge';
|
|
3
|
+
export { FigmaEmbed } from './figma_embed';
|
|
4
|
+
export { Guideline, GuidelineText } from './guideline';
|
|
5
|
+
export { Icon } from './icon';
|
|
6
|
+
export { PropTable } from './prop_table';
|
|
7
|
+
export { createDemo, Demo, DemoSource, type DemoProps } from './demo';
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { AppThemeContext, useAppTheme } from './theme_context';
|
|
9
|
+
export { Badge } from './badge';
|
|
10
|
+
export { FigmaEmbed } from './figma_embed';
|
|
11
|
+
export { Guideline, GuidelineText } from './guideline';
|
|
12
|
+
export { Icon } from './icon';
|
|
13
|
+
export { PropTable } from './prop_table';
|
|
14
|
+
export { createDemo, Demo, DemoSource } from './demo';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CommonProps, ExclusiveUnion, IconType, PropsForAnchor, PropsForButton, UseEuiTheme } from '@elastic/eui';
|
|
2
|
+
type SharedProps = {
|
|
3
|
+
icon: IconType;
|
|
4
|
+
showLabel?: boolean;
|
|
5
|
+
isMenuItem?: boolean;
|
|
6
|
+
isSelected?: boolean;
|
|
7
|
+
} & CommonProps;
|
|
8
|
+
type Props = ExclusiveUnion<PropsForAnchor<SharedProps>, PropsForButton<SharedProps>>;
|
|
9
|
+
export declare const getStyles: ({ euiTheme }: UseEuiTheme) => {
|
|
10
|
+
item: import("@emotion/react").SerializedStyles;
|
|
11
|
+
navItem: import("@emotion/react").SerializedStyles;
|
|
12
|
+
menuItem: import("@emotion/react").SerializedStyles;
|
|
13
|
+
darkMode: import("@emotion/react").SerializedStyles;
|
|
14
|
+
disabled: import("@emotion/react").SerializedStyles;
|
|
15
|
+
selected: import("@emotion/react").SerializedStyles;
|
|
16
|
+
title: import("@emotion/react").SerializedStyles;
|
|
17
|
+
};
|
|
18
|
+
export declare const NavbarItem: (props: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, 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 { useContext } from 'react';
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
12
|
+
import { EuiIcon, useEuiMemoizedStyles, } from '@elastic/eui';
|
|
13
|
+
import { AppThemeContext } from '../theme_context';
|
|
14
|
+
// converted from css modules to Emotion
|
|
15
|
+
export const getStyles = ({ euiTheme }) => ({
|
|
16
|
+
item: css `
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
|
|
21
|
+
-webkit-tap-highlight-color: transparent;
|
|
22
|
+
transition: background var(--ifm-transition-fast);
|
|
23
|
+
|
|
24
|
+
&:hover {
|
|
25
|
+
background-color: ${euiTheme.components.buttons.backgroundTextHover};
|
|
26
|
+
color: currentColor;
|
|
27
|
+
}
|
|
28
|
+
`,
|
|
29
|
+
navItem: css `
|
|
30
|
+
justify-content: center;
|
|
31
|
+
width: ${euiTheme.size.xl};
|
|
32
|
+
height: ${euiTheme.size.xl};
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
`,
|
|
35
|
+
menuItem: css `
|
|
36
|
+
justify-content: flex-start;
|
|
37
|
+
gap: ${euiTheme.size.s};
|
|
38
|
+
|
|
39
|
+
@media (min-width: 997px) {
|
|
40
|
+
justify-content: center;
|
|
41
|
+
width: ${euiTheme.size.xl};
|
|
42
|
+
height: ${euiTheme.size.xl};
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
darkMode: css `
|
|
47
|
+
&:hover {
|
|
48
|
+
color: currentColor;
|
|
49
|
+
}
|
|
50
|
+
`,
|
|
51
|
+
disabled: css `
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
`,
|
|
54
|
+
selected: css `
|
|
55
|
+
background-color: ${euiTheme.colors.backgroundFilledText};
|
|
56
|
+
color: ${euiTheme.colors.textInverse};
|
|
57
|
+
`,
|
|
58
|
+
title: css `
|
|
59
|
+
@media (min-width: 997px) {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
`,
|
|
63
|
+
});
|
|
64
|
+
// using a type guard to ensure proper typing from ExclusiveUnion
|
|
65
|
+
const isAnchorClick = (onClick, href) => href != null;
|
|
66
|
+
export const NavbarItem = (props) => {
|
|
67
|
+
const { className, title, icon, onClick, href, target, showLabel, isMenuItem = true, isSelected, css, } = props;
|
|
68
|
+
const isBrowser = useIsBrowser();
|
|
69
|
+
const { colorMode } = useContext(AppThemeContext);
|
|
70
|
+
const isDarkMode = colorMode === 'dark';
|
|
71
|
+
const styles = useEuiMemoizedStyles(getStyles);
|
|
72
|
+
const cssStyles = [
|
|
73
|
+
styles.item,
|
|
74
|
+
isMenuItem ? styles.menuItem : styles.navItem,
|
|
75
|
+
!isBrowser && styles.disabled,
|
|
76
|
+
isSelected && styles.selected,
|
|
77
|
+
isDarkMode && styles.darkMode,
|
|
78
|
+
];
|
|
79
|
+
const content = showLabel ? (_jsxs(_Fragment, { children: [_jsx(EuiIcon, { type: icon }), _jsx("span", { css: styles.title, children: title })] })) : (_jsx(EuiIcon, { type: icon }));
|
|
80
|
+
if (isAnchorClick(onClick, href)) {
|
|
81
|
+
return (_jsx("a", { href: href, target: target ?? '_blank', title: title, className: className, css: cssStyles, onClick: onClick, "aria-label": title, "aria-live": "polite", children: content }));
|
|
82
|
+
}
|
|
83
|
+
return (_jsx("button", { type: "button", disabled: !isBrowser, className: className, css: cssStyles, onClick: onClick, title: title, "aria-label": title, "aria-live": "polite", "aria-pressed": isSelected != null ? isSelected : undefined, children: content }));
|
|
84
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a processed component prop with its metadata
|
|
3
|
+
*/
|
|
4
|
+
export type ProcessedComponentProp = {
|
|
5
|
+
/** Name of the prop */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Description of the prop */
|
|
8
|
+
description: string;
|
|
9
|
+
/** Whether the prop is required */
|
|
10
|
+
isRequired?: boolean;
|
|
11
|
+
/** Type information for the prop */
|
|
12
|
+
type?: {
|
|
13
|
+
name: string;
|
|
14
|
+
raw?: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
/** Default value of the prop */
|
|
18
|
+
defaultValue?: string;
|
|
19
|
+
/** Allow additional properties that might be needed in the future */
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Represents a type extension with display name and potentially other information
|
|
24
|
+
*/
|
|
25
|
+
export type ExtendedType = {
|
|
26
|
+
/** Display name of the type being extended */
|
|
27
|
+
displayName: string;
|
|
28
|
+
/** Any additional metadata about the extended type */
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Represents a processed component with its metadata
|
|
33
|
+
*/
|
|
34
|
+
export type ProcessedComponent = {
|
|
35
|
+
/** Display name of the component */
|
|
36
|
+
displayName: string;
|
|
37
|
+
/** Props of the component as a record of prop name to prop details */
|
|
38
|
+
props: Record<string, ProcessedComponentProp>;
|
|
39
|
+
/** Types that this component extends */
|
|
40
|
+
extends: ExtendedType[];
|
|
41
|
+
/** Allow additional properties that might be needed in the future */
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
};
|
|
@@ -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 {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ProcessedComponent } from './definition_types';
|
|
2
|
+
export type PropTableExtendedTypesProps = {
|
|
3
|
+
definition: ProcessedComponent;
|
|
4
|
+
};
|
|
5
|
+
export declare const PropTableExtendedTypes: ({ definition, }: PropTableExtendedTypesProps) => import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 { Fragment, useMemo } from 'react';
|
|
10
|
+
import { EuiLink, EuiText } from '@elastic/eui';
|
|
11
|
+
import { extendedTypesInfo } from './extended_types_info';
|
|
12
|
+
export const PropTableExtendedTypes = ({ definition, }) => {
|
|
13
|
+
const extendedTypes = useMemo(() => {
|
|
14
|
+
const types = definition.extends.filter((type) => extendedTypesInfo.hasOwnProperty(type.displayName));
|
|
15
|
+
if (types.every((type) => type.displayName.indexOf('HTMLAttributes') > -1)) {
|
|
16
|
+
const htmlAttributesIndex = types.findIndex((type) => type.displayName === 'HTMLAttributes');
|
|
17
|
+
if (htmlAttributesIndex > -1 && types.length > 1) {
|
|
18
|
+
types.splice(htmlAttributesIndex, 1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return types;
|
|
22
|
+
}, [definition.extends]);
|
|
23
|
+
if (!extendedTypes.length) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return (_jsxs(EuiText, { size: "s", children: ["Extends", ' ', extendedTypes.map((type, index) => (_jsxs(Fragment, { children: [_jsx(EuiLink, { href: extendedTypesInfo[type.displayName].url, children: type.displayName }), extendedTypes.length - 1 > index && ', '] }, index)))] }));
|
|
27
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const extendedTypesInfo: {
|
|
2
|
+
HTMLAttributes: {
|
|
3
|
+
name: string;
|
|
4
|
+
url: string;
|
|
5
|
+
};
|
|
6
|
+
SelectHTMLAttributes: {
|
|
7
|
+
name: string;
|
|
8
|
+
url: string;
|
|
9
|
+
};
|
|
10
|
+
TextareaHTMLAttributes: {
|
|
11
|
+
name: string;
|
|
12
|
+
url: string;
|
|
13
|
+
};
|
|
14
|
+
InputHTMLAttributes: {
|
|
15
|
+
name: string;
|
|
16
|
+
url: string;
|
|
17
|
+
};
|
|
18
|
+
AnchorHTMLAttributes: {
|
|
19
|
+
name: string;
|
|
20
|
+
url: string;
|
|
21
|
+
};
|
|
22
|
+
ButtonHTMLAttributes: {
|
|
23
|
+
name: string;
|
|
24
|
+
url: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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 extendedTypesInfo = {
|
|
9
|
+
// HTMLAttributes is removed from display if any of the following elements also exist
|
|
10
|
+
HTMLAttributes: {
|
|
11
|
+
name: 'HTMLElement',
|
|
12
|
+
url: 'https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement',
|
|
13
|
+
},
|
|
14
|
+
SelectHTMLAttributes: {
|
|
15
|
+
name: 'HTMLSelectElement',
|
|
16
|
+
url: 'https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement',
|
|
17
|
+
},
|
|
18
|
+
TextareaHTMLAttributes: {
|
|
19
|
+
name: 'HTMLTextAreaElement',
|
|
20
|
+
url: 'https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement',
|
|
21
|
+
},
|
|
22
|
+
InputHTMLAttributes: {
|
|
23
|
+
name: 'HTMLInputElement',
|
|
24
|
+
url: 'https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement',
|
|
25
|
+
},
|
|
26
|
+
AnchorHTMLAttributes: {
|
|
27
|
+
name: 'HTMLAnchorElement',
|
|
28
|
+
url: 'https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement',
|
|
29
|
+
},
|
|
30
|
+
ButtonHTMLAttributes: {
|
|
31
|
+
name: 'HTMLButtonElement',
|
|
32
|
+
url: 'https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PropTable } from './prop_table';
|
|
@@ -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 { PropTable } from './prop_table';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ProcessedComponent } from './definition_types';
|
|
2
|
+
export type PropTableProps = {
|
|
3
|
+
definition: ProcessedComponent;
|
|
4
|
+
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
5
|
+
showTitle?: boolean;
|
|
6
|
+
parseDescription?: (description: string) => string | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare const PropTable: ({ definition, headingLevel, showTitle, parseDescription, }: PropTableProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|