@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
|
@@ -19,7 +19,6 @@ import { useConnectMCPButton, useThemeHooks } from '@redocly/theme/core/hooks';
|
|
|
19
19
|
import { DEFAULT_MCP_OPTIONS } from '@redocly/theme/core/constants';
|
|
20
20
|
|
|
21
21
|
type MenuOption = {
|
|
22
|
-
key: MCPOption;
|
|
23
22
|
icon: React.ComponentType;
|
|
24
23
|
titleTranslationKey: string;
|
|
25
24
|
titleDefault: string;
|
|
@@ -27,48 +26,50 @@ type MenuOption = {
|
|
|
27
26
|
descriptionDefault: string;
|
|
28
27
|
};
|
|
29
28
|
|
|
30
|
-
const MENU_OPTIONS: MenuOption
|
|
31
|
-
{
|
|
32
|
-
key: 'cursor',
|
|
29
|
+
const MENU_OPTIONS: Record<MCPOption, MenuOption> = {
|
|
30
|
+
cursor: {
|
|
33
31
|
icon: CursorIcon,
|
|
34
32
|
titleTranslationKey: 'page.actions.connectMcp.cursor',
|
|
35
33
|
titleDefault: 'Connect to Cursor',
|
|
36
34
|
descriptionTranslationKey: 'page.actions.connectMcp.cursorDescription',
|
|
37
35
|
descriptionDefault: 'Install MCP server on Cursor',
|
|
38
36
|
},
|
|
39
|
-
{
|
|
40
|
-
key: 'vscode',
|
|
37
|
+
vscode: {
|
|
41
38
|
icon: VSCodeIcon,
|
|
42
39
|
titleTranslationKey: 'page.actions.connectMcp.vscode',
|
|
43
40
|
titleDefault: 'Connect to VS Code',
|
|
44
41
|
descriptionTranslationKey: 'page.actions.connectMcp.vscodeDescription',
|
|
45
42
|
descriptionDefault: 'Install MCP server on VS Code',
|
|
46
43
|
},
|
|
47
|
-
{
|
|
48
|
-
|
|
44
|
+
claude: {
|
|
45
|
+
icon: ClaudeIcon,
|
|
46
|
+
titleTranslationKey: 'page.actions.connectMcp.claude',
|
|
47
|
+
titleDefault: 'Connect to Claude',
|
|
48
|
+
descriptionTranslationKey: 'page.actions.connectMcp.claudeDescription',
|
|
49
|
+
descriptionDefault: 'Add MCP server to your Claude account',
|
|
50
|
+
},
|
|
51
|
+
'claude-code': {
|
|
49
52
|
icon: ClaudeIcon,
|
|
50
53
|
titleTranslationKey: 'page.actions.connectMcp.claudeCode',
|
|
51
54
|
titleDefault: 'Connect to Claude Code',
|
|
52
55
|
descriptionTranslationKey: 'page.actions.connectMcp.claudeCodeDescription',
|
|
53
56
|
descriptionDefault: 'Copy the Claude Code CLI command',
|
|
54
57
|
},
|
|
55
|
-
{
|
|
56
|
-
key: 'codex',
|
|
58
|
+
codex: {
|
|
57
59
|
icon: CodexIcon,
|
|
58
60
|
titleTranslationKey: 'page.actions.connectMcp.codex',
|
|
59
61
|
titleDefault: 'Connect to Codex CLI',
|
|
60
62
|
descriptionTranslationKey: 'page.actions.connectMcp.codexDescription',
|
|
61
63
|
descriptionDefault: 'Copy the Codex CLI command',
|
|
62
64
|
},
|
|
63
|
-
{
|
|
64
|
-
key: 'copy',
|
|
65
|
+
copy: {
|
|
65
66
|
icon: CopyIcon,
|
|
66
67
|
titleTranslationKey: 'page.actions.connectMcp.copyConfig',
|
|
67
68
|
titleDefault: 'Copy MCP Configuration',
|
|
68
69
|
descriptionTranslationKey: 'page.actions.connectMcp.copyConfigDescription',
|
|
69
70
|
descriptionDefault: 'Copy MCP JSON Configuration',
|
|
70
71
|
},
|
|
71
|
-
|
|
72
|
+
};
|
|
72
73
|
|
|
73
74
|
// Copy actions keep the dropdown open so the copied checkmark is visible.
|
|
74
75
|
const COPY_OPTIONS: MCPOption[] = ['claude-code', 'codex', 'copy'];
|
|
@@ -89,7 +90,7 @@ export function ConnectMCPButton({
|
|
|
89
90
|
|
|
90
91
|
const { copiedOption, visibleOptions, handleAction } = useConnectMCPButton({ options });
|
|
91
92
|
|
|
92
|
-
const menuOptions =
|
|
93
|
+
const menuOptions = visibleOptions.map((key) => ({ key, ...MENU_OPTIONS[key] }));
|
|
93
94
|
const primaryOption = menuOptions[0];
|
|
94
95
|
const dropdownOptions = menuOptions.slice(1);
|
|
95
96
|
|
|
@@ -124,7 +125,7 @@ export function ConnectMCPButton({
|
|
|
124
125
|
>
|
|
125
126
|
{dropdownOptions.length > 0
|
|
126
127
|
? ({ close }: { close: () => void }) => (
|
|
127
|
-
<
|
|
128
|
+
<StyledDropdownMenu>
|
|
128
129
|
{dropdownOptions.map((option) => {
|
|
129
130
|
const Icon = option.icon;
|
|
130
131
|
const showCheckmark = copiedOption === option.key;
|
|
@@ -156,7 +157,7 @@ export function ConnectMCPButton({
|
|
|
156
157
|
</DropdownMenuItem>
|
|
157
158
|
);
|
|
158
159
|
})}
|
|
159
|
-
</
|
|
160
|
+
</StyledDropdownMenu>
|
|
160
161
|
)
|
|
161
162
|
: null}
|
|
162
163
|
</SplitButton>
|
|
@@ -164,6 +165,10 @@ export function ConnectMCPButton({
|
|
|
164
165
|
);
|
|
165
166
|
}
|
|
166
167
|
|
|
168
|
+
const StyledDropdownMenu = styled(DropdownMenu)`
|
|
169
|
+
--dropdown-menu-max-height: var(--connect-mcp-button-dropdown-max-height);
|
|
170
|
+
`;
|
|
171
|
+
|
|
167
172
|
const ConnectMCPButtonWrapper = styled.div`
|
|
168
173
|
display: inline-block;
|
|
169
174
|
position: relative;
|
|
@@ -162,9 +162,11 @@ export function Catalog(props: CatalogProps): JSX.Element {
|
|
|
162
162
|
<CatalogPageContentWrapper>
|
|
163
163
|
<CatalogTitleWrapper>
|
|
164
164
|
<CatalogTitle data-translation-key={catalogConfig?.titleTranslationKey}>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
<span>
|
|
166
|
+
{catalogConfig?.titleTranslationKey
|
|
167
|
+
? translate(catalogConfig?.titleTranslationKey)
|
|
168
|
+
: catalogConfig?.slug}
|
|
169
|
+
</span>{' '}
|
|
168
170
|
</CatalogTitle>
|
|
169
171
|
<CounterTag borderless>{entitiesCounter}</CounterTag>
|
|
170
172
|
</CatalogTitleWrapper>
|
|
@@ -256,7 +258,7 @@ const CatalogDescription = styled.p`
|
|
|
256
258
|
const CatalogPageWrapper = styled.div`
|
|
257
259
|
--sidebar-width: var(--catalog-sidebar-width);
|
|
258
260
|
|
|
259
|
-
height: calc(100vh - var(--navbar-
|
|
261
|
+
height: calc(100vh - var(--navbar-offset));
|
|
260
262
|
display: flex;
|
|
261
263
|
flex-direction: column;
|
|
262
264
|
overflow: hidden;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.tsx
CHANGED
|
@@ -3,5 +3,7 @@ import type { CatalogEntityRelationsGraphProps } from '@redocly/theme/components
|
|
|
3
3
|
import { dynamic } from '@redocly/theme/core/utils';
|
|
4
4
|
|
|
5
5
|
export const CatalogEntityRelationsGraph = dynamic<CatalogEntityRelationsGraphProps>(() =>
|
|
6
|
-
import('
|
|
6
|
+
import('@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph').then(
|
|
7
|
+
(mod) => mod.CatalogEntityRelationsGraph,
|
|
8
|
+
),
|
|
7
9
|
);
|
package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx
CHANGED
|
@@ -164,10 +164,10 @@ export function CatalogEntityHistorySidebar({
|
|
|
164
164
|
|
|
165
165
|
const SidebarOverlay = styled.div`
|
|
166
166
|
position: fixed;
|
|
167
|
-
top:
|
|
167
|
+
top: var(--navbar-offset);
|
|
168
168
|
left: 0;
|
|
169
169
|
width: var(--sidebar-width);
|
|
170
|
-
height: calc(100vh - var(--navbar-
|
|
170
|
+
height: calc(100vh - var(--navbar-offset));
|
|
171
171
|
padding: var(--catalog-history-sidebar-padding);
|
|
172
172
|
background-color: var(--catalog-history-sidebar-bg-color);
|
|
173
173
|
border-right: 1px solid var(--catalog-history-sidebar-border-color);
|
|
@@ -120,7 +120,7 @@ const SplitViewWrapper = styled.div`
|
|
|
120
120
|
const SchemaSampleWrapper = styled.div`
|
|
121
121
|
flex: 1;
|
|
122
122
|
position: sticky;
|
|
123
|
-
top: calc(var(--navbar-
|
|
123
|
+
top: calc(var(--navbar-offset) + var(--spacing-md));
|
|
124
124
|
align-self: flex-start;
|
|
125
125
|
padding-top: var(--spacing-sm);
|
|
126
126
|
`;
|
|
@@ -96,30 +96,28 @@ export function CatalogFilterCheckboxes({
|
|
|
96
96
|
<FilterOptions>
|
|
97
97
|
{filteredOptions.map(({ value, count }) => {
|
|
98
98
|
const id = 'filter--' + filter.property + '--' + value;
|
|
99
|
+
const checked =
|
|
100
|
+
filter.selectedOptions instanceof Set
|
|
101
|
+
? filter.selectedOptions.has(value) ||
|
|
102
|
+
filter.selectedOptions.has(value?.toLowerCase())
|
|
103
|
+
: false;
|
|
99
104
|
return (
|
|
100
|
-
<FilterCheckboxOption
|
|
101
|
-
|
|
102
|
-
role="link"
|
|
103
|
-
onClick={() => {
|
|
104
|
-
filter.toggleOption(value);
|
|
105
|
-
telemetry.sendCatalogEntitiesFilterCheckboxToggledMessage([
|
|
106
|
-
{
|
|
107
|
-
...getBaseDataAttributes('catalogEntitiesFilterCheckboxId', 'checkbox'),
|
|
108
|
-
category: filter.property,
|
|
109
|
-
value: value,
|
|
110
|
-
},
|
|
111
|
-
]);
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
114
|
-
<CheckboxIcon
|
|
115
|
-
checked={
|
|
116
|
-
filter.selectedOptions instanceof Set
|
|
117
|
-
? filter.selectedOptions.has(value) ||
|
|
118
|
-
filter.selectedOptions.has(value?.toLowerCase())
|
|
119
|
-
: false
|
|
120
|
-
}
|
|
121
|
-
/>
|
|
105
|
+
<FilterCheckboxOption key={id}>
|
|
106
|
+
<CheckboxIcon checked={checked} />
|
|
122
107
|
<FilterOptionLabel data-translation-key={value}>
|
|
108
|
+
<FilterCheckboxInput
|
|
109
|
+
checked={checked}
|
|
110
|
+
onChange={() => {
|
|
111
|
+
filter.toggleOption(value);
|
|
112
|
+
telemetry.sendCatalogEntitiesFilterCheckboxToggledMessage([
|
|
113
|
+
{
|
|
114
|
+
...getBaseDataAttributes('catalogEntitiesFilterCheckboxId', 'checkbox'),
|
|
115
|
+
category: filter.property,
|
|
116
|
+
value: value,
|
|
117
|
+
},
|
|
118
|
+
]);
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
123
121
|
{highlightText(changeTextCasing(translate(value), filterValuesCasing) || '')}
|
|
124
122
|
</FilterOptionLabel>
|
|
125
123
|
{showCounter && <CounterTag borderless>{count}</CounterTag>}
|
|
@@ -168,6 +166,23 @@ const HighlightedText = styled.span`
|
|
|
168
166
|
|
|
169
167
|
const FilterCheckboxOption = styled(FilterOption)`
|
|
170
168
|
padding-left: var(--filter-option-checkbox-padding-left);
|
|
169
|
+
|
|
170
|
+
&:has(input:focus-visible) {
|
|
171
|
+
outline: 1px solid var(--button-border-color-focused);
|
|
172
|
+
outline-offset: -1px;
|
|
173
|
+
}
|
|
174
|
+
`;
|
|
175
|
+
|
|
176
|
+
const FilterCheckboxInput = styled.input.attrs({ type: 'checkbox' })`
|
|
177
|
+
position: absolute;
|
|
178
|
+
width: 1px;
|
|
179
|
+
height: 1px;
|
|
180
|
+
margin: -1px;
|
|
181
|
+
padding: 0;
|
|
182
|
+
overflow: hidden;
|
|
183
|
+
clip: rect(0 0 0 0);
|
|
184
|
+
white-space: nowrap;
|
|
185
|
+
border: 0;
|
|
171
186
|
`;
|
|
172
187
|
|
|
173
188
|
const FilterSearchWrapper = styled.div`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { JSX } from 'react';
|
|
@@ -19,6 +19,7 @@ export function CatalogFilterDateRange({
|
|
|
19
19
|
filter,
|
|
20
20
|
className,
|
|
21
21
|
}: CatalogFilterDateRangeProps): JSX.Element {
|
|
22
|
+
const [today] = useState(() => new Date());
|
|
22
23
|
const { useTranslate } = useThemeHooks();
|
|
23
24
|
const { translate } = useTranslate();
|
|
24
25
|
|
|
@@ -60,7 +61,7 @@ export function CatalogFilterDateRange({
|
|
|
60
61
|
monthPlaceholder="MM"
|
|
61
62
|
yearPlaceholder="YYYY"
|
|
62
63
|
value={from}
|
|
63
|
-
maxDate={
|
|
64
|
+
maxDate={today}
|
|
64
65
|
onChange={(from) => {
|
|
65
66
|
if (Array.isArray(from)) return;
|
|
66
67
|
filter.selectOption({
|
|
@@ -23,7 +23,7 @@ export function CatalogMobileFiltersPanel({
|
|
|
23
23
|
|
|
24
24
|
const CatalogMobileFiltersPanelWrapper = styled.div`
|
|
25
25
|
width: 100%;
|
|
26
|
-
max-height: calc(100vh - var(--navbar-
|
|
26
|
+
max-height: calc(100vh - var(--navbar-offset));
|
|
27
27
|
overflow-y: auto;
|
|
28
28
|
background: var(--sidebar-bg-color);
|
|
29
29
|
display: flex;
|
package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx
CHANGED
|
@@ -27,10 +27,10 @@ export function CatalogMobileFiltersPanelOverlay({
|
|
|
27
27
|
const CatalogMobileFiltersPanelOverlayWrapper = styled.div`
|
|
28
28
|
display: none;
|
|
29
29
|
position: fixed;
|
|
30
|
-
top:
|
|
30
|
+
top: var(--navbar-offset);
|
|
31
31
|
left: 0;
|
|
32
32
|
width: 100%;
|
|
33
|
-
height: calc(100vh - var(--navbar-
|
|
33
|
+
height: calc(100vh - var(--navbar-offset));
|
|
34
34
|
z-index: 3;
|
|
35
35
|
background: var(--bg-color);
|
|
36
36
|
flex-direction: column;
|
|
@@ -10,8 +10,7 @@ import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
|
|
|
10
10
|
import type { ReportButtonProps } from '@redocly/theme/core/hooks';
|
|
11
11
|
import { useThemeHooks, useThemeConfig } from '@redocly/theme/core/hooks';
|
|
12
12
|
import { DeselectIcon } from '@redocly/theme/icons/DeselectIcon/DeselectIcon';
|
|
13
|
-
import {
|
|
14
|
-
import { MinimizeIcon } from '@redocly/theme/icons/MinimizeIcon/MinimizeIcon';
|
|
13
|
+
import { ExpandCollapseIcon } from '@redocly/theme/icons/ExpandCollapseIcon/ExpandCollapseIcon';
|
|
15
14
|
import { SelectIcon } from '@redocly/theme/icons/SelectIcon/SelectIcon';
|
|
16
15
|
import { WarningSquareIcon } from '@redocly/theme/icons/WarningSquareIcon/WarningSquareIcon';
|
|
17
16
|
import { Button } from '@redocly/theme/components/Button/Button';
|
|
@@ -116,16 +115,14 @@ export function CodeBlockControls({
|
|
|
116
115
|
variant="text"
|
|
117
116
|
size="small"
|
|
118
117
|
data-testid="expand-all"
|
|
119
|
-
icon={controlsType === 'icon' ? <
|
|
118
|
+
icon={controlsType === 'icon' ? <ExpandCollapseIcon /> : undefined}
|
|
120
119
|
aria-label="Expand all"
|
|
121
120
|
onClick={expand?.onClick}
|
|
122
121
|
>
|
|
123
122
|
{controlsType !== 'icon' && (expand?.label || 'Expand all')}
|
|
124
123
|
</ControlButton>
|
|
125
124
|
</Tooltip>
|
|
126
|
-
) :
|
|
127
|
-
|
|
128
|
-
{collapse && !codeSnippet?.collapse?.hide ? (
|
|
125
|
+
) : collapse && !codeSnippet?.collapse?.hide ? (
|
|
129
126
|
<Tooltip
|
|
130
127
|
tip={
|
|
131
128
|
collapse.props?.tooltip ||
|
|
@@ -138,7 +135,7 @@ export function CodeBlockControls({
|
|
|
138
135
|
variant="text"
|
|
139
136
|
size="small"
|
|
140
137
|
data-testid="collapse-all"
|
|
141
|
-
icon={controlsType === 'icon' ? <
|
|
138
|
+
icon={controlsType === 'icon' ? <ExpandCollapseIcon $collapse /> : undefined}
|
|
142
139
|
onClick={collapse?.onClick}
|
|
143
140
|
aria-label="Collapse all"
|
|
144
141
|
>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { JSX } from 'react';
|
|
4
|
+
|
|
5
|
+
import { ConsentBanner } from '@redocly/theme/components/Consent/ConsentBanner';
|
|
6
|
+
import { ConsentDialog } from '@redocly/theme/components/Consent/ConsentDialog';
|
|
7
|
+
import { useConsentTelemetry } from '@redocly/theme/core/hooks';
|
|
8
|
+
|
|
9
|
+
export function Consent(): JSX.Element {
|
|
10
|
+
useConsentTelemetry();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<ConsentBanner />
|
|
15
|
+
<ConsentDialog />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { keyframes } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { JSX } from 'react';
|
|
5
|
+
|
|
6
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
7
|
+
import { Link } from '@redocly/theme/components/Link/Link';
|
|
8
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
9
|
+
|
|
10
|
+
export function ConsentBanner(): JSX.Element | null {
|
|
11
|
+
const { useConsent, useTranslate } = useThemeHooks();
|
|
12
|
+
const consent = useConsent();
|
|
13
|
+
const { translate } = useTranslate();
|
|
14
|
+
|
|
15
|
+
if (!consent.enabled || consent.mode !== 'opt-in' || consent.decided || consent.isDialogOpen) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const title = translate('consent.title', 'We value your privacy');
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<BannerWrapper data-component-name="Consent/ConsentBanner" role="region" aria-label={title}>
|
|
23
|
+
<Title>{title}</Title>
|
|
24
|
+
<Message>
|
|
25
|
+
{translate(
|
|
26
|
+
'consent.message',
|
|
27
|
+
'By selecting "Accept all cookies", you agree to the use of cookies to improve site navigation, understand how our site is used, and support our marketing efforts. Select "Customize" to choose which types of cookies you allow.',
|
|
28
|
+
)}{' '}
|
|
29
|
+
{consent.config?.privacyPolicyUrl ? (
|
|
30
|
+
<Link to={consent.config.privacyPolicyUrl} external>
|
|
31
|
+
{translate('consent.privacyPolicy', 'Privacy policy')}
|
|
32
|
+
</Link>
|
|
33
|
+
) : null}
|
|
34
|
+
</Message>
|
|
35
|
+
<Actions>
|
|
36
|
+
<MainActions>
|
|
37
|
+
<Button variant="outlined" onClick={consent.reject}>
|
|
38
|
+
{translate('consent.rejectAll', 'Reject all')}
|
|
39
|
+
</Button>
|
|
40
|
+
<Button variant="primary" onClick={consent.accept}>
|
|
41
|
+
{translate('consent.acceptAllCookies', 'Accept all cookies')}
|
|
42
|
+
</Button>
|
|
43
|
+
</MainActions>
|
|
44
|
+
<Button variant="text" onClick={consent.openDialog}>
|
|
45
|
+
{translate('consent.customize', 'Customize')}
|
|
46
|
+
</Button>
|
|
47
|
+
</Actions>
|
|
48
|
+
</BannerWrapper>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const slideUp = keyframes`
|
|
53
|
+
from {
|
|
54
|
+
opacity: 0;
|
|
55
|
+
transform: translateY(16px);
|
|
56
|
+
}
|
|
57
|
+
to {
|
|
58
|
+
opacity: 1;
|
|
59
|
+
transform: translateY(0);
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
const BannerWrapper = styled.div`
|
|
64
|
+
position: fixed;
|
|
65
|
+
left: var(--consent-banner-offset);
|
|
66
|
+
bottom: var(--consent-banner-offset);
|
|
67
|
+
z-index: var(--consent-banner-z-index);
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
gap: var(--consent-banner-gap);
|
|
71
|
+
width: var(--consent-banner-width);
|
|
72
|
+
max-width: calc(100vw - 2 * var(--consent-banner-offset));
|
|
73
|
+
padding: var(--consent-banner-padding);
|
|
74
|
+
border: 1px solid var(--consent-banner-border-color);
|
|
75
|
+
border-radius: var(--consent-banner-border-radius);
|
|
76
|
+
background: var(--consent-banner-bg-color);
|
|
77
|
+
color: var(--consent-banner-text-color);
|
|
78
|
+
box-shadow: var(--consent-banner-box-shadow);
|
|
79
|
+
font-family: var(--font-family-base);
|
|
80
|
+
|
|
81
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
82
|
+
animation: ${slideUp} 240ms ease-out;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
|
|
86
|
+
const Title = styled.h2`
|
|
87
|
+
margin: 0;
|
|
88
|
+
font-size: var(--consent-banner-title-font-size);
|
|
89
|
+
font-weight: var(--font-weight-bold);
|
|
90
|
+
`;
|
|
91
|
+
|
|
92
|
+
const Message = styled.p`
|
|
93
|
+
margin: 0;
|
|
94
|
+
color: var(--text-color-secondary);
|
|
95
|
+
font-size: var(--consent-banner-font-size);
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
const Actions = styled.div`
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-wrap: wrap;
|
|
101
|
+
gap: var(--consent-banner-gap);
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: space-between;
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
const MainActions = styled.div`
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-wrap: wrap;
|
|
109
|
+
gap: var(--consent-banner-gap);
|
|
110
|
+
`;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { JSX } from 'react';
|
|
5
|
+
import type { UseConsentResult } from '@redocly/theme/core/types';
|
|
6
|
+
import type { ConsentDraft } from '@redocly/theme/core/hooks';
|
|
7
|
+
|
|
8
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
9
|
+
import { Link } from '@redocly/theme/components/Link/Link';
|
|
10
|
+
import { Portal } from '@redocly/theme/components/Portal/Portal';
|
|
11
|
+
import { Switch } from '@redocly/theme/components/Switch/Switch';
|
|
12
|
+
import { useConsentDialog, useThemeHooks } from '@redocly/theme/core/hooks';
|
|
13
|
+
import { CloseIcon } from '@redocly/theme/icons/CloseIcon/CloseIcon';
|
|
14
|
+
|
|
15
|
+
const noop = () => {};
|
|
16
|
+
|
|
17
|
+
export function ConsentDialog(): JSX.Element | null {
|
|
18
|
+
const { useConsent } = useThemeHooks();
|
|
19
|
+
const consent = useConsent();
|
|
20
|
+
|
|
21
|
+
if (!consent.enabled || !consent.isDialogOpen) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return <ConsentDialogContent consent={consent} />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function ConsentDialogContent({ consent }: { consent: UseConsentResult }): JSX.Element {
|
|
29
|
+
const { useTranslate } = useThemeHooks();
|
|
30
|
+
const { translate } = useTranslate();
|
|
31
|
+
const { draft, setCategory, dialogRef, close, save, categories } = useConsentDialog(consent);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Portal>
|
|
35
|
+
<Overlay
|
|
36
|
+
className="scroll-lock"
|
|
37
|
+
data-component-name="Consent/ConsentDialog"
|
|
38
|
+
onMouseDown={(event) => {
|
|
39
|
+
if (event.target === event.currentTarget) close();
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<Dialog
|
|
43
|
+
ref={dialogRef}
|
|
44
|
+
role="dialog"
|
|
45
|
+
aria-modal="true"
|
|
46
|
+
aria-labelledby="redocly-consent-dialog-title"
|
|
47
|
+
tabIndex={-1}
|
|
48
|
+
>
|
|
49
|
+
<TitleRow>
|
|
50
|
+
<Title id="redocly-consent-dialog-title">
|
|
51
|
+
{translate('consent.dialog.title', 'Cookie preferences')}
|
|
52
|
+
</Title>
|
|
53
|
+
<Button
|
|
54
|
+
variant="ghost"
|
|
55
|
+
size="small"
|
|
56
|
+
icon={<CloseIcon />}
|
|
57
|
+
aria-label={translate('consent.dialog.close', 'Close')}
|
|
58
|
+
onClick={close}
|
|
59
|
+
/>
|
|
60
|
+
</TitleRow>
|
|
61
|
+
<Description>
|
|
62
|
+
{translate(
|
|
63
|
+
'consent.dialog.description',
|
|
64
|
+
'Choose which cookies this site may use. You can change your choice at any time.',
|
|
65
|
+
)}{' '}
|
|
66
|
+
{consent.config?.privacyPolicyUrl ? (
|
|
67
|
+
<Link to={consent.config.privacyPolicyUrl} external>
|
|
68
|
+
{translate('consent.privacyPolicy', 'Privacy policy')}
|
|
69
|
+
</Link>
|
|
70
|
+
) : null}
|
|
71
|
+
</Description>
|
|
72
|
+
{categories.map((category) => {
|
|
73
|
+
const gpcLocked = category.id === 'marketing' && consent.gpc;
|
|
74
|
+
return (
|
|
75
|
+
<Row key={category.id}>
|
|
76
|
+
<RowText>
|
|
77
|
+
<RowTitle>
|
|
78
|
+
{translate(category.titleTranslationKey, category.titleDefault)}
|
|
79
|
+
</RowTitle>
|
|
80
|
+
<RowDescription>
|
|
81
|
+
{translate(category.descriptionTranslationKey, category.descriptionDefault)}
|
|
82
|
+
</RowDescription>
|
|
83
|
+
{gpcLocked ? (
|
|
84
|
+
<GpcNotice>
|
|
85
|
+
{translate(
|
|
86
|
+
'consent.gpcNotice',
|
|
87
|
+
'Your browser asked us not to share your data, so this stays off.',
|
|
88
|
+
)}
|
|
89
|
+
</GpcNotice>
|
|
90
|
+
) : null}
|
|
91
|
+
</RowText>
|
|
92
|
+
{category.locked ? (
|
|
93
|
+
<SwitchGroup role="group" aria-label={translate('consent.alwaysOn', 'Always on')}>
|
|
94
|
+
<Switch value={true} disabled onChange={noop} />
|
|
95
|
+
</SwitchGroup>
|
|
96
|
+
) : gpcLocked ? (
|
|
97
|
+
<SwitchGroup
|
|
98
|
+
role="group"
|
|
99
|
+
aria-label={translate('consent.alwaysOff', 'Always off')}
|
|
100
|
+
>
|
|
101
|
+
<Switch value={false} disabled onChange={noop} />
|
|
102
|
+
</SwitchGroup>
|
|
103
|
+
) : (
|
|
104
|
+
<Switch
|
|
105
|
+
value={draft[category.id as keyof ConsentDraft]}
|
|
106
|
+
onChange={(value) => setCategory(category.id as keyof ConsentDraft, value)}
|
|
107
|
+
/>
|
|
108
|
+
)}
|
|
109
|
+
</Row>
|
|
110
|
+
);
|
|
111
|
+
})}
|
|
112
|
+
<Actions>
|
|
113
|
+
<Button variant="outlined" onClick={consent.reject}>
|
|
114
|
+
{translate('consent.rejectAll', 'Reject all')}
|
|
115
|
+
</Button>
|
|
116
|
+
<Spacer />
|
|
117
|
+
<Button variant="outlined" onClick={consent.accept}>
|
|
118
|
+
{translate('consent.acceptAll', 'Accept all')}
|
|
119
|
+
</Button>
|
|
120
|
+
<Button variant="primary" onClick={save}>
|
|
121
|
+
{translate('consent.savePreferences', 'Save preferences')}
|
|
122
|
+
</Button>
|
|
123
|
+
</Actions>
|
|
124
|
+
</Dialog>
|
|
125
|
+
</Overlay>
|
|
126
|
+
</Portal>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const Overlay = styled.div`
|
|
131
|
+
position: fixed;
|
|
132
|
+
inset: 0;
|
|
133
|
+
z-index: var(--z-index-overlay);
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
background: var(--bg-color-modal-overlay);
|
|
138
|
+
font-family: var(--font-family-base);
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
const Dialog = styled.div`
|
|
142
|
+
width: var(--consent-dialog-width);
|
|
143
|
+
max-width: var(--consent-dialog-max-width);
|
|
144
|
+
padding: var(--consent-dialog-padding);
|
|
145
|
+
border-radius: var(--consent-dialog-border-radius);
|
|
146
|
+
background: var(--consent-dialog-bg-color);
|
|
147
|
+
box-shadow: var(--consent-dialog-box-shadow);
|
|
148
|
+
`;
|
|
149
|
+
|
|
150
|
+
const TitleRow = styled.div`
|
|
151
|
+
display: flex;
|
|
152
|
+
gap: var(--spacing-xs);
|
|
153
|
+
align-items: flex-start;
|
|
154
|
+
justify-content: space-between;
|
|
155
|
+
`;
|
|
156
|
+
|
|
157
|
+
const Title = styled.h2`
|
|
158
|
+
margin: 0 0 var(--spacing-xs);
|
|
159
|
+
font-size: var(--font-size-lg);
|
|
160
|
+
`;
|
|
161
|
+
|
|
162
|
+
const Description = styled.p`
|
|
163
|
+
margin: 0 0 var(--spacing-base);
|
|
164
|
+
color: var(--consent-dialog-description-color);
|
|
165
|
+
font-size: var(--font-size-sm);
|
|
166
|
+
`;
|
|
167
|
+
|
|
168
|
+
const Row = styled.div`
|
|
169
|
+
display: flex;
|
|
170
|
+
gap: var(--spacing-base);
|
|
171
|
+
align-items: flex-start;
|
|
172
|
+
padding: var(--spacing-sm) 0;
|
|
173
|
+
border-top: 1px solid var(--consent-dialog-row-border-color);
|
|
174
|
+
`;
|
|
175
|
+
|
|
176
|
+
const RowText = styled.div`
|
|
177
|
+
flex: 1;
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
const RowTitle = styled.div`
|
|
181
|
+
font-size: var(--font-size-base);
|
|
182
|
+
font-weight: var(--font-weight-bold);
|
|
183
|
+
`;
|
|
184
|
+
|
|
185
|
+
const RowDescription = styled.div`
|
|
186
|
+
color: var(--consent-dialog-description-color);
|
|
187
|
+
font-size: var(--font-size-sm);
|
|
188
|
+
`;
|
|
189
|
+
|
|
190
|
+
const GpcNotice = styled.div`
|
|
191
|
+
color: var(--consent-dialog-description-color);
|
|
192
|
+
font-size: var(--font-size-sm);
|
|
193
|
+
`;
|
|
194
|
+
|
|
195
|
+
const SwitchGroup = styled.div`
|
|
196
|
+
flex: none;
|
|
197
|
+
`;
|
|
198
|
+
|
|
199
|
+
const Actions = styled.div`
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-wrap: wrap;
|
|
202
|
+
gap: var(--spacing-xs);
|
|
203
|
+
margin-top: var(--spacing-base);
|
|
204
|
+
padding-top: var(--spacing-base);
|
|
205
|
+
border-top: 1px solid var(--consent-dialog-row-border-color);
|
|
206
|
+
`;
|
|
207
|
+
|
|
208
|
+
const Spacer = styled.span`
|
|
209
|
+
flex: 1;
|
|
210
|
+
`;
|