@elastic/eui-docusaurus-theme 2.3.0 → 2.5.0-snapshot.1783939453438
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/lib/.tsbuildinfo-client +1 -1
- package/lib/components/demo/actions_bar/actions_bar.d.ts +2 -1
- package/lib/components/demo/actions_bar/actions_bar.js +4 -2
- package/lib/components/demo/codesandbox/get_parameters.d.ts +4 -0
- package/lib/components/demo/codesandbox/get_parameters.js +17 -0
- package/lib/components/demo/codesandbox/open_action.js +32 -6
- package/lib/components/demo/demo.d.ts +2 -1
- package/lib/components/demo/demo.js +5 -3
- package/lib/components/demo/preview/preview.js +2 -2
- package/lib/components/navbar_item/index.d.ts +2 -1
- package/lib/components/navbar_item/index.js +57 -47
- package/lib/components/version_switcher/index.js +2 -2
- package/lib/theme/Admonition/Types.js +3 -3
- package/lib/theme/CodeBlock/index.js +11 -4
- package/lib/theme/Demo/actions.d.ts +1 -0
- package/lib/theme/DocBreadcrumbs/Items/Home/index.js +1 -1
- package/lib/theme/DocBreadcrumbs/index.js +1 -1
- package/lib/theme/DocCard/index.js +2 -2
- package/lib/theme/DocSidebarItem/Category/index.js +1 -1
- package/lib/theme/Heading/index.js +2 -2
- package/lib/theme/Navbar/Content/index.js +12 -10
- package/lib/theme/Navbar/MobileSidebar/index.js +25 -2
- package/lib/theme/Navbar/breakpoint.d.ts +7 -0
- package/lib/theme/Navbar/breakpoint.js +18 -0
- package/lib/theme/NavbarItem/NavbarNavLink.js +1 -1
- package/lib/theme/PaginatorNavLink/index.js +1 -1
- package/lib/theme/TOCCollapsible/CollapseButton/index.js +1 -1
- package/package.json +6 -5
- package/src/components/demo/actions_bar/actions_bar.tsx +11 -5
- package/src/components/demo/codesandbox/get_parameters.ts +19 -0
- package/src/components/demo/codesandbox/open_action.tsx +46 -8
- package/src/components/demo/demo.tsx +7 -1
- package/src/components/demo/preview/preview.tsx +9 -3
- package/src/components/navbar_item/index.tsx +84 -65
- package/src/components/version_switcher/index.tsx +5 -5
- package/src/theme/Admonition/Types.tsx +4 -5
- package/src/theme/CodeBlock/index.tsx +15 -5
- package/src/theme/Demo/actions.tsx +1 -0
- package/src/theme/DocBreadcrumbs/Items/Home/index.tsx +1 -1
- package/src/theme/DocBreadcrumbs/index.tsx +1 -1
- package/src/theme/DocCard/index.tsx +2 -2
- package/src/theme/DocSidebarItem/Category/index.tsx +1 -1
- package/src/theme/Heading/index.tsx +11 -9
- package/src/theme/Navbar/Content/index.tsx +13 -10
- package/src/theme/Navbar/MobileSidebar/index.tsx +26 -3
- package/src/theme/Navbar/breakpoint.ts +23 -0
- package/src/theme/NavbarItem/NavbarNavLink.tsx +1 -1
- package/src/theme/PaginatorNavLink/index.tsx +2 -2
- package/src/theme/TOCCollapsible/CollapseButton/index.tsx +1 -1
- package/src/theme/theme.d.ts +1 -0
|
@@ -138,7 +138,7 @@ function CollapseButton({
|
|
|
138
138
|
onClick={onClick}
|
|
139
139
|
{...rest}
|
|
140
140
|
>
|
|
141
|
-
<EuiIcon size="s" type={collapsed ? '
|
|
141
|
+
<EuiIcon size="s" type={collapsed ? 'chevronSingleRight' : 'chevronSingleDown'} />
|
|
142
142
|
</button>
|
|
143
143
|
);
|
|
144
144
|
}
|
|
@@ -11,6 +11,7 @@ import { Props as HeadingProps } from '@theme/Heading';
|
|
|
11
11
|
import {
|
|
12
12
|
EuiTitle,
|
|
13
13
|
EuiButtonIcon,
|
|
14
|
+
EuiToolTip,
|
|
14
15
|
UseEuiTheme,
|
|
15
16
|
EuiTitleProps,
|
|
16
17
|
useEuiMemoizedStyles,
|
|
@@ -76,15 +77,16 @@ const Heading = ({
|
|
|
76
77
|
>
|
|
77
78
|
{children}
|
|
78
79
|
{shouldShowSectionLink && (
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
<EuiToolTip content={anchorTitle} disableScreenReaderOutput>
|
|
81
|
+
<EuiButtonIcon
|
|
82
|
+
css={styles.anchor}
|
|
83
|
+
href={`#${id}`}
|
|
84
|
+
aria-label={anchorTitle}
|
|
85
|
+
iconType="link"
|
|
86
|
+
color="text"
|
|
87
|
+
size="xs"
|
|
88
|
+
/>
|
|
89
|
+
</EuiToolTip>
|
|
88
90
|
)}
|
|
89
91
|
</Component>
|
|
90
92
|
</EuiTitle>
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
VersionSwitcherProps,
|
|
41
41
|
} from '../../../components/version_switcher';
|
|
42
42
|
import { HighContrastModeToggle } from '../../../components/high_contrast_mode_toggle';
|
|
43
|
+
import { getNavbarBreakpoint } from '../breakpoint';
|
|
43
44
|
|
|
44
45
|
const DOCS_PATH = '/docs';
|
|
45
46
|
|
|
@@ -54,6 +55,8 @@ const getStyles = (euiThemeContext: UseEuiTheme) => {
|
|
|
54
55
|
const { euiTheme } = euiThemeContext;
|
|
55
56
|
const form = euiFormVariables(euiThemeContext);
|
|
56
57
|
const iconColor = encodeURIComponent(euiTheme.colors.text);
|
|
58
|
+
const { desktopMediaQuery, mobileMediaQuery } =
|
|
59
|
+
getNavbarBreakpoint(euiThemeContext);
|
|
57
60
|
|
|
58
61
|
return {
|
|
59
62
|
navbarItems: css`
|
|
@@ -62,7 +65,7 @@ const getStyles = (euiThemeContext: UseEuiTheme) => {
|
|
|
62
65
|
|
|
63
66
|
.navbar__item,
|
|
64
67
|
[class*='colorModeToggle'] {
|
|
65
|
-
|
|
68
|
+
${mobileMediaQuery} {
|
|
66
69
|
display: none;
|
|
67
70
|
}
|
|
68
71
|
}
|
|
@@ -74,12 +77,16 @@ const getStyles = (euiThemeContext: UseEuiTheme) => {
|
|
|
74
77
|
background-color: var(--ifm-color-emphasis-200);
|
|
75
78
|
color: currentColor;
|
|
76
79
|
}
|
|
80
|
+
|
|
81
|
+
${mobileMediaQuery} {
|
|
82
|
+
display: inherit;
|
|
83
|
+
}
|
|
77
84
|
}
|
|
78
85
|
`,
|
|
79
86
|
navbarItemsLeft: css`
|
|
80
87
|
gap: ${euiTheme.size.s};
|
|
81
88
|
|
|
82
|
-
|
|
89
|
+
${desktopMediaQuery} {
|
|
83
90
|
gap: ${euiTheme.size.l};
|
|
84
91
|
}
|
|
85
92
|
|
|
@@ -91,7 +98,7 @@ const getStyles = (euiThemeContext: UseEuiTheme) => {
|
|
|
91
98
|
gap: ${euiTheme.size.s};
|
|
92
99
|
`,
|
|
93
100
|
actions: css`
|
|
94
|
-
|
|
101
|
+
${mobileMediaQuery} {
|
|
95
102
|
display: none;
|
|
96
103
|
}
|
|
97
104
|
`,
|
|
@@ -130,22 +137,18 @@ const getStyles = (euiThemeContext: UseEuiTheme) => {
|
|
|
130
137
|
max-inline-size: 25rem;
|
|
131
138
|
}
|
|
132
139
|
|
|
133
|
-
|
|
140
|
+
${desktopMediaQuery} {
|
|
134
141
|
min-inline-size: 15rem;
|
|
135
142
|
}
|
|
136
|
-
|
|
137
|
-
@media (min-width: 1200px) {
|
|
138
|
-
min-inline-size: 25rem;
|
|
139
|
-
}
|
|
140
143
|
}
|
|
141
144
|
`,
|
|
142
145
|
versionSwitcher: css`
|
|
143
|
-
|
|
146
|
+
${mobileMediaQuery} {
|
|
144
147
|
display: none;
|
|
145
148
|
}
|
|
146
149
|
`,
|
|
147
150
|
themeSwitcher: css`
|
|
148
|
-
|
|
151
|
+
${mobileMediaQuery} {
|
|
149
152
|
display: none;
|
|
150
153
|
}
|
|
151
154
|
`,
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { type ReactNode } from 'react';
|
|
9
|
+
import { type ReactNode, useEffect } from 'react';
|
|
10
|
+
import { useWindowSize } from '@docusaurus/theme-common';
|
|
10
11
|
import {
|
|
11
12
|
useLockBodyScroll,
|
|
12
13
|
useNavbarMobileSidebar,
|
|
@@ -15,8 +16,10 @@ import NavbarMobileSidebarLayout from '@theme-original/Navbar/MobileSidebar/Layo
|
|
|
15
16
|
import NavbarMobileSidebarHeader from './Header';
|
|
16
17
|
import NavbarMobileSidebarPrimaryMenu from '@theme-original/Navbar/MobileSidebar/PrimaryMenu';
|
|
17
18
|
import NavbarMobileSidebarSecondaryMenu from '@theme-original/Navbar/MobileSidebar/SecondaryMenu';
|
|
19
|
+
import { useEuiTheme } from '@elastic/eui';
|
|
18
20
|
|
|
19
21
|
import { VersionSwitcherProps } from '../../../components/version_switcher';
|
|
22
|
+
import { getNavbarBreakpoint } from '../breakpoint';
|
|
20
23
|
|
|
21
24
|
type Props = {
|
|
22
25
|
versionSwitcherOptions?: VersionSwitcherProps;
|
|
@@ -26,9 +29,29 @@ export default function NavbarMobileSidebar({
|
|
|
26
29
|
versionSwitcherOptions,
|
|
27
30
|
}: Props): ReactNode {
|
|
28
31
|
const mobileSidebar = useNavbarMobileSidebar();
|
|
29
|
-
|
|
32
|
+
const {
|
|
33
|
+
disabled,
|
|
34
|
+
shouldRender: shouldRenderDefault,
|
|
35
|
+
shown,
|
|
36
|
+
toggle,
|
|
37
|
+
} = mobileSidebar;
|
|
38
|
+
const euiThemeContext = useEuiTheme();
|
|
39
|
+
const { mobileBreakpoint } = getNavbarBreakpoint(euiThemeContext);
|
|
40
|
+
const windowSize = useWindowSize({
|
|
41
|
+
desktopBreakpoint: mobileBreakpoint,
|
|
42
|
+
});
|
|
43
|
+
const shouldRender =
|
|
44
|
+
shouldRenderDefault || (!disabled && windowSize === 'mobile');
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
useLockBodyScroll(shouldRender && shown);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (windowSize === 'desktop' && shown) {
|
|
50
|
+
toggle();
|
|
51
|
+
}
|
|
52
|
+
}, [shown, toggle, windowSize]);
|
|
53
|
+
|
|
54
|
+
if (!shouldRender) {
|
|
32
55
|
return null;
|
|
33
56
|
}
|
|
34
57
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { UseEuiTheme } from '@elastic/eui';
|
|
10
|
+
|
|
11
|
+
const NAVBAR_MOBILE_BREAKPOINT_KEY = 'xl';
|
|
12
|
+
|
|
13
|
+
export const getNavbarBreakpoint = ({ euiTheme }: UseEuiTheme) => {
|
|
14
|
+
const mobileBreakpoint = euiTheme.breakpoint[NAVBAR_MOBILE_BREAKPOINT_KEY];
|
|
15
|
+
const desktopBreakpoint = mobileBreakpoint + 1;
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
desktopBreakpoint,
|
|
19
|
+
desktopMediaQuery: `@media (min-width: ${desktopBreakpoint}px)`,
|
|
20
|
+
mobileBreakpoint,
|
|
21
|
+
mobileMediaQuery: `@media (max-width: ${mobileBreakpoint}px)`,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -63,9 +63,9 @@ export default function PaginatorNavLink(props: Props): JSX.Element {
|
|
|
63
63
|
{subLabel && <div className="pagination-nav__sublabel">{subLabel}</div>}
|
|
64
64
|
|
|
65
65
|
<div className="pagination-nav__label">
|
|
66
|
-
{isPrev && <EuiIcon type="
|
|
66
|
+
{isPrev && <EuiIcon type="chevronSingleLeft" />}
|
|
67
67
|
{title}
|
|
68
|
-
{isNext && <EuiIcon type="
|
|
68
|
+
{isNext && <EuiIcon type="chevronSingleRight" />}
|
|
69
69
|
</div>
|
|
70
70
|
</Link>
|
|
71
71
|
);
|
package/src/theme/theme.d.ts
CHANGED