@redocly/theme 0.70.0-next.1 → 0.70.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/Buttons/ConnectMCPButton.js +19 -14
- package/lib/components/Buttons/variables.d.ts +1 -0
- package/lib/components/Buttons/variables.js +4 -1
- package/lib/components/Catalog/Catalog.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.d.ts +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +30 -11
- package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +2 -1
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.js +1 -1
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.js +2 -2
- package/lib/components/CodeBlock/CodeBlockControls.js +3 -5
- package/lib/components/Consent/Consent.d.ts +2 -0
- package/lib/components/Consent/Consent.js +17 -0
- package/lib/components/Consent/ConsentBanner.d.ts +2 -0
- package/lib/components/Consent/ConsentBanner.js +120 -0
- package/lib/components/Consent/ConsentDialog.d.ts +2 -0
- package/lib/components/Consent/ConsentDialog.js +128 -0
- package/lib/components/Consent/ConsentSettingsLink.d.ts +2 -0
- package/lib/components/Consent/ConsentSettingsLink.js +35 -0
- package/lib/components/Consent/variables.d.ts +1 -0
- package/lib/components/Consent/variables.js +31 -0
- package/lib/components/Dropdown/Dropdown.d.ts +4 -2
- package/lib/components/Dropdown/Dropdown.js +31 -9
- package/lib/components/Dropdown/DropdownMenu.d.ts +1 -0
- package/lib/components/Dropdown/DropdownMenu.js +1 -1
- package/lib/components/Feedback/Reasons.js +3 -2
- package/lib/components/Filter/FilterCheckboxes.js +30 -11
- package/lib/components/Filter/FilterDateRange.js +36 -2
- package/lib/components/Footer/Footer.js +4 -1
- package/lib/components/Image/Image.js +24 -4
- package/lib/components/JsonViewer/Helpers.d.ts +10 -2
- package/lib/components/JsonViewer/Helpers.js +32 -36
- package/lib/components/JsonViewer/JsonViewer.js +15 -18
- package/lib/components/LoadProgressBar/LoadProgressBar.d.ts +8 -0
- package/lib/components/LoadProgressBar/LoadProgressBar.js +122 -0
- package/lib/components/MCP/McpConnectionTabs.js +9 -2
- package/lib/components/Markdown/Markdown.js +3 -2
- package/lib/components/Markdown/styles/base-table.js +14 -1
- package/lib/components/Markdown/variables.js +1 -0
- package/lib/components/Menu/Menu.js +4 -0
- package/lib/components/Menu/MenuSelect.d.ts +7 -0
- package/lib/components/Menu/MenuSelect.js +129 -0
- package/lib/components/Menu/variables.js +43 -4
- package/lib/components/Navbar/Navbar.js +44 -5
- package/lib/components/Navbar/variables.js +3 -0
- package/lib/components/NavigationTabs/NavigationTab.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTab.js +93 -0
- package/lib/components/NavigationTabs/NavigationTabContent.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTabContent.js +50 -0
- package/lib/components/NavigationTabs/NavigationTabMenu.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTabMenu.js +18 -0
- package/lib/components/NavigationTabs/NavigationTabs.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTabs.js +97 -0
- package/lib/components/NavigationTabs/variables.d.ts +1 -0
- package/lib/components/NavigationTabs/variables.js +37 -0
- package/lib/components/Portal/Portal.js +37 -5
- package/lib/components/Product/utils.js +1 -1
- package/lib/components/Search/SearchAiActionButtons.js +8 -3
- package/lib/components/Search/SearchAiActivity.d.ts +10 -0
- package/lib/components/Search/SearchAiActivity.js +278 -0
- package/lib/components/Search/SearchAiConversationInput.js +10 -6
- package/lib/components/Search/SearchAiDialog.js +13 -2
- package/lib/components/Search/SearchAiMessage.d.ts +2 -1
- package/lib/components/Search/SearchAiMessage.js +21 -109
- package/lib/components/Search/SearchAiResponse.js +1 -0
- package/lib/components/Search/SearchDialog.js +10 -0
- package/lib/components/Search/SearchItem.js +11 -10
- package/lib/components/Search/SearchTrigger.js +37 -6
- package/lib/components/Search/variables.js +17 -2
- package/lib/components/Segmented/Segmented.js +23 -3
- package/lib/components/Select/Select.js +10 -3
- package/lib/components/Select/SelectInput.d.ts +1 -0
- package/lib/components/Select/SelectInput.js +5 -11
- package/lib/components/Sidebar/Sidebar.js +2 -2
- package/lib/components/SplitButton/SplitButton.js +37 -3
- package/lib/components/TableOfContent/TableOfContent.js +2 -2
- package/lib/core/constants/common.d.ts +1 -0
- package/lib/core/constants/common.js +1 -0
- package/lib/core/constants/consent.d.ts +2 -0
- package/lib/core/constants/consent.js +30 -0
- package/lib/core/constants/index.d.ts +2 -0
- package/lib/core/constants/index.js +2 -0
- package/lib/core/constants/mcp.d.ts +2 -2
- package/lib/core/constants/mcp.js +3 -8
- package/lib/core/constants/prompt.d.ts +9 -0
- package/lib/core/constants/prompt.js +33 -0
- package/lib/core/constants/search.d.ts +1 -1
- package/lib/core/constants/search.js +6 -2
- package/lib/core/contexts/PortalContainerContext.d.ts +2 -0
- package/lib/core/contexts/PortalContainerContext.js +7 -0
- package/lib/core/hooks/code-walkthrough/use-code-panel.d.ts +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.d.ts +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +1 -2
- package/lib/core/hooks/code-walkthrough/use-renderable-files.d.ts +1 -1
- package/lib/core/hooks/index.d.ts +9 -0
- package/lib/core/hooks/index.js +9 -0
- package/lib/core/hooks/menu/use-collapse.js +1 -1
- package/lib/core/hooks/menu/use-mobile-menu-items.js +75 -51
- package/lib/core/hooks/menu/use-mobile-menu-levels.js +12 -7
- package/lib/core/hooks/prompt/use-prompt-actions.d.ts +7 -0
- package/lib/core/hooks/prompt/use-prompt-actions.js +19 -0
- package/lib/core/hooks/prompt/use-prompt-text-limit.d.ts +19 -0
- package/lib/core/hooks/prompt/use-prompt-text-limit.js +35 -0
- package/lib/core/hooks/search/use-persisted-quick-filter.d.ts +21 -0
- package/lib/core/hooks/search/use-persisted-quick-filter.js +92 -0
- package/lib/core/hooks/search/use-search-ai-activity.d.ts +11 -0
- package/lib/core/hooks/search/use-search-ai-activity.js +15 -0
- package/lib/core/hooks/use-connect-mcp-button.js +3 -1
- package/lib/core/hooks/use-consent-dialog.d.ts +12 -0
- package/lib/core/hooks/use-consent-dialog.js +36 -0
- package/lib/core/hooks/use-consent-telemetry.d.ts +1 -0
- package/lib/core/hooks/use-consent-telemetry.js +42 -0
- package/lib/core/hooks/use-dialog-hotkeys.js +4 -2
- package/lib/core/hooks/use-full-height.d.ts +1 -1
- package/lib/core/hooks/use-full-height.js +8 -8
- package/lib/core/hooks/use-page-actions.d.ts +1 -1
- package/lib/core/hooks/use-page-actions.js +10 -8
- package/lib/core/hooks/use-pointer-border-highlight.d.ts +7 -0
- package/lib/core/hooks/use-pointer-border-highlight.js +29 -0
- package/lib/core/hooks/use-scroll-item-into-view.d.ts +2 -0
- package/lib/core/hooks/use-scroll-item-into-view.js +16 -0
- package/lib/core/hooks/use-tab-list.d.ts +31 -0
- package/lib/core/hooks/use-tab-list.js +49 -0
- package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
- package/lib/core/hooks/use-telemetry-fallback.js +2 -0
- package/lib/core/hooks/use-theme-hooks.js +16 -0
- package/lib/core/styles/dark.js +14 -12
- package/lib/core/styles/global.d.ts +2 -0
- package/lib/core/styles/global.js +115 -136
- package/lib/core/styles/index.d.ts +1 -0
- package/lib/core/styles/index.js +3 -1
- package/lib/core/styles/search-ai-appear.d.ts +1 -0
- package/lib/core/styles/search-ai-appear.js +18 -0
- package/lib/core/types/code-walkthrough.d.ts +84 -0
- package/lib/core/types/consent.d.ts +54 -0
- package/lib/core/types/consent.js +3 -0
- package/lib/core/types/dropdown.d.ts +1 -0
- package/lib/core/types/dropdown.js +3 -0
- package/lib/core/types/hooks.d.ts +8 -1
- package/lib/core/types/index.d.ts +4 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/mcp.d.ts +3 -2
- package/lib/core/types/navigation-tabs.d.ts +49 -0
- package/lib/core/types/navigation-tabs.js +3 -0
- package/lib/core/types/prompt.d.ts +9 -0
- package/lib/core/types/prompt.js +3 -0
- package/lib/core/types/search.d.ts +25 -0
- package/lib/core/utils/Dynamic.d.ts +8 -1
- package/lib/core/utils/Dynamic.js +34 -3
- package/lib/core/utils/assign-ref.d.ts +2 -0
- package/lib/core/utils/assign-ref.js +12 -0
- package/lib/core/utils/consent-settings-link-placement.d.ts +3 -0
- package/lib/core/utils/consent-settings-link-placement.js +15 -0
- package/lib/core/utils/content-segments.d.ts +12 -1
- package/lib/core/utils/content-segments.js +90 -5
- package/lib/core/utils/download-code-walkthrough.d.ts +1 -1
- package/lib/core/utils/dropdown.d.ts +2 -0
- package/lib/core/utils/dropdown.js +12 -0
- package/lib/core/utils/get-ai-prompt-link.d.ts +15 -0
- package/lib/core/utils/get-ai-prompt-link.js +29 -0
- package/lib/core/utils/get-code-walkthrough-file-text.d.ts +1 -1
- package/lib/core/utils/index.d.ts +5 -0
- package/lib/core/utils/index.js +5 -0
- package/lib/core/utils/match-code-walkthrough-conditions.d.ts +1 -1
- package/lib/core/utils/mcp.d.ts +2 -1
- package/lib/core/utils/mcp.js +13 -3
- package/lib/core/utils/menu.d.ts +4 -0
- package/lib/core/utils/menu.js +48 -8
- package/lib/core/utils/navigation-tabs.d.ts +8 -0
- package/lib/core/utils/navigation-tabs.js +71 -0
- package/lib/core/utils/search-ai-activity.d.ts +4 -0
- package/lib/core/utils/search-ai-activity.js +83 -0
- package/lib/core/utils/urls.js +3 -1
- package/lib/core/utils/with-load-progress.d.ts +3 -0
- package/lib/core/utils/with-load-progress.js +24 -19
- package/lib/ext/configure.d.ts +1 -1
- package/lib/ext/configure.js +0 -1
- package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.d.ts +29 -0
- package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.js +81 -0
- package/lib/icons/LinkIcon/LinkIconSymbol.d.ts +12 -0
- package/lib/icons/LinkIcon/LinkIconSymbol.js +41 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +9 -1
- package/lib/layouts/PageLayout.js +1 -1
- package/lib/layouts/RootLayout.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +3 -3
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +1 -1
- package/lib/markdoc/components/Prompt/Prompt.d.ts +15 -0
- package/lib/markdoc/components/Prompt/Prompt.js +163 -0
- package/lib/markdoc/components/Prompt/PromptActions.d.ts +13 -0
- package/lib/markdoc/components/Prompt/PromptActions.js +43 -0
- package/lib/markdoc/components/Prompt/PromptBody.d.ts +14 -0
- package/lib/markdoc/components/Prompt/PromptBody.js +99 -0
- package/lib/markdoc/components/Prompt/PromptCopyButton.d.ts +10 -0
- package/lib/markdoc/components/Prompt/PromptCopyButton.js +28 -0
- package/lib/markdoc/components/Prompt/PromptHeader.d.ts +9 -0
- package/lib/markdoc/components/Prompt/PromptHeader.js +57 -0
- package/lib/markdoc/components/Prompt/PromptShowHideButton.d.ts +7 -0
- package/lib/markdoc/components/Prompt/PromptShowHideButton.js +21 -0
- package/lib/markdoc/components/Prompt/PromptToggleLabel.d.ts +7 -0
- package/lib/markdoc/components/Prompt/PromptToggleLabel.js +28 -0
- package/lib/markdoc/components/Prompt/variables.d.ts +1 -0
- package/lib/markdoc/components/Prompt/variables.dark.d.ts +1 -0
- package/lib/markdoc/components/Prompt/variables.dark.js +8 -0
- package/lib/markdoc/components/Prompt/variables.js +44 -0
- package/lib/markdoc/components/Tabs/TabList.js +8 -6
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/default.d.ts +2 -0
- package/lib/markdoc/default.js +2 -0
- package/lib/markdoc/tags/code-walkthrough.d.ts +1 -1
- package/lib/markdoc/tags/connect-mcp.js +15 -0
- package/lib/markdoc/tags/prompt.d.ts +2 -0
- package/lib/markdoc/tags/prompt.js +56 -0
- package/package.json +4 -8
- package/src/components/Buttons/ConnectMCPButton.tsx +21 -16
- package/src/components/Buttons/variables.ts +4 -0
- package/src/components/Catalog/Catalog.tsx +6 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.tsx +3 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +37 -22
- package/src/components/Catalog/CatalogFilter/CatalogFilterDateRange.tsx +3 -2
- package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.tsx +1 -1
- package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx +2 -2
- package/src/components/CodeBlock/CodeBlockControls.tsx +4 -7
- package/src/components/Consent/Consent.tsx +18 -0
- package/src/components/Consent/ConsentBanner.tsx +110 -0
- package/src/components/Consent/ConsentDialog.tsx +210 -0
- package/src/components/Consent/ConsentSettingsLink.tsx +44 -0
- package/src/components/Consent/variables.ts +28 -0
- package/src/components/Dropdown/Dropdown.tsx +32 -7
- package/src/components/Dropdown/DropdownMenu.tsx +7 -1
- package/src/components/Feedback/Reasons.tsx +3 -2
- package/src/components/Filter/FilterCheckboxes.tsx +33 -18
- package/src/components/Filter/FilterDateRange.tsx +3 -2
- package/src/components/Footer/Footer.tsx +2 -0
- package/src/components/Image/Image.tsx +26 -5
- package/src/components/JsonViewer/Helpers.tsx +51 -54
- package/src/components/JsonViewer/JsonViewer.tsx +23 -25
- package/src/components/LoadProgressBar/LoadProgressBar.tsx +113 -0
- package/src/components/MCP/McpConnectionTabs.tsx +22 -5
- package/src/components/Markdown/Markdown.tsx +3 -2
- package/src/components/Markdown/styles/base-table.ts +14 -1
- package/src/components/Markdown/variables.ts +1 -0
- package/src/components/Menu/Menu.tsx +5 -0
- package/src/components/Menu/MenuSelect.tsx +198 -0
- package/src/components/Menu/variables.ts +43 -4
- package/src/components/Navbar/Navbar.tsx +22 -5
- package/src/components/Navbar/variables.ts +3 -0
- package/src/components/NavigationTabs/NavigationTab.tsx +148 -0
- package/src/components/NavigationTabs/NavigationTabContent.tsx +66 -0
- package/src/components/NavigationTabs/NavigationTabMenu.tsx +40 -0
- package/src/components/NavigationTabs/NavigationTabs.tsx +83 -0
- package/src/components/NavigationTabs/variables.ts +34 -0
- package/src/components/Portal/Portal.tsx +4 -2
- package/src/components/Product/utils.ts +1 -1
- package/src/components/Search/SearchAiActionButtons.tsx +31 -19
- package/src/components/Search/SearchAiActivity.tsx +318 -0
- package/src/components/Search/SearchAiConversationInput.tsx +13 -7
- package/src/components/Search/SearchAiDialog.tsx +20 -4
- package/src/components/Search/SearchAiMessage.tsx +28 -136
- package/src/components/Search/SearchAiResponse.tsx +1 -0
- package/src/components/Search/SearchDialog.tsx +11 -0
- package/src/components/Search/SearchItem.tsx +19 -10
- package/src/components/Search/SearchTrigger.tsx +47 -3
- package/src/components/Search/variables.ts +17 -2
- package/src/components/Segmented/Segmented.tsx +25 -16
- package/src/components/Select/Select.tsx +12 -6
- package/src/components/Select/SelectInput.tsx +10 -18
- package/src/components/Sidebar/Sidebar.tsx +2 -2
- package/src/components/SplitButton/SplitButton.tsx +8 -2
- package/src/components/TableOfContent/TableOfContent.tsx +2 -2
- package/src/core/constants/common.ts +1 -0
- package/src/core/constants/consent.ts +29 -0
- package/src/core/constants/index.ts +2 -0
- package/src/core/constants/mcp.ts +3 -9
- package/src/core/constants/prompt.ts +34 -0
- package/src/core/constants/search.ts +6 -2
- package/src/core/contexts/PortalContainerContext.tsx +4 -0
- package/src/core/hooks/__mocks__/index.ts +5 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +20 -0
- package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +1 -2
- package/src/core/hooks/code-walkthrough/__mocks__/mock-intersection-observer.ts +1 -2
- package/src/core/hooks/code-walkthrough/use-code-panel.ts +1 -1
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +2 -2
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +1 -1
- package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +3 -3
- package/src/core/hooks/code-walkthrough/use-renderable-files.ts +1 -1
- package/src/core/hooks/index.ts +9 -0
- package/src/core/hooks/menu/use-collapse.ts +1 -1
- package/src/core/hooks/menu/use-mobile-menu-items.ts +91 -56
- package/src/core/hooks/menu/use-mobile-menu-levels.ts +14 -6
- package/src/core/hooks/prompt/use-prompt-actions.ts +28 -0
- package/src/core/hooks/prompt/use-prompt-text-limit.ts +59 -0
- package/src/core/hooks/search/use-persisted-quick-filter.ts +125 -0
- package/src/core/hooks/search/use-search-ai-activity.ts +31 -0
- package/src/core/hooks/use-connect-mcp-button.ts +13 -2
- package/src/core/hooks/use-consent-dialog.ts +51 -0
- package/src/core/hooks/use-consent-telemetry.ts +56 -0
- package/src/core/hooks/use-dialog-hotkeys.ts +11 -5
- package/src/core/hooks/use-full-height.ts +8 -8
- package/src/core/hooks/use-page-actions.ts +21 -9
- package/src/core/hooks/use-pointer-border-highlight.ts +46 -0
- package/src/core/hooks/use-scroll-item-into-view.ts +18 -0
- package/src/core/hooks/use-tab-list.ts +63 -0
- package/src/core/hooks/use-telemetry-fallback.ts +2 -0
- package/src/core/hooks/use-theme-hooks.ts +16 -0
- package/src/core/styles/dark.ts +2 -0
- package/src/core/styles/global.ts +96 -116
- package/src/core/styles/index.ts +2 -1
- package/src/core/styles/search-ai-appear.ts +16 -0
- package/src/core/types/code-walkthrough.ts +103 -0
- package/src/core/types/consent.ts +51 -0
- package/src/core/types/dropdown.ts +1 -0
- package/src/core/types/hooks.ts +8 -0
- package/src/core/types/index.ts +4 -0
- package/src/core/types/l10n.ts +46 -2
- package/src/core/types/mcp.ts +4 -2
- package/src/core/types/navigation-tabs.ts +54 -0
- package/src/core/types/prompt.ts +11 -0
- package/src/core/types/search.ts +23 -0
- package/src/core/utils/Dynamic.tsx +67 -35
- package/src/core/utils/assign-ref.ts +9 -0
- package/src/core/utils/consent-settings-link-placement.ts +18 -0
- package/src/core/utils/content-segments.ts +98 -6
- package/src/core/utils/download-code-walkthrough.ts +1 -1
- package/src/core/utils/dropdown.ts +14 -0
- package/src/core/utils/get-ai-prompt-link.ts +30 -0
- package/src/core/utils/get-code-walkthrough-file-text.ts +1 -1
- package/src/core/utils/index.ts +5 -0
- package/src/core/utils/match-code-walkthrough-conditions.ts +1 -1
- package/src/core/utils/mcp.ts +16 -4
- package/src/core/utils/menu.ts +54 -9
- package/src/core/utils/navigation-tabs.ts +99 -0
- package/src/core/utils/search-ai-activity.ts +110 -0
- package/src/core/utils/urls.ts +3 -1
- package/src/core/utils/with-load-progress.ts +23 -18
- package/src/ext/configure.ts +1 -1
- package/src/icons/CheckboxIcon/CheckboxIcon.tsx +1 -0
- package/src/icons/ChevronSortIcon/ChevronSortIcon.tsx +1 -0
- package/src/icons/ExpandCollapseIcon/ExpandCollapseIcon.tsx +56 -0
- package/src/icons/LinkIcon/LinkIconSymbol.tsx +51 -0
- package/src/index.ts +8 -0
- package/src/layouts/PageLayout.tsx +1 -1
- package/src/layouts/RootLayout.tsx +2 -2
- package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +2 -2
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +4 -4
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodePanelToolbar.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +2 -2
- package/src/markdoc/components/Prompt/Prompt.tsx +219 -0
- package/src/markdoc/components/Prompt/PromptActions.tsx +104 -0
- package/src/markdoc/components/Prompt/PromptBody.tsx +107 -0
- package/src/markdoc/components/Prompt/PromptCopyButton.tsx +73 -0
- package/src/markdoc/components/Prompt/PromptHeader.tsx +81 -0
- package/src/markdoc/components/Prompt/PromptShowHideButton.tsx +43 -0
- package/src/markdoc/components/Prompt/PromptToggleLabel.tsx +41 -0
- package/src/markdoc/components/Prompt/variables.dark.ts +5 -0
- package/src/markdoc/components/Prompt/variables.ts +41 -0
- package/src/markdoc/components/Tabs/TabList.tsx +9 -12
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/code-walkthrough.ts +1 -1
- package/src/markdoc/tags/connect-mcp.ts +16 -1
- package/src/markdoc/tags/prompt.ts +58 -0
|
@@ -4,9 +4,12 @@ export const navbar = css`
|
|
|
4
4
|
--navbar-bg-color: var(--bg-color); // @presenter Color
|
|
5
5
|
--navbar-border-color: var(--border-color-secondary);
|
|
6
6
|
--navbar-border: 1px solid var(--navbar-border-color);
|
|
7
|
+
--navbar-row-bottom-border-color: var(--navbar-border-color);
|
|
7
8
|
|
|
8
9
|
--navbar-text-color: var(--text-color-secondary); // @presenter Color
|
|
9
10
|
--navbar-height: 64px; // @presenter Spacing
|
|
11
|
+
--navbar-stack-height: var(--navbar-height);
|
|
12
|
+
--navbar-offset: calc(var(--navbar-stack-height) + var(--banner-height));
|
|
10
13
|
--navbar-font-size: var(--font-size-base);
|
|
11
14
|
--navbar-padding: 0 var(--spacing-xl); // @presenter Spacing
|
|
12
15
|
--navbar-font-family: var(--font-family-base);
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { JSX } from 'react';
|
|
5
|
+
import type { LinkProps, NavigationTabRowItem } from '@redocly/theme/core/types';
|
|
6
|
+
|
|
7
|
+
import { getNavbarItemClickedPayload } from '@redocly/theme/core/utils';
|
|
8
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
9
|
+
import { Link } from '@redocly/theme/components/Link/Link';
|
|
10
|
+
import { Dropdown } from '@redocly/theme/components/Dropdown/Dropdown';
|
|
11
|
+
import { NavigationTabMenu } from '@redocly/theme/components/NavigationTabs/NavigationTabMenu';
|
|
12
|
+
import { NavigationTabContent } from '@redocly/theme/components/NavigationTabs/NavigationTabContent';
|
|
13
|
+
import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
|
|
14
|
+
|
|
15
|
+
export type NavigationTabProps = {
|
|
16
|
+
tab: NavigationTabRowItem;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function NavigationTab({ tab, className }: NavigationTabProps): JSX.Element | null {
|
|
21
|
+
const { useTelemetry } = useThemeHooks();
|
|
22
|
+
const telemetry = useTelemetry();
|
|
23
|
+
|
|
24
|
+
const active = !!tab.active;
|
|
25
|
+
const menuItems = tab.type === 'group' ? tab.items : [];
|
|
26
|
+
const isGroup = tab.type === 'group' && menuItems.length > 0;
|
|
27
|
+
const linkItem = tab.type === 'link' ? tab : undefined;
|
|
28
|
+
|
|
29
|
+
if (!linkItem?.link && !isGroup) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const content = (
|
|
34
|
+
<>
|
|
35
|
+
<NavigationTabContent item={tab} />
|
|
36
|
+
{isGroup ? <NavigationTabChevron size="10px" /> : null}
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (isGroup) {
|
|
41
|
+
return (
|
|
42
|
+
<NavigationTabWrapper
|
|
43
|
+
data-component-name="NavigationTabs/NavigationTab"
|
|
44
|
+
className={className}
|
|
45
|
+
>
|
|
46
|
+
<NavigationTabDropdown
|
|
47
|
+
triggerEvent="hover"
|
|
48
|
+
portalled
|
|
49
|
+
trigger={
|
|
50
|
+
<NavigationTabTrigger
|
|
51
|
+
$active={active}
|
|
52
|
+
aria-current={active ? 'true' : undefined}
|
|
53
|
+
onClick={() =>
|
|
54
|
+
telemetry.sendNavbarMenuItemClickedMessage(getNavbarItemClickedPayload(tab.type))
|
|
55
|
+
}
|
|
56
|
+
>
|
|
57
|
+
{content}
|
|
58
|
+
</NavigationTabTrigger>
|
|
59
|
+
}
|
|
60
|
+
>
|
|
61
|
+
<NavigationTabMenu items={menuItems} />
|
|
62
|
+
</NavigationTabDropdown>
|
|
63
|
+
</NavigationTabWrapper>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<NavigationTabWrapper data-component-name="NavigationTabs/NavigationTab" className={className}>
|
|
69
|
+
<NavigationTabLink
|
|
70
|
+
as={Link}
|
|
71
|
+
to={linkItem?.link}
|
|
72
|
+
$active={active}
|
|
73
|
+
external={linkItem?.external}
|
|
74
|
+
target={linkItem?.target}
|
|
75
|
+
aria-current={active ? 'page' : undefined}
|
|
76
|
+
onClick={() =>
|
|
77
|
+
telemetry.sendNavbarMenuItemClickedMessage(getNavbarItemClickedPayload(tab.type))
|
|
78
|
+
}
|
|
79
|
+
>
|
|
80
|
+
{content}
|
|
81
|
+
</NavigationTabLink>
|
|
82
|
+
</NavigationTabWrapper>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const NavigationTabChevron = styled(ChevronDownIcon)`
|
|
87
|
+
flex-shrink: 0;
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
const NavigationTabWrapper = styled.li`
|
|
91
|
+
list-style: none;
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
align-items: stretch;
|
|
94
|
+
flex-shrink: 0;
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
const NavigationTabDropdown = styled(Dropdown)`
|
|
98
|
+
display: inline-flex;
|
|
99
|
+
align-items: stretch;
|
|
100
|
+
height: 100%;
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
const NavigationTabLink = styled.div<LinkProps & { $active: boolean }>`
|
|
104
|
+
display: inline-flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
gap: var(--navigation-tabs-item-content-gap);
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
height: 100%;
|
|
109
|
+
padding: var(--navigation-tabs-item-padding);
|
|
110
|
+
font-size: var(--navigation-tabs-item-font-size);
|
|
111
|
+
line-height: var(--navigation-tabs-item-line-height);
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
text-decoration: none;
|
|
114
|
+
transition: border-color var(--navigation-tabs-item-transition);
|
|
115
|
+
|
|
116
|
+
font-weight: ${({ $active }) =>
|
|
117
|
+
$active
|
|
118
|
+
? 'var(--navigation-tabs-item-font-weight-active)'
|
|
119
|
+
: 'var(--navigation-tabs-item-font-weight)'};
|
|
120
|
+
color: ${({ $active }) =>
|
|
121
|
+
$active
|
|
122
|
+
? 'var(--navigation-tabs-item-text-color-active)'
|
|
123
|
+
: 'var(--navigation-tabs-item-text-color)'};
|
|
124
|
+
border-bottom: ${({ $active }) =>
|
|
125
|
+
$active
|
|
126
|
+
? 'var(--navigation-tabs-item-bottom-border-active)'
|
|
127
|
+
: 'var(--navigation-tabs-item-bottom-border)'};
|
|
128
|
+
|
|
129
|
+
&:hover {
|
|
130
|
+
color: var(--navigation-tabs-item-text-color-hover);
|
|
131
|
+
border-bottom: ${({ $active }) => !$active && 'var(--navigation-tabs-item-bottom-border-hover)'};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&:focus-visible {
|
|
135
|
+
outline: 1px solid var(--navigation-tabs-item-border-color-focused);
|
|
136
|
+
outline-offset: 2px;
|
|
137
|
+
border-radius: var(--navigation-tabs-item-border-radius);
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
const NavigationTabTrigger = styled(NavigationTabLink).attrs({ as: 'button', type: 'button' })`
|
|
142
|
+
background: none;
|
|
143
|
+
border-top: none;
|
|
144
|
+
border-left: none;
|
|
145
|
+
border-right: none;
|
|
146
|
+
font-family: inherit;
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
`;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { JSX } from 'react';
|
|
5
|
+
import type { NavigationTabRowItem } from '@redocly/theme/core/types';
|
|
6
|
+
|
|
7
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
8
|
+
import { GenericIcon } from '@redocly/theme/icons/GenericIcon/GenericIcon';
|
|
9
|
+
import { LaunchIcon } from '@redocly/theme/icons/LaunchIcon/LaunchIcon';
|
|
10
|
+
|
|
11
|
+
export type NavigationTabContentProps = {
|
|
12
|
+
item: NavigationTabRowItem;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function NavigationTabContent({ item, className }: NavigationTabContentProps): JSX.Element {
|
|
17
|
+
const { useTranslate } = useThemeHooks();
|
|
18
|
+
const { translate } = useTranslate();
|
|
19
|
+
const label = translate(item.labelTranslationKey, item.label);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<NavigationTabContentWrapper
|
|
23
|
+
data-component-name="NavigationTabs/NavigationTabContent"
|
|
24
|
+
className={className}
|
|
25
|
+
>
|
|
26
|
+
{(item.icon || item.srcSet) && <NavigationTabIcon icon={item.icon} srcSet={item.srcSet} />}
|
|
27
|
+
<NavigationTabLabel data-label={label} data-translation-key={item.labelTranslationKey}>
|
|
28
|
+
{label}
|
|
29
|
+
</NavigationTabLabel>
|
|
30
|
+
{'external' in item && item.external ? <NavigationTabExternalIcon size="10px" /> : null}
|
|
31
|
+
</NavigationTabContentWrapper>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const NavigationTabContentWrapper = styled.span`
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: var(--navigation-tabs-item-content-gap);
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const NavigationTabIcon = styled(GenericIcon)`
|
|
42
|
+
--icon-width: var(--navigation-tabs-item-icon-size);
|
|
43
|
+
--icon-height: var(--navigation-tabs-item-icon-size);
|
|
44
|
+
flex-shrink: 0;
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
const NavigationTabLabel = styled.span`
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
vertical-align: middle;
|
|
52
|
+
|
|
53
|
+
&::after {
|
|
54
|
+
content: attr(data-label);
|
|
55
|
+
height: 0;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
visibility: hidden;
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
font-weight: var(--navigation-tabs-item-label-font-weight-active);
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
const NavigationTabExternalIcon = styled(LaunchIcon)`
|
|
64
|
+
margin-left: var(--navigation-tabs-item-external-icon-margin-left);
|
|
65
|
+
flex-shrink: 0;
|
|
66
|
+
`;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { JSX } from 'react';
|
|
5
|
+
import type { NavigationTabItem } from '@redocly/theme/core/types';
|
|
6
|
+
|
|
7
|
+
import { DropdownMenu } from '@redocly/theme/components/Dropdown/DropdownMenu';
|
|
8
|
+
import { DropdownMenuItem } from '@redocly/theme/components/Dropdown/DropdownMenuItem';
|
|
9
|
+
import { NavigationTabContent } from '@redocly/theme/components/NavigationTabs/NavigationTabContent';
|
|
10
|
+
|
|
11
|
+
export type NavigationTabMenuProps = {
|
|
12
|
+
items: NavigationTabItem[];
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function NavigationTabMenu({ items, className }: NavigationTabMenuProps): JSX.Element {
|
|
17
|
+
return (
|
|
18
|
+
<NavigationTabMenuWrapper
|
|
19
|
+
data-component-name="NavigationTabs/NavigationTabMenu"
|
|
20
|
+
className={className}
|
|
21
|
+
>
|
|
22
|
+
<DropdownMenu>
|
|
23
|
+
{items.map((item, index) => (
|
|
24
|
+
<DropdownMenuItem
|
|
25
|
+
key={`${item.label}_${index}`}
|
|
26
|
+
to={item.link}
|
|
27
|
+
external={item.external}
|
|
28
|
+
data-translation-key={item.labelTranslationKey}
|
|
29
|
+
active={item.active}
|
|
30
|
+
aria-current={item.active ? 'page' : undefined}
|
|
31
|
+
>
|
|
32
|
+
<NavigationTabContent item={item} />
|
|
33
|
+
</DropdownMenuItem>
|
|
34
|
+
))}
|
|
35
|
+
</DropdownMenu>
|
|
36
|
+
</NavigationTabMenuWrapper>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const NavigationTabMenuWrapper = styled.div``;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { JSX } from 'react';
|
|
5
|
+
import type { NavigationTabsConfig } from '@redocly/theme/core/types';
|
|
6
|
+
|
|
7
|
+
import { breakpoints } from '@redocly/theme/core/utils';
|
|
8
|
+
import { useScrollItemIntoView, useThemeHooks } from '@redocly/theme/core/hooks';
|
|
9
|
+
import { NavigationTab } from '@redocly/theme/components/NavigationTabs/NavigationTab';
|
|
10
|
+
|
|
11
|
+
export type NavigationTabsProps = {
|
|
12
|
+
config?: NavigationTabsConfig;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function NavigationTabs({ config, className }: NavigationTabsProps): JSX.Element | null {
|
|
17
|
+
const { useTranslate } = useThemeHooks();
|
|
18
|
+
const { translate } = useTranslate();
|
|
19
|
+
const listRef = useRef<HTMLUListElement | null>(null);
|
|
20
|
+
|
|
21
|
+
const tabs = config?.items ?? [];
|
|
22
|
+
const activeIndex = tabs.findIndex((tab) => tab.active);
|
|
23
|
+
|
|
24
|
+
useScrollItemIntoView(listRef, activeIndex);
|
|
25
|
+
|
|
26
|
+
if (!tabs.length) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<NavigationTabsWrapper
|
|
32
|
+
data-component-name="NavigationTabs/NavigationTabs"
|
|
33
|
+
className={className}
|
|
34
|
+
aria-label={translate('navigationTabs.label', 'Navigation tabs')}
|
|
35
|
+
>
|
|
36
|
+
<NavigationTabsList ref={listRef}>
|
|
37
|
+
{tabs.map((tab, index) => (
|
|
38
|
+
<NavigationTab key={`${tab.label}_${index}`} tab={tab} />
|
|
39
|
+
))}
|
|
40
|
+
</NavigationTabsList>
|
|
41
|
+
</NavigationTabsWrapper>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const NavigationTabsWrapper = styled.nav`
|
|
46
|
+
display: none;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: var(--navigation-tabs-height);
|
|
50
|
+
max-width: var(--navbar-container-max-width);
|
|
51
|
+
padding: var(--navigation-tabs-padding);
|
|
52
|
+
background: var(--navigation-tabs-bg-color);
|
|
53
|
+
border-bottom: var(--navigation-tabs-bottom-border);
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
|
|
56
|
+
@media screen and (min-width: ${breakpoints.medium}) {
|
|
57
|
+
display: flex;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media screen and (min-width: ${breakpoints.max}) {
|
|
61
|
+
max-width: var(--container-max-width);
|
|
62
|
+
margin-left: auto;
|
|
63
|
+
margin-right: auto;
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
const NavigationTabsList = styled.ul`
|
|
68
|
+
list-style: none;
|
|
69
|
+
margin: 0 0 calc(-1 * var(--navigation-tabs-border-width));
|
|
70
|
+
padding: 0;
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-wrap: nowrap;
|
|
73
|
+
align-items: stretch;
|
|
74
|
+
gap: var(--navigation-tabs-gap);
|
|
75
|
+
min-width: 0;
|
|
76
|
+
overflow-x: auto;
|
|
77
|
+
scrollbar-width: none;
|
|
78
|
+
-ms-overflow-style: none;
|
|
79
|
+
|
|
80
|
+
&::-webkit-scrollbar {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const navigationTabs = css`
|
|
4
|
+
--navigation-tabs-height: 48px; // @presenter Spacing
|
|
5
|
+
--navigation-tabs-bg-color: transparent; // @presenter Color
|
|
6
|
+
--navigation-tabs-border-color: var(--border-color-secondary);
|
|
7
|
+
--navigation-tabs-border-width: 1px;
|
|
8
|
+
--navigation-tabs-bottom-border: var(--navigation-tabs-border-width) solid var(--navigation-tabs-border-color);
|
|
9
|
+
--navigation-tabs-padding-vertical: 0;
|
|
10
|
+
--navigation-tabs-padding-horizontal: var(--spacing-xl);
|
|
11
|
+
--navigation-tabs-padding: var(--navigation-tabs-padding-vertical) var(--navigation-tabs-padding-horizontal); // @presenter Spacing
|
|
12
|
+
--navigation-tabs-gap: var(--spacing-base); // @presenter Spacing
|
|
13
|
+
|
|
14
|
+
--navigation-tabs-item-padding-vertical: var(--spacing-xxs);
|
|
15
|
+
--navigation-tabs-item-padding-horizontal: 0;
|
|
16
|
+
--navigation-tabs-item-padding: var(--navigation-tabs-item-padding-vertical) var(--navigation-tabs-item-padding-horizontal);
|
|
17
|
+
--navigation-tabs-item-content-gap: var(--spacing-xs);
|
|
18
|
+
--navigation-tabs-item-font-size: var(--font-size-base);
|
|
19
|
+
--navigation-tabs-item-line-height: var(--line-height-base);
|
|
20
|
+
--navigation-tabs-item-font-weight: var(--font-weight-regular);
|
|
21
|
+
--navigation-tabs-item-font-weight-active: var(--font-weight-medium);
|
|
22
|
+
--navigation-tabs-item-text-color: var(--navbar-text-color); // @presenter Color
|
|
23
|
+
--navigation-tabs-item-text-color-hover: var(--text-color-primary); // @presenter Color
|
|
24
|
+
--navigation-tabs-item-text-color-active: var(--text-color-primary); // @presenter Color
|
|
25
|
+
--navigation-tabs-item-bottom-border: var(--navigation-tabs-border-width) solid transparent;
|
|
26
|
+
--navigation-tabs-item-bottom-border-hover: var(--navigation-tabs-border-width) solid var(--border-color-primary);
|
|
27
|
+
--navigation-tabs-item-bottom-border-active: var(--navigation-tabs-border-width) solid var(--border-color-inverse);
|
|
28
|
+
--navigation-tabs-item-border-color-focused: var(--button-border-color-focused);
|
|
29
|
+
--navigation-tabs-item-border-radius: var(--navbar-item-border-radius);
|
|
30
|
+
--navigation-tabs-item-icon-size: 1.25em; // @presenter Spacing
|
|
31
|
+
--navigation-tabs-item-external-icon-margin-left: 0;
|
|
32
|
+
--navigation-tabs-item-label-font-weight-active: var(--navigation-tabs-item-font-weight-active);
|
|
33
|
+
--navigation-tabs-item-transition: 150ms ease-in-out;
|
|
34
|
+
`;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
|
|
4
4
|
import type { PropsWithChildren, JSX } from 'react';
|
|
5
5
|
|
|
6
6
|
import { IS_BROWSER } from '@redocly/theme/core/utils';
|
|
7
|
+
import { PortalContainerContext } from '@redocly/theme/core/contexts/PortalContainerContext';
|
|
7
8
|
|
|
8
9
|
export type PortalProps = {
|
|
9
10
|
mountId?: string;
|
|
@@ -13,7 +14,8 @@ export function Portal({
|
|
|
13
14
|
children,
|
|
14
15
|
mountId = 'root',
|
|
15
16
|
}: PropsWithChildren<PortalProps>): React.ReactPortal | JSX.Element {
|
|
16
|
-
const
|
|
17
|
+
const container = useContext(PortalContainerContext);
|
|
18
|
+
const mount = IS_BROWSER ? container || document.getElementById(mountId) || document.body : null;
|
|
17
19
|
|
|
18
20
|
if (!mount) {
|
|
19
21
|
return <>{children}</>;
|
|
@@ -10,6 +10,8 @@ import { ThumbUpFilledIcon } from '@redocly/theme/icons/ThumbUpFilledIcon/ThumbU
|
|
|
10
10
|
import { ThumbDownIcon } from '@redocly/theme/icons/ThumbDownIcon/ThumbDownIcon';
|
|
11
11
|
import { ThumbDownFilledIcon } from '@redocly/theme/icons/ThumbDownFilledIcon/ThumbDownFilledIcon';
|
|
12
12
|
import { CopyButton } from '@redocly/theme/components/Buttons/CopyButton';
|
|
13
|
+
import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
|
|
14
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
13
15
|
|
|
14
16
|
export type SearchAiActionButtonsProps = {
|
|
15
17
|
content: string;
|
|
@@ -26,28 +28,38 @@ export function SearchAiActionButtons({
|
|
|
26
28
|
onFeedback,
|
|
27
29
|
disabled,
|
|
28
30
|
}: SearchAiActionButtonsProps): JSX.Element {
|
|
31
|
+
const { useTranslate } = useThemeHooks();
|
|
32
|
+
const { translate } = useTranslate();
|
|
33
|
+
|
|
29
34
|
return (
|
|
30
35
|
<ActionButtonsWrapper className={className} data-component-name="Search/SearchAiActionButtons">
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
<Tooltip tip={translate('search.ai.actions.copy', 'Copy the response')} placement="top">
|
|
37
|
+
<CopyButton data={content} />
|
|
38
|
+
</Tooltip>
|
|
39
|
+
|
|
40
|
+
<Tooltip tip={translate('search.ai.actions.like', 'Like the response')} placement="top">
|
|
41
|
+
<FeedbackButton
|
|
42
|
+
variant="text"
|
|
43
|
+
size="small"
|
|
44
|
+
icon={feedback === FeedbackType.Like ? <ThumbUpFilledIcon /> : <ThumbUpIcon />}
|
|
45
|
+
onClick={() => !disabled && onFeedback(FeedbackType.Like)}
|
|
46
|
+
extraClass={feedback === FeedbackType.Like ? 'active' : ''}
|
|
47
|
+
aria-label="Like this response"
|
|
48
|
+
disabled={disabled}
|
|
49
|
+
/>
|
|
50
|
+
</Tooltip>
|
|
41
51
|
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
<Tooltip tip={translate('search.ai.actions.dislike', 'Dislike the response')} placement="top">
|
|
53
|
+
<FeedbackButton
|
|
54
|
+
variant="text"
|
|
55
|
+
size="small"
|
|
56
|
+
icon={feedback === FeedbackType.Dislike ? <ThumbDownFilledIcon /> : <ThumbDownIcon />}
|
|
57
|
+
onClick={() => !disabled && onFeedback(FeedbackType.Dislike)}
|
|
58
|
+
extraClass={feedback === FeedbackType.Dislike ? 'active' : ''}
|
|
59
|
+
aria-label="Dislike this response"
|
|
60
|
+
disabled={disabled}
|
|
61
|
+
/>
|
|
62
|
+
</Tooltip>
|
|
51
63
|
</ActionButtonsWrapper>
|
|
52
64
|
);
|
|
53
65
|
}
|