@redocly/theme 0.69.0-next.1 → 0.69.0-next.10
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/Accordion/Accordion.js +5 -1
- package/lib/components/Accordion/variables.js +1 -1
- package/lib/components/Admonition/Admonition.d.ts +1 -1
- package/lib/components/Admonition/Admonition.js +1 -1
- package/lib/components/Admonition/variables.dark.js +2 -2
- package/lib/components/Admonition/variables.js +10 -10
- package/lib/components/Badge/Badge.d.ts +3 -1
- package/lib/components/Badge/Badge.js +7 -2
- package/lib/components/Banner/variables.dark.js +2 -0
- package/lib/components/Banner/variables.js +3 -1
- package/lib/components/Breadcrumbs/Breadcrumb.js +1 -1
- package/lib/components/Breadcrumbs/variables.js +1 -1
- package/lib/components/Button/ButtonGroup.d.ts +3 -5
- package/lib/components/Button/ButtonGroup.js +25 -5
- package/lib/components/Button/variables.js +27 -4
- package/lib/components/Buttons/ConnectMCPButton.js +39 -123
- package/lib/components/Buttons/CopyButton.js +12 -1
- package/lib/components/Buttons/variables.d.ts +0 -1
- package/lib/components/Buttons/variables.js +3 -44
- package/lib/components/Catalog/CatalogEntities.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +5 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.js +1 -0
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
- package/lib/components/Catalog/CatalogViewModeToggle.js +2 -43
- package/lib/components/Catalog/variables.js +5 -5
- package/lib/components/CatalogClassic/variables.js +2 -2
- package/lib/components/CodeBlock/CodeBlock.js +2 -1
- package/lib/components/CodeBlock/CodeBlockContainer.js +1 -0
- package/lib/components/Dropdown/Dropdown.d.ts +10 -20
- package/lib/components/Dropdown/Dropdown.js +13 -2
- package/lib/components/Dropdown/DropdownMenuItemContent.d.ts +9 -0
- package/lib/components/Dropdown/DropdownMenuItemContent.js +56 -0
- package/lib/components/Dropdown/variables.js +19 -2
- package/lib/components/Feedback/Mood.js +18 -14
- package/lib/components/Feedback/Rating.js +18 -13
- package/lib/components/Feedback/Scale.js +27 -22
- package/lib/components/Feedback/Sentiment.js +17 -13
- package/lib/components/Filter/FilterInput.js +4 -2
- package/lib/components/Filter/FilterSelect.js +1 -0
- package/lib/components/Filter/variables.js +2 -2
- package/lib/components/Image/variables.js +5 -3
- package/lib/components/JsonViewer/Helpers.js +12 -42
- package/lib/components/LanguagePicker/variables.js +1 -1
- package/lib/components/MCP/McpConnectionTabs.d.ts +7 -0
- package/lib/components/MCP/McpConnectionTabs.js +151 -0
- package/lib/components/Markdown/styles/base-table.js +8 -0
- package/lib/components/Markdown/variables.js +1 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/Menu/variables.js +1 -1
- package/lib/components/Navbar/variables.js +1 -1
- package/lib/components/PageActions/PageActions.js +4 -6
- package/lib/components/PageActions/PageActionsMenuItem.d.ts +4 -4
- package/lib/components/PageActions/PageActionsMenuItem.js +27 -43
- package/lib/components/Panel/Panel.js +5 -1
- package/lib/components/Panel/variables.js +1 -1
- package/lib/components/Product/variables.js +2 -1
- package/lib/components/ReplayGate/ReplayGate.d.ts +1 -0
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +22 -32
- package/lib/components/Search/SearchAiDialog.js +4 -1
- package/lib/components/Search/SearchAiMessage.js +1 -1
- package/lib/components/Search/SearchAiNegativeFeedbackForm.js +2 -2
- package/lib/components/Search/SearchDialog.js +2 -2
- package/lib/components/Search/SearchItem.js +6 -3
- package/lib/components/Search/SearchRecent.js +1 -0
- package/lib/components/Search/SearchSuggestedPages.js +1 -0
- package/lib/components/Search/variables.js +9 -5
- package/lib/components/Segmented/Segmented.js +3 -3
- package/lib/components/Select/Select.js +30 -23
- package/lib/components/Select/variables.js +3 -3
- package/lib/components/Sidebar/Sidebar.js +2 -38
- package/lib/components/SplitButton/SplitButton.d.ts +21 -0
- package/lib/components/SplitButton/SplitButton.js +37 -0
- package/lib/components/Switch/variables.dark.js +2 -2
- package/lib/components/Switch/variables.js +2 -2
- package/lib/components/Tag/variables.js +2 -2
- package/lib/components/Tags/variables.js +1 -1
- package/lib/components/Toast/variables.js +1 -1
- package/lib/components/Tooltip/AnchorTooltip.js +2 -2
- package/lib/components/Tooltip/JsTooltip.js +2 -2
- package/lib/components/UserMenu/variables.js +1 -1
- package/lib/core/constants/mcp.d.ts +4 -0
- package/lib/core/constants/mcp.js +10 -1
- package/lib/core/constants/search.js +2 -2
- package/lib/core/contexts/PageActionsContext.d.ts +5 -0
- package/lib/core/contexts/PageActionsContext.js +10 -0
- package/lib/core/contexts/index.d.ts +1 -0
- package/lib/core/contexts/index.js +1 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +5 -17
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +1 -0
- package/lib/core/hooks/menu/use-menu-item-expanded.js +1 -0
- package/lib/core/hooks/use-active-heading.js +59 -15
- package/lib/core/hooks/use-active-section-id.js +3 -1
- package/lib/core/hooks/use-connect-mcp-button.d.ts +1 -1
- package/lib/core/hooks/use-connect-mcp-button.js +16 -13
- package/lib/core/hooks/use-control.js +3 -0
- package/lib/core/hooks/use-local-state.js +1 -0
- package/lib/core/hooks/use-mcp-config.d.ts +2 -0
- package/lib/core/hooks/use-mcp-config.js +14 -4
- package/lib/core/hooks/use-mobile-menu.js +10 -2
- package/lib/core/styles/global.js +16 -11
- package/lib/core/styles/palette.js +2 -0
- package/lib/core/types/button-group.d.ts +2 -0
- package/lib/core/types/button-group.js +3 -0
- package/lib/core/types/catalog.d.ts +2 -4
- package/lib/core/types/common.d.ts +2 -0
- package/lib/core/types/hooks.d.ts +1 -0
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/mcp.d.ts +1 -1
- package/lib/core/utils/RenderWithLink.d.ts +2 -0
- package/lib/core/utils/RenderWithLink.js +20 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/mcp.d.ts +5 -0
- package/lib/core/utils/mcp.js +35 -0
- package/lib/icons/CodexIcon/CodexIcon.d.ts +25 -0
- package/lib/icons/CodexIcon/CodexIcon.js +22 -0
- package/lib/icons/LinkIcon/LinkIcon.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/layouts/McpNotAllowed.js +10 -10
- package/lib/markdoc/components/Cards/Card.d.ts +8 -1
- package/lib/markdoc/components/Cards/Card.js +55 -16
- package/lib/markdoc/components/Cards/CardBadge.d.ts +9 -0
- package/lib/markdoc/components/Cards/CardBadge.js +30 -0
- package/lib/markdoc/components/Cards/CardIcon.d.ts +5 -4
- package/lib/markdoc/components/Cards/CardIcon.js +6 -3
- package/lib/markdoc/components/Cards/variables.dark.js +32 -0
- package/lib/markdoc/components/Cards/variables.js +81 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +1 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/variables.js +2 -1
- package/lib/markdoc/components/Heading/Heading.js +5 -2
- package/lib/markdoc/components/Tabs/TabList.js +6 -2
- package/lib/markdoc/components/Tabs/Tabs.js +4 -2
- package/lib/markdoc/components/Tabs/variables.js +4 -4
- package/lib/markdoc/tags/admonition.js +1 -1
- package/lib/markdoc/tags/card.js +14 -0
- package/lib/markdoc/tags/connect-mcp.js +2 -1
- package/package.json +19 -10
- package/src/components/Accordion/Accordion.tsx +7 -3
- package/src/components/Accordion/variables.ts +1 -1
- package/src/components/Admonition/Admonition.tsx +2 -2
- package/src/components/Admonition/variables.dark.ts +2 -2
- package/src/components/Admonition/variables.ts +10 -10
- package/src/components/Badge/Badge.tsx +16 -2
- package/src/components/Banner/variables.dark.ts +2 -0
- package/src/components/Banner/variables.ts +3 -1
- package/src/components/Breadcrumbs/Breadcrumb.tsx +1 -1
- package/src/components/Breadcrumbs/variables.ts +1 -1
- package/src/components/Button/ButtonGroup.tsx +28 -10
- package/src/components/Button/variables.ts +27 -4
- package/src/components/Buttons/ConnectMCPButton.tsx +88 -145
- package/src/components/Buttons/CopyButton.tsx +14 -2
- package/src/components/Buttons/variables.ts +2 -44
- package/src/components/Catalog/CatalogEntities.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +6 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilterSelect.tsx +1 -0
- package/src/components/Catalog/CatalogViewModeToggle.tsx +2 -17
- package/src/components/Catalog/variables.ts +5 -5
- package/src/components/CatalogClassic/variables.ts +2 -2
- package/src/components/CodeBlock/CodeBlock.tsx +2 -1
- package/src/components/CodeBlock/CodeBlockContainer.tsx +1 -0
- package/src/components/Dropdown/Dropdown.tsx +25 -4
- package/src/components/Dropdown/DropdownMenuItemContent.tsx +72 -0
- package/src/components/Dropdown/variables.ts +19 -2
- package/src/components/Feedback/Mood.tsx +22 -15
- package/src/components/Feedback/Rating.tsx +22 -14
- package/src/components/Feedback/Scale.tsx +40 -32
- package/src/components/Feedback/Sentiment.tsx +21 -14
- package/src/components/Filter/FilterInput.tsx +5 -3
- package/src/components/Filter/FilterSelect.tsx +1 -0
- package/src/components/Filter/variables.ts +2 -2
- package/src/components/Image/variables.ts +5 -3
- package/src/components/JsonViewer/Helpers.tsx +13 -9
- package/src/components/LanguagePicker/variables.ts +1 -1
- package/src/components/MCP/McpConnectionTabs.tsx +263 -0
- package/src/components/Markdown/styles/base-table.ts +8 -0
- package/src/components/Markdown/variables.ts +1 -1
- package/src/components/Menu/MenuItem.tsx +2 -2
- package/src/components/Menu/variables.ts +1 -1
- package/src/components/Navbar/variables.ts +1 -1
- package/src/components/PageActions/PageActions.tsx +22 -23
- package/src/components/PageActions/PageActionsMenuItem.tsx +41 -55
- package/src/components/Panel/Panel.tsx +7 -3
- package/src/components/Panel/variables.ts +1 -1
- package/src/components/Product/variables.ts +2 -1
- package/src/components/ReplayGate/ReplayGate.tsx +3 -0
- package/src/components/Search/FilterFields/SearchFilterFieldSelect.tsx +32 -40
- package/src/components/Search/SearchAiDialog.tsx +4 -1
- package/src/components/Search/SearchAiMessage.tsx +1 -1
- package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +2 -2
- package/src/components/Search/SearchDialog.tsx +2 -2
- package/src/components/Search/SearchItem.tsx +7 -1
- package/src/components/Search/SearchRecent.tsx +1 -0
- package/src/components/Search/SearchSuggestedPages.tsx +1 -0
- package/src/components/Search/variables.ts +9 -5
- package/src/components/Segmented/Segmented.tsx +6 -3
- package/src/components/Select/Select.tsx +36 -22
- package/src/components/Select/variables.ts +3 -3
- package/src/components/Sidebar/Sidebar.tsx +2 -6
- package/src/components/SplitButton/SplitButton.tsx +95 -0
- package/src/components/Switch/variables.dark.ts +2 -2
- package/src/components/Switch/variables.ts +2 -2
- package/src/components/Tag/variables.ts +2 -2
- package/src/components/Tags/variables.ts +1 -1
- package/src/components/Toast/variables.ts +1 -1
- package/src/components/Tooltip/AnchorTooltip.tsx +2 -2
- package/src/components/Tooltip/JsTooltip.tsx +2 -2
- package/src/components/UserMenu/variables.ts +1 -1
- package/src/core/constants/mcp.ts +14 -0
- package/src/core/constants/search.ts +2 -2
- package/src/core/contexts/PageActionsContext.tsx +7 -0
- package/src/core/contexts/index.ts +1 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +6 -20
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +1 -0
- package/src/core/hooks/menu/use-menu-item-expanded.ts +1 -0
- package/src/core/hooks/use-active-heading.ts +79 -15
- package/src/core/hooks/use-active-section-id.ts +3 -1
- package/src/core/hooks/use-connect-mcp-button.ts +23 -15
- package/src/core/hooks/use-control.ts +5 -1
- package/src/core/hooks/use-local-state.ts +1 -0
- package/src/core/hooks/use-mcp-config.ts +15 -4
- package/src/core/hooks/use-mobile-menu.ts +11 -3
- package/src/core/openapi/index.ts +1 -1
- package/src/core/styles/global.ts +17 -12
- package/src/core/styles/palette.ts +2 -0
- package/src/core/types/button-group.ts +2 -0
- package/src/core/types/catalog.ts +2 -4
- package/src/core/types/common.ts +3 -0
- package/src/core/types/hooks.ts +1 -0
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +29 -1
- package/src/core/types/mcp.ts +1 -1
- package/src/core/utils/RenderWithLink.tsx +19 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/mcp.ts +39 -0
- package/src/icons/CodexIcon/CodexIcon.tsx +23 -0
- package/src/icons/LinkIcon/LinkIcon.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/layouts/McpNotAllowed.tsx +37 -11
- package/src/markdoc/components/Cards/Card.tsx +79 -14
- package/src/markdoc/components/Cards/CardBadge.tsx +39 -0
- package/src/markdoc/components/Cards/CardIcon.tsx +16 -5
- package/src/markdoc/components/Cards/variables.dark.ts +32 -0
- package/src/markdoc/components/Cards/variables.ts +81 -7
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +1 -0
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/variables.ts +2 -1
- package/src/markdoc/components/Heading/Heading.tsx +7 -4
- package/src/markdoc/components/Tabs/TabList.tsx +6 -2
- package/src/markdoc/components/Tabs/Tabs.tsx +4 -2
- package/src/markdoc/components/Tabs/variables.ts +4 -4
- package/src/markdoc/tags/admonition.ts +1 -1
- package/src/markdoc/tags/card.ts +14 -0
- package/src/markdoc/tags/connect-mcp.ts +3 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { JSX } from 'react';
|
|
@@ -23,14 +23,16 @@ export function JsonValue(props: {
|
|
|
23
23
|
expandAllSignal ?? level < defaultExpandLevel,
|
|
24
24
|
);
|
|
25
25
|
const isExpanded = expandAllSignal !== undefined && level > 0 ? expandAllSignal : isExpandedState;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const [prevExpandAllSignal, setPrevExpandAllSignal] = React.useState(expandAllSignal);
|
|
27
|
+
const [prevLevel, setPrevLevel] = React.useState(level);
|
|
28
|
+
|
|
29
|
+
if (prevExpandAllSignal !== expandAllSignal || prevLevel !== level) {
|
|
30
|
+
setPrevExpandAllSignal(expandAllSignal);
|
|
31
|
+
setPrevLevel(level);
|
|
32
|
+
if (expandAllSignal !== undefined && !(expandAllSignal === false && level === 0)) {
|
|
31
33
|
setExpanded(expandAllSignal);
|
|
32
34
|
}
|
|
33
|
-
}
|
|
35
|
+
}
|
|
34
36
|
|
|
35
37
|
const keys: string[] =
|
|
36
38
|
(value && Object.keys(value).filter((key) => value[key] !== undefined)) || []; // filter out undefined properties
|
|
@@ -131,12 +133,14 @@ function JsonKeyValue(props: {
|
|
|
131
133
|
expandAllSignal ?? level < defaultExpandLevel,
|
|
132
134
|
);
|
|
133
135
|
const isExpanded = expandAllSignal !== undefined ? expandAllSignal : isExpandedState;
|
|
136
|
+
const [prevExpandAllSignal, setPrevExpandAllSignal] = React.useState(expandAllSignal);
|
|
134
137
|
|
|
135
|
-
|
|
138
|
+
if (prevExpandAllSignal !== expandAllSignal) {
|
|
139
|
+
setPrevExpandAllSignal(expandAllSignal);
|
|
136
140
|
if (expandAllSignal !== undefined) {
|
|
137
141
|
setExpanded(expandAllSignal);
|
|
138
142
|
}
|
|
139
|
-
}
|
|
143
|
+
}
|
|
140
144
|
|
|
141
145
|
const openingPunctuation = Array.isArray(value) ? '[' : '{';
|
|
142
146
|
const closingPunctuation = Array.isArray(value) ? ']' : '}';
|
|
@@ -22,7 +22,7 @@ export const languagePicker = css`
|
|
|
22
22
|
--language-picker-dropdown-item-padding-vertical: var(--dropdown-menu-item-padding-vertical); // @presenter Spacing
|
|
23
23
|
--language-picker-dropdown-item-separator-padding-top: var(--dropdown-menu-item-separator-padding-top ); // @presenter Spacing
|
|
24
24
|
--language-picker-dropdown-item-separator-padding-bottom: var(--dropdown-menu-item-separator-padding-bottom ); // @presenter Spacing
|
|
25
|
-
--language-picker-dropdown-item-border-radius: var(--dropdown-menu-item-border-radius
|
|
25
|
+
--language-picker-dropdown-item-border-radius: var(--dropdown-menu-item-border-radius); // @presenter BorderRadius
|
|
26
26
|
--language-picker-dropdown-item-bg-color-active: var(--dropdown-menu-item-bg-color-active); // @presenter Color
|
|
27
27
|
--language-picker-dropdown-item-bg-color-hover: var(--dropdown-menu-item-bg-color-hover); // @presenter Color
|
|
28
28
|
--language-picker-dropdown-item-bg-color-disabled: var(--dropdown-menu-item-bg-color-disabled); // @presenter Color
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { JSX, ReactNode } from 'react';
|
|
5
|
+
import type { TFunction } from '@redocly/theme/core/types';
|
|
6
|
+
|
|
7
|
+
import { useMCPConfig, useThemeHooks } from '@redocly/theme/core/hooks';
|
|
8
|
+
import {
|
|
9
|
+
generateClaudeCodeCommand,
|
|
10
|
+
generateClaudeDesktopConfig,
|
|
11
|
+
generateCodexCommand,
|
|
12
|
+
generateMcpInstallPrompt,
|
|
13
|
+
} from '@redocly/theme/core/utils';
|
|
14
|
+
import { CodeBlock } from '@redocly/theme/components/CodeBlock/CodeBlock';
|
|
15
|
+
import { ClaudeIcon } from '@redocly/theme/icons/ClaudeIcon/ClaudeIcon';
|
|
16
|
+
import { ChatGptIcon } from '@redocly/theme/icons/ChatGptIcon/ChatGptIcon';
|
|
17
|
+
import { Tabs, TabsSize } from '@redocly/theme/markdoc/components/Tabs/Tabs';
|
|
18
|
+
import { TabItemFragment } from '@redocly/theme/markdoc/components/Tabs/TabItemFragment';
|
|
19
|
+
import { NumberedList } from '@redocly/theme/markdoc/components/NumberedList/NumberedList';
|
|
20
|
+
import { NumberedItem } from '@redocly/theme/markdoc/components/NumberedList/NumberedItem';
|
|
21
|
+
|
|
22
|
+
export type McpConnectionTab = 'claude' | 'chatgpt' | 'json';
|
|
23
|
+
|
|
24
|
+
export type McpConnectionTabsProps = {
|
|
25
|
+
options?: McpConnectionTab[];
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const DEFAULT_TAB_OPTIONS: McpConnectionTab[] = ['claude', 'chatgpt', 'json'];
|
|
30
|
+
|
|
31
|
+
const TAB_LABELS: Record<
|
|
32
|
+
McpConnectionTab,
|
|
33
|
+
{ translationKey: string; defaultLabel: string; icon?: React.ComponentType }
|
|
34
|
+
> = {
|
|
35
|
+
claude: {
|
|
36
|
+
translationKey: 'page.mcpNotAllowed.tabs.claude',
|
|
37
|
+
defaultLabel: 'Claude',
|
|
38
|
+
icon: ClaudeIcon,
|
|
39
|
+
},
|
|
40
|
+
chatgpt: {
|
|
41
|
+
translationKey: 'page.mcpNotAllowed.tabs.chatgpt',
|
|
42
|
+
defaultLabel: 'ChatGPT',
|
|
43
|
+
icon: ChatGptIcon,
|
|
44
|
+
},
|
|
45
|
+
json: { translationKey: 'page.mcpNotAllowed.tabs.json', defaultLabel: 'JSON' },
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type TabClient = { headline: string; content: ReactNode };
|
|
49
|
+
|
|
50
|
+
// The report control is docs feedback, not useful on the connection page.
|
|
51
|
+
const CODE_BLOCK_HEADER = { controls: { copy: {}, report: { hidden: true } } };
|
|
52
|
+
|
|
53
|
+
export function McpConnectionTabs({
|
|
54
|
+
options = DEFAULT_TAB_OPTIONS,
|
|
55
|
+
className,
|
|
56
|
+
}: McpConnectionTabsProps): JSX.Element | null {
|
|
57
|
+
const { useTranslate } = useThemeHooks();
|
|
58
|
+
const { translate } = useTranslate();
|
|
59
|
+
const { serverName, serverUrl, isMcpDisabled } = useMCPConfig();
|
|
60
|
+
// The SSR markup of error pages is cached with the build-time origin, so the
|
|
61
|
+
// tabs remount after hydration to pick up the real browser origin.
|
|
62
|
+
const [hydrated, setHydrated] = useState(false);
|
|
63
|
+
|
|
64
|
+
useEffect(() => setHydrated(true), []);
|
|
65
|
+
|
|
66
|
+
if (isMcpDisabled) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const connection = { serverName, url: serverUrl };
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<McpConnectionTabsWrapper
|
|
74
|
+
key={hydrated ? 'client' : 'ssr'}
|
|
75
|
+
data-component-name="MCP/McpConnectionTabs"
|
|
76
|
+
data-testid="mcp-connection-tabs"
|
|
77
|
+
className={className}
|
|
78
|
+
>
|
|
79
|
+
<Tabs size={TabsSize.SMALL}>
|
|
80
|
+
{options.map((option) => {
|
|
81
|
+
const { translationKey, defaultLabel, icon: TabIcon } = TAB_LABELS[option];
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<TabItemFragment
|
|
85
|
+
key={option}
|
|
86
|
+
label={translate(translationKey, defaultLabel)}
|
|
87
|
+
icon={TabIcon ? <TabIcon /> : undefined}
|
|
88
|
+
>
|
|
89
|
+
{renderTabContent(option, connection, translate)}
|
|
90
|
+
</TabItemFragment>
|
|
91
|
+
);
|
|
92
|
+
})}
|
|
93
|
+
</Tabs>
|
|
94
|
+
</McpConnectionTabsWrapper>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function renderTabContent(
|
|
99
|
+
option: McpConnectionTab,
|
|
100
|
+
connection: { serverName: string; url: string },
|
|
101
|
+
translate: TFunction,
|
|
102
|
+
): ReactNode {
|
|
103
|
+
const terminalHint = (
|
|
104
|
+
<TabHint>
|
|
105
|
+
{translate('page.mcpNotAllowed.snippets.terminal.hint', 'Run this command in your terminal:')}
|
|
106
|
+
</TabHint>
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const urlBlock = <CodeBlock lang="text" source={connection.url} header={CODE_BLOCK_HEADER} />;
|
|
110
|
+
|
|
111
|
+
const assistantPromptClient: TabClient = {
|
|
112
|
+
headline: translate('page.mcpNotAllowed.snippets.prompt.headline', 'Prompt'),
|
|
113
|
+
content: (
|
|
114
|
+
<>
|
|
115
|
+
<TabHint>
|
|
116
|
+
{translate(
|
|
117
|
+
'page.mcpNotAllowed.snippets.prompt.hint',
|
|
118
|
+
'Or paste this prompt into the chat to have it add the server for you:',
|
|
119
|
+
)}
|
|
120
|
+
</TabHint>
|
|
121
|
+
<CodeBlock
|
|
122
|
+
lang="text"
|
|
123
|
+
source={generateMcpInstallPrompt(connection)}
|
|
124
|
+
header={CODE_BLOCK_HEADER}
|
|
125
|
+
wrapContents
|
|
126
|
+
/>
|
|
127
|
+
</>
|
|
128
|
+
),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
switch (option) {
|
|
132
|
+
case 'claude':
|
|
133
|
+
return renderClientList([
|
|
134
|
+
{
|
|
135
|
+
headline: translate('page.mcpNotAllowed.snippets.claudeCode.headline', 'Claude Code'),
|
|
136
|
+
content: (
|
|
137
|
+
<>
|
|
138
|
+
{terminalHint}
|
|
139
|
+
<CodeBlock
|
|
140
|
+
lang="shell"
|
|
141
|
+
source={generateClaudeCodeCommand(connection)}
|
|
142
|
+
header={CODE_BLOCK_HEADER}
|
|
143
|
+
wrapContents
|
|
144
|
+
/>
|
|
145
|
+
</>
|
|
146
|
+
),
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
headline: translate(
|
|
150
|
+
'page.mcpNotAllowed.snippets.claudeDesktop.headline',
|
|
151
|
+
'Claude Desktop',
|
|
152
|
+
),
|
|
153
|
+
content: (
|
|
154
|
+
<>
|
|
155
|
+
<TabHint>
|
|
156
|
+
{translate(
|
|
157
|
+
'page.mcpNotAllowed.snippets.claudeDesktop.instruction',
|
|
158
|
+
'In Claude Desktop, open Settings → Developer → Edit Config, add this to the configuration file, and restart Claude Desktop:',
|
|
159
|
+
)}
|
|
160
|
+
</TabHint>
|
|
161
|
+
<CodeBlock
|
|
162
|
+
lang="json"
|
|
163
|
+
source={generateClaudeDesktopConfig(connection)}
|
|
164
|
+
header={CODE_BLOCK_HEADER}
|
|
165
|
+
/>
|
|
166
|
+
</>
|
|
167
|
+
),
|
|
168
|
+
},
|
|
169
|
+
]);
|
|
170
|
+
case 'chatgpt':
|
|
171
|
+
return renderClientList([
|
|
172
|
+
{
|
|
173
|
+
headline: translate('page.mcpNotAllowed.snippets.codexCli.headline', 'Codex CLI'),
|
|
174
|
+
content: (
|
|
175
|
+
<>
|
|
176
|
+
{terminalHint}
|
|
177
|
+
<CodeBlock
|
|
178
|
+
lang="shell"
|
|
179
|
+
source={generateCodexCommand(connection)}
|
|
180
|
+
header={CODE_BLOCK_HEADER}
|
|
181
|
+
wrapContents
|
|
182
|
+
/>
|
|
183
|
+
</>
|
|
184
|
+
),
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
headline: translate(
|
|
188
|
+
'page.mcpNotAllowed.snippets.chatgptApp.headline',
|
|
189
|
+
'ChatGPT desktop app',
|
|
190
|
+
),
|
|
191
|
+
content: (
|
|
192
|
+
<>
|
|
193
|
+
<TabHint>
|
|
194
|
+
{translate(
|
|
195
|
+
'page.mcpNotAllowed.snippets.chatgptApp.instruction',
|
|
196
|
+
'In the ChatGPT desktop app, go to Settings → Plugins → MCPs and add a server with the "Streamable HTTP" type and this URL (restart the app afterwards):',
|
|
197
|
+
)}
|
|
198
|
+
</TabHint>
|
|
199
|
+
{urlBlock}
|
|
200
|
+
</>
|
|
201
|
+
),
|
|
202
|
+
},
|
|
203
|
+
assistantPromptClient,
|
|
204
|
+
]);
|
|
205
|
+
case 'json':
|
|
206
|
+
return (
|
|
207
|
+
<>
|
|
208
|
+
<TabHint>
|
|
209
|
+
{translate(
|
|
210
|
+
'page.mcpNotAllowed.snippets.json.hint',
|
|
211
|
+
'Add this server entry to your MCP client configuration file:',
|
|
212
|
+
)}
|
|
213
|
+
</TabHint>
|
|
214
|
+
<CodeBlock
|
|
215
|
+
lang="json"
|
|
216
|
+
source={JSON.stringify(
|
|
217
|
+
{ [connection.serverName]: { url: connection.url, description: 'MCP Server' } },
|
|
218
|
+
null,
|
|
219
|
+
2,
|
|
220
|
+
)}
|
|
221
|
+
header={CODE_BLOCK_HEADER}
|
|
222
|
+
/>
|
|
223
|
+
</>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function renderClientList(clients: TabClient[]): ReactNode {
|
|
229
|
+
return (
|
|
230
|
+
<NumberedList>
|
|
231
|
+
{clients.map((client, index) => (
|
|
232
|
+
<NumberedItem
|
|
233
|
+
key={index}
|
|
234
|
+
type="dot"
|
|
235
|
+
size="small"
|
|
236
|
+
headline={client.headline}
|
|
237
|
+
index={index + 1}
|
|
238
|
+
isLast={index === clients.length - 1}
|
|
239
|
+
>
|
|
240
|
+
{client.content}
|
|
241
|
+
</NumberedItem>
|
|
242
|
+
))}
|
|
243
|
+
</NumberedList>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const McpConnectionTabsWrapper = styled.div`
|
|
248
|
+
--md-numbered-list-margin: 0 0 var(--spacing-sm);
|
|
249
|
+
|
|
250
|
+
font-size: var(--page-mcp-405-snippets-font-size);
|
|
251
|
+
line-height: var(--page-mcp-405-snippets-line-height);
|
|
252
|
+
text-align: left;
|
|
253
|
+
|
|
254
|
+
/* The copy control floats over the code, so wrapped lines need room to clear it. */
|
|
255
|
+
pre[data-testid='source-code'] {
|
|
256
|
+
padding-right: var(--page-mcp-405-snippets-code-padding-right);
|
|
257
|
+
}
|
|
258
|
+
`;
|
|
259
|
+
|
|
260
|
+
const TabHint = styled.p`
|
|
261
|
+
margin: 0 0 var(--spacing-xs);
|
|
262
|
+
color: var(--page-mcp-405-snippets-hint-text-color);
|
|
263
|
+
`;
|
|
@@ -45,6 +45,14 @@ export const markdownBaseTableCss = css`
|
|
|
45
45
|
background-color: var(--md-table-header-bg-color);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/* hide the header row when every cell is empty; one labelled cell keeps it visible */
|
|
49
|
+
thead:has(th:empty) {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
thead:has(th:not(:empty)) {
|
|
53
|
+
display: table-header-group;
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
tr {
|
|
49
57
|
background-color: var(--md-table-stripe-bg-color);
|
|
50
58
|
}
|
|
@@ -40,7 +40,7 @@ export const markdown = css`
|
|
|
40
40
|
--md-table-line-height: var(--line-height-md); // @presenter FontSize
|
|
41
41
|
--md-table-margin-vertical: 20px; // @presenter Spacing
|
|
42
42
|
--md-table-bg-color: transparent; // @presenter Color
|
|
43
|
-
--md-table-border-radius: var(--border-radius);
|
|
43
|
+
--md-table-border-radius: var(--border-radius-xl);
|
|
44
44
|
|
|
45
45
|
--md-table-border-width: 1px;
|
|
46
46
|
--md-table-header-bg-color: var(--layer-color);
|
|
@@ -122,8 +122,8 @@ function MenuItemImpl(props: React.PropsWithChildren<MenuItemProps>): JSX.Elemen
|
|
|
122
122
|
onClick={handleOnClick}
|
|
123
123
|
onKeyDown={handleExpandOnEnter}
|
|
124
124
|
ref={labelRef}
|
|
125
|
-
role={item.link ? 'none' : 'link'}
|
|
126
|
-
tabIndex={!item.link ? 0 : undefined}
|
|
125
|
+
role={item.link || isSeparator ? 'none' : 'link'}
|
|
126
|
+
tabIndex={!item.link && !isSeparator ? 0 : undefined}
|
|
127
127
|
data-testid="menu-item-label"
|
|
128
128
|
data-active={item.active}
|
|
129
129
|
>
|
|
@@ -56,7 +56,7 @@ export const menu = css`
|
|
|
56
56
|
--menu-item-label-margin: var(--menu-item-label-margin-vertical) var(--menu-item-label-margin-horizontal);
|
|
57
57
|
--menu-item-label-padding: var(--menu-item-padding-vertical) var(--menu-item-padding-horizontal);
|
|
58
58
|
--menu-item-label-gap: var(--spacing-xxs);
|
|
59
|
-
--menu-item-label-border-radius:
|
|
59
|
+
--menu-item-label-border-radius: var(--border-radius-lg);
|
|
60
60
|
--menu-item-label-chevron-size: 12px;
|
|
61
61
|
--menu-item-label-chevron-offset: calc(var(--menu-item-label-gap) + var(--menu-item-label-chevron-size));
|
|
62
62
|
|
|
@@ -27,7 +27,7 @@ export const navbar = css`
|
|
|
27
27
|
|
|
28
28
|
--navbar-item-line-height: var(--line-height-base);
|
|
29
29
|
--navbar-item-bg-color-active: var(--bg-color-active);
|
|
30
|
-
--navbar-item-border-radius: var(--border-radius);
|
|
30
|
+
--navbar-item-border-radius: var(--border-radius-lg);
|
|
31
31
|
--navbar-item-bottom-border: none;
|
|
32
32
|
|
|
33
33
|
--navbar-item-text-color-hover: var(--text-color-primary);
|
|
@@ -7,13 +7,12 @@ import type { PageAction } from '@redocly/theme/core/types';
|
|
|
7
7
|
import { PageActionsMenuItem } from '@redocly/theme/components/PageActions/PageActionsMenuItem';
|
|
8
8
|
import { DropdownMenuItem } from '@redocly/theme/components/Dropdown/DropdownMenuItem';
|
|
9
9
|
import { Link } from '@redocly/theme/components/Link/Link';
|
|
10
|
-
import { ButtonGroup } from '@redocly/theme/components/Button/ButtonGroup';
|
|
11
10
|
import { Button } from '@redocly/theme/components/Button/Button';
|
|
12
|
-
import {
|
|
11
|
+
import { SplitButton } from '@redocly/theme/components/SplitButton/SplitButton';
|
|
13
12
|
import { DropdownMenu } from '@redocly/theme/components/Dropdown/DropdownMenu';
|
|
14
13
|
import { Spinner } from '@redocly/theme/icons/Spinner/Spinner';
|
|
15
14
|
import { CheckmarkFilledIcon } from '@redocly/theme/icons/CheckmarkFilledIcon/CheckmarkFilledIcon';
|
|
16
|
-
import { PageActionType, usePageActions } from '@redocly/theme/core/hooks';
|
|
15
|
+
import { PageActionType, usePageActions, useThemeHooks } from '@redocly/theme/core/hooks';
|
|
17
16
|
|
|
18
17
|
type ActionState = 'idle' | 'processing' | 'done';
|
|
19
18
|
|
|
@@ -28,6 +27,8 @@ const ACTION_DONE_DISPLAY_DURATION = 1000;
|
|
|
28
27
|
export function PageActions(props: PageActionProps): JSX.Element | null {
|
|
29
28
|
const { pageSlug, mcpUrl } = props;
|
|
30
29
|
|
|
30
|
+
const { useTranslate } = useThemeHooks();
|
|
31
|
+
const { translate } = useTranslate();
|
|
31
32
|
const actions = usePageActions(pageSlug || '/', mcpUrl, props.actions);
|
|
32
33
|
|
|
33
34
|
const [actionState, setActionState] = useState<ActionState>('idle');
|
|
@@ -73,27 +74,25 @@ export function PageActions(props: PageActionProps): JSX.Element | null {
|
|
|
73
74
|
|
|
74
75
|
return (
|
|
75
76
|
<PageActionsWrapper data-component-name="PageActions/PageActions">
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
portalled
|
|
89
|
-
trigger={<Button aria-label="More actions" />}
|
|
90
|
-
placement="bottom"
|
|
91
|
-
alignment="end"
|
|
77
|
+
<SplitButton
|
|
78
|
+
portalled
|
|
79
|
+
variant="outlined"
|
|
80
|
+
size="medium"
|
|
81
|
+
toggleAriaLabel={translate('page.actions.moreActions', 'More actions')}
|
|
82
|
+
button={
|
|
83
|
+
<Button
|
|
84
|
+
variant="outlined"
|
|
85
|
+
icon={renderIcon(buttonAction, actionState)}
|
|
86
|
+
to={'link' in buttonAction ? buttonAction.link : undefined}
|
|
87
|
+
external
|
|
88
|
+
onClick={() => handleActionClick(buttonAction)}
|
|
92
89
|
>
|
|
93
|
-
|
|
94
|
-
</
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
{buttonAction.buttonText}
|
|
91
|
+
</Button>
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
{actions.length > 1 ? <StyledDropdownMenu>{menuItems}</StyledDropdownMenu> : null}
|
|
95
|
+
</SplitButton>
|
|
97
96
|
</PageActionsWrapper>
|
|
98
97
|
);
|
|
99
98
|
}
|
|
@@ -1,73 +1,59 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { JSX } from 'react';
|
|
4
5
|
import type { PageAction } from '@redocly/theme/core/types';
|
|
5
6
|
|
|
7
|
+
import { DropdownMenuItemContent } from '@redocly/theme/components/Dropdown/DropdownMenuItemContent';
|
|
6
8
|
import { LaunchIcon } from '@redocly/theme/icons/LaunchIcon/LaunchIcon';
|
|
7
9
|
|
|
8
|
-
type PageActionsMenuItemProps = {
|
|
10
|
+
export type PageActionsMenuItemProps = {
|
|
9
11
|
pageAction: PageAction;
|
|
12
|
+
className?: string;
|
|
10
13
|
};
|
|
11
14
|
|
|
12
|
-
export function PageActionsMenuItem(props: PageActionsMenuItemProps) {
|
|
13
|
-
const { pageAction } = props;
|
|
15
|
+
export function PageActionsMenuItem(props: PageActionsMenuItemProps): JSX.Element {
|
|
16
|
+
const { pageAction, className } = props;
|
|
14
17
|
|
|
15
18
|
return (
|
|
16
|
-
<MenuItemWrapper data-component-name="PageActions/PageActionsMenuItem">
|
|
17
|
-
<
|
|
18
|
-
<pageAction.iconComponent />
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
<MenuItemWrapper data-component-name="PageActions/PageActionsMenuItem" className={className}>
|
|
20
|
+
<DropdownMenuItemContent
|
|
21
|
+
icon={<pageAction.iconComponent />}
|
|
22
|
+
title={
|
|
23
|
+
<>
|
|
24
|
+
{pageAction.title}
|
|
25
|
+
{'link' in pageAction ? (
|
|
26
|
+
<LaunchIcon color="var(--page-actions-menu-item-title-icon-color)" size="14px" />
|
|
27
|
+
) : null}
|
|
28
|
+
</>
|
|
29
|
+
}
|
|
30
|
+
description={pageAction.description}
|
|
31
|
+
/>
|
|
29
32
|
</MenuItemWrapper>
|
|
30
33
|
);
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
const MenuItemWrapper = styled.div`
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
const Title = styled.div`
|
|
59
|
-
font-weight: var(--page-actions-menu-item-title-font-weight);
|
|
60
|
-
font-size: var(--page-actions-menu-item-title-font-size);
|
|
61
|
-
line-height: var(--page-actions-menu-item-title-line-height);
|
|
62
|
-
color: var(--page-actions-menu-item-title-color);
|
|
63
|
-
display: flex;
|
|
64
|
-
align-items: center;
|
|
65
|
-
gap: var(--page-actions-menu-item-title-icon-gap);
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
const Description = styled.div`
|
|
69
|
-
font-weight: var(--page-actions-menu-item-description-font-weight);
|
|
70
|
-
font-size: var(--page-actions-menu-item-description-font-size);
|
|
71
|
-
line-height: var(--page-actions-menu-item-description-line-height);
|
|
72
|
-
color: var(--page-actions-menu-item-description-color);
|
|
37
|
+
--dropdown-menu-item-content-gap: var(--page-actions-menu-item-gap);
|
|
38
|
+
--dropdown-menu-item-content-padding: var(--page-actions-menu-item-padding);
|
|
39
|
+
--dropdown-menu-item-content-icon-size: var(--page-actions-menu-item-icon-wrapper-size);
|
|
40
|
+
--dropdown-menu-item-content-icon-color: var(--page-actions-menu-item-icon-color);
|
|
41
|
+
--dropdown-menu-item-content-icon-border: 1px solid var(--page-actions-menu-item-icon-border-color);
|
|
42
|
+
--dropdown-menu-item-content-icon-border-radius: var(--page-actions-menu-item-icon-border-radius);
|
|
43
|
+
--dropdown-menu-item-content-text-gap: var(--page-actions-menu-item-text-gap);
|
|
44
|
+
--dropdown-menu-item-content-title-icon-gap: var(--page-actions-menu-item-title-icon-gap);
|
|
45
|
+
--dropdown-menu-item-content-title-font-weight: var(--page-actions-menu-item-title-font-weight);
|
|
46
|
+
--dropdown-menu-item-content-title-font-size: var(--page-actions-menu-item-title-font-size);
|
|
47
|
+
--dropdown-menu-item-content-title-line-height: var(--page-actions-menu-item-title-line-height);
|
|
48
|
+
--dropdown-menu-item-content-title-color: var(--page-actions-menu-item-title-color);
|
|
49
|
+
--dropdown-menu-item-content-description-font-weight: var(
|
|
50
|
+
--page-actions-menu-item-description-font-weight
|
|
51
|
+
);
|
|
52
|
+
--dropdown-menu-item-content-description-font-size: var(
|
|
53
|
+
--page-actions-menu-item-description-font-size
|
|
54
|
+
);
|
|
55
|
+
--dropdown-menu-item-content-description-line-height: var(
|
|
56
|
+
--page-actions-menu-item-description-line-height
|
|
57
|
+
);
|
|
58
|
+
--dropdown-menu-item-content-description-color: var(--page-actions-menu-item-description-color);
|
|
73
59
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { BaseSyntheticEvent, PropsWithChildren, ReactNode, JSX } from 'react';
|
|
@@ -34,6 +34,12 @@ export function Panel({
|
|
|
34
34
|
}: PropsWithChildren<PanelProps>): JSX.Element {
|
|
35
35
|
const [isExpanded, setExpanded] = useState(expanded);
|
|
36
36
|
const [animate, setAnimate] = useState(false);
|
|
37
|
+
const [prevExpanded, setPrevExpanded] = useState(expanded);
|
|
38
|
+
|
|
39
|
+
if (prevExpanded !== expanded) {
|
|
40
|
+
setPrevExpanded(expanded);
|
|
41
|
+
setExpanded(expanded);
|
|
42
|
+
}
|
|
37
43
|
|
|
38
44
|
const toggle = ({ target }: BaseSyntheticEvent): void => {
|
|
39
45
|
if (target instanceof HTMLAnchorElement || !isExpandable) return;
|
|
@@ -42,8 +48,6 @@ export function Panel({
|
|
|
42
48
|
onToggle?.(!isExpanded);
|
|
43
49
|
};
|
|
44
50
|
|
|
45
|
-
useEffect(() => setExpanded(expanded), [expanded]);
|
|
46
|
-
|
|
47
51
|
return (
|
|
48
52
|
<PanelWrapper
|
|
49
53
|
className={className}
|
|
@@ -178,7 +178,7 @@ export const apiReferencePanels = css`
|
|
|
178
178
|
* @tokens Panel common
|
|
179
179
|
*/
|
|
180
180
|
|
|
181
|
-
--panel-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
181
|
+
--panel-border-radius: var(--border-radius-xl); // @presenter BorderRadius
|
|
182
182
|
--panel-border: 1px solid var(--border-color-secondary); // @presenter Border
|
|
183
183
|
|
|
184
184
|
--panel-line-height: var(--line-height-base); // @presenter LineHeight
|
|
@@ -25,7 +25,7 @@ export const productPicker = css`
|
|
|
25
25
|
--product-picker-dropdown-item-padding-vertical: var(--dropdown-menu-item-padding-vertical); // @presenter Spacing
|
|
26
26
|
--product-picker-dropdown-item-separator-padding-top: var(--dropdown-menu-item-separator-padding-top ); // @presenter Spacing
|
|
27
27
|
--product-picker-dropdown-item-separator-padding-bottom: var(--dropdown-menu-item-separator-padding-bottom ); // @presenter Spacing
|
|
28
|
-
--product-picker-dropdown-item-border-radius: var(--dropdown-menu-item-border-radius
|
|
28
|
+
--product-picker-dropdown-item-border-radius: var(--dropdown-menu-item-border-radius); // @presenter BorderRadius
|
|
29
29
|
--product-picker-dropdown-item-bg-color-active: var(--dropdown-menu-item-bg-color-active); // @presenter Color
|
|
30
30
|
--product-picker-dropdown-item-bg-color-hover: var(--dropdown-menu-item-bg-color-hover); // @presenter Color
|
|
31
31
|
--product-picker-dropdown-item-bg-color-disabled: var(--dropdown-menu-item-bg-color-disabled); // @presenter Color
|
|
@@ -36,4 +36,5 @@ export const productPicker = css`
|
|
|
36
36
|
--product-picker-dropdown-item-color-hover: var(--dropdown-menu-item-color-hover);
|
|
37
37
|
--product-picker-dropdown-item-border-color-focused: var(--dropdown-menu-item-border-color-focused);
|
|
38
38
|
|
|
39
|
+
// @tokens End
|
|
39
40
|
`;
|
|
@@ -10,6 +10,9 @@ export type ReplayGateProps = {
|
|
|
10
10
|
// The current OpenAPI description's id (from x-metadata), when known. Lets a custom
|
|
11
11
|
// ReplayGate vary behavior per API in a multi-API catalog.
|
|
12
12
|
apiId?: string;
|
|
13
|
+
// Closes the whole Replay overlay. A gate that denies access calls this instead of
|
|
14
|
+
// rendering `children`, so a dismissed gate doesn't leave Replay reachable.
|
|
15
|
+
onClose: () => void;
|
|
13
16
|
children: React.ReactNode;
|
|
14
17
|
};
|
|
15
18
|
|