@redocly/theme 0.67.0-next.0 → 0.67.0-next.2
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/components/Admonition/Admonition.js +9 -9
- package/lib/components/Badge/Badge.d.ts +1 -1
- package/lib/components/Badge/Badge.js +4 -4
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.js +16 -17
- package/lib/components/Buttons/AIAssistantButton.js +2 -0
- package/lib/components/Catalog/CatalogActionsRow.js +3 -1
- package/lib/components/Catalog/CatalogAvatar.d.ts +3 -1
- package/lib/components/Catalog/CatalogAvatar.js +3 -3
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +4 -4
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.js +7 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +6 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +4 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +3 -5
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +15 -11
- package/lib/components/Catalog/CatalogEntityTypeTag.js +5 -5
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +5 -3
- package/lib/components/CatalogClassic/CatalogClassic.d.ts +4 -2
- package/lib/components/CatalogClassic/CatalogClassic.js +3 -1
- package/lib/components/CodeBlock/CodeBlockContainer.js +16 -4
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +2 -1
- package/lib/components/CodeBlock/CodeBlockControls.js +9 -7
- package/lib/components/CodeBlock/CodeBlockTabs.js +2 -2
- package/lib/components/Dropdown/Dropdown.js +6 -6
- package/lib/components/Dropdown/DropdownMenuItem.d.ts +1 -1
- package/lib/components/Feedback/Comment.js +3 -3
- package/lib/components/Feedback/Mood.js +3 -3
- package/lib/components/Filter/FilterContent.js +2 -2
- package/lib/components/Footer/Footer.js +2 -2
- package/lib/components/Footer/FooterColumn.js +2 -2
- package/lib/components/Footer/FooterItem.js +5 -5
- package/lib/components/Image/Image.js +2 -2
- package/lib/components/LastUpdated/LastUpdated.js +2 -2
- package/lib/components/Link/Link.d.ts +2 -19
- package/lib/components/Link/Link.js +2 -9
- package/lib/components/Loaders/Loading.js +2 -2
- package/lib/components/Loaders/SpinnerLoader.js +4 -4
- package/lib/components/Markdown/Markdown.d.ts +7 -10
- package/lib/components/Markdown/Markdown.js +6 -3
- package/lib/components/Marker/Marker.js +3 -3
- package/lib/components/Menu/MenuContainer.d.ts +2 -2
- package/lib/components/Menu/MenuContainer.js +9 -11
- package/lib/components/Menu/MenuItem.js +14 -14
- package/lib/components/Menu/MenuMobile.js +8 -8
- package/lib/components/Navbar/NavbarItem.js +7 -7
- package/lib/components/PageNavigation/NavigationButton.js +3 -3
- package/lib/components/Panel/PanelBody.d.ts +5 -5
- package/lib/components/Panel/PanelBody.js +6 -3
- package/lib/components/Panel/PanelHeader.d.ts +2 -5
- package/lib/components/Panel/PanelHeader.js +6 -2
- package/lib/components/Search/SearchAiMessage.js +10 -8
- package/lib/components/Search/SearchDialog.js +6 -0
- package/lib/components/Search/SearchSuggestedPages.js +2 -2
- package/lib/components/Select/Select.js +3 -1
- package/lib/components/Select/SelectInput.d.ts +1 -0
- package/lib/components/Select/SelectInput.js +8 -8
- package/lib/components/Sidebar/Sidebar.d.ts +4 -2
- package/lib/components/Sidebar/Sidebar.js +10 -8
- package/lib/components/SidebarActions/styled.d.ts +6 -6
- package/lib/components/SidebarActions/styled.js +12 -4
- package/lib/components/StatusCode/StatusCode.d.ts +6 -4
- package/lib/components/StatusCode/StatusCode.js +8 -2
- package/lib/components/Switch/Switch.js +13 -13
- package/lib/components/TableOfContent/TableOfContent.js +2 -2
- package/lib/components/Tag/Tag.js +11 -11
- package/lib/components/Tooltip/AnchorTooltip.js +26 -25
- package/lib/components/Tooltip/JsTooltip.js +5 -5
- package/lib/components/Typography/CompactTypography.d.ts +27 -11
- package/lib/components/Typography/CompactTypography.js +2 -2
- package/lib/components/Typography/Typography.d.ts +6 -2
- package/lib/components/Typography/Typography.js +18 -3
- package/lib/components/UserMenu/UserAvatar.js +5 -5
- package/lib/core/contexts/ThemeDataContext.d.ts +1 -1
- package/lib/core/hooks/feedback/use-report-dialog.d.ts +8 -5
- package/lib/core/styles/global.js +1 -0
- package/lib/core/templates/Markdown.js +5 -6
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/link.d.ts +19 -0
- package/lib/core/types/link.js +3 -0
- package/lib/core/utils/details.d.ts +1 -1
- package/lib/core/utils/details.js +3 -0
- package/lib/core/utils/dom.d.ts +0 -1
- package/lib/core/utils/dom.js +0 -9
- package/lib/core/utils/index.d.ts +0 -1
- package/lib/core/utils/index.js +0 -1
- package/lib/ext/configure-helpers.d.ts +35 -0
- package/lib/ext/configure-helpers.js +3 -0
- package/lib/ext/configure.d.ts +3 -25
- package/lib/ext/configure.js +16 -0
- package/lib/ext/helpers/is-direct-configure-request-values.d.ts +15 -0
- package/lib/ext/helpers/is-direct-configure-request-values.js +42 -0
- package/lib/ext/use-configure-replay.d.ts +1 -1
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.d.ts +1 -1
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +6 -1
- package/lib/icons/AiStarsIcon/AiStarsIcon.d.ts +1 -1
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +6 -1
- package/lib/icons/MagicWandIcon/MagicWandIcon.d.ts +23 -0
- package/lib/icons/MagicWandIcon/MagicWandIcon.js +25 -0
- package/lib/icons/ReturnKeyIcon/ReturnKeyIcon.d.ts +25 -5
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/layouts/DocumentationLayout.js +2 -2
- package/lib/layouts/ThreePanelLayout.d.ts +27 -7
- package/lib/layouts/ThreePanelLayout.js +11 -8
- package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +4 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +6 -2
- package/lib/markdoc/components/Image/Image.js +3 -3
- package/lib/markdoc/components/Tabs/TabItemFragment.d.ts +9 -0
- package/lib/markdoc/components/Tabs/TabItemFragment.js +11 -0
- package/lib/markdoc/components/Tabs/TabList.d.ts +7 -4
- package/lib/markdoc/components/Tabs/TabList.js +6 -4
- package/lib/markdoc/components/Tabs/Tabs.d.ts +3 -9
- package/lib/markdoc/components/Tabs/Tabs.js +12 -5
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/tags/tab.js +1 -1
- package/lib/markdoc/tags/tabs.js +1 -1
- package/package.json +2 -3
- package/src/components/Admonition/Admonition.tsx +11 -11
- package/src/components/Badge/Badge.tsx +11 -6
- package/src/components/Button/Button.tsx +51 -21
- package/src/components/Buttons/AIAssistantButton.tsx +2 -0
- package/src/components/Catalog/CatalogActionsRow.tsx +3 -1
- package/src/components/Catalog/CatalogAvatar.tsx +6 -10
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +6 -6
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.tsx +14 -14
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +11 -11
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +4 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +8 -11
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +10 -9
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +22 -16
- package/src/components/Catalog/CatalogEntityTypeTag.tsx +8 -8
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +8 -6
- package/src/components/CatalogClassic/CatalogClassic.tsx +3 -1
- package/src/components/CodeBlock/CodeBlockContainer.tsx +23 -7
- package/src/components/CodeBlock/CodeBlockControls.tsx +16 -10
- package/src/components/CodeBlock/CodeBlockTabs.tsx +4 -4
- package/src/components/Dropdown/Dropdown.tsx +9 -9
- package/src/components/Dropdown/DropdownMenuItem.tsx +1 -1
- package/src/components/Feedback/Comment.tsx +5 -5
- package/src/components/Feedback/Mood.tsx +5 -5
- package/src/components/Filter/FilterContent.tsx +4 -4
- package/src/components/Filter/FilterPopover.tsx +1 -1
- package/src/components/Footer/Footer.tsx +4 -4
- package/src/components/Footer/FooterColumn.tsx +3 -3
- package/src/components/Footer/FooterItem.tsx +9 -9
- package/src/components/Image/Image.tsx +3 -3
- package/src/components/LastUpdated/LastUpdated.tsx +4 -4
- package/src/components/Link/Link.tsx +6 -51
- package/src/components/Loaders/Loading.tsx +3 -3
- package/src/components/Loaders/SpinnerLoader.tsx +5 -5
- package/src/components/Markdown/Markdown.tsx +7 -7
- package/src/components/Marker/Marker.tsx +4 -4
- package/src/components/Menu/MenuContainer.tsx +32 -16
- package/src/components/Menu/MenuItem.tsx +34 -29
- package/src/components/Menu/MenuMobile.tsx +12 -12
- package/src/components/Navbar/NavbarItem.tsx +13 -13
- package/src/components/PageNavigation/NavigationButton.tsx +4 -4
- package/src/components/Panel/PanelBody.tsx +7 -4
- package/src/components/Panel/PanelHeader.tsx +9 -4
- package/src/components/Search/SearchAiMessage.tsx +17 -15
- package/src/components/Search/SearchDialog.tsx +6 -0
- package/src/components/Search/SearchSuggestedPages.tsx +20 -5
- package/src/components/Select/Select.tsx +3 -1
- package/src/components/Select/SelectInput.tsx +10 -9
- package/src/components/Sidebar/Sidebar.tsx +15 -13
- package/src/components/SidebarActions/styled.ts +12 -4
- package/src/components/StatusCode/StatusCode.tsx +12 -4
- package/src/components/Switch/Switch.tsx +21 -21
- package/src/components/TableOfContent/TableOfContent.tsx +3 -3
- package/src/components/Tag/Tag.tsx +34 -27
- package/src/components/Tooltip/AnchorTooltip.tsx +50 -42
- package/src/components/Tooltip/JsTooltip.tsx +14 -13
- package/src/components/Typography/CompactTypography.tsx +4 -4
- package/src/components/Typography/Typography.tsx +21 -5
- package/src/components/UserMenu/UserAvatar.tsx +7 -7
- package/src/core/contexts/ThemeDataContext.tsx +1 -1
- package/src/core/hooks/feedback/use-report-dialog.ts +1 -5
- package/src/core/styles/dark.ts +1 -1
- package/src/core/styles/global.ts +1 -0
- package/src/core/templates/Markdown.tsx +6 -7
- package/src/core/types/index.ts +1 -0
- package/src/core/types/link.ts +20 -0
- package/src/core/utils/details.ts +4 -0
- package/src/core/utils/dom.ts +0 -8
- package/src/core/utils/index.ts +0 -1
- package/src/ext/configure-helpers.ts +45 -0
- package/src/ext/configure.ts +6 -26
- package/src/ext/helpers/is-direct-configure-request-values.ts +53 -0
- package/src/ext/use-configure-replay.ts +3 -3
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +9 -3
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +9 -3
- package/src/icons/MagicWandIcon/MagicWandIcon.tsx +26 -0
- package/src/icons/ReturnKeyIcon/ReturnKeyIcon.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/layouts/DocumentationLayout.tsx +3 -3
- package/src/layouts/ThreePanelLayout.tsx +27 -14
- package/src/markdoc/components/CodeWalkthrough/CodeContainer.tsx +4 -4
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +4 -4
- package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +3 -3
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +6 -2
- package/src/markdoc/components/Image/Image.tsx +4 -4
- package/src/markdoc/components/Tabs/TabItemFragment.tsx +15 -0
- package/src/markdoc/components/Tabs/TabList.tsx +9 -6
- package/src/markdoc/components/Tabs/Tabs.tsx +21 -15
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/tags/tab.ts +1 -1
- package/src/markdoc/tags/tabs.ts +1 -1
|
@@ -11,13 +11,29 @@ export type TypographyProps = {
|
|
|
11
11
|
marginBottom?: string;
|
|
12
12
|
marginTop?: string;
|
|
13
13
|
textAlign?: string;
|
|
14
|
-
|
|
14
|
+
className?: string;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
'
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const typographyStyleProps = new Set([
|
|
18
|
+
'color',
|
|
19
|
+
'fontFamily',
|
|
20
|
+
'fontSize',
|
|
21
|
+
'fontStyle',
|
|
22
|
+
'fontWeight',
|
|
23
|
+
'lineHeight',
|
|
24
|
+
'letterSpacing',
|
|
25
|
+
'marginBottom',
|
|
26
|
+
'marginTop',
|
|
27
|
+
'textAlign',
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
export const Typography = styled.span
|
|
31
|
+
.withConfig({
|
|
32
|
+
shouldForwardProp: (prop) => !typographyStyleProps.has(prop),
|
|
33
|
+
})
|
|
34
|
+
.attrs<{ 'data-component-name': string }>({
|
|
35
|
+
'data-component-name': 'Typography/Typography',
|
|
36
|
+
})<TypographyProps>`
|
|
21
37
|
color: ${({ color }) => color || 'var(--text-color-primary)'};
|
|
22
38
|
font-family: ${({ fontFamily }) => fontFamily || 'var(--font-family-base)'};
|
|
23
39
|
font-size: ${({ fontSize }) => fontSize || 'var(--font-size-base)'};
|
|
@@ -22,17 +22,17 @@ export function UserAvatar({
|
|
|
22
22
|
<UserAvatarWrapper
|
|
23
23
|
data-component-name="UserMenu/UserAvatar"
|
|
24
24
|
className={className}
|
|
25
|
-
height={height}
|
|
26
|
-
width={width}
|
|
25
|
+
$height={height}
|
|
26
|
+
$width={width}
|
|
27
27
|
>
|
|
28
28
|
{picture ? <img src={picture} alt="profile" /> : <UserIcon />}
|
|
29
29
|
</UserAvatarWrapper>
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const UserAvatarWrapper = styled.div<{ height: string; width: string }>`
|
|
34
|
-
width: ${({ width }) => width};
|
|
35
|
-
height: ${({ height }) => height};
|
|
33
|
+
const UserAvatarWrapper = styled.div<{ $height: string; $width: string }>`
|
|
34
|
+
width: ${({ $width }) => $width};
|
|
35
|
+
height: ${({ $height }) => $height};
|
|
36
36
|
display: flex;
|
|
37
37
|
overflow: hidden;
|
|
38
38
|
position: relative;
|
|
@@ -50,8 +50,8 @@ const UserAvatarWrapper = styled.div<{ height: string; width: string }>`
|
|
|
50
50
|
background-color: var(--user-menu-avatar-bg-color);
|
|
51
51
|
|
|
52
52
|
& > svg {
|
|
53
|
-
width: ${({ width }) => `calc(${width} - 14px)`};
|
|
54
|
-
height: ${({ height }) => `calc(${height} - 14px)`};
|
|
53
|
+
width: ${({ $width }) => `calc(${$width} - 14px)`};
|
|
54
|
+
height: ${({ $height }) => `calc(${$height} - 14px)`};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
& > img {
|
|
@@ -2,7 +2,7 @@ import { createContext } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { JSX } from 'react';
|
|
4
4
|
import type { ThemeHooks } from '../types/hooks';
|
|
5
|
-
import type { LinkProps } from '
|
|
5
|
+
import type { LinkProps } from '../types/link';
|
|
6
6
|
import type { UiAccessibleConfig } from '../../config';
|
|
7
7
|
|
|
8
8
|
export interface ThemeDataTransferObject {
|
|
@@ -11,12 +11,8 @@ export type ReportButtonProps = {
|
|
|
11
11
|
tooltip: string;
|
|
12
12
|
hide: boolean;
|
|
13
13
|
};
|
|
14
|
-
type ReportComponentsProps = {
|
|
15
|
-
visible?: boolean;
|
|
16
|
-
props: Partial<ReportDialogProps> | ReportButtonProps;
|
|
17
|
-
};
|
|
18
14
|
|
|
19
|
-
export function useReportDialog()
|
|
15
|
+
export function useReportDialog() {
|
|
20
16
|
const { codeSnippet: { report = {} } = {} } = useThemeConfig();
|
|
21
17
|
const [isReportDialogShown, setIsReportDialogShown] = useState(false);
|
|
22
18
|
const { tooltipText, buttonText, label } = report;
|
package/src/core/styles/dark.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { codeBlockDarkMode } from '@redocly/theme/components/CodeBlock/variables
|
|
|
19
19
|
|
|
20
20
|
import { activeBrandPaletteDark } from './palette.dark';
|
|
21
21
|
|
|
22
|
-
const replayDarkMode = css
|
|
22
|
+
const replayDarkMode = css`
|
|
23
23
|
/**
|
|
24
24
|
* @tokens Replay Colors
|
|
25
25
|
* @presenter Color
|
|
@@ -761,6 +761,7 @@ const apiReferenceDocs = css`
|
|
|
761
761
|
--schema-property-details-width: 70%;
|
|
762
762
|
--schema-property-details-spacing: var(--spacing-base); // @presenter Spacing
|
|
763
763
|
--schema-fist-property-details-spacing: var(--spacing-sm); // @presenter Spacing
|
|
764
|
+
--schema-first-property-details-spacing: var(--schema-fist-property-details-spacing, var(--spacing-sm)); // @presenter Spacing
|
|
764
765
|
|
|
765
766
|
/**
|
|
766
767
|
* @tokens API Reference Schema Icons
|
|
@@ -11,7 +11,6 @@ import { TableOfContent } from '@redocly/theme/components/TableOfContent/TableOf
|
|
|
11
11
|
import { Feedback } from '@redocly/theme/components/Feedback/Feedback';
|
|
12
12
|
import { CodeWalkthroughLayout } from '@redocly/theme/layouts/CodeWalkthroughLayout';
|
|
13
13
|
|
|
14
|
-
import { IS_BROWSER, onDocumentReady } from '../utils/dom';
|
|
15
14
|
import { extendDetailsBehaviour } from '../utils/details';
|
|
16
15
|
import { useThemeHooks } from '../hooks/use-theme-hooks';
|
|
17
16
|
import { useThemeConfig } from '../hooks/use-theme-config';
|
|
@@ -66,19 +65,19 @@ export default function ({ pageProps, children }: React.PropsWithChildren<Markdo
|
|
|
66
65
|
prevPage,
|
|
67
66
|
};
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
return extendDetailsBehaviour();
|
|
70
|
+
}, [pathname]);
|
|
72
71
|
|
|
73
|
-
const
|
|
72
|
+
const markdownDocument = <Markdown ref={wrapperRefCb}>{children}</Markdown>;
|
|
74
73
|
const tagList = pageProps.metadata.markdoc.tagList;
|
|
75
74
|
const withCodeWalkthrough = Boolean(
|
|
76
75
|
Array.isArray(tagList) && tagList.includes('code-walkthrough'),
|
|
77
76
|
);
|
|
78
77
|
|
|
79
78
|
return withCodeWalkthrough ? (
|
|
80
|
-
<CodeWalkthroughLayout>{
|
|
79
|
+
<CodeWalkthroughLayout>{markdownDocument}</CodeWalkthroughLayout>
|
|
81
80
|
) : (
|
|
82
|
-
<DocumentationLayout {...documentationLayoutProps}>{
|
|
81
|
+
<DocumentationLayout {...documentationLayoutProps}>{markdownDocument}</DocumentationLayout>
|
|
83
82
|
);
|
|
84
83
|
}
|
package/src/core/types/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RelativeRoutingType } from 'react-router-dom';
|
|
2
|
+
|
|
3
|
+
export type LinkProps = {
|
|
4
|
+
to: string;
|
|
5
|
+
target?: '_self' | '_blank';
|
|
6
|
+
external?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
innerRef?: React.Ref<HTMLAnchorElement>;
|
|
10
|
+
languageInsensitive?: boolean;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
reloadDocument?: boolean;
|
|
13
|
+
replace?: boolean;
|
|
14
|
+
state?: unknown;
|
|
15
|
+
preventScrollReset?: boolean;
|
|
16
|
+
relative?: RelativeRoutingType;
|
|
17
|
+
viewTransition?: boolean;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
rel?: string;
|
|
20
|
+
};
|
|
@@ -2,6 +2,10 @@ export function extendDetailsBehaviour() {
|
|
|
2
2
|
enhanceDetails();
|
|
3
3
|
openDetailsFromHash();
|
|
4
4
|
window.addEventListener('hashchange', openDetailsFromHash);
|
|
5
|
+
|
|
6
|
+
return () => {
|
|
7
|
+
window.removeEventListener('hashchange', openDetailsFromHash);
|
|
8
|
+
};
|
|
5
9
|
}
|
|
6
10
|
|
|
7
11
|
function openDetailsAndScroll(detailsElement: Element) {
|
package/src/core/utils/dom.ts
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
1
|
export const IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
|
|
2
|
-
|
|
3
|
-
export function onDocumentReady(fn: () => unknown) {
|
|
4
|
-
if (document.readyState === 'loading') {
|
|
5
|
-
document.addEventListener('DOMContentLoaded', fn as EventListener);
|
|
6
|
-
} else {
|
|
7
|
-
fn();
|
|
8
|
-
}
|
|
9
|
-
}
|
package/src/core/utils/index.ts
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type SecurityDetails = {
|
|
2
|
+
password?: string;
|
|
3
|
+
username?: string;
|
|
4
|
+
token?: {
|
|
5
|
+
token_type?: string;
|
|
6
|
+
access_token: string;
|
|
7
|
+
};
|
|
8
|
+
client_id?: string;
|
|
9
|
+
client_secret?: string;
|
|
10
|
+
scopes?: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ConfigureInputHintAction = {
|
|
14
|
+
label: string;
|
|
15
|
+
action: () => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type ConfigureInputHint = {
|
|
19
|
+
title: string;
|
|
20
|
+
text: string;
|
|
21
|
+
actions?: ConfigureInputHintAction[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type ConfigureRequestValues = {
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
27
|
+
body?: Record<string, any>;
|
|
28
|
+
query?: Record<string, string>;
|
|
29
|
+
path?: Record<string, string>;
|
|
30
|
+
cookie?: Record<string, string>;
|
|
31
|
+
security?: Record<string, SecurityDetails>;
|
|
32
|
+
envVariables?: Record<string, string>;
|
|
33
|
+
serverVariables?: Record<string, string>;
|
|
34
|
+
inputHints?: Record<string, ConfigureInputHint>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type ConfigureServerRequestValues = {
|
|
38
|
+
[serverUrl: string]: ConfigureRequestValues;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type ConfigureReplayConfig =
|
|
42
|
+
| ConfigureRequestValues
|
|
43
|
+
| ConfigureServerRequestValues
|
|
44
|
+
| null
|
|
45
|
+
| undefined;
|
package/src/ext/configure.ts
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
import type { UserClaims, OpenAPIServer } from '@redocly/theme/core/types';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
username?: string;
|
|
6
|
-
token?: {
|
|
7
|
-
token_type?: string;
|
|
8
|
-
access_token: string;
|
|
9
|
-
};
|
|
10
|
-
client_id?: string;
|
|
11
|
-
client_secret?: string;
|
|
12
|
-
scopes?: string[];
|
|
13
|
-
};
|
|
3
|
+
export * from '@redocly/theme/ext/configure-helpers';
|
|
4
|
+
export * from '@redocly/theme/ext/helpers/is-direct-configure-request-values';
|
|
14
5
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
query?: Record<string, string>;
|
|
20
|
-
path?: Record<string, string>;
|
|
21
|
-
cookie?: Record<string, string>;
|
|
22
|
-
security?: Record<string, SecurityDetails>;
|
|
23
|
-
envVariables?: Record<string, string>;
|
|
24
|
-
serverVariables?: Record<string, string>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type ConfigureServerRequestValues = {
|
|
28
|
-
[serverUrl: string]: ConfigureRequestValues;
|
|
29
|
-
};
|
|
6
|
+
import type {
|
|
7
|
+
ConfigureRequestValues,
|
|
8
|
+
ConfigureServerRequestValues,
|
|
9
|
+
} from '@redocly/theme/ext/configure-helpers';
|
|
30
10
|
|
|
31
11
|
type Configure = {
|
|
32
12
|
requestValues?: ConfigureRequestValues | ConfigureServerRequestValues;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConfigureRequestValues,
|
|
3
|
+
ConfigureServerRequestValues,
|
|
4
|
+
} from '@redocly/theme/ext/configure-helpers';
|
|
5
|
+
|
|
6
|
+
const CONFIGURE_REQUEST_VALUE_KEYS = [
|
|
7
|
+
'headers',
|
|
8
|
+
'body',
|
|
9
|
+
'query',
|
|
10
|
+
'path',
|
|
11
|
+
'cookie',
|
|
12
|
+
'security',
|
|
13
|
+
'envVariables',
|
|
14
|
+
'serverVariables',
|
|
15
|
+
'inputHints',
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
const CONFIGURE_REQUEST_VALUE_KEY_SET = new Set<string>(CONFIGURE_REQUEST_VALUE_KEYS);
|
|
19
|
+
|
|
20
|
+
function hasConfigureRequestValueKeys(value: object): boolean {
|
|
21
|
+
return CONFIGURE_REQUEST_VALUE_KEYS.some((key) => key in value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Type guard that distinguishes a direct {@link ConfigureRequestValues} payload (request
|
|
26
|
+
* values that apply to every server) from a {@link ConfigureServerRequestValues} payload
|
|
27
|
+
* (request values keyed by server URL).
|
|
28
|
+
*
|
|
29
|
+
* A payload is treated as server-keyed when at least one top-level key is *not* a known
|
|
30
|
+
* request-value key (e.g. `headers`, `security`, `inputHints`) and its value looks like a
|
|
31
|
+
* nested {@link ConfigureRequestValues}. This keeps mixed shapes — e.g. server-keyed values
|
|
32
|
+
* alongside a top-level `inputHints` sibling — classified as server-keyed.
|
|
33
|
+
*
|
|
34
|
+
* @param value - The configure payload returned from `getReplayConfiguration`.
|
|
35
|
+
* @returns `true` when `value` is a direct {@link ConfigureRequestValues}, narrowing the type.
|
|
36
|
+
*/
|
|
37
|
+
export function isDirectConfigureRequestValues(
|
|
38
|
+
value: ConfigureRequestValues | ConfigureServerRequestValues,
|
|
39
|
+
): value is ConfigureRequestValues {
|
|
40
|
+
const hasServerKeyedValues = Object.entries(value).some(
|
|
41
|
+
([key, entry]) =>
|
|
42
|
+
!CONFIGURE_REQUEST_VALUE_KEY_SET.has(key) &&
|
|
43
|
+
entry != null &&
|
|
44
|
+
typeof entry === 'object' &&
|
|
45
|
+
hasConfigureRequestValueKeys(entry),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
if (hasServerKeyedValues) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return hasConfigureRequestValueKeys(value);
|
|
53
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEffect, useState, useCallback } from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
ConfigureRequestValues,
|
|
5
|
-
ConfigureServerRequestValues,
|
|
3
|
+
import {
|
|
4
|
+
type ConfigureRequestValues,
|
|
5
|
+
type ConfigureServerRequestValues,
|
|
6
6
|
} from '@redocly/theme/ext/configure';
|
|
7
7
|
import type { UserClaims, OpenAPIServer, OpenAPIInfo } from '@redocly/theme/core/types';
|
|
8
8
|
|
|
@@ -59,9 +59,15 @@ const Icon = (props: AiStarsGradientIconProps) => {
|
|
|
59
59
|
);
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const iconStyleProps = new Set(['background', 'borderRadius', 'padding', 'margin']);
|
|
63
|
+
|
|
64
|
+
export const AiStarsGradientIcon = styled(Icon)
|
|
65
|
+
.withConfig({
|
|
66
|
+
shouldForwardProp: (prop) => !iconStyleProps.has(prop),
|
|
67
|
+
})
|
|
68
|
+
.attrs({
|
|
69
|
+
'data-component-name': 'icons/AiStarsGradientIcon/AiStarsGradientIcon',
|
|
70
|
+
})<AiStarsGradientIconProps>`
|
|
65
71
|
height: ${({ size }) => size || '16px'};
|
|
66
72
|
width: ${({ size }) => size || '16px'};
|
|
67
73
|
|
|
@@ -29,9 +29,15 @@ const Icon = (props: AiStarsIconProps) => {
|
|
|
29
29
|
);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const iconStyleProps = new Set(['background', 'borderRadius', 'padding', 'margin']);
|
|
33
|
+
|
|
34
|
+
export const AiStarsIcon = styled(Icon)
|
|
35
|
+
.withConfig({
|
|
36
|
+
shouldForwardProp: (prop) => !iconStyleProps.has(prop),
|
|
37
|
+
})
|
|
38
|
+
.attrs({
|
|
39
|
+
'data-component-name': 'icons/AiStarsIcon/AiStarsIcon',
|
|
40
|
+
})<AiStarsIconProps>`
|
|
35
41
|
height: ${({ size }) => size || '16px'};
|
|
36
42
|
width: ${({ size }) => size || '16px'};
|
|
37
43
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { IconProps } from '@redocly/theme/icons/types';
|
|
5
|
+
|
|
6
|
+
import { getCssColorVariable } from '@redocly/theme/core/utils';
|
|
7
|
+
|
|
8
|
+
const Icon = (props: IconProps) => (
|
|
9
|
+
<svg viewBox="0 0 12.25 12.2494" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path d="M11.9937 9.62499L4.37501 2.00632C4.20836 1.84719 3.98679 1.7584 3.75636 1.7584C3.52594 1.7584 3.30437 1.84719 3.13772 2.00632L2.00634 3.1377C1.84252 3.30191 1.75051 3.52439 1.75051 3.75634C1.75051 3.9883 1.84252 4.21078 2.00634 4.37499L9.62457 11.9937C9.7888 12.1575 10.0113 12.2494 10.2432 12.2494C10.4752 12.2494 10.6976 12.1575 10.8619 11.9937L11.9937 10.8621C12.0749 10.7808 12.1394 10.6844 12.1834 10.5782C12.2274 10.4721 12.25 10.3583 12.25 10.2434C12.25 10.1285 12.2274 10.0147 12.1834 9.90859C12.1394 9.80244 12.0749 9.70622 11.9937 9.62499ZM2.62501 3.75632L3.75634 2.62499L5.94384 4.81249L4.81221 5.94426L2.62471 3.75676L2.62501 3.75632ZM10.2432 11.375L5.43074 6.56293L6.56251 5.43116L11.375 10.2437L10.2432 11.375Z" />
|
|
11
|
+
<path d="M0.875027 5.24999L3.56734e-05 6.12498L0.875027 6.99997L1.75002 6.12498L0.875027 5.24999Z" />
|
|
12
|
+
<path d="M6.12503 8.20979e-06L5.25004 0.875L6.12503 1.74999L7.00002 0.875L6.12503 8.20979e-06Z" />
|
|
13
|
+
<path d="M0.874992 0L0 0.874992L0.874992 1.74998L1.74998 0.874992L0.874992 0Z" />
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const MagicWandIcon = styled(Icon).attrs({
|
|
18
|
+
'data-component-name': 'icons/MagicWandIcon/MagicWandIcon',
|
|
19
|
+
})`
|
|
20
|
+
path {
|
|
21
|
+
fill: ${({ color }) => getCssColorVariable(color)};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
height: ${({ size }) => size || '14px'};
|
|
25
|
+
width: ${({ size }) => size || '14px'};
|
|
26
|
+
`;
|
|
@@ -2,7 +2,7 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { Typography } from '@redocly/theme/components/Typography/Typography';
|
|
4
4
|
|
|
5
|
-
export const ReturnKeyIcon = styled(Typography).attrs({
|
|
5
|
+
export const ReturnKeyIcon = styled(Typography).attrs<{ 'data-component-name': string }>({
|
|
6
6
|
'data-component-name': 'icons/ReturnKeyIcon/ReturnKeyIcon',
|
|
7
7
|
})`
|
|
8
8
|
margin-left: auto;
|
package/src/index.ts
CHANGED
|
@@ -267,6 +267,7 @@ export * from '@redocly/theme/icons/TableBuiltIcon/TableBuiltIcon';
|
|
|
267
267
|
export * from '@redocly/theme/icons/ValueVariableIcon/ValueVariableIcon';
|
|
268
268
|
export * from '@redocly/theme/icons/InformationIcon/InformationIcon';
|
|
269
269
|
export * from '@redocly/theme/icons/ChevronSortIcon/ChevronSortIcon';
|
|
270
|
+
export * from '@redocly/theme/icons/MagicWandIcon/MagicWandIcon';
|
|
270
271
|
export * from '@redocly/theme/icons/DocumentIcon/DocumentIcon';
|
|
271
272
|
export * from '@redocly/theme/icons/JsonIcon/JsonIcon';
|
|
272
273
|
export * from '@redocly/theme/icons/SubtractIcon/SubtractIcon';
|
|
@@ -38,7 +38,7 @@ export function DocumentationLayout({
|
|
|
38
38
|
return (
|
|
39
39
|
<CodeSnippetProvider>
|
|
40
40
|
<LayoutWrapper data-component-name="Layout/DocumentationLayout" className={className}>
|
|
41
|
-
<ContentWrapper withToc={!config?.toc?.hide}>
|
|
41
|
+
<ContentWrapper $withToc={!config?.toc?.hide}>
|
|
42
42
|
<DocumentationLayoutTop config={config} editPage={editPage} lastModified={lastModified} />
|
|
43
43
|
{children}
|
|
44
44
|
<DocumentationLayoutBottom feedback={feedback} nextPage={nextPage} prevPage={prevPage} />
|
|
@@ -57,7 +57,7 @@ const LayoutWrapper = styled.div.attrs(({ className }) => ({
|
|
|
57
57
|
width: 100%;
|
|
58
58
|
`;
|
|
59
59
|
|
|
60
|
-
const ContentWrapper = styled.section<{ withToc: boolean }>`
|
|
60
|
+
const ContentWrapper = styled.section<{ $withToc: boolean }>`
|
|
61
61
|
--md-content-font-size: var(--font-size-lg);
|
|
62
62
|
--md-content-line-height: var(--line-height-lg);
|
|
63
63
|
--md-table-font-size: var(--md-content-font-size);
|
|
@@ -78,6 +78,6 @@ const ContentWrapper = styled.section<{ withToc: boolean }>`
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
@media screen and (min-width: ${breakpoints.medium}) {
|
|
81
|
-
width: ${({ withToc }) => (withToc ? `calc(90% - var(--toc-width))` : '90%')};
|
|
81
|
+
width: ${({ $withToc }) => ($withToc ? `calc(90% - var(--toc-width))` : '90%')};
|
|
82
82
|
}
|
|
83
83
|
`;
|
|
@@ -1,28 +1,41 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type JSX, type PropsWithChildren } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { LayoutVariant } from '@redocly/config';
|
|
4
4
|
|
|
5
|
-
import type { JSX } from 'react';
|
|
6
|
-
|
|
7
5
|
import { breakpoints } from '@redocly/theme/core/utils';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
children: React.ReactNode;
|
|
7
|
+
export type ThreePanelLayoutProps = PropsWithChildren<{
|
|
11
8
|
layout?: LayoutVariant;
|
|
12
9
|
collapsedSidebar?: boolean;
|
|
13
10
|
id?: string;
|
|
14
11
|
className?: string;
|
|
15
|
-
}
|
|
12
|
+
}>;
|
|
16
13
|
|
|
17
|
-
export function ThreePanelLayout({
|
|
14
|
+
export function ThreePanelLayout({
|
|
15
|
+
layout,
|
|
16
|
+
collapsedSidebar,
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}: ThreePanelLayoutProps): JSX.Element {
|
|
18
20
|
return (
|
|
19
|
-
<Wrapper
|
|
21
|
+
<Wrapper
|
|
22
|
+
data-component-name="Layout/ThreePanelLayout"
|
|
23
|
+
{...props}
|
|
24
|
+
$layout={layout}
|
|
25
|
+
$collapsedSidebar={collapsedSidebar}
|
|
26
|
+
>
|
|
20
27
|
{children}
|
|
21
28
|
</Wrapper>
|
|
22
29
|
);
|
|
23
30
|
}
|
|
24
31
|
|
|
25
|
-
const Wrapper = styled.div<{
|
|
32
|
+
export const Wrapper = styled.div.attrs<{
|
|
33
|
+
'data-component-name': string;
|
|
34
|
+
$layout: LayoutVariant;
|
|
35
|
+
$collapsedSidebar: boolean;
|
|
36
|
+
}>({
|
|
37
|
+
'data-component-name': 'Layout/ThreePanelLayout',
|
|
38
|
+
})<ThreePanelLayoutProps>`
|
|
26
39
|
position: relative;
|
|
27
40
|
display: flex;
|
|
28
41
|
flex-direction: column;
|
|
@@ -30,20 +43,20 @@ const Wrapper = styled.div<{ collapsedSidebar?: boolean; layout?: LayoutVariant
|
|
|
30
43
|
margin: 0 auto;
|
|
31
44
|
width: 100%;
|
|
32
45
|
|
|
33
|
-
${({ layout = LayoutVariant.THREE_PANEL }) => {
|
|
46
|
+
${({ $layout = LayoutVariant.THREE_PANEL }) => {
|
|
34
47
|
return css`
|
|
35
|
-
max-width: ${layout === LayoutVariant.THREE_PANEL ? '100%' : ''};
|
|
48
|
+
max-width: ${$layout === LayoutVariant.THREE_PANEL ? '100%' : ''};
|
|
36
49
|
|
|
37
50
|
@media screen and (min-width: ${breakpoints.small}) {
|
|
38
|
-
max-width: var(--layout-${layout}-small-max-width);
|
|
51
|
+
max-width: var(--layout-${$layout}-small-max-width);
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
@media screen and (min-width: ${breakpoints.medium}) {
|
|
42
|
-
max-width: var(--layout-${layout}-medium-max-width);
|
|
55
|
+
max-width: var(--layout-${$layout}-medium-max-width);
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
@media screen and (min-width: ${breakpoints.large}) {
|
|
46
|
-
max-width: var(--layout-${layout}-large-max-width);
|
|
59
|
+
max-width: var(--layout-${$layout}-large-max-width);
|
|
47
60
|
}
|
|
48
61
|
|
|
49
62
|
@media print {
|
|
@@ -59,7 +59,7 @@ export function CodeContainer({
|
|
|
59
59
|
<CodeContainerWrapper
|
|
60
60
|
data-component-name="Markdoc/CodeWalkthrough/CodeContainer"
|
|
61
61
|
ref={compRef}
|
|
62
|
-
hideCodeColors={!isHovered}
|
|
62
|
+
$hideCodeColors={!isHovered}
|
|
63
63
|
onMouseEnter={() => setIsHovered(true)}
|
|
64
64
|
onMouseLeave={() => setIsHovered(false)}
|
|
65
65
|
>
|
|
@@ -69,7 +69,7 @@ export function CodeContainer({
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
const CodeContainerWrapper = styled.div<{ hideCodeColors
|
|
72
|
+
const CodeContainerWrapper = styled.div<{ $hideCodeColors: boolean }>`
|
|
73
73
|
position: relative;
|
|
74
74
|
|
|
75
75
|
display: flex;
|
|
@@ -89,8 +89,8 @@ const CodeContainerWrapper = styled.div<{ hideCodeColors?: boolean }>`
|
|
|
89
89
|
span.line::before {
|
|
90
90
|
color: var(--code-panel-line-numbering-color);
|
|
91
91
|
}
|
|
92
|
-
${({ hideCodeColors }) =>
|
|
93
|
-
hideCodeColors &&
|
|
92
|
+
${({ $hideCodeColors }) =>
|
|
93
|
+
$hideCodeColors &&
|
|
94
94
|
css`
|
|
95
95
|
.line.greyed-out {
|
|
96
96
|
color: var(--text-color-helper) !important;
|
|
@@ -85,7 +85,7 @@ export function CodePanelHeader({
|
|
|
85
85
|
tabRefs.current[i] = el as HTMLButtonElement;
|
|
86
86
|
}}
|
|
87
87
|
data-name={path}
|
|
88
|
-
active={path === activeTabName}
|
|
88
|
+
$active={path === activeTabName}
|
|
89
89
|
key={i}
|
|
90
90
|
onClick={() => handleTabSwitch(path)}
|
|
91
91
|
>
|
|
@@ -173,7 +173,7 @@ const ActionBar = styled.div`
|
|
|
173
173
|
display: flex;
|
|
174
174
|
`;
|
|
175
175
|
|
|
176
|
-
const Tab = styled.button<{ active: boolean }>`
|
|
176
|
+
const Tab = styled.button<{ $active: boolean }>`
|
|
177
177
|
--icon-width: 16px;
|
|
178
178
|
--icon-height: 16px;
|
|
179
179
|
|
|
@@ -188,8 +188,8 @@ const Tab = styled.button<{ active: boolean }>`
|
|
|
188
188
|
color: var(--text-color-secondary);
|
|
189
189
|
white-space: nowrap;
|
|
190
190
|
scroll-margin-right: var(--spacing-base);
|
|
191
|
-
${({ active }) =>
|
|
192
|
-
active
|
|
191
|
+
${({ $active }) =>
|
|
192
|
+
$active
|
|
193
193
|
? css`
|
|
194
194
|
color: var(--text-color-primary);
|
|
195
195
|
background-color: var(--tab-bg-color-filled);
|
|
@@ -18,7 +18,7 @@ export function CodePanelPreview({ children }: PropsWithChildren): JSX.Element {
|
|
|
18
18
|
{translate('codeWalkthrough.preview', 'Preview')}
|
|
19
19
|
{isOpen ? <ChevronUpIcon /> : <ChevronDownIcon />}
|
|
20
20
|
</PreviewDropdown>
|
|
21
|
-
<PreviewContentWrapper isOpen={isOpen}>{children}</PreviewContentWrapper>
|
|
21
|
+
<PreviewContentWrapper $isOpen={isOpen}>{children}</PreviewContentWrapper>
|
|
22
22
|
</CodePanelPreviewWrapper>
|
|
23
23
|
);
|
|
24
24
|
}
|
|
@@ -41,8 +41,8 @@ const PreviewDropdown = styled.div`
|
|
|
41
41
|
cursor: pointer;
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
|
-
const PreviewContentWrapper = styled.div<{ isOpen: boolean }>`
|
|
45
|
-
display: ${({ isOpen }) => (isOpen ? 'grid' : 'none')};
|
|
44
|
+
const PreviewContentWrapper = styled.div<{ $isOpen: boolean }>`
|
|
45
|
+
display: ${({ $isOpen }) => ($isOpen ? 'grid' : 'none')};
|
|
46
46
|
place-items: center;
|
|
47
47
|
|
|
48
48
|
margin: auto 0;
|
|
@@ -147,7 +147,9 @@ export function CodeStep({
|
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
const StepContent = styled.div
|
|
150
|
+
const StepContent = styled.div.withConfig({
|
|
151
|
+
shouldForwardProp: (prop) => prop !== 'isActive',
|
|
152
|
+
})<{ isActive: boolean }>`
|
|
151
153
|
margin: var(--spacing-xs) 0px var(--spacing-xs) calc(var(--spacing-unit) * 3.5);
|
|
152
154
|
padding: var(--spacing-md) var(--spacing-lg);
|
|
153
155
|
background: ${({ isActive }) => (isActive ? 'var(--layer-color)' : 'none')};
|
|
@@ -163,7 +165,9 @@ const StepHeading = styled.p`
|
|
|
163
165
|
font-weight: var(--font-weight-semibold);
|
|
164
166
|
`;
|
|
165
167
|
|
|
166
|
-
export const StepWrapper = styled.div
|
|
168
|
+
export const StepWrapper = styled.div.withConfig({
|
|
169
|
+
shouldForwardProp: (prop) => !['isActive', 'scrollMarginTop'].includes(prop),
|
|
170
|
+
})<{ isActive: boolean; scrollMarginTop: number; className?: string }>`
|
|
167
171
|
position: relative;
|
|
168
172
|
scroll-margin-top: ${({ scrollMarginTop }) => scrollMarginTop}px;
|
|
169
173
|
|