@redocly/theme 0.69.0-next.1 → 0.69.0-next.11
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 +161 -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/AccordionGroupContext.d.ts +1 -0
- package/lib/core/contexts/AccordionGroupContext.js +6 -0
- package/lib/core/contexts/PageActionsContext.d.ts +5 -0
- package/lib/core/contexts/PageActionsContext.js +10 -0
- package/lib/core/contexts/index.d.ts +2 -0
- package/lib/core/contexts/index.js +2 -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 +2 -0
- package/lib/core/hooks/menu/use-menu-item-expanded.js +1 -0
- package/lib/core/hooks/use-active-heading.js +63 -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 +23 -15
- 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/hooks/use-tabs.js +4 -2
- package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
- package/lib/core/hooks/use-telemetry-fallback.js +2 -0
- 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/Accordion/Accordion.js +6 -6
- package/lib/markdoc/components/Accordion/AccordionGroup.d.ts +2 -1
- package/lib/markdoc/components/Accordion/AccordionGroup.js +39 -3
- 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/accordion-group.js +3 -0
- 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 +285 -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/AccordionGroupContext.tsx +3 -0
- package/src/core/contexts/PageActionsContext.tsx +7 -0
- package/src/core/contexts/index.ts +2 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +2 -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 +2 -0
- package/src/core/hooks/menu/use-menu-item-expanded.ts +1 -0
- package/src/core/hooks/use-active-heading.ts +83 -15
- package/src/core/hooks/use-active-section-id.ts +3 -1
- package/src/core/hooks/use-connect-mcp-button.ts +31 -17
- 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/hooks/use-tabs.ts +4 -2
- package/src/core/hooks/use-telemetry-fallback.ts +2 -0
- 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/Accordion/Accordion.tsx +8 -2
- package/src/markdoc/components/Accordion/AccordionGroup.tsx +9 -2
- 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/accordion-group.ts +3 -0
- 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
|
@@ -20,7 +20,7 @@ import { checkbox } from '@redocly/theme/icons/CheckboxIcon/variables';
|
|
|
20
20
|
import { admonition } from '@redocly/theme/components/Admonition/variables';
|
|
21
21
|
import { footer } from '@redocly/theme/components/Footer/variables';
|
|
22
22
|
import { button } from '@redocly/theme/components/Button/variables';
|
|
23
|
-
import { aiAssistantButton
|
|
23
|
+
import { aiAssistantButton } from '@redocly/theme/components/Buttons/variables';
|
|
24
24
|
import { navbar } from '@redocly/theme/components/Navbar/variables';
|
|
25
25
|
import { search } from '@redocly/theme/components/Search/variables';
|
|
26
26
|
import { menu, mobileMenu } from '@redocly/theme/components/Menu/variables';
|
|
@@ -454,18 +454,24 @@ const borders = css`
|
|
|
454
454
|
|
|
455
455
|
--border-color-primary: var(--color-warm-grey-3); // Raised dividers
|
|
456
456
|
--border-color-secondary: var(--color-warm-grey-2); // Default dividers, borders
|
|
457
|
-
--border-color-
|
|
457
|
+
--border-color-inverse: var(--color-warm-grey-10);
|
|
458
|
+
--border-color-invers: var(--border-color-inverse, var(--color-warm-grey-10)); // Deprecated: use --border-color-inverse
|
|
458
459
|
|
|
459
460
|
/**
|
|
460
461
|
* @tokens Border Radius
|
|
461
462
|
* @presenter BorderRadius
|
|
462
463
|
*/
|
|
463
464
|
|
|
465
|
+
--border-radius-none: 0;
|
|
464
466
|
--border-radius: 4px;
|
|
465
467
|
--border-radius-md: calc(var(--border-radius) * 1.5);
|
|
466
468
|
--border-radius-lg: calc(var(--border-radius) * 2);
|
|
467
469
|
--border-radius-xl: calc(var(--border-radius) * 3);
|
|
468
470
|
--border-radius-xxl: calc(var(--border-radius) * 4);
|
|
471
|
+
--border-radius-xxxl: calc(var(--border-radius) * 6);
|
|
472
|
+
--border-radius-full: 999px;
|
|
473
|
+
|
|
474
|
+
// @tokens End
|
|
469
475
|
`;
|
|
470
476
|
|
|
471
477
|
const headingsTypography = css`
|
|
@@ -824,7 +830,7 @@ const badges = css`
|
|
|
824
830
|
|
|
825
831
|
--badge-text-color: var(--text-color-inverse); // @presenter Color
|
|
826
832
|
--badge-bg-color: var(--color-purple-6); // @presenter Color
|
|
827
|
-
--badge-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
833
|
+
--badge-border-radius: var(--border-radius-md); // @presenter BorderRadius
|
|
828
834
|
|
|
829
835
|
/**
|
|
830
836
|
* @tokens Deprecated Badge
|
|
@@ -832,7 +838,7 @@ const badges = css`
|
|
|
832
838
|
|
|
833
839
|
--badge-deprecated-text-color: var(--color-warm-grey-1); // @presenter Color
|
|
834
840
|
--badge-deprecated-bg-color: var(--color-warning-base); // @presenter Color
|
|
835
|
-
--badge-deprecated-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
841
|
+
--badge-deprecated-border-radius: var(--border-radius-md); // @presenter BorderRadius
|
|
836
842
|
|
|
837
843
|
/**
|
|
838
844
|
* @tokens Webhook Badge
|
|
@@ -840,7 +846,7 @@ const badges = css`
|
|
|
840
846
|
|
|
841
847
|
--badge-webhook-text-color: var(--color-warm-grey-1); // @presenter Color
|
|
842
848
|
--badge-webhook-bg-color: var(--color-purple-7); // @presenter Color
|
|
843
|
-
--badge-webhook-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
849
|
+
--badge-webhook-border-radius: var(--border-radius-md); // @presenter BorderRadius
|
|
844
850
|
|
|
845
851
|
/**
|
|
846
852
|
* @tokens Audience Badge
|
|
@@ -1048,11 +1054,6 @@ const pages = css`
|
|
|
1048
1054
|
--page-mcp-405-margin-vertical-mobile: var(--spacing-xxl);
|
|
1049
1055
|
--page-mcp-405-margin-horizontal-mobile: 1rem;
|
|
1050
1056
|
|
|
1051
|
-
--page-mcp-405-status-text-color: var(--text-color-helper);
|
|
1052
|
-
--page-mcp-405-status-font-size: var(--font-size-lg); // @presenter FontSize
|
|
1053
|
-
--page-mcp-405-status-line-height: var(--line-height-lg); // @presenter LineHeight
|
|
1054
|
-
--page-mcp-405-status-font-weight: var(--font-weight-semibold); // @presenter FontWeight
|
|
1055
|
-
|
|
1056
1057
|
--page-mcp-405-title-text-color: var(--text-color-primary);
|
|
1057
1058
|
--page-mcp-405-title-font-size: 42px; // @presenter FontSize
|
|
1058
1059
|
--page-mcp-405-title-font-weight: var(--font-weight-bold); // @presenter FontWeight
|
|
@@ -1067,6 +1068,11 @@ const pages = css`
|
|
|
1067
1068
|
--page-mcp-405-description-font-size-mobile: var(--font-size-lg);
|
|
1068
1069
|
--page-mcp-405-description-line-height-mobile: var(--line-height-lg);
|
|
1069
1070
|
|
|
1071
|
+
--page-mcp-405-snippets-font-size: var(--font-size-base); // @presenter FontSize
|
|
1072
|
+
--page-mcp-405-snippets-line-height: var(--line-height-base); // @presenter LineHeight
|
|
1073
|
+
--page-mcp-405-snippets-hint-text-color: var(--text-color-secondary);
|
|
1074
|
+
--page-mcp-405-snippets-code-padding-right: var(--spacing-xxl);
|
|
1075
|
+
|
|
1070
1076
|
// @tokens End
|
|
1071
1077
|
|
|
1072
1078
|
/**
|
|
@@ -1264,7 +1270,7 @@ const tree = css`
|
|
|
1264
1270
|
|
|
1265
1271
|
*::-webkit-scrollbar-thumb {
|
|
1266
1272
|
background-color: var(--color-warm-grey-2);
|
|
1267
|
-
border-radius: var(--border-radius);
|
|
1273
|
+
border-radius: var(--border-radius-full);
|
|
1268
1274
|
}
|
|
1269
1275
|
|
|
1270
1276
|
*::-webkit-scrollbar-thumb:hover {
|
|
@@ -1332,7 +1338,6 @@ export const styles = css<{ palette?: string }>`
|
|
|
1332
1338
|
${breadcrumbs}
|
|
1333
1339
|
${button}
|
|
1334
1340
|
${aiAssistantButton}
|
|
1335
|
-
${connectMCPButton}
|
|
1336
1341
|
${cards}
|
|
1337
1342
|
${catalog}
|
|
1338
1343
|
${catalogClassic}
|
|
@@ -212,10 +212,8 @@ export type BffCatalogEntityList = BffCatalogList<BffCatalogEntity>;
|
|
|
212
212
|
export type BffCatalogRelatedEntityList = BffCatalogList<BffCatalogRelatedEntity>;
|
|
213
213
|
|
|
214
214
|
export type Page = {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
hasNextPage: boolean;
|
|
218
|
-
hasPrevPage: boolean;
|
|
215
|
+
nextPage: string | null;
|
|
216
|
+
previousPage: string | null;
|
|
219
217
|
limit: number;
|
|
220
218
|
total: number;
|
|
221
219
|
};
|
package/src/core/types/common.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type React from 'react';
|
|
1
2
|
import { DEFAULT_COLOR_MODES } from '../constants';
|
|
2
3
|
|
|
3
4
|
export type Plural<T extends string> = `${T}s`;
|
|
4
5
|
|
|
5
6
|
export type ColorMode = (typeof DEFAULT_COLOR_MODES)[keyof typeof DEFAULT_COLOR_MODES];
|
|
7
|
+
|
|
8
|
+
export type RenderableChildren<Context> = React.ReactNode | ((context: Context) => React.ReactNode);
|
package/src/core/types/hooks.ts
CHANGED
package/src/core/types/index.ts
CHANGED
package/src/core/types/l10n.ts
CHANGED
|
@@ -134,8 +134,28 @@ export type TranslationKey =
|
|
|
134
134
|
| 'page.forbidden.description'
|
|
135
135
|
| 'page.notFound.title'
|
|
136
136
|
| 'page.notFound.description'
|
|
137
|
+
| 'page.apiNotFound.title'
|
|
138
|
+
| 'page.apiNotFound.description'
|
|
139
|
+
| 'page.apiNotFound.hint'
|
|
140
|
+
| 'page.apiNotFound.backButton'
|
|
137
141
|
| 'page.mcpNotAllowed.title'
|
|
138
142
|
| 'page.mcpNotAllowed.description'
|
|
143
|
+
| 'page.mcpNotAllowed.publicNote'
|
|
144
|
+
| 'page.mcpNotAllowed.publicEndpointHint'
|
|
145
|
+
| 'page.mcpNotAllowed.mainEndpointHint'
|
|
146
|
+
| 'page.mcpNotAllowed.snippets.terminal.hint'
|
|
147
|
+
| 'page.mcpNotAllowed.snippets.claudeCode.headline'
|
|
148
|
+
| 'page.mcpNotAllowed.snippets.claudeDesktop.headline'
|
|
149
|
+
| 'page.mcpNotAllowed.snippets.claudeDesktop.instruction'
|
|
150
|
+
| 'page.mcpNotAllowed.snippets.chatgptApp.headline'
|
|
151
|
+
| 'page.mcpNotAllowed.snippets.chatgptApp.instruction'
|
|
152
|
+
| 'page.mcpNotAllowed.snippets.codexCli.headline'
|
|
153
|
+
| 'page.mcpNotAllowed.snippets.prompt.headline'
|
|
154
|
+
| 'page.mcpNotAllowed.snippets.prompt.hint'
|
|
155
|
+
| 'page.mcpNotAllowed.snippets.json.hint'
|
|
156
|
+
| 'page.mcpNotAllowed.tabs.claude'
|
|
157
|
+
| 'page.mcpNotAllowed.tabs.chatgpt'
|
|
158
|
+
| 'page.mcpNotAllowed.tabs.json'
|
|
139
159
|
| 'page.lastUpdated.timeago'
|
|
140
160
|
| 'page.lastUpdated.on'
|
|
141
161
|
| 'catalog.filters.placeholder'
|
|
@@ -271,8 +291,14 @@ export type TranslationKey =
|
|
|
271
291
|
| 'page.actions.connectMcp.cursorDescription'
|
|
272
292
|
| 'page.actions.connectMcp.vscode'
|
|
273
293
|
| 'page.actions.connectMcp.vscodeDescription'
|
|
294
|
+
| 'page.actions.connectMcp.claudeCode'
|
|
295
|
+
| 'page.actions.connectMcp.claudeCodeDescription'
|
|
296
|
+
| 'page.actions.connectMcp.codex'
|
|
297
|
+
| 'page.actions.connectMcp.codexDescription'
|
|
274
298
|
| 'page.actions.connectMcp.copyConfig'
|
|
275
299
|
| 'page.actions.connectMcp.copyConfigDescription'
|
|
300
|
+
| 'page.actions.connectMcp.moreOptions'
|
|
301
|
+
| 'page.actions.moreActions'
|
|
276
302
|
| 'openapi.download.description.title'
|
|
277
303
|
| 'openapi.info.title'
|
|
278
304
|
| 'openapi.info.contact.url'
|
|
@@ -280,6 +306,7 @@ export type TranslationKey =
|
|
|
280
306
|
| 'openapi.info.license'
|
|
281
307
|
| 'openapi.info.termsOfService'
|
|
282
308
|
| 'openapi.info.metadata.title'
|
|
309
|
+
| 'graphql.info.metadata.title'
|
|
283
310
|
| 'openapi.key'
|
|
284
311
|
| 'openapi.value'
|
|
285
312
|
| 'openapi.enum'
|
|
@@ -369,6 +396,8 @@ export type TranslationKey =
|
|
|
369
396
|
| 'openapi.mcp.inputExample'
|
|
370
397
|
| 'openapi.mcp.outputSchema'
|
|
371
398
|
| 'openapi.mcp.outputExample'
|
|
399
|
+
| 'openapi.mcp.exampleTitle'
|
|
400
|
+
| 'openapi.mcp.argumentsExample'
|
|
372
401
|
| 'asyncapi.download.description.title'
|
|
373
402
|
| 'asyncapi.info.title'
|
|
374
403
|
| 'asyncapi.info.contact.url'
|
|
@@ -449,7 +478,6 @@ export type TranslationKey =
|
|
|
449
478
|
| 'graphql.sample'
|
|
450
479
|
| 'graphql.referenced'
|
|
451
480
|
| 'graphql.content.fragment'
|
|
452
|
-
| 'button.copy.tooltipText'
|
|
453
481
|
| 'button.download.tooltipText'
|
|
454
482
|
| 'button.externalLink.tooltipText'
|
|
455
483
|
| 'button.email.tooltipText'
|
package/src/core/types/mcp.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { JSX } from 'react';
|
|
4
|
+
|
|
5
|
+
// Splits a translated sentence on <link>...</link> markers and renders the
|
|
6
|
+
// marked phrase as an anchor, so each locale keeps its own word order.
|
|
7
|
+
export function renderWithLink(text: string, href: string): JSX.Element {
|
|
8
|
+
const [before, label, after] = text.split(/<link>|<\/link>/);
|
|
9
|
+
if (label === undefined) {
|
|
10
|
+
return <>{text}</>;
|
|
11
|
+
}
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
{before}
|
|
15
|
+
<a href={href}>{label}</a>
|
|
16
|
+
{after}
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
package/src/core/utils/index.ts
CHANGED
package/src/core/utils/mcp.ts
CHANGED
|
@@ -32,3 +32,42 @@ export function generateMCPDeepLink(
|
|
|
32
32
|
return generateCursorMCPDeepLink(config);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
// Server names can contain spaces (e.g. "Docs MCP server") which break bare CLI
|
|
37
|
+
// arguments, so commands use a slugified form while JSON configs keep the raw name.
|
|
38
|
+
export function slugifyMcpServerName(name: string): string {
|
|
39
|
+
return name
|
|
40
|
+
.toLowerCase()
|
|
41
|
+
.replace(/[^a-z0-9_-]+/g, '-')
|
|
42
|
+
.replace(/^-+|-+$/g, '');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Claude Desktop's config file only launches stdio commands, so remote servers
|
|
46
|
+
// connect through the mcp-remote bridge.
|
|
47
|
+
export function generateClaudeDesktopConfig(config: McpConnectionParams): string {
|
|
48
|
+
return JSON.stringify(
|
|
49
|
+
{
|
|
50
|
+
mcpServers: {
|
|
51
|
+
[slugifyMcpServerName(config.serverName)]: {
|
|
52
|
+
command: 'npx',
|
|
53
|
+
args: ['-y', 'mcp-remote', config.url],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
null,
|
|
58
|
+
2,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function generateClaudeCodeCommand(config: McpConnectionParams): string {
|
|
63
|
+
return `claude mcp add --transport http ${slugifyMcpServerName(config.serverName)} ${config.url}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function generateCodexCommand(config: McpConnectionParams): string {
|
|
67
|
+
return `codex mcp add ${slugifyMcpServerName(config.serverName)} --url ${config.url}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Pasted into an AI assistant (Claude Code, Codex) so it installs the server itself.
|
|
71
|
+
export function generateMcpInstallPrompt(config: McpConnectionParams): string {
|
|
72
|
+
return `Add the MCP server "${slugifyMcpServerName(config.serverName)}" with URL ${config.url} (streamable HTTP transport) to my MCP configuration, then verify it is connected.`;
|
|
73
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.073zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.8956zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997z" />
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const CodexIcon = styled(Icon).attrs({
|
|
15
|
+
'data-component-name': 'icons/CodexIcon/CodexIcon',
|
|
16
|
+
})`
|
|
17
|
+
path {
|
|
18
|
+
fill: ${({ color }) => getCssColorVariable(color)};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
height: ${({ size }) => size || '16px'};
|
|
22
|
+
width: ${({ size }) => size || '16px'};
|
|
23
|
+
`;
|
|
@@ -15,7 +15,7 @@ const Icon = (props: IconProps) => (
|
|
|
15
15
|
{...props}
|
|
16
16
|
>
|
|
17
17
|
<path
|
|
18
|
-
d="M0
|
|
18
|
+
d="M0 6C0 2.68629 2.68629 0 6 0H14C17.3137 0 20 2.68629 20 6V14C20 17.3137 17.3137 20 14 20H6C2.68629 20 0 17.3137 0 14V6Z"
|
|
19
19
|
fill="var(--layer-color)"
|
|
20
20
|
/>
|
|
21
21
|
<path
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,8 @@ export * from '@redocly/theme/components/Badge/Badge';
|
|
|
15
15
|
export * from '@redocly/theme/components/Dropdown/Dropdown';
|
|
16
16
|
export * from '@redocly/theme/components/Dropdown/DropdownMenu';
|
|
17
17
|
export * from '@redocly/theme/components/Dropdown/DropdownMenuItem';
|
|
18
|
+
export * from '@redocly/theme/components/Dropdown/DropdownMenuItemContent';
|
|
19
|
+
export * from '@redocly/theme/components/SplitButton/SplitButton';
|
|
18
20
|
export * from '@redocly/theme/components/Loaders/Loading';
|
|
19
21
|
export * from '@redocly/theme/components/LoadMore/LoadMore';
|
|
20
22
|
export * from '@redocly/theme/components/Link/Link';
|
|
@@ -3,28 +3,61 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import type { JSX } from 'react';
|
|
5
5
|
|
|
6
|
-
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
6
|
+
import { useThemeHooks, useMCPConfig } from '@redocly/theme/core/hooks';
|
|
7
|
+
import { renderWithLink } from '@redocly/theme/core/utils';
|
|
7
8
|
import { ConnectMCPButton } from '@redocly/theme/components/Buttons/ConnectMCPButton';
|
|
9
|
+
import { McpConnectionTabs } from '@redocly/theme/components/MCP/McpConnectionTabs';
|
|
8
10
|
|
|
9
11
|
export default function McpNotAllowed(): JSX.Element {
|
|
10
12
|
const { useTranslate } = useThemeHooks();
|
|
11
13
|
const { translate } = useTranslate();
|
|
14
|
+
const { isPublicEndpointPage, alternateServerUrl } = useMCPConfig();
|
|
12
15
|
|
|
13
16
|
return (
|
|
14
17
|
<NotAllowedWrapper data-component-name="layouts/McpNotAllowed">
|
|
15
|
-
<StatusText>405</StatusText>
|
|
16
18
|
<Title data-translation-key="page.mcpNotAllowed.title">
|
|
17
|
-
{translate('page.mcpNotAllowed.title', '
|
|
19
|
+
{translate('page.mcpNotAllowed.title', 'Connect to the MCP server')}
|
|
18
20
|
</Title>
|
|
19
21
|
<Description data-translation-key="page.mcpNotAllowed.description">
|
|
20
22
|
{translate(
|
|
21
23
|
'page.mcpNotAllowed.description',
|
|
22
|
-
'To use this MCP server, register it in your MCP
|
|
24
|
+
'To use this MCP server, register it in your MCP client (for example: VS Code, Cursor, or Claude Code).',
|
|
23
25
|
)}
|
|
24
26
|
</Description>
|
|
27
|
+
{isPublicEndpointPage && (
|
|
28
|
+
<Description data-translation-key="page.mcpNotAllowed.publicNote">
|
|
29
|
+
{translate(
|
|
30
|
+
'page.mcpNotAllowed.publicNote',
|
|
31
|
+
'This endpoint serves publicly available content only and requires no login.',
|
|
32
|
+
)}
|
|
33
|
+
</Description>
|
|
34
|
+
)}
|
|
35
|
+
{isPublicEndpointPage && alternateServerUrl && (
|
|
36
|
+
<Description data-translation-key="page.mcpNotAllowed.mainEndpointHint">
|
|
37
|
+
{renderWithLink(
|
|
38
|
+
translate(
|
|
39
|
+
'page.mcpNotAllowed.mainEndpointHint',
|
|
40
|
+
'To access content available to your account, use the <link>main MCP endpoint</link>.',
|
|
41
|
+
),
|
|
42
|
+
alternateServerUrl,
|
|
43
|
+
)}
|
|
44
|
+
</Description>
|
|
45
|
+
)}
|
|
46
|
+
{!isPublicEndpointPage && alternateServerUrl && (
|
|
47
|
+
<Description data-translation-key="page.mcpNotAllowed.publicEndpointHint">
|
|
48
|
+
{renderWithLink(
|
|
49
|
+
translate(
|
|
50
|
+
'page.mcpNotAllowed.publicEndpointHint',
|
|
51
|
+
'To connect anonymously without an account, use the <link>public endpoint</link>.',
|
|
52
|
+
),
|
|
53
|
+
alternateServerUrl,
|
|
54
|
+
)}
|
|
55
|
+
</Description>
|
|
56
|
+
)}
|
|
25
57
|
<ButtonWrapper>
|
|
26
58
|
<ConnectMCPButton alignment="start" />
|
|
27
59
|
</ButtonWrapper>
|
|
60
|
+
<McpConnectionTabs />
|
|
28
61
|
</NotAllowedWrapper>
|
|
29
62
|
);
|
|
30
63
|
}
|
|
@@ -44,13 +77,6 @@ const NotAllowedWrapper = styled.div`
|
|
|
44
77
|
}
|
|
45
78
|
`;
|
|
46
79
|
|
|
47
|
-
const StatusText = styled.div`
|
|
48
|
-
color: var(--page-mcp-405-status-text-color);
|
|
49
|
-
font-size: var(--page-mcp-405-status-font-size);
|
|
50
|
-
line-height: var(--page-mcp-405-status-line-height);
|
|
51
|
-
font-weight: var(--page-mcp-405-status-font-weight);
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
80
|
const Title = styled.div`
|
|
55
81
|
font-size: var(--page-mcp-405-title-font-size);
|
|
56
82
|
line-height: var(--page-mcp-405-title-line-height);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import styled, { keyframes } from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { JSX, PropsWithChildren } from 'react';
|
|
5
5
|
|
|
6
6
|
import { ChevronRightIcon } from '@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon';
|
|
7
7
|
import { ACCORDION_COMPONENT_NAME } from '@redocly/theme/core/constants';
|
|
8
|
+
import { AccordionGroupContext } from '@redocly/theme/core/contexts';
|
|
8
9
|
|
|
9
10
|
export type AccordionProps = {
|
|
10
11
|
title: string;
|
|
@@ -22,10 +23,13 @@ export function Accordion({
|
|
|
22
23
|
'data-source': dataSource,
|
|
23
24
|
'data-hash': dataHash,
|
|
24
25
|
}: PropsWithChildren<AccordionProps>): JSX.Element {
|
|
26
|
+
const groupName = useContext(AccordionGroupContext);
|
|
27
|
+
|
|
25
28
|
return (
|
|
26
29
|
<AccordionWrapper
|
|
27
30
|
className={className}
|
|
28
31
|
open={expanded}
|
|
32
|
+
name={groupName ?? undefined}
|
|
29
33
|
data-component-name={ACCORDION_COMPONENT_NAME}
|
|
30
34
|
data-source={dataSource}
|
|
31
35
|
data-hash={dataHash}
|
|
@@ -37,7 +41,9 @@ export function Accordion({
|
|
|
37
41
|
/>
|
|
38
42
|
{title}
|
|
39
43
|
</AccordionSummary>
|
|
40
|
-
<AccordionBody>
|
|
44
|
+
<AccordionBody>
|
|
45
|
+
<AccordionGroupContext.Provider value={null}>{children}</AccordionGroupContext.Provider>
|
|
46
|
+
</AccordionBody>
|
|
41
47
|
</AccordionWrapper>
|
|
42
48
|
);
|
|
43
49
|
}
|
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useId } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { JSX, PropsWithChildren } from 'react';
|
|
5
5
|
|
|
6
6
|
import { ACCORDION_GROUP_COMPONENT_NAME, ACCORDION_SELECTOR } from '@redocly/theme/core/constants';
|
|
7
|
+
import { AccordionGroupContext } from '@redocly/theme/core/contexts';
|
|
7
8
|
|
|
8
9
|
export type AccordionGroupProps = {
|
|
10
|
+
singleExpanded?: boolean;
|
|
9
11
|
className?: string;
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export function AccordionGroup({
|
|
15
|
+
singleExpanded = false,
|
|
13
16
|
className,
|
|
14
17
|
children,
|
|
15
18
|
}: PropsWithChildren<AccordionGroupProps>): JSX.Element {
|
|
19
|
+
const groupName = useId();
|
|
20
|
+
|
|
16
21
|
return (
|
|
17
22
|
<AccordionGroupWrapper
|
|
18
23
|
className={className}
|
|
19
24
|
data-component-name={ACCORDION_GROUP_COMPONENT_NAME}
|
|
20
25
|
>
|
|
21
|
-
{
|
|
26
|
+
<AccordionGroupContext.Provider value={singleExpanded ? groupName : null}>
|
|
27
|
+
{children}
|
|
28
|
+
</AccordionGroupContext.Provider>
|
|
22
29
|
</AccordionGroupWrapper>
|
|
23
30
|
);
|
|
24
31
|
}
|
|
@@ -2,8 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { ChevronRightIcon } from '@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon';
|
|
5
|
+
import { ArrowUpRightIcon } from '@redocly/theme/icons/ArrowUpRightIcon/ArrowUpRightIcon';
|
|
5
6
|
import { CardImage } from '@redocly/theme/markdoc/components/Cards/CardImage';
|
|
6
7
|
import { CardIcon, CardIconWrapper } from '@redocly/theme/markdoc/components/Cards/CardIcon';
|
|
8
|
+
import { CardBadge } from '@redocly/theme/markdoc/components/Cards/CardBadge';
|
|
7
9
|
import { Link } from '@redocly/theme/components/Link/Link';
|
|
8
10
|
|
|
9
11
|
export type CardProps = React.PropsWithChildren<{
|
|
@@ -17,8 +19,15 @@ export type CardProps = React.PropsWithChildren<{
|
|
|
17
19
|
layout?: 'horizontal' | 'vertical' | 'combined';
|
|
18
20
|
variant?: 'filled' | 'outlined' | 'elevated' | 'ghost';
|
|
19
21
|
iconVariant?: 'filled' | 'ghost';
|
|
22
|
+
iconColor?: string;
|
|
20
23
|
align?: 'start' | 'center' | 'end';
|
|
21
24
|
to?: string;
|
|
25
|
+
linkIcon?: 'chevron' | 'arrow';
|
|
26
|
+
cta?: React.ReactNode;
|
|
27
|
+
badge?: string;
|
|
28
|
+
badgeColor?: string;
|
|
29
|
+
badgeIcon?: string;
|
|
30
|
+
badgeIconRawContent?: string;
|
|
22
31
|
}>;
|
|
23
32
|
|
|
24
33
|
export function Card({
|
|
@@ -32,8 +41,15 @@ export function Card({
|
|
|
32
41
|
variant = 'filled',
|
|
33
42
|
lineClamp,
|
|
34
43
|
iconVariant = 'filled',
|
|
44
|
+
iconColor,
|
|
35
45
|
align = 'start',
|
|
36
46
|
to,
|
|
47
|
+
cta,
|
|
48
|
+
linkIcon,
|
|
49
|
+
badge,
|
|
50
|
+
badgeColor,
|
|
51
|
+
badgeIcon,
|
|
52
|
+
badgeIconRawContent,
|
|
37
53
|
children,
|
|
38
54
|
}: CardProps) {
|
|
39
55
|
const titleNoSpaces = title?.replace(/\s+/g, '-').toLowerCase();
|
|
@@ -66,14 +82,30 @@ export function Card({
|
|
|
66
82
|
src={icon}
|
|
67
83
|
rawContent={iconRawContent}
|
|
68
84
|
position={iconPosition}
|
|
85
|
+
color={iconColor}
|
|
69
86
|
/>
|
|
70
87
|
)}
|
|
71
88
|
<ContentWrapper>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
<TitleWrapper id={cardTitleId} $isCardLink={!!to} $justifyContent={justifyContent}>
|
|
90
|
+
<Title>
|
|
91
|
+
{title}
|
|
92
|
+
{!!to && !!linkIcon && (
|
|
93
|
+
<CardLinkIcon as={linkIcon === 'arrow' ? ArrowUpRightIcon : undefined} />
|
|
94
|
+
)}
|
|
95
|
+
</Title>
|
|
96
|
+
{!!badge && (
|
|
97
|
+
<CardBadge color={badgeColor} icon={badgeIcon} iconRawContent={badgeIconRawContent}>
|
|
98
|
+
{badge}
|
|
99
|
+
</CardBadge>
|
|
100
|
+
)}
|
|
101
|
+
</TitleWrapper>
|
|
76
102
|
<Body $lineClamp={lineClamp}>{children}</Body>
|
|
103
|
+
{!!to && !!cta && (
|
|
104
|
+
<Cta $justifyContent={justifyContent}>
|
|
105
|
+
<CtaText> {cta} </CtaText>
|
|
106
|
+
<CtaIcon />
|
|
107
|
+
</Cta>
|
|
108
|
+
)}
|
|
77
109
|
</ContentWrapper>
|
|
78
110
|
</CardContentWrapper>
|
|
79
111
|
</>
|
|
@@ -105,25 +137,28 @@ const ContentWrapper = styled.div`
|
|
|
105
137
|
width: 100%;
|
|
106
138
|
`;
|
|
107
139
|
|
|
108
|
-
const
|
|
109
|
-
margin: var(--card-title-margin);
|
|
110
|
-
font-weight: var(--card-title-font-weight);
|
|
140
|
+
const TitleWrapper = styled.div<{ $isCardLink: boolean; $justifyContent: string }>`
|
|
111
141
|
color: var(--card-title-text-color);
|
|
112
142
|
display: flex;
|
|
113
143
|
align-items: center;
|
|
144
|
+
flex-wrap: wrap;
|
|
145
|
+
row-gap: var(--card-title-row-gap);
|
|
114
146
|
justify-content: ${({ $justifyContent }) => $justifyContent};
|
|
115
147
|
width: 100%;
|
|
116
148
|
`;
|
|
117
149
|
|
|
150
|
+
const Title = styled.h3`
|
|
151
|
+
margin: var(--card-title-margin);
|
|
152
|
+
font-weight: var(--card-title-font-weight);
|
|
153
|
+
`;
|
|
154
|
+
|
|
155
|
+
// The `as` prop selects the icon; the chevron is the default target.
|
|
118
156
|
const CardLinkIcon = styled(ChevronRightIcon)`
|
|
119
157
|
width: var(--card-link-icon-width);
|
|
120
158
|
height: var(--card-link-icon-height);
|
|
121
|
-
color: var(--
|
|
159
|
+
color: var(--icon-color-secondary);
|
|
122
160
|
margin-left: var(--spacing-xxs);
|
|
123
|
-
|
|
124
|
-
transition:
|
|
125
|
-
opacity 0.3s,
|
|
126
|
-
transform 0.3s;
|
|
161
|
+
margin-top: calc(var(--spacing-xxs) / 2);
|
|
127
162
|
`;
|
|
128
163
|
|
|
129
164
|
const Body = styled.div<{ $lineClamp?: number }>`
|
|
@@ -149,6 +184,29 @@ const Body = styled.div<{ $lineClamp?: number }>`
|
|
|
149
184
|
}
|
|
150
185
|
`;
|
|
151
186
|
|
|
187
|
+
const Cta = styled.div<{ $justifyContent: string }>`
|
|
188
|
+
display: flex;
|
|
189
|
+
gap: var(--card-cta-gap);
|
|
190
|
+
align-items: center;
|
|
191
|
+
margin-top: var(--card-cta-margin-top);
|
|
192
|
+
color: var(--card-cta-text-color);
|
|
193
|
+
font-size: var(--card-cta-font-size);
|
|
194
|
+
justify-content: ${({ $justifyContent }) => $justifyContent};
|
|
195
|
+
|
|
196
|
+
&& > * {
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
}
|
|
199
|
+
`;
|
|
200
|
+
|
|
201
|
+
const CtaText = styled.span`
|
|
202
|
+
font-weight: var(--card-cta-font-weight);
|
|
203
|
+
`;
|
|
204
|
+
|
|
205
|
+
const CtaIcon = styled(ChevronRightIcon)`
|
|
206
|
+
width: var(--card-cta-icon-width);
|
|
207
|
+
height: var(--card-cta-icon-height);
|
|
208
|
+
`;
|
|
209
|
+
|
|
152
210
|
const CardWrapper = styled.div.attrs<{
|
|
153
211
|
$variant: string;
|
|
154
212
|
$isCardLink: boolean;
|
|
@@ -185,6 +243,13 @@ const CardWrapper = styled.div.attrs<{
|
|
|
185
243
|
height: 100%;
|
|
186
244
|
object-fit: cover;
|
|
187
245
|
`}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&:hover,
|
|
249
|
+
&:focus-within {
|
|
250
|
+
${Cta} {
|
|
251
|
+
color: var(--card-link-icon-color);
|
|
252
|
+
}
|
|
188
253
|
}
|
|
189
254
|
|
|
190
255
|
&.card-link {
|
|
@@ -203,8 +268,8 @@ const CardWrapper = styled.div.attrs<{
|
|
|
203
268
|
background-color: var(--card-icon-bg-color-hover);
|
|
204
269
|
}
|
|
205
270
|
|
|
206
|
-
|
|
207
|
-
|
|
271
|
+
${CardLinkIcon} {
|
|
272
|
+
color: var(--card-link-icon-color);
|
|
208
273
|
}
|
|
209
274
|
}
|
|
210
275
|
}
|