@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
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SearchAiActivity = SearchAiActivity;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
39
|
+
const hooks_1 = require("../../core/hooks");
|
|
40
|
+
const styles_1 = require("../../core/styles");
|
|
41
|
+
const AiStarsIcon_1 = require("../../icons/AiStarsIcon/AiStarsIcon");
|
|
42
|
+
const ChatIcon_1 = require("../../icons/ChatIcon/ChatIcon");
|
|
43
|
+
const ChevronDownIcon_1 = require("../../icons/ChevronDownIcon/ChevronDownIcon");
|
|
44
|
+
const CodeIcon_1 = require("../../icons/CodeIcon/CodeIcon");
|
|
45
|
+
const SearchIcon_1 = require("../../icons/SearchIcon/SearchIcon");
|
|
46
|
+
const ACTIVITY_KIND_ICONS = {
|
|
47
|
+
thinking: AiStarsIcon_1.AiStarsIcon,
|
|
48
|
+
search: SearchIcon_1.SearchIcon,
|
|
49
|
+
support: ChatIcon_1.ChatIcon,
|
|
50
|
+
code: CodeIcon_1.CodeIcon,
|
|
51
|
+
};
|
|
52
|
+
function SearchAiActivity({ toolCalls, isActive, className, }) {
|
|
53
|
+
var _a;
|
|
54
|
+
const [isExpanded, setIsExpanded] = (0, react_1.useState)(false);
|
|
55
|
+
const listId = (0, react_1.useId)();
|
|
56
|
+
const { status, steps } = (0, hooks_1.useSearchAiActivity)({ toolCalls, isActive });
|
|
57
|
+
const StatusIcon = ACTIVITY_KIND_ICONS[status.kind];
|
|
58
|
+
const header = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
59
|
+
react_1.default.createElement(IconWrapper, { "aria-hidden": true },
|
|
60
|
+
react_1.default.createElement(StatusIcon, { size: "var(--search-ai-activity-icon-size)" })),
|
|
61
|
+
react_1.default.createElement(StatusLabel, { key: `${status.label}${(_a = status.detail) !== null && _a !== void 0 ? _a : ''}`, title: status.detail ? `${status.label} “${status.detail}”` : status.label, $isRunning: status.isRunning },
|
|
62
|
+
status.label,
|
|
63
|
+
status.detail && react_1.default.createElement(StatusDetail, null,
|
|
64
|
+
" \u201C",
|
|
65
|
+
status.detail,
|
|
66
|
+
"\u201D")),
|
|
67
|
+
steps.length > 1 && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
68
|
+
' ',
|
|
69
|
+
react_1.default.createElement(ToolCallCount, null, steps.length))),
|
|
70
|
+
steps.length > 0 && (react_1.default.createElement(ExpandIcon, { size: "var(--search-ai-activity-icon-size)", $isExpanded: isExpanded }))));
|
|
71
|
+
return (react_1.default.createElement(SearchAiActivityWrapper, { "data-component-name": "Search/SearchAiActivity", "data-testid": "tool-calls-info", className: className }, steps.length > 0 ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
72
|
+
react_1.default.createElement(HeaderButton, { type: "button", "aria-expanded": isExpanded, "aria-controls": listId, onClick: () => setIsExpanded((expanded) => !expanded) }, header),
|
|
73
|
+
react_1.default.createElement(StepsWrapper, { id: listId, $isExpanded: isExpanded },
|
|
74
|
+
react_1.default.createElement(StepList, null, steps.map((step) => {
|
|
75
|
+
const StepIcon = ACTIVITY_KIND_ICONS[step.kind];
|
|
76
|
+
return (react_1.default.createElement(StepItem, { key: step.id },
|
|
77
|
+
react_1.default.createElement(StepIconWrapper, { "aria-hidden": true },
|
|
78
|
+
react_1.default.createElement(StepIcon, { size: "var(--search-ai-activity-icon-size)" })),
|
|
79
|
+
react_1.default.createElement(StepText, { $isRunning: step.isRunning && isExpanded }, step.label)));
|
|
80
|
+
}))))) : (react_1.default.createElement(HeaderWrapper, null, header))));
|
|
81
|
+
}
|
|
82
|
+
const labelIn = (0, styled_components_1.keyframes) `
|
|
83
|
+
from {
|
|
84
|
+
opacity: 0.35;
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
const shimmerSweep = (0, styled_components_1.keyframes) `
|
|
88
|
+
from {
|
|
89
|
+
background-position: 100% 0;
|
|
90
|
+
}
|
|
91
|
+
to {
|
|
92
|
+
background-position: 0 0;
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
const shimmer = (0, styled_components_1.css) `
|
|
96
|
+
@supports (background-clip: text) or (-webkit-background-clip: text) {
|
|
97
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
98
|
+
background:
|
|
99
|
+
linear-gradient(
|
|
100
|
+
90deg,
|
|
101
|
+
transparent 0%,
|
|
102
|
+
transparent 40%,
|
|
103
|
+
var(--search-ai-activity-shimmer-color) 50%,
|
|
104
|
+
transparent 60%,
|
|
105
|
+
transparent 100%
|
|
106
|
+
)
|
|
107
|
+
100% 0 / 250% 100% no-repeat,
|
|
108
|
+
linear-gradient(currentColor, currentColor);
|
|
109
|
+
-webkit-background-clip: text;
|
|
110
|
+
background-clip: text;
|
|
111
|
+
-webkit-text-fill-color: transparent;
|
|
112
|
+
animation:
|
|
113
|
+
${labelIn} var(--search-ai-activity-fade-duration) ease-out,
|
|
114
|
+
${shimmerSweep} var(--search-ai-activity-shimmer-duration) linear
|
|
115
|
+
infinite;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
const SearchAiActivityWrapper = styled_components_1.default.div `
|
|
120
|
+
font-size: var(--search-ai-activity-font-size);
|
|
121
|
+
line-height: var(--search-ai-activity-line-height);
|
|
122
|
+
color: var(--search-ai-activity-text-color);
|
|
123
|
+
`;
|
|
124
|
+
const headerStyles = (0, styled_components_1.css) `
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: var(--spacing-xs);
|
|
128
|
+
max-width: 100%;
|
|
129
|
+
min-height: var(--search-ai-activity-line-height);
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
`;
|
|
132
|
+
const HeaderWrapper = styled_components_1.default.div `
|
|
133
|
+
${headerStyles}
|
|
134
|
+
`;
|
|
135
|
+
const HeaderButton = styled_components_1.default.button `
|
|
136
|
+
${headerStyles}
|
|
137
|
+
margin: 0;
|
|
138
|
+
padding: 0;
|
|
139
|
+
border: 0;
|
|
140
|
+
border-radius: var(--border-radius);
|
|
141
|
+
background: none;
|
|
142
|
+
font: inherit;
|
|
143
|
+
color: inherit;
|
|
144
|
+
text-align: start;
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
transition: color var(--search-ai-activity-fade-duration) ease-out;
|
|
147
|
+
|
|
148
|
+
&:hover {
|
|
149
|
+
color: var(--search-ai-activity-text-color-hover);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&:focus-visible {
|
|
153
|
+
outline: 2px solid var(--button-border-color-focused);
|
|
154
|
+
outline-offset: 2px;
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
const IconWrapper = styled_components_1.default.span `
|
|
158
|
+
display: inline-flex;
|
|
159
|
+
flex-shrink: 0;
|
|
160
|
+
width: var(--search-ai-activity-icon-size);
|
|
161
|
+
height: var(--search-ai-activity-icon-size);
|
|
162
|
+
`;
|
|
163
|
+
const StatusLabel = styled_components_1.default.span `
|
|
164
|
+
min-width: 0;
|
|
165
|
+
overflow: hidden;
|
|
166
|
+
text-overflow: ellipsis;
|
|
167
|
+
font-weight: var(--font-weight-regular);
|
|
168
|
+
animation: ${labelIn} var(--search-ai-activity-fade-duration) ease-out;
|
|
169
|
+
|
|
170
|
+
@media (prefers-reduced-motion: reduce) {
|
|
171
|
+
animation: none;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
${({ $isRunning }) => $isRunning && shimmer}
|
|
175
|
+
`;
|
|
176
|
+
const StatusDetail = styled_components_1.default.span `
|
|
177
|
+
color: var(--search-ai-activity-detail-color);
|
|
178
|
+
`;
|
|
179
|
+
const ToolCallCount = styled_components_1.default.span `
|
|
180
|
+
flex-shrink: 0;
|
|
181
|
+
min-width: calc(var(--search-ai-activity-line-height) - 4px);
|
|
182
|
+
padding: 0 var(--spacing-xxs);
|
|
183
|
+
border-radius: calc(var(--search-ai-activity-line-height) / 2);
|
|
184
|
+
background: var(--search-ai-activity-count-bg-color);
|
|
185
|
+
font-size: var(--search-ai-activity-count-font-size);
|
|
186
|
+
line-height: calc(var(--search-ai-activity-line-height) - 4px);
|
|
187
|
+
font-variant-numeric: tabular-nums;
|
|
188
|
+
text-align: center;
|
|
189
|
+
`;
|
|
190
|
+
const ExpandIcon = (0, styled_components_1.default)(ChevronDownIcon_1.ChevronDownIcon) `
|
|
191
|
+
flex-shrink: 0;
|
|
192
|
+
margin-inline-start: calc(var(--spacing-xxs) * -1);
|
|
193
|
+
transform: rotate(${({ $isExpanded }) => ($isExpanded ? '180deg' : '0deg')});
|
|
194
|
+
transition: transform var(--search-ai-activity-expand-duration)
|
|
195
|
+
var(--search-ai-activity-easing);
|
|
196
|
+
|
|
197
|
+
@media (prefers-reduced-motion: reduce) {
|
|
198
|
+
transition: none;
|
|
199
|
+
}
|
|
200
|
+
`;
|
|
201
|
+
const StepsWrapper = styled_components_1.default.div `
|
|
202
|
+
display: grid;
|
|
203
|
+
grid-template-rows: ${({ $isExpanded }) => ($isExpanded ? '1fr' : '0fr')};
|
|
204
|
+
opacity: ${({ $isExpanded }) => ($isExpanded ? 1 : 0)};
|
|
205
|
+
visibility: ${({ $isExpanded }) => ($isExpanded ? 'visible' : 'hidden')};
|
|
206
|
+
${({ $isExpanded }) => !$isExpanded &&
|
|
207
|
+
(0, styled_components_1.css) `
|
|
208
|
+
contain: inline-size;
|
|
209
|
+
`}
|
|
210
|
+
transition:
|
|
211
|
+
grid-template-rows var(--search-ai-activity-expand-duration) var(--search-ai-activity-easing),
|
|
212
|
+
opacity var(--search-ai-activity-expand-duration) ease-out,
|
|
213
|
+
visibility var(--search-ai-activity-expand-duration);
|
|
214
|
+
|
|
215
|
+
@media (prefers-reduced-motion: reduce) {
|
|
216
|
+
transition: none;
|
|
217
|
+
}
|
|
218
|
+
`;
|
|
219
|
+
const STEP_GAP = 'var(--spacing-xs)';
|
|
220
|
+
const ICON_OFFSET = 'calc((var(--search-ai-activity-line-height) - var(--search-ai-activity-icon-size)) / 2)';
|
|
221
|
+
const RAIL_GAP = '3px';
|
|
222
|
+
const RAIL_INSET = 'calc(var(--search-ai-activity-icon-size) / 2 - 0.5px)';
|
|
223
|
+
const StepList = styled_components_1.default.ol `
|
|
224
|
+
min-height: 0;
|
|
225
|
+
overflow: hidden;
|
|
226
|
+
margin: 0;
|
|
227
|
+
padding: 0;
|
|
228
|
+
list-style: none;
|
|
229
|
+
|
|
230
|
+
/* Padding would stay visible while the list is collapsed; the spacer collapses with it. */
|
|
231
|
+
&::before {
|
|
232
|
+
content: "";
|
|
233
|
+
display: block;
|
|
234
|
+
height: ${STEP_GAP};
|
|
235
|
+
}
|
|
236
|
+
`;
|
|
237
|
+
const StepItem = styled_components_1.default.li `
|
|
238
|
+
position: relative;
|
|
239
|
+
display: flex;
|
|
240
|
+
gap: var(--spacing-xs);
|
|
241
|
+
padding-bottom: ${STEP_GAP};
|
|
242
|
+
${styles_1.searchAiAppearAnimation}
|
|
243
|
+
|
|
244
|
+
&:last-child {
|
|
245
|
+
padding-bottom: 0;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&:first-child::before,
|
|
249
|
+
&:not(:last-child)::after {
|
|
250
|
+
content: "";
|
|
251
|
+
position: absolute;
|
|
252
|
+
inset-inline-start: ${RAIL_INSET};
|
|
253
|
+
width: 1px;
|
|
254
|
+
background: var(--search-ai-activity-rail-color);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&:first-child::before {
|
|
258
|
+
top: calc(${STEP_GAP} * -1 - ${ICON_OFFSET} + ${RAIL_GAP});
|
|
259
|
+
height: calc(${STEP_GAP} + ${ICON_OFFSET} * 2 - ${RAIL_GAP} * 2);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
&:not(:last-child)::after {
|
|
263
|
+
top: calc(
|
|
264
|
+
${ICON_OFFSET} + var(--search-ai-activity-icon-size) + ${RAIL_GAP}
|
|
265
|
+
);
|
|
266
|
+
bottom: calc(${RAIL_GAP} - ${ICON_OFFSET});
|
|
267
|
+
}
|
|
268
|
+
`;
|
|
269
|
+
const StepIconWrapper = (0, styled_components_1.default)(IconWrapper) `
|
|
270
|
+
margin-top: ${ICON_OFFSET};
|
|
271
|
+
`;
|
|
272
|
+
const StepText = styled_components_1.default.span `
|
|
273
|
+
min-width: 0;
|
|
274
|
+
overflow-wrap: anywhere;
|
|
275
|
+
|
|
276
|
+
${({ $isRunning }) => $isRunning && shimmer}
|
|
277
|
+
`;
|
|
278
|
+
//# sourceMappingURL=SearchAiActivity.js.map
|
|
@@ -48,17 +48,21 @@ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, classN
|
|
|
48
48
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
49
49
|
const { translate } = useTranslate();
|
|
50
50
|
const inputRef = (0, react_1.useRef)(null);
|
|
51
|
+
const wasGeneratingResponseRef = (0, react_1.useRef)(isGeneratingResponse);
|
|
51
52
|
const [query, setQuery] = (0, react_1.useState)('');
|
|
52
53
|
(0, react_1.useEffect)(() => {
|
|
53
|
-
|
|
54
|
+
const wasGeneratingResponse = wasGeneratingResponseRef.current;
|
|
55
|
+
wasGeneratingResponseRef.current = isGeneratingResponse;
|
|
56
|
+
if (wasGeneratingResponse && !isGeneratingResponse) {
|
|
54
57
|
requestAnimationFrame(() => {
|
|
55
58
|
var _a;
|
|
56
59
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
62
|
}, [isGeneratingResponse]);
|
|
63
|
+
const isDisabled = disabled || isGeneratingResponse || query.trim().length === 0;
|
|
60
64
|
const handleSendMessage = () => {
|
|
61
|
-
if (
|
|
65
|
+
if (isDisabled)
|
|
62
66
|
return;
|
|
63
67
|
setQuery('');
|
|
64
68
|
onMessageSent(query);
|
|
@@ -72,7 +76,6 @@ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, classN
|
|
|
72
76
|
handleSendMessage();
|
|
73
77
|
}
|
|
74
78
|
};
|
|
75
|
-
const isDisabled = disabled || isGeneratingResponse || query.trim().length === 0;
|
|
76
79
|
const commonProps = {
|
|
77
80
|
placeholder: placeholder || translate('search.ai.followUpQuestion', 'Ask a follow up question?'),
|
|
78
81
|
onChange: (e) => setQuery(e.target.value),
|
|
@@ -83,7 +86,7 @@ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, classN
|
|
|
83
86
|
};
|
|
84
87
|
return (react_1.default.createElement(SearchAiConversationInputWrapper, { "data-component-name": "Search/SearchAiConversationInput", className: className },
|
|
85
88
|
multiline ? (react_1.default.createElement(ConversationTextarea, Object.assign({ ref: inputRef }, commonProps))) : (react_1.default.createElement(ConversationInput, Object.assign({ ref: inputRef, type: "text" }, commonProps))),
|
|
86
|
-
react_1.default.createElement(SendButton, { disabled: isDisabled, size: "small", icon: react_1.default.createElement(SendIcon_1.SendIcon, { color: isDisabled
|
|
89
|
+
react_1.default.createElement(SendButton, { "aria-label": translate('search.ai.send', 'Send question'), "aria-disabled": isDisabled, size: "small", icon: react_1.default.createElement(SendIcon_1.SendIcon, { color: isDisabled
|
|
87
90
|
? '--button-content-color-disabled'
|
|
88
91
|
: 'var(--search-ai-conversation-input-send-button-icon-color)' }), onClick: handleSendMessage })));
|
|
89
92
|
}
|
|
@@ -151,11 +154,12 @@ const SendButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
|
151
154
|
border-radius: var(--search-ai-conversation-input-send-button-border-radius);
|
|
152
155
|
padding: var(--search-ai-conversation-input-send-button-padding);
|
|
153
156
|
|
|
154
|
-
&:hover {
|
|
157
|
+
&:hover:not([aria-disabled='true']) {
|
|
155
158
|
background-color: var(--search-ai-conversation-input-send-button-bg-color-hover);
|
|
156
159
|
}
|
|
157
160
|
|
|
158
|
-
|
|
161
|
+
&[aria-disabled='true'] {
|
|
162
|
+
cursor: default;
|
|
159
163
|
background-color: var(--search-ai-conversation-input-send-button-bg-color-disabled);
|
|
160
164
|
border: var(--search-ai-conversation-input-send-button-border-disabled);
|
|
161
165
|
}
|
|
@@ -52,6 +52,13 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
52
52
|
const { aiAssistant } = (0, hooks_1.useThemeConfig)();
|
|
53
53
|
const { translate } = useTranslate();
|
|
54
54
|
const conversationEndRef = react_1.default.useRef(null);
|
|
55
|
+
const wrapperRef = react_1.default.useRef(null);
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
requestAnimationFrame(() => {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
(_b = (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[data-component-name="Search/SearchAiConversationInput"] :is(input, textarea):not(:disabled)')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
60
|
+
});
|
|
61
|
+
}, []);
|
|
55
62
|
const suggestions = (_a = aiAssistant === null || aiAssistant === void 0 ? void 0 : aiAssistant.suggestions) !== null && _a !== void 0 ? _a : [];
|
|
56
63
|
const placeholder = isGeneratingResponse
|
|
57
64
|
? translate('search.ai.generatingResponse', 'Generating response...')
|
|
@@ -92,6 +99,10 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
92
99
|
}
|
|
93
100
|
// oxlint-disable-next-line react-you-might-not-need-an-effect/no-pass-data-to-parent -- merges the streamed assistant response into the lifted conversation state as chunks arrive
|
|
94
101
|
setConversation((prev) => {
|
|
102
|
+
// A reset can land between this effect's render and its update.
|
|
103
|
+
if (prev.length === 0) {
|
|
104
|
+
return prev;
|
|
105
|
+
}
|
|
95
106
|
const lastMessage = prev[prev.length - 1];
|
|
96
107
|
const content = response || '';
|
|
97
108
|
if (lastMessage && lastMessage.role === constants_1.AiSearchConversationRole.ASSISTANT) {
|
|
@@ -139,14 +150,14 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
139
150
|
const handleFeedbackChange = (0, react_1.useCallback)((messageId, feedback) => {
|
|
140
151
|
setConversation((prev) => prev.map((item) => (item.messageId === messageId ? Object.assign(Object.assign({}, item), { feedback }) : item)));
|
|
141
152
|
}, [setConversation]);
|
|
142
|
-
return (react_1.default.createElement(SearchAiDialogWrapper, { "data-component-name": "Search/SearchAiDialog", className: className },
|
|
153
|
+
return (react_1.default.createElement(SearchAiDialogWrapper, { ref: wrapperRef, "data-component-name": "Search/SearchAiDialog", className: className },
|
|
143
154
|
!conversation.length && (react_1.default.createElement(WelcomeWrapper, null,
|
|
144
155
|
react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { color: "var(--search-ai-icon-color)", size: "32px", background: "var(--search-ai-icon-bg-color)", borderRadius: "var(--border-radius-lg)", margin: "0 var(--spacing-xs) 0 0" }),
|
|
145
156
|
translate('search.ai.welcomeText', 'Welcome to AI assistant! Feel free to ask me anything. How can I help you? '))),
|
|
146
157
|
react_1.default.createElement(ConversationWrapper, null,
|
|
147
158
|
conversation.map((item, index) => (react_1.default.createElement(SearchAiMessage_1.SearchAiMessage, { key: `search-ai-message-${index}`, role: item.role, content: item.content, isThinking: item.role === constants_1.AiSearchConversationRole.ASSISTANT &&
|
|
148
159
|
isGeneratingResponse &&
|
|
149
|
-
index === conversation.length - 1, resources: item.resources, messageId: item.messageId, feedback: item.feedback, onFeedbackChange: handleFeedbackChange,
|
|
160
|
+
index === conversation.length - 1, resources: item.resources, messageId: item.messageId, feedback: item.feedback, onFeedbackChange: handleFeedbackChange, contentSegments: item.contentSegments }))),
|
|
150
161
|
error && (react_1.default.createElement(Admonition_1.Admonition, { type: "danger", name: translate(constants_1.AI_SEARCH_ERROR_CONFIG[error].headerKey, constants_1.AI_SEARCH_ERROR_CONFIG[error].headerDefault) }, translate(constants_1.AI_SEARCH_ERROR_CONFIG[error].messageKey, constants_1.AI_SEARCH_ERROR_CONFIG[error].messageDefault))),
|
|
151
162
|
!conversation.length && !error && (react_1.default.createElement(SuggestionsWrapper, null, suggestions === null || suggestions === void 0 ? void 0 : suggestions.map((suggestion) => (react_1.default.createElement(Button_1.Button, { key: suggestion, variant: "outlined", onClick: () => handleOnMessageSent(suggestion) }, suggestion))))),
|
|
152
163
|
react_1.default.createElement("div", { ref: conversationEndRef })),
|
|
@@ -10,9 +10,10 @@ export type SearchAiMessageProps = {
|
|
|
10
10
|
messageId?: string;
|
|
11
11
|
feedback?: FeedbackType;
|
|
12
12
|
onFeedbackChange: (messageId: string, feedback: FeedbackType | undefined) => void;
|
|
13
|
+
/** @deprecated Not used; the message reads its tool calls from `contentSegments`. */
|
|
13
14
|
toolCalls?: ToolCall[];
|
|
14
15
|
contentSegments?: ContentSegment[];
|
|
15
16
|
};
|
|
16
|
-
declare function SearchAiMessageComponent({ role, content, isThinking, resources, className, messageId, feedback, onFeedbackChange,
|
|
17
|
+
declare function SearchAiMessageComponent({ role, content, isThinking, resources, className, messageId, feedback, onFeedbackChange, contentSegments, }: SearchAiMessageProps): JSX.Element;
|
|
17
18
|
export declare const SearchAiMessage: React.MemoExoticComponent<typeof SearchAiMessageComponent>;
|
|
18
19
|
export {};
|
|
@@ -41,6 +41,7 @@ const react_1 = __importStar(require("react"));
|
|
|
41
41
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
42
|
const types_1 = require("../../core/types");
|
|
43
43
|
const constants_1 = require("../../core/constants");
|
|
44
|
+
const utils_1 = require("../../core/utils");
|
|
44
45
|
const Link_1 = require("../../components/Link/Link");
|
|
45
46
|
const Tag_1 = require("../../components/Tag/Tag");
|
|
46
47
|
const hooks_1 = require("../../core/hooks");
|
|
@@ -50,36 +51,14 @@ const AiStarsIcon_1 = require("../../icons/AiStarsIcon/AiStarsIcon");
|
|
|
50
51
|
const CheckmarkOutlineIcon_1 = require("../../icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon");
|
|
51
52
|
const SearchAiActionButtons_1 = require("../../components/Search/SearchAiActionButtons");
|
|
52
53
|
const SearchAiNegativeFeedbackForm_1 = require("../../components/Search/SearchAiNegativeFeedbackForm");
|
|
54
|
+
const SearchAiActivity_1 = require("../../components/Search/SearchAiActivity");
|
|
55
|
+
const styles_1 = require("../../core/styles");
|
|
53
56
|
function MarkdownSegment({ text }) {
|
|
54
57
|
const { useMarkdownText } = (0, hooks_1.useThemeHooks)();
|
|
55
58
|
const markdown = useMarkdownText(text);
|
|
56
59
|
return react_1.default.createElement(ResponseText, { as: "div", children: markdown, "data-testid": "response-text" });
|
|
57
60
|
}
|
|
58
|
-
|
|
59
|
-
// does; show that instead of a generic "Executing execute..." label.
|
|
60
|
-
function getExecuteDescription(args) {
|
|
61
|
-
if (args && typeof args === 'object' && 'description' in args) {
|
|
62
|
-
const { description } = args;
|
|
63
|
-
if (typeof description === 'string' && description.trim().length > 0) {
|
|
64
|
-
return description.trim();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
function getToolCallDisplayText(toolCall) {
|
|
70
|
-
var _a;
|
|
71
|
-
if (toolCall.name === types_1.ToolCallName.Execute) {
|
|
72
|
-
const description = getExecuteDescription(toolCall.args);
|
|
73
|
-
if (description) {
|
|
74
|
-
return { inProgressText: description, completedText: description };
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return ((_a = constants_1.TOOL_CALL_DISPLAY_TEXT[toolCall.name]) !== null && _a !== void 0 ? _a : {
|
|
78
|
-
inProgressText: `Executing ${toolCall.name}...`,
|
|
79
|
-
completedText: `${toolCall.name} executed`,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
function SearchAiMessageComponent({ role, content, isThinking, resources, className, messageId, feedback, onFeedbackChange, toolCalls = [], contentSegments = [{ type: 'text', text: content }], }) {
|
|
61
|
+
function SearchAiMessageComponent({ role, content, isThinking, resources, className, messageId, feedback, onFeedbackChange, contentSegments = [{ type: 'text', text: content }], }) {
|
|
83
62
|
var _a;
|
|
84
63
|
const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
85
64
|
const { translate } = useTranslate();
|
|
@@ -88,7 +67,8 @@ function SearchAiMessageComponent({ role, content, isThinking, resources, classN
|
|
|
88
67
|
const hasResources = !isThinking && resources && resources.length > 0;
|
|
89
68
|
const resourcesCount = (_a = resources === null || resources === void 0 ? void 0 : resources.length) !== null && _a !== void 0 ? _a : 0;
|
|
90
69
|
const showSuccessMessage = feedbackSent && feedback;
|
|
91
|
-
const
|
|
70
|
+
const groupedSegments = (0, utils_1.groupToolCallSegments)(contentSegments, isThinking);
|
|
71
|
+
const isFullWidth = (0, utils_1.hasToolCallsAndText)(contentSegments);
|
|
92
72
|
const sendFeedbackTelemetry = (feedbackValue, dislikeReason) => {
|
|
93
73
|
if (!messageId)
|
|
94
74
|
return;
|
|
@@ -122,17 +102,11 @@ function SearchAiMessageComponent({ role, content, isThinking, resources, classN
|
|
|
122
102
|
};
|
|
123
103
|
return (react_1.default.createElement(SearchAiMessageWrapper, { "data-component-name": "Search/SearchAiMessage", $role: role, className: className, "data-testid": "search-ai-message" },
|
|
124
104
|
role === constants_1.AiSearchConversationRole.ASSISTANT && (react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { size: "32px", background: "var(--search-ai-icon-bg-color)", borderRadius: "var(--border-radius-lg)", color: "var(--search-ai-icon-color)", margin: "0 var(--spacing-xs) 0 0" })),
|
|
125
|
-
react_1.default.createElement(MessageContentWrapper,
|
|
126
|
-
react_1.default.createElement(MessageWrapper, { $role: role },
|
|
127
|
-
|
|
128
|
-
if (segment.type === '
|
|
129
|
-
|
|
130
|
-
const { inProgressText, completedText } = getToolCallDisplayText(segment.toolCall);
|
|
131
|
-
const toolCallDisplayText = toolCallCompleted ? completedText : inProgressText;
|
|
132
|
-
return (react_1.default.createElement(ToolCallsInfoWrapper, { key: `tool-${index}`, "data-testid": "tool-calls-info" },
|
|
133
|
-
react_1.default.createElement(ToolCallInfoItem, null,
|
|
134
|
-
react_1.default.createElement(DocumentIcon_1.DocumentIcon, { size: "14px", color: "--search-ai-text-color" }),
|
|
135
|
-
react_1.default.createElement(ToolCallText, { $isSearching: !toolCallCompleted }, toolCallDisplayText))));
|
|
105
|
+
react_1.default.createElement(MessageContentWrapper, { $isFullWidth: isFullWidth }, role === constants_1.AiSearchConversationRole.ASSISTANT ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
106
|
+
react_1.default.createElement(MessageWrapper, { $role: role, $isFullWidth: isFullWidth },
|
|
107
|
+
groupedSegments.map((segment, index) => {
|
|
108
|
+
if (segment.type === 'tools') {
|
|
109
|
+
return (react_1.default.createElement(ToolCallsActivity, { key: `tools-${index}`, toolCalls: segment.toolCalls, isActive: segment.isActive }));
|
|
136
110
|
}
|
|
137
111
|
return react_1.default.createElement(MarkdownSegment, { key: `text-${index}`, text: segment.text });
|
|
138
112
|
}),
|
|
@@ -146,11 +120,7 @@ function SearchAiMessageComponent({ role, content, isThinking, resources, classN
|
|
|
146
120
|
translate('search.ai.resourcesFound.resources', 'resources')),
|
|
147
121
|
react_1.default.createElement(ResourceTagsWrapper, null, resources === null || resources === void 0 ? void 0 : resources.map((resource, index) => (react_1.default.createElement(Link_1.Link, { key: `${resource.url}-${index}`, to: resource.url, target: "_blank" },
|
|
148
122
|
react_1.default.createElement(ResourceTag, { borderless: true, icon: react_1.default.createElement(DocumentIcon_1.DocumentIcon, { color: "--search-ai-resource-tag-icon-color" }) }, resource.title)))))))),
|
|
149
|
-
|
|
150
|
-
react_1.default.createElement(ThinkingDot, null),
|
|
151
|
-
react_1.default.createElement(ThinkingDot, null),
|
|
152
|
-
react_1.default.createElement(ThinkingDot, null))),
|
|
153
|
-
content.length > 0 && (react_1.default.createElement(FeedbackWrapper, null,
|
|
123
|
+
!isThinking && content.length > 0 && (react_1.default.createElement(FeedbackWrapper, null,
|
|
154
124
|
react_1.default.createElement(SearchAiActionButtons_1.SearchAiActionButtons, { content: content, feedback: feedback, onFeedback: handleFeedbackClick, disabled: !!feedback })))),
|
|
155
125
|
messageId && feedback === types_1.FeedbackType.Dislike && !showSuccessMessage && (react_1.default.createElement(SearchAiNegativeFeedbackForm_1.SearchAiNegativeFeedbackForm, { messageId: messageId, onClose: (messageId, feedback) => {
|
|
156
126
|
onFeedbackChange(messageId, feedback);
|
|
@@ -171,7 +141,6 @@ function areResourcesEqual(prev, next) {
|
|
|
171
141
|
});
|
|
172
142
|
}
|
|
173
143
|
exports.SearchAiMessage = (0, react_1.memo)(SearchAiMessageComponent, (prevProps, nextProps) => {
|
|
174
|
-
var _a, _b;
|
|
175
144
|
return (prevProps.role === nextProps.role &&
|
|
176
145
|
prevProps.content === nextProps.content &&
|
|
177
146
|
prevProps.isThinking === nextProps.isThinking &&
|
|
@@ -179,7 +148,6 @@ exports.SearchAiMessage = (0, react_1.memo)(SearchAiMessageComponent, (prevProps
|
|
|
179
148
|
prevProps.feedback === nextProps.feedback &&
|
|
180
149
|
prevProps.onFeedbackChange === nextProps.onFeedbackChange &&
|
|
181
150
|
areResourcesEqual(prevProps.resources, nextProps.resources) &&
|
|
182
|
-
((_a = prevProps.toolCalls) === null || _a === void 0 ? void 0 : _a.length) === ((_b = nextProps.toolCalls) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
183
151
|
prevProps.contentSegments === nextProps.contentSegments);
|
|
184
152
|
});
|
|
185
153
|
const SearchAiMessageWrapper = styled_components_1.default.div `
|
|
@@ -192,6 +160,7 @@ const SearchAiMessageWrapper = styled_components_1.default.div `
|
|
|
192
160
|
const MessageContentWrapper = styled_components_1.default.div `
|
|
193
161
|
display: flex;
|
|
194
162
|
flex-direction: column;
|
|
163
|
+
flex-grow: ${({ $isFullWidth }) => ($isFullWidth ? 1 : 0)};
|
|
195
164
|
gap: var(--spacing-sm);
|
|
196
165
|
max-width: 80%;
|
|
197
166
|
min-width: 0;
|
|
@@ -217,7 +186,7 @@ const MessageWrapper = styled_components_1.default.div `
|
|
|
217
186
|
? 'var(--spacing-sm)'
|
|
218
187
|
: 'var(--spacing-sm) var(--spacing-sm) var(--spacing-xs) var(--spacing-sm)'};
|
|
219
188
|
border-radius: var(--border-radius-xl);
|
|
220
|
-
width: fit-content;
|
|
189
|
+
width: ${({ $isFullWidth }) => ($isFullWidth ? 'auto' : 'fit-content')};
|
|
221
190
|
max-width: 100%;
|
|
222
191
|
word-wrap: break-word;
|
|
223
192
|
white-space: pre-wrap;
|
|
@@ -234,12 +203,14 @@ const ResourcesWrapper = styled_components_1.default.div `
|
|
|
234
203
|
display: flex;
|
|
235
204
|
flex-direction: column;
|
|
236
205
|
margin: 0;
|
|
206
|
+
${styles_1.searchAiAppearAnimation}
|
|
237
207
|
`;
|
|
238
208
|
const FeedbackWrapper = styled_components_1.default.div `
|
|
239
209
|
display: flex;
|
|
240
210
|
flex-direction: row;
|
|
241
211
|
gap: var(--search-ai-feedback-gap);
|
|
242
212
|
margin-top: var(--spacing-sm);
|
|
213
|
+
${styles_1.searchAiAppearAnimation}
|
|
243
214
|
`;
|
|
244
215
|
const ResourcesTitle = styled_components_1.default.div `
|
|
245
216
|
font-weight: var(--search-ai-resources-title-font-weight);
|
|
@@ -251,7 +222,7 @@ const ResourceTagsWrapper = styled_components_1.default.div `
|
|
|
251
222
|
flex-wrap: wrap;
|
|
252
223
|
gap: var(--search-ai-resource-tags-gap);
|
|
253
224
|
`;
|
|
254
|
-
const ResourceTag = (0, styled_components_1.default)(Tag_1.Tag) `
|
|
225
|
+
const ResourceTag = (0, styled_components_1.default)(Tag_1.Tag).attrs({ textTransform: 'none' }) `
|
|
255
226
|
.tag-default {
|
|
256
227
|
--tag-color: var(--search-ai-resource-tag-text-color);
|
|
257
228
|
max-width: 100%;
|
|
@@ -270,41 +241,6 @@ const ResourceTag = (0, styled_components_1.default)(Tag_1.Tag) `
|
|
|
270
241
|
max-width: 100%;
|
|
271
242
|
}
|
|
272
243
|
`;
|
|
273
|
-
const ThinkingDotsWrapper = styled_components_1.default.div `
|
|
274
|
-
display: flex;
|
|
275
|
-
gap: var(--search-ai-thinking-dots-gap);
|
|
276
|
-
padding: var(--search-ai-thinking-dots-padding);
|
|
277
|
-
`;
|
|
278
|
-
const ThinkingDot = styled_components_1.default.div `
|
|
279
|
-
width: var(--search-ai-thinking-dot-size);
|
|
280
|
-
height: var(--search-ai-thinking-dot-size);
|
|
281
|
-
border-radius: 50%;
|
|
282
|
-
background: var(--search-ai-thinking-dot-color);
|
|
283
|
-
animation: bounce 1.4s infinite ease-in-out;
|
|
284
|
-
|
|
285
|
-
&:nth-child(1) {
|
|
286
|
-
animation-delay: -0.32s;
|
|
287
|
-
}
|
|
288
|
-
&:nth-child(2) {
|
|
289
|
-
animation-delay: -0.16s;
|
|
290
|
-
}
|
|
291
|
-
&:nth-child(3) {
|
|
292
|
-
animation-delay: 0s;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
@keyframes bounce {
|
|
296
|
-
0%,
|
|
297
|
-
80%,
|
|
298
|
-
100% {
|
|
299
|
-
opacity: 0.2;
|
|
300
|
-
transform: scale(0.8);
|
|
301
|
-
}
|
|
302
|
-
40% {
|
|
303
|
-
opacity: 1;
|
|
304
|
-
transform: scale(1);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
`;
|
|
308
244
|
const SuccessMessageWrapper = styled_components_1.default.div `
|
|
309
245
|
max-width: fit-content;
|
|
310
246
|
display: flex;
|
|
@@ -319,35 +255,11 @@ const SuccessMessageText = styled_components_1.default.div `
|
|
|
319
255
|
font-size: var(--font-size-base);
|
|
320
256
|
color: var(--color-success-darker);
|
|
321
257
|
`;
|
|
322
|
-
const
|
|
323
|
-
display: flex;
|
|
324
|
-
flex-direction: column;
|
|
325
|
-
gap: var(--spacing-xxs);
|
|
258
|
+
const ToolCallsActivity = (0, styled_components_1.default)(SearchAiActivity_1.SearchAiActivity) `
|
|
326
259
|
margin: 0 0 var(--spacing-sm) 0;
|
|
327
|
-
font-size: var(--font-size-xs);
|
|
328
|
-
color: var(--search-ai-text-color);
|
|
329
|
-
opacity: 0.6;
|
|
330
|
-
`;
|
|
331
|
-
const ToolCallInfoItem = styled_components_1.default.div `
|
|
332
|
-
display: flex;
|
|
333
|
-
align-items: center;
|
|
334
|
-
gap: var(--spacing-xxs);
|
|
335
|
-
`;
|
|
336
|
-
const ToolCallText = styled_components_1.default.span `
|
|
337
|
-
font-weight: var(--font-weight-regular);
|
|
338
260
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
@keyframes pulse {
|
|
344
|
-
0%, 100% {
|
|
345
|
-
opacity: 1;
|
|
346
|
-
}
|
|
347
|
-
50% {
|
|
348
|
-
opacity: 0.4;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
`}
|
|
261
|
+
&:last-child {
|
|
262
|
+
margin-bottom: var(--spacing-xxs);
|
|
263
|
+
}
|
|
352
264
|
`;
|
|
353
265
|
//# sourceMappingURL=SearchAiMessage.js.map
|
|
@@ -141,6 +141,7 @@ const ResourceTags = styled_components_1.default.div `
|
|
|
141
141
|
`;
|
|
142
142
|
const ResourceTag = (0, styled_components_1.default)(Tag_1.Tag).attrs({
|
|
143
143
|
className: 'tag-resource',
|
|
144
|
+
textTransform: 'none',
|
|
144
145
|
}) `
|
|
145
146
|
.tag-default {
|
|
146
147
|
--tag-color: --search-ai-resource-tag-text-color;
|
|
@@ -76,6 +76,16 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
76
76
|
const autoSearchDisabled = mode !== 'search';
|
|
77
77
|
const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, groupCounts, setLoadMore, advancedSearch, askAi, groupField, searchError, retrySearch, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
|
|
78
78
|
const { isFilterOpen, onFilterToggle, onFilterChange, onFilterReset, onFacetReset, onQuickFilterReset, } = (0, hooks_1.useSearchFilter)(filter, setFilter);
|
|
79
|
+
(0, hooks_1.usePersistedQuickFilter)({
|
|
80
|
+
filter,
|
|
81
|
+
setFilter,
|
|
82
|
+
facets,
|
|
83
|
+
groupField,
|
|
84
|
+
query,
|
|
85
|
+
isSearchLoading,
|
|
86
|
+
searchError,
|
|
87
|
+
enabled: initialMode === 'search',
|
|
88
|
+
});
|
|
79
89
|
const { addSearchHistoryItem } = (0, hooks_1.useRecentSearches)();
|
|
80
90
|
const aiSearch = useAiSearch({ filter: filter, product: product === null || product === void 0 ? void 0 : product.name });
|
|
81
91
|
(0, hooks_1.useModalScrollLock)(true);
|