@redocly/theme 0.59.0-rc.3 → 0.60.0-custom.2
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/LICENSE +7 -1
- package/lib/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.js +1 -0
- package/lib/components/Buttons/AIAssistantButton.js +6 -2
- package/lib/components/Buttons/ConnectMCPButton.d.ts +8 -0
- package/lib/components/Buttons/ConnectMCPButton.js +145 -0
- package/lib/components/Buttons/variables.d.ts +1 -0
- package/lib/components/Buttons/variables.js +44 -2
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +4 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +5 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +2 -2
- package/lib/components/Catalog/CatalogEntityIcon.js +2 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilter.js +4 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +2 -2
- package/lib/components/Catalog/CatalogSelector.js +1 -1
- package/lib/components/Catalog/CatalogSortButton.js +4 -1
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +2 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +2 -2
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +5 -1
- package/lib/components/Catalog/variables.dark.js +1 -1
- package/lib/components/Catalog/variables.js +6 -4
- package/lib/components/CatalogClassic/variables.js +1 -1
- package/lib/components/CodeBlock/CodeBlock.js +3 -1
- package/lib/components/CodeBlock/CodeBlockTabs.js +3 -3
- package/lib/components/DatePicker/variables.js +2 -0
- package/lib/components/Dropdown/Dropdown.d.ts +16 -2
- package/lib/components/Dropdown/Dropdown.js +5 -5
- package/lib/components/Feedback/Mood.js +2 -2
- package/lib/components/Feedback/Rating.js +2 -2
- package/lib/components/Filter/FilterDateRange.js +2 -2
- package/lib/components/Filter/FilterSelect.js +5 -1
- package/lib/components/Link/Link.d.ts +1 -0
- package/lib/components/Loaders/Loading.js +4 -1
- package/lib/components/Markdown/Markdown.js +9 -9
- package/lib/components/Markdown/styles/{baseTable.js → base-table.js} +1 -1
- package/lib/components/Markdown/styles/{headingAnchor.js → heading-anchor.js} +1 -1
- package/lib/components/Menu/MenuItem.js +6 -2
- package/lib/components/Navbar/NavbarItem.js +3 -3
- package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.js +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiOperation.js +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiTitle.js +1 -0
- package/lib/components/OpenApiDocs/hooks/BeforeOpenApiOperation.js +1 -0
- package/lib/components/OpenApiDocs/hooks/OpenApiFooter.js +3 -2
- package/lib/components/OpenApiDocs/hooks/OpenApiHeader.js +3 -2
- package/lib/components/PageActions/PageActions.js +4 -1
- package/lib/components/PageActions/variables.js +2 -0
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +2 -1
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +8 -3
- package/lib/components/Search/SearchAiActionButtons.d.ts +10 -0
- package/lib/components/Search/SearchAiActionButtons.js +43 -0
- package/lib/components/Search/SearchAiConversationInput.d.ts +3 -1
- package/lib/components/Search/SearchAiConversationInput.js +39 -7
- package/lib/components/Search/SearchAiDialog.d.ts +3 -6
- package/lib/components/Search/SearchAiDialog.js +20 -9
- package/lib/components/Search/SearchAiMessage.d.ts +9 -5
- package/lib/components/Search/SearchAiMessage.js +147 -21
- package/lib/components/Search/SearchAiNegativeFeedbackForm.d.ts +10 -0
- package/lib/components/Search/SearchAiNegativeFeedbackForm.js +170 -0
- package/lib/components/Search/SearchDialog.js +36 -5
- package/lib/components/Search/SearchGroups.js +5 -2
- package/lib/components/Search/SearchHighlight.js +1 -0
- package/lib/components/Search/SearchItem.js +9 -2
- package/lib/components/Search/variables.js +38 -64
- package/lib/components/Segmented/Segmented.d.ts +1 -8
- package/lib/components/Segmented/Segmented.js +5 -3
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/Select.js +4 -2
- package/lib/components/Select/SelectInput.d.ts +1 -1
- package/lib/components/Select/SelectInput.js +3 -1
- package/lib/components/SidebarActions/styled.d.ts +5 -4
- package/lib/components/SidebarActions/styled.js +9 -5
- package/lib/components/Tag/Tag.d.ts +3 -2
- package/lib/components/Tag/Tag.js +65 -16
- package/lib/components/Tag/variables.dark.js +143 -36
- package/lib/components/Tag/variables.js +85 -60
- package/lib/components/Tooltip/Tooltip.js +2 -0
- package/lib/components/VersionPicker/VersionPicker.d.ts +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/core/constants/index.d.ts +2 -0
- package/lib/core/constants/index.js +2 -0
- package/lib/core/constants/mcp.d.ts +1 -0
- package/lib/core/constants/mcp.js +5 -0
- package/lib/core/constants/request-methods.d.ts +1 -0
- package/lib/core/constants/request-methods.js +14 -0
- package/lib/core/constants/search.d.ts +5 -4
- package/lib/core/constants/search.js +4 -5
- package/lib/core/hoc/index.d.ts +1 -1
- package/lib/core/hoc/index.js +1 -1
- package/lib/core/hoc/{typedMemo.js → typed-memo.js} +1 -1
- package/lib/core/hooks/__tests__/mocks/mock-intersection-observer.d.ts +1 -1
- package/lib/core/hooks/__tests__/mocks/mock-intersection-observer.js +1 -3
- package/lib/core/hooks/catalog/{useCatalogEntities.js → use-catalog-entities.js} +1 -1
- package/lib/core/hooks/catalog/{useCatalogEntitySchema.d.ts → use-catalog-entity-schema.d.ts} +1 -1
- package/lib/core/hooks/catalog/{useCatalogEntitySchema.js → use-catalog-entity-schema.js} +1 -1
- package/lib/core/hooks/catalog/{useCatalogTableHeaderCellActions.js → use-catalog-table-header-cell-actions.js} +1 -1
- package/lib/core/hooks/catalog/{useCatalogTableViewRow.js → use-catalog-table-view-row.js} +1 -1
- package/lib/core/hooks/catalog/{useGraph.js → use-graph.js} +2 -2
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +1 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +1 -0
- package/lib/core/hooks/code-walkthrough/use-renderable-files.js +2 -2
- package/lib/core/hooks/index.d.ts +8 -2
- package/lib/core/hooks/index.js +8 -2
- package/lib/core/hooks/menu/use-collapse.js +1 -0
- package/lib/core/hooks/menu/use-mobile-menu-items.js +1 -0
- package/lib/core/hooks/menu/use-nested-menu.js +1 -1
- package/lib/core/hooks/search/use-feedback-tooltip.d.ts +6 -0
- package/lib/core/hooks/search/use-feedback-tooltip.js +26 -0
- package/lib/core/hooks/use-connect-mcp-button.d.ts +13 -0
- package/lib/core/hooks/use-connect-mcp-button.js +50 -0
- package/lib/core/hooks/use-mcp-config.d.ts +9 -0
- package/lib/core/hooks/use-mcp-config.js +30 -0
- package/lib/core/hooks/use-page-actions.d.ts +1 -1
- package/lib/core/hooks/use-page-actions.js +120 -120
- package/lib/core/hooks/use-product-picker.js +2 -1
- package/lib/core/hooks/use-tabs.d.ts +3 -2
- package/lib/core/hooks/use-tabs.js +115 -57
- package/lib/core/hooks/use-telemetry-fallback.d.ts +10 -8
- package/lib/core/hooks/use-telemetry-fallback.js +11 -8
- package/lib/core/hooks/use-theme-config.js +1 -0
- package/lib/core/hooks/use-theme-hooks.js +1 -0
- package/lib/core/openapi/index.d.ts +3 -1
- package/lib/core/openapi/index.js +5 -3
- package/lib/core/styles/dark.js +4 -0
- package/lib/core/styles/global.js +5 -0
- package/lib/core/templates/Markdown.js +1 -0
- package/lib/core/types/hooks.d.ts +8 -2
- package/lib/core/types/index.d.ts +20 -18
- package/lib/core/types/index.js +0 -18
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/mcp.d.ts +6 -0
- package/lib/core/types/mcp.js +3 -0
- package/lib/core/types/search.d.ts +12 -4
- package/lib/core/types/search.js +6 -0
- package/lib/core/types/segmented.d.ts +12 -0
- package/lib/core/types/segmented.js +3 -0
- package/lib/core/types/sidebar.d.ts +1 -0
- package/lib/core/utils/{dynamic.js → Dynamic.js} +1 -1
- package/lib/core/utils/{get-file-icon.js → GetFileIcon.js} +1 -1
- package/lib/core/utils/args-typecheck.d.ts +2 -2
- package/lib/core/utils/clipboard-service.js +2 -0
- package/lib/core/utils/frontmatter-translate.d.ts +6 -0
- package/lib/core/utils/frontmatter-translate.js +14 -0
- package/lib/core/utils/get-operation-color.d.ts +7 -0
- package/lib/core/utils/get-operation-color.js +13 -0
- package/lib/core/utils/get-user-agent.js +1 -0
- package/lib/core/utils/index.d.ts +5 -2
- package/lib/core/utils/index.js +5 -2
- package/lib/core/utils/js-utils.d.ts +1 -1
- package/lib/core/utils/load-and-navigate.js +1 -0
- package/lib/core/utils/markdoc.js +1 -0
- package/lib/core/utils/mcp.d.ts +2 -0
- package/lib/core/utils/mcp.js +31 -0
- package/lib/core/utils/parse-style-string.js +1 -0
- package/lib/ext/configure.d.ts +2 -2
- package/lib/ext/configure.js +12 -6
- package/lib/ext/{useConfigureReplay.js → use-configure-replay.js} +5 -4
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +44 -4
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +11 -2
- package/lib/icons/ConnectIcon/ConnectIcon.d.ts +9 -0
- package/lib/icons/ConnectIcon/ConnectIcon.js +17 -0
- package/lib/icons/CubeIcon/CubeIcon.d.ts +9 -0
- package/lib/icons/CubeIcon/CubeIcon.js +17 -0
- package/lib/icons/HashtagIcon/HashtagIcon.d.ts +9 -0
- package/lib/icons/HashtagIcon/HashtagIcon.js +22 -0
- package/lib/icons/RedoclyIcon/RedoclyIcon.js +4 -7
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.js +34 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.js +34 -0
- package/lib/icons/VSCodeIcon/VSCodeIcon.d.ts +9 -0
- package/lib/icons/VSCodeIcon/VSCodeIcon.js +17 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.js +3 -3
- package/lib/layouts/ThreePanelLayout.js +4 -4
- package/lib/markdoc/components/Cards/Card.js +1 -28
- package/lib/markdoc/components/Cards/variables.dark.js +2 -0
- package/lib/markdoc/components/Cards/variables.js +2 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +1 -0
- package/lib/markdoc/components/ConnectMCP/ConnectMCP.d.ts +8 -0
- package/lib/markdoc/components/ConnectMCP/ConnectMCP.js +19 -0
- package/lib/markdoc/components/Tabs/TabList.d.ts +3 -1
- package/lib/markdoc/components/Tabs/TabList.js +197 -47
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tabs.js +57 -12
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/default.d.ts +6 -0
- package/lib/markdoc/default.js +2 -0
- package/lib/markdoc/tags/card.js +0 -1
- package/lib/markdoc/tags/code-walkthrough.js +1 -0
- package/lib/markdoc/tags/connect-mcp.d.ts +2 -0
- package/lib/markdoc/tags/connect-mcp.js +27 -0
- package/lib/markdoc/tags/html.js +1 -0
- package/package.json +6 -6
- package/src/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.tsx +1 -0
- package/src/components/Button/Button.tsx +1 -0
- package/src/components/Buttons/AIAssistantButton.tsx +6 -2
- package/src/components/Buttons/ConnectMCPButton.tsx +180 -0
- package/src/components/Buttons/variables.ts +44 -1
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +4 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +4 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +3 -1
- package/src/components/Catalog/CatalogEntityIcon.tsx +2 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilter.tsx +5 -0
- package/src/components/Catalog/CatalogFilter/CatalogFilterDateRange.tsx +2 -2
- package/src/components/Catalog/CatalogSelector.tsx +2 -2
- package/src/components/Catalog/CatalogSortButton.tsx +5 -1
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +1 -1
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +1 -1
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +8 -1
- package/src/components/Catalog/variables.dark.ts +1 -1
- package/src/components/Catalog/variables.ts +6 -4
- package/src/components/CatalogClassic/CatalogClassicInfoBlock.tsx +1 -0
- package/src/components/CatalogClassic/variables.ts +1 -1
- package/src/components/CodeBlock/CodeBlock.tsx +4 -0
- package/src/components/CodeBlock/CodeBlockControls.tsx +1 -0
- package/src/components/CodeBlock/CodeBlockTabs.tsx +1 -1
- package/src/components/DatePicker/variables.ts +3 -1
- package/src/components/Dropdown/Dropdown.tsx +84 -79
- package/src/components/Feedback/Mood.tsx +2 -2
- package/src/components/Feedback/Rating.tsx +2 -2
- package/src/components/Filter/FilterDateRange.tsx +2 -2
- package/src/components/Filter/FilterSelect.tsx +1 -0
- package/src/components/JsonViewer/JsonViewer.tsx +1 -0
- package/src/components/JsonViewer/helpers.tsx +3 -0
- package/src/components/LastUpdated/LastUpdated.tsx +1 -0
- package/src/components/Link/Link.tsx +1 -0
- package/src/components/Loaders/Loading.tsx +5 -1
- package/src/components/Markdown/Markdown.tsx +2 -2
- package/src/components/Menu/MenuItem.tsx +7 -2
- package/src/components/Navbar/NavbarItem.tsx +6 -5
- package/src/components/OpenApiDocs/hooks/AdditionalOverviewInfo.tsx +1 -0
- package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +1 -0
- package/src/components/OpenApiDocs/hooks/AfterOpenApiOperation.tsx +1 -1
- package/src/components/OpenApiDocs/hooks/AfterOpenApiTitle.tsx +1 -1
- package/src/components/OpenApiDocs/hooks/BeforeOpenApiOperation.tsx +1 -1
- package/src/components/OpenApiDocs/hooks/OpenApiFooter.tsx +1 -1
- package/src/components/OpenApiDocs/hooks/OpenApiHeader.tsx +1 -1
- package/src/components/PageActions/PageActions.tsx +5 -1
- package/src/components/PageActions/variables.ts +2 -0
- package/src/components/Search/FilterFields/SearchFilterFieldSelect.tsx +4 -1
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +10 -4
- package/src/components/Search/SearchAiActionButtons.tsx +76 -0
- package/src/components/Search/SearchAiConversationInput.tsx +61 -18
- package/src/components/Search/SearchAiDialog.tsx +52 -23
- package/src/components/Search/SearchAiMessage.tsx +173 -39
- package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +212 -0
- package/src/components/Search/SearchDialog.tsx +49 -13
- package/src/components/Search/SearchGroups.tsx +6 -1
- package/src/components/Search/SearchHighlight.tsx +1 -0
- package/src/components/Search/SearchItem.tsx +15 -3
- package/src/components/Search/variables.ts +38 -64
- package/src/components/Segmented/Segmented.tsx +16 -21
- package/src/components/Select/Select.tsx +8 -4
- package/src/components/Select/SelectInput.tsx +11 -1
- package/src/components/SidebarActions/{styled.tsx → styled.ts} +11 -4
- package/src/components/Tag/Tag.tsx +36 -18
- package/src/components/Tag/variables.dark.ts +143 -36
- package/src/components/Tag/variables.ts +85 -60
- package/src/components/Tooltip/Tooltip.tsx +2 -1
- package/src/components/VersionPicker/VersionPicker.tsx +2 -1
- package/src/config.ts +2 -0
- package/src/core/constants/index.ts +2 -0
- package/src/core/constants/mcp.ts +1 -0
- package/src/core/constants/request-methods.ts +10 -0
- package/src/core/constants/search.ts +8 -4
- package/src/core/hoc/index.ts +1 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +2 -2
- package/src/core/hooks/__tests__/mocks/mock-intersection-observer.ts +9 -8
- package/src/core/hooks/catalog/{useCatalogEntitySchema.ts → use-catalog-entity-schema.ts} +3 -3
- package/src/core/hooks/catalog/{useGraph.ts → use-graph.ts} +1 -1
- package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +1 -1
- package/src/core/hooks/code-walkthrough/__mocks__/mock-intersection-observer.ts +24 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +1 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +2 -2
- package/src/core/hooks/code-walkthrough/use-renderable-files.ts +1 -1
- package/src/core/hooks/index.ts +8 -2
- package/src/core/hooks/menu/use-collapse.ts +3 -3
- package/src/core/hooks/menu/use-mobile-menu-items.ts +1 -0
- package/src/core/hooks/menu/use-nested-menu.ts +2 -2
- package/src/core/hooks/search/use-feedback-tooltip.ts +32 -0
- package/src/core/hooks/use-connect-mcp-button.ts +79 -0
- package/src/core/hooks/use-mcp-config.ts +49 -0
- package/src/core/hooks/use-page-actions.ts +164 -146
- package/src/core/hooks/use-product-picker.ts +2 -1
- package/src/core/hooks/use-tabs.ts +168 -86
- package/src/core/hooks/use-telemetry-fallback.ts +11 -8
- package/src/core/hooks/use-theme-config.ts +1 -0
- package/src/core/hooks/use-theme-hooks.ts +2 -1
- package/src/core/openapi/index.ts +3 -1
- package/src/core/styles/dark.ts +4 -0
- package/src/core/styles/global.ts +6 -1
- package/src/core/templates/Markdown.tsx +1 -0
- package/src/core/types/catalog.ts +3 -1
- package/src/core/types/filter.ts +1 -0
- package/src/core/types/hooks.ts +11 -1
- package/src/core/types/index.ts +20 -18
- package/src/core/types/l10n.ts +37 -1
- package/src/core/types/mcp.ts +8 -0
- package/src/core/types/search.ts +15 -5
- package/src/core/types/segmented.ts +15 -0
- package/src/core/types/select.ts +1 -0
- package/src/core/types/sidebar.ts +1 -0
- package/src/core/utils/args-typecheck.ts +2 -2
- package/src/core/utils/clipboard-service.ts +2 -0
- package/src/core/utils/frontmatter-translate.ts +9 -0
- package/src/core/utils/get-operation-color.ts +18 -0
- package/src/core/utils/get-user-agent.ts +1 -0
- package/src/core/utils/index.ts +5 -2
- package/src/core/utils/js-utils.ts +1 -1
- package/src/core/utils/load-and-navigate.ts +1 -0
- package/src/core/utils/markdoc.ts +1 -0
- package/src/core/utils/mcp.ts +34 -0
- package/src/core/utils/parse-style-string.ts +1 -0
- package/src/ext/configure.ts +15 -8
- package/src/ext/process-scorecard.ts +1 -0
- package/src/ext/{useConfigureReplay.ts → use-configure-replay.ts} +5 -3
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +13 -4
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +11 -2
- package/src/icons/ConnectIcon/ConnectIcon.tsx +27 -0
- package/src/icons/CubeIcon/CubeIcon.tsx +27 -0
- package/src/icons/HashtagIcon/HashtagIcon.tsx +23 -0
- package/src/icons/RedoclyIcon/RedoclyIcon.tsx +4 -22
- package/src/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.tsx +38 -0
- package/src/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.tsx +35 -0
- package/src/icons/VSCodeIcon/VSCodeIcon.tsx +29 -0
- package/src/index.ts +4 -3
- package/src/layouts/ThreePanelLayout.tsx +1 -1
- package/src/markdoc/components/Cards/Card.tsx +1 -28
- package/src/markdoc/components/Cards/variables.dark.ts +2 -0
- package/src/markdoc/components/Cards/variables.ts +3 -1
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +1 -1
- package/src/markdoc/components/ConnectMCP/ConnectMCP.tsx +28 -0
- package/src/markdoc/components/Tabs/TabList.tsx +312 -105
- package/src/markdoc/components/Tabs/Tabs.tsx +136 -11
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/card.ts +0 -1
- package/src/markdoc/tags/code-walkthrough.ts +2 -0
- package/src/markdoc/tags/connect-mcp.ts +25 -0
- package/src/markdoc/tags/html.ts +1 -0
- package/lib/core/hooks/__mocks__/index.d.ts +0 -28
- package/lib/core/hooks/__mocks__/index.js +0 -45
- package/lib/core/hooks/__mocks__/search/use-recent-searches.d.ts +0 -5
- package/lib/core/hooks/__mocks__/search/use-recent-searches.js +0 -13
- package/lib/core/hooks/__mocks__/search/use-search-filter.d.ts +0 -8
- package/lib/core/hooks/__mocks__/search/use-search-filter.js +0 -15
- package/lib/core/hooks/__mocks__/search/use-suggested-pages.d.ts +0 -4
- package/lib/core/hooks/__mocks__/search/use-suggested-pages.js +0 -13
- package/lib/core/hooks/__mocks__/use-controlled-state.d.ts +0 -1
- package/lib/core/hooks/__mocks__/use-controlled-state.js +0 -7
- package/lib/core/hooks/__mocks__/use-element-size.d.ts +0 -4
- package/lib/core/hooks/__mocks__/use-element-size.js +0 -9
- package/lib/core/hooks/__mocks__/use-input-key-commands.d.ts +0 -3
- package/lib/core/hooks/__mocks__/use-input-key-commands.js +0 -8
- package/lib/core/hooks/__mocks__/use-mobile-menu.d.ts +0 -1
- package/lib/core/hooks/__mocks__/use-mobile-menu.js +0 -7
- package/lib/core/hooks/__mocks__/use-theme-config.d.ts +0 -8
- package/lib/core/hooks/__mocks__/use-theme-config.js +0 -13
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +0 -69
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +0 -94
- package/lib/core/hooks/__mocks__/use-time-ago.d.ts +0 -3
- package/lib/core/hooks/__mocks__/use-time-ago.js +0 -8
- package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.d.ts +0 -10
- package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.js +0 -56
- package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.d.ts +0 -1
- package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.js +0 -35
- /package/lib/components/Markdown/styles/{baseTable.d.ts → base-table.d.ts} +0 -0
- /package/lib/components/Markdown/styles/{headingAnchor.d.ts → heading-anchor.d.ts} +0 -0
- /package/lib/core/hoc/{typedMemo.d.ts → typed-memo.d.ts} +0 -0
- /package/lib/core/hooks/catalog/{useCatalogEntities.d.ts → use-catalog-entities.d.ts} +0 -0
- /package/lib/core/hooks/catalog/{useCatalogTableHeaderCellActions.d.ts → use-catalog-table-header-cell-actions.d.ts} +0 -0
- /package/lib/core/hooks/catalog/{useCatalogTableViewRow.d.ts → use-catalog-table-view-row.d.ts} +0 -0
- /package/lib/core/hooks/catalog/{useGraph.d.ts → use-graph.d.ts} +0 -0
- /package/lib/core/utils/{dynamic.d.ts → Dynamic.d.ts} +0 -0
- /package/lib/core/utils/{get-file-icon.d.ts → GetFileIcon.d.ts} +0 -0
- /package/lib/ext/{useConfigureReplay.d.ts → use-configure-replay.d.ts} +0 -0
- /package/src/components/Markdown/styles/{baseTable.ts → base-table.ts} +0 -0
- /package/src/components/Markdown/styles/{headingAnchor.ts → heading-anchor.ts} +0 -0
- /package/src/components/Panel/{PanelBody.ts → PanelBody.tsx} +0 -0
- /package/src/components/Panel/{PanelHeader.ts → PanelHeader.tsx} +0 -0
- /package/src/components/Panel/{PanelHeaderTitle.ts → PanelHeaderTitle.tsx} +0 -0
- /package/src/components/StatusCode/{StatusCode.ts → StatusCode.tsx} +0 -0
- /package/src/components/Typography/{CompactTypography.ts → CompactTypography.tsx} +0 -0
- /package/src/components/Typography/{Emphasis.ts → Emphasis.tsx} +0 -0
- /package/src/components/Typography/{H1.ts → H1.tsx} +0 -0
- /package/src/components/Typography/{H2.ts → H2.tsx} +0 -0
- /package/src/components/Typography/{H3.ts → H3.tsx} +0 -0
- /package/src/components/Typography/{H4.ts → H4.tsx} +0 -0
- /package/src/components/Typography/{SectionHeader.ts → SectionHeader.tsx} +0 -0
- /package/src/components/Typography/{Typography.ts → Typography.tsx} +0 -0
- /package/src/core/hoc/{typedMemo.ts → typed-memo.ts} +0 -0
- /package/src/core/hooks/catalog/{useCatalogEntities.ts → use-catalog-entities.ts} +0 -0
- /package/src/core/hooks/catalog/{useCatalogTableHeaderCellActions.ts → use-catalog-table-header-cell-actions.ts} +0 -0
- /package/src/core/hooks/catalog/{useCatalogTableViewRow.ts → use-catalog-table-view-row.ts} +0 -0
- /package/src/core/utils/{dynamic.tsx → Dynamic.tsx} +0 -0
- /package/src/core/utils/{get-file-icon.tsx → GetFileIcon.tsx} +0 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { JSX } from 'react';
|
|
5
|
+
|
|
6
|
+
import { FeedbackType } from '@redocly/theme/core/types';
|
|
7
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
8
|
+
import { CloseIcon } from '@redocly/theme/icons/CloseIcon/CloseIcon';
|
|
9
|
+
import { ArrowLeftIcon } from '@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon';
|
|
10
|
+
import { SendIcon } from '@redocly/theme/icons/SendIcon/SendIcon';
|
|
11
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
12
|
+
|
|
13
|
+
export type SearchAiNegativeFeedbackFormProps = {
|
|
14
|
+
messageId: string;
|
|
15
|
+
onClose: (messageId: string, feedback: FeedbackType, reason?: string) => void;
|
|
16
|
+
onSubmit: (reason: string) => void;
|
|
17
|
+
formRef?: React.Ref<HTMLDivElement>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const NEGATIVE_FEEDBACK_DEFAULT_REASONS = [
|
|
21
|
+
"Didn't answer my question",
|
|
22
|
+
"Couldn't find what I was looking for",
|
|
23
|
+
'Wrong topic',
|
|
24
|
+
'Partially helpful, but missing details',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export function SearchAiNegativeFeedbackForm({
|
|
28
|
+
messageId,
|
|
29
|
+
onClose,
|
|
30
|
+
onSubmit,
|
|
31
|
+
formRef,
|
|
32
|
+
}: SearchAiNegativeFeedbackFormProps): JSX.Element {
|
|
33
|
+
const { useTranslate } = useThemeHooks();
|
|
34
|
+
const { translate } = useTranslate();
|
|
35
|
+
const [showMoreInput, setShowMoreInput] = useState(false);
|
|
36
|
+
const [detailedFeedback, setDetailedFeedback] = useState('');
|
|
37
|
+
const textAreaRef = React.useRef<HTMLTextAreaElement>(null);
|
|
38
|
+
|
|
39
|
+
const adjustTextAreaHeight = () => {
|
|
40
|
+
const textArea = textAreaRef.current;
|
|
41
|
+
if (textArea) {
|
|
42
|
+
textArea.style.height = 'auto';
|
|
43
|
+
textArea.style.height = `${textArea.scrollHeight}px`;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const handleTextChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
48
|
+
setDetailedFeedback(e.target.value);
|
|
49
|
+
adjustTextAreaHeight();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (showMoreInput) {
|
|
54
|
+
adjustTextAreaHeight();
|
|
55
|
+
}
|
|
56
|
+
}, [showMoreInput]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<FeedbackFormWrapper data-component-name="Search/SearchAiNegativeFeedbackForm" ref={formRef}>
|
|
60
|
+
<FeedbackHeader>
|
|
61
|
+
{showMoreInput ? (
|
|
62
|
+
<BackButton
|
|
63
|
+
variant="text"
|
|
64
|
+
size="small"
|
|
65
|
+
icon={<ArrowLeftIcon />}
|
|
66
|
+
onClick={() => setShowMoreInput(false)}
|
|
67
|
+
aria-label="Back to feedback reasons"
|
|
68
|
+
/>
|
|
69
|
+
) : null}
|
|
70
|
+
<FeedbackTitle data-translation-key="search.ai.feedback.title">
|
|
71
|
+
{translate('search.ai.feedback.title', "What didn't you like about this response?")}
|
|
72
|
+
</FeedbackTitle>
|
|
73
|
+
<CloseButton
|
|
74
|
+
variant="text"
|
|
75
|
+
size="small"
|
|
76
|
+
icon={<CloseIcon />}
|
|
77
|
+
onClick={() => onClose(messageId, FeedbackType.Dislike, undefined)}
|
|
78
|
+
aria-label="Close feedback form"
|
|
79
|
+
/>
|
|
80
|
+
</FeedbackHeader>
|
|
81
|
+
|
|
82
|
+
{!showMoreInput ? (
|
|
83
|
+
<FeedbackReasonsWrapper>
|
|
84
|
+
{NEGATIVE_FEEDBACK_DEFAULT_REASONS.map((reason) => (
|
|
85
|
+
<Button key={reason} variant="outlined" size="small" onClick={() => onSubmit(reason)}>
|
|
86
|
+
{reason}
|
|
87
|
+
</Button>
|
|
88
|
+
))}
|
|
89
|
+
<Button variant="outlined" size="small" onClick={() => setShowMoreInput(true)}>
|
|
90
|
+
{translate('search.ai.feedback.more', 'More...')}
|
|
91
|
+
</Button>
|
|
92
|
+
</FeedbackReasonsWrapper>
|
|
93
|
+
) : (
|
|
94
|
+
<FeedbackInputWrapper>
|
|
95
|
+
<FeedbackTextArea
|
|
96
|
+
ref={textAreaRef}
|
|
97
|
+
placeholder={translate('search.ai.feedback.detailsPlaceholder', 'Add specific details')}
|
|
98
|
+
value={detailedFeedback}
|
|
99
|
+
onChange={handleTextChange}
|
|
100
|
+
rows={1}
|
|
101
|
+
autoFocus
|
|
102
|
+
/>
|
|
103
|
+
<SendButton
|
|
104
|
+
size="small"
|
|
105
|
+
icon={
|
|
106
|
+
<SendIcon
|
|
107
|
+
color={
|
|
108
|
+
!detailedFeedback.trim()
|
|
109
|
+
? '--button-content-color-disabled'
|
|
110
|
+
: 'var(--search-ai-conversation-input-send-button-icon-color)'
|
|
111
|
+
}
|
|
112
|
+
/>
|
|
113
|
+
}
|
|
114
|
+
onClick={() => onSubmit(detailedFeedback)}
|
|
115
|
+
disabled={!detailedFeedback.trim()}
|
|
116
|
+
aria-label="Send feedback"
|
|
117
|
+
/>
|
|
118
|
+
</FeedbackInputWrapper>
|
|
119
|
+
)}
|
|
120
|
+
</FeedbackFormWrapper>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const FeedbackFormWrapper = styled.div`
|
|
125
|
+
display: flex;
|
|
126
|
+
flex-direction: column;
|
|
127
|
+
gap: var(--spacing-sm);
|
|
128
|
+
padding: var(--spacing-xs);
|
|
129
|
+
background: var(--search-ai-feedback-form-bg-color);
|
|
130
|
+
border: 1px solid var(--search-ai-feedback-form-border-color);
|
|
131
|
+
border-radius: var(--border-radius-lg);
|
|
132
|
+
`;
|
|
133
|
+
|
|
134
|
+
const FeedbackHeader = styled.div`
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: space-between;
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: var(--spacing-sm);
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
const FeedbackTitle = styled.div`
|
|
142
|
+
font-size: var(--font-size-base);
|
|
143
|
+
color: var(--text-color);
|
|
144
|
+
flex: 1;
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
const BackButton = styled(Button)`
|
|
148
|
+
flex-shrink: 0;
|
|
149
|
+
`;
|
|
150
|
+
|
|
151
|
+
const CloseButton = styled(Button)`
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
`;
|
|
154
|
+
|
|
155
|
+
const FeedbackReasonsWrapper = styled.div`
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-wrap: wrap;
|
|
158
|
+
gap: var(--spacing-xs);
|
|
159
|
+
`;
|
|
160
|
+
|
|
161
|
+
const FeedbackInputWrapper = styled.div`
|
|
162
|
+
position: relative;
|
|
163
|
+
width: 100%;
|
|
164
|
+
`;
|
|
165
|
+
|
|
166
|
+
const FeedbackTextArea = styled.textarea`
|
|
167
|
+
width: 100%;
|
|
168
|
+
min-height: 5rem;
|
|
169
|
+
max-height: 12.5rem;
|
|
170
|
+
padding: var(--spacing-xs);
|
|
171
|
+
padding-right: 3rem;
|
|
172
|
+
border: 1px solid var(--border-color-primary);
|
|
173
|
+
border-radius: var(--border-radius-md);
|
|
174
|
+
font-family: inherit;
|
|
175
|
+
font-size: var(--font-size-base);
|
|
176
|
+
line-height: var(--line-height-base);
|
|
177
|
+
background: var(--background-color);
|
|
178
|
+
color: var(--text-color);
|
|
179
|
+
resize: none;
|
|
180
|
+
overflow-y: auto;
|
|
181
|
+
|
|
182
|
+
&:focus {
|
|
183
|
+
outline: 1px solid var(--button-border-color-focused);
|
|
184
|
+
border-color: var(--button-border-color-focused);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&::placeholder {
|
|
188
|
+
color: var(--text-color-helper);
|
|
189
|
+
}
|
|
190
|
+
`;
|
|
191
|
+
|
|
192
|
+
const SendButton = styled(Button)`
|
|
193
|
+
position: absolute;
|
|
194
|
+
right: var(--search-ai-conversation-input-send-button-right);
|
|
195
|
+
bottom: var(--spacing-sm);
|
|
196
|
+
transition: background-color 0.2s ease;
|
|
197
|
+
background-color: var(--search-ai-conversation-input-send-button-bg-color);
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
justify-content: center;
|
|
201
|
+
border-radius: var(--search-ai-conversation-input-send-button-border-radius);
|
|
202
|
+
padding: var(--search-ai-conversation-input-send-button-padding);
|
|
203
|
+
|
|
204
|
+
&:hover {
|
|
205
|
+
background-color: var(--search-ai-conversation-input-send-button-bg-color-hover);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&:disabled {
|
|
209
|
+
background-color: var(--search-ai-conversation-input-send-button-bg-color-disabled);
|
|
210
|
+
border: var(--search-ai-conversation-input-send-button-border-disabled);
|
|
211
|
+
}
|
|
212
|
+
`;
|
|
@@ -48,6 +48,7 @@ export function SearchDialog({
|
|
|
48
48
|
const products = useProducts();
|
|
49
49
|
const currentProduct = useCurrentProduct();
|
|
50
50
|
const [product, setProduct] = useState(currentProduct);
|
|
51
|
+
const searchSessionId = `search-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
|
|
51
52
|
const [mode, setMode] = useState<'search' | 'ai-dialog'>(initialMode);
|
|
52
53
|
const autoSearchDisabled = mode !== 'search';
|
|
53
54
|
const {
|
|
@@ -62,7 +63,7 @@ export function SearchDialog({
|
|
|
62
63
|
advancedSearch,
|
|
63
64
|
askAi,
|
|
64
65
|
groupField,
|
|
65
|
-
} = useSearch(product?.name, autoSearchDisabled);
|
|
66
|
+
} = useSearch(product?.name, autoSearchDisabled, searchSessionId);
|
|
66
67
|
const {
|
|
67
68
|
isFilterOpen,
|
|
68
69
|
onFilterToggle,
|
|
@@ -72,10 +73,24 @@ export function SearchDialog({
|
|
|
72
73
|
onQuickFilterReset,
|
|
73
74
|
} = useSearchFilter(filter, setFilter);
|
|
74
75
|
const { addSearchHistoryItem } = useRecentSearches();
|
|
75
|
-
const aiSearch = useAiSearch({ filter });
|
|
76
|
+
const aiSearch = useAiSearch({ filter }, searchSessionId);
|
|
76
77
|
|
|
77
78
|
const searchInputRef = useRef<HTMLInputElement>(null);
|
|
78
79
|
const modalRef = useRef<HTMLDivElement>(null);
|
|
80
|
+
|
|
81
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
const mediaQuery = window.matchMedia(`(max-width: ${breakpoints.small})`);
|
|
85
|
+
setIsMobile(mediaQuery.matches);
|
|
86
|
+
|
|
87
|
+
const handleChange = (e: MediaQueryListEvent) => {
|
|
88
|
+
setIsMobile(e.matches);
|
|
89
|
+
};
|
|
90
|
+
mediaQuery.addEventListener('change', handleChange);
|
|
91
|
+
return () => mediaQuery.removeEventListener('change', handleChange);
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
79
94
|
const aiQueryRef = useRef<HTMLDivElement>(null);
|
|
80
95
|
const firstSearchResultRef = useRef<HTMLAnchorElement>(null);
|
|
81
96
|
const searchKeysWithResults = items ? Object.keys(items).filter((key) => items[key]?.length) : [];
|
|
@@ -150,13 +165,14 @@ export function SearchDialog({
|
|
|
150
165
|
totalResults: results.length.toString(),
|
|
151
166
|
index: index.toString(),
|
|
152
167
|
searchEngine: mode,
|
|
168
|
+
searchSessionId,
|
|
153
169
|
});
|
|
154
170
|
onClose();
|
|
155
171
|
}}
|
|
156
172
|
/>
|
|
157
173
|
);
|
|
158
174
|
},
|
|
159
|
-
[onClose, product, products, addSearchHistoryItem, query, telemetry, mode],
|
|
175
|
+
[onClose, product, products, addSearchHistoryItem, query, telemetry, mode, searchSessionId],
|
|
160
176
|
);
|
|
161
177
|
|
|
162
178
|
const showLoadMore = useCallback(
|
|
@@ -226,6 +242,9 @@ export function SearchDialog({
|
|
|
226
242
|
if (query.trim()) {
|
|
227
243
|
aiSearch.askQuestion(query);
|
|
228
244
|
}
|
|
245
|
+
telemetry.sendSearchAiOpenedMessage({
|
|
246
|
+
method: 'ai_search_button',
|
|
247
|
+
});
|
|
229
248
|
}}
|
|
230
249
|
>
|
|
231
250
|
{translate('search.ai.button', 'Search with AI')}
|
|
@@ -249,17 +268,22 @@ export function SearchDialog({
|
|
|
249
268
|
tabIndex={0}
|
|
250
269
|
icon={<ChevronLeftIcon />}
|
|
251
270
|
>
|
|
252
|
-
{
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
variant="secondary"
|
|
256
|
-
disabled={!aiSearch.conversation.length}
|
|
257
|
-
onClick={() => aiSearch.clearConversation()}
|
|
258
|
-
tabIndex={0}
|
|
259
|
-
icon={<EditIcon />}
|
|
260
|
-
>
|
|
261
|
-
{translate('search.ai.newConversation', 'New conversation')}
|
|
271
|
+
{isMobile
|
|
272
|
+
? translate('search.ai.back', 'Back')
|
|
273
|
+
: translate('search.ai.backToSearch', 'Back to search')}
|
|
262
274
|
</Button>
|
|
275
|
+
<AiDialogHeaderActionsWrapper>
|
|
276
|
+
<Button
|
|
277
|
+
variant="secondary"
|
|
278
|
+
disabled={!aiSearch.conversation.length}
|
|
279
|
+
onClick={() => aiSearch.clearConversation()}
|
|
280
|
+
tabIndex={0}
|
|
281
|
+
icon={<EditIcon />}
|
|
282
|
+
>
|
|
283
|
+
{translate('search.ai.newConversation', 'New conversation')}
|
|
284
|
+
</Button>
|
|
285
|
+
{isMobile && <Button variant="text" icon={<CloseIcon />} onClick={handleClose} />}
|
|
286
|
+
</AiDialogHeaderActionsWrapper>
|
|
263
287
|
</AiDialogHeaderWrapper>
|
|
264
288
|
)}
|
|
265
289
|
</SearchDialogHeader>
|
|
@@ -296,6 +320,9 @@ export function SearchDialog({
|
|
|
296
320
|
if (query.trim()) {
|
|
297
321
|
aiSearch.askQuestion(query);
|
|
298
322
|
}
|
|
323
|
+
telemetry.sendSearchAiOpenedMessage({
|
|
324
|
+
method: 'ai_search_input',
|
|
325
|
+
});
|
|
299
326
|
}}
|
|
300
327
|
onKeyDown={(e) => {
|
|
301
328
|
if (e.key === 'Enter') {
|
|
@@ -303,6 +330,9 @@ export function SearchDialog({
|
|
|
303
330
|
if (query.trim()) {
|
|
304
331
|
aiSearch.askQuestion(query);
|
|
305
332
|
}
|
|
333
|
+
telemetry.sendSearchAiOpenedMessage({
|
|
334
|
+
method: 'ai_search_input',
|
|
335
|
+
});
|
|
306
336
|
}
|
|
307
337
|
}}
|
|
308
338
|
ref={aiQueryRef}
|
|
@@ -389,6 +419,7 @@ export function SearchDialog({
|
|
|
389
419
|
telemetry.sendSearchRecentClickedMessage({
|
|
390
420
|
query,
|
|
391
421
|
index: index.toString(),
|
|
422
|
+
searchSessionId,
|
|
392
423
|
});
|
|
393
424
|
setQuery(query);
|
|
394
425
|
focusSearchInput();
|
|
@@ -524,6 +555,10 @@ const AiDialogHeaderWrapper = styled.div`
|
|
|
524
555
|
align-items: center;
|
|
525
556
|
width: 100%;
|
|
526
557
|
`;
|
|
558
|
+
const AiDialogHeaderActionsWrapper = styled.div`
|
|
559
|
+
display: flex;
|
|
560
|
+
gap: var(--spacing-xxs);
|
|
561
|
+
`;
|
|
527
562
|
|
|
528
563
|
const SearchDialogBody = styled.div`
|
|
529
564
|
display: flex;
|
|
@@ -640,6 +675,7 @@ const AiDisclaimer = styled.div`
|
|
|
640
675
|
line-height: var(--search-ai-disclaimer-line-height);
|
|
641
676
|
color: var(--search-ai-disclaimer-text-color);
|
|
642
677
|
margin: 0 auto;
|
|
678
|
+
text-align: center;
|
|
643
679
|
`;
|
|
644
680
|
|
|
645
681
|
const SearchWithAI = styled.div`
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
type SearchFilterItem,
|
|
10
10
|
} from '@redocly/theme/core/types';
|
|
11
11
|
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
12
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
12
13
|
|
|
13
14
|
type SearchGroupsProps = {
|
|
14
15
|
facets: SearchFacet[];
|
|
@@ -26,6 +27,8 @@ export function SearchGroups({
|
|
|
26
27
|
onQuickFilterReset,
|
|
27
28
|
}: SearchGroupsProps): JSX.Element {
|
|
28
29
|
const groupFacets = facets.filter((facet) => facet.field === groupField);
|
|
30
|
+
const { useTranslate } = useThemeHooks();
|
|
31
|
+
const { translate } = useTranslate();
|
|
29
32
|
|
|
30
33
|
const handleGroupTagClick = (
|
|
31
34
|
value: string,
|
|
@@ -45,8 +48,9 @@ export function SearchGroups({
|
|
|
45
48
|
borderless
|
|
46
49
|
active={!searchFilter.some((item) => item.isQuickFilter)}
|
|
47
50
|
onClick={() => searchFilter.some((item) => item.isQuickFilter) && onQuickFilterReset()}
|
|
51
|
+
selectable
|
|
48
52
|
>
|
|
49
|
-
All
|
|
53
|
+
{translate('search.groups.all', 'All')}
|
|
50
54
|
</GroupTag>
|
|
51
55
|
<Divider />
|
|
52
56
|
{groupFacets.flatMap((facet) =>
|
|
@@ -61,6 +65,7 @@ export function SearchGroups({
|
|
|
61
65
|
onClick={() => handleGroupTagClick(value, facet.field, active, currentValues)}
|
|
62
66
|
active={active}
|
|
63
67
|
borderless
|
|
68
|
+
selectable
|
|
64
69
|
>
|
|
65
70
|
{value} {isCounterVisible && <span>{count}</span>}
|
|
66
71
|
</GroupTag>
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { JSX } from 'react';
|
|
5
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
5
6
|
function slicer(str: string, arr: string[]): any[] {
|
|
6
7
|
const markOpenIndex = str.indexOf('<mark>');
|
|
7
8
|
const markCloseIndex = str.indexOf('</mark>');
|
|
@@ -9,8 +9,9 @@ import { Link } from '@redocly/theme/components/Link/Link';
|
|
|
9
9
|
import { Image } from '@redocly/theme/components/Image/Image';
|
|
10
10
|
import { searchHighlight } from '@redocly/theme/components/Search/SearchHighlight';
|
|
11
11
|
import { Badge } from '@redocly/theme/components/Badge/Badge';
|
|
12
|
-
import { trimText } from '@redocly/theme/core/utils';
|
|
12
|
+
import { trimText, getOperationColor } from '@redocly/theme/core/utils';
|
|
13
13
|
import { ReturnKeyIcon } from '@redocly/theme/icons/ReturnKeyIcon/ReturnKeyIcon';
|
|
14
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
14
15
|
|
|
15
16
|
type ActiveItem<T> = T & { active?: boolean };
|
|
16
17
|
export type SearchItemProps = {
|
|
@@ -32,6 +33,8 @@ export function SearchItem({
|
|
|
32
33
|
innerRef,
|
|
33
34
|
}: SearchItemProps): JSX.Element {
|
|
34
35
|
const ref = useRef<HTMLAnchorElement>(null);
|
|
36
|
+
const { useTranslate } = useThemeHooks();
|
|
37
|
+
const { translate } = useTranslate();
|
|
35
38
|
|
|
36
39
|
useEffect(() => {
|
|
37
40
|
if (item.active) {
|
|
@@ -45,6 +48,11 @@ export function SearchItem({
|
|
|
45
48
|
highlight.parameters && highlight.parameters.length ? highlight.parameters[0] : null;
|
|
46
49
|
const shouldShowPath = document.path && document.path?.length > 1;
|
|
47
50
|
|
|
51
|
+
const httpColor = getOperationColor({
|
|
52
|
+
isAdditionalOperation: document.isAdditionalOperation,
|
|
53
|
+
httpVerb: document.httpMethod || '',
|
|
54
|
+
});
|
|
55
|
+
|
|
48
56
|
return (
|
|
49
57
|
<SearchItemWrapper
|
|
50
58
|
className={className}
|
|
@@ -74,7 +82,7 @@ export function SearchItem({
|
|
|
74
82
|
)}
|
|
75
83
|
{document.httpMethod ? (
|
|
76
84
|
<SearchItemOperation>
|
|
77
|
-
<SearchItemOperationTag color={
|
|
85
|
+
<SearchItemOperationTag color={httpColor}>
|
|
78
86
|
{document.httpMethod.toUpperCase()}
|
|
79
87
|
</SearchItemOperationTag>
|
|
80
88
|
{highlight.httpPath ? searchHighlight(highlight.httpPath) : document.httpPath}
|
|
@@ -84,7 +92,11 @@ export function SearchItem({
|
|
|
84
92
|
<SearchItemTitle>
|
|
85
93
|
{highlight.title ? searchHighlight(highlight.title) : document.title}
|
|
86
94
|
</SearchItemTitle>
|
|
87
|
-
{document.deprecated ?
|
|
95
|
+
{document.deprecated ? (
|
|
96
|
+
<SearchItemBadge deprecated>
|
|
97
|
+
{translate('search.searchItem.deprecated', 'Deprecated')}
|
|
98
|
+
</SearchItemBadge>
|
|
99
|
+
) : null}
|
|
88
100
|
{document.badges
|
|
89
101
|
? document.badges.map(({ name, color }) => (
|
|
90
102
|
<SearchItemBadge color={color || 'var(--color-info-base)'} key={name}>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
|
|
3
|
+
/* eslint-disable theme/no-raw-colors-in-styles */
|
|
3
4
|
export const search = css`
|
|
4
5
|
/**
|
|
5
6
|
* @tokens Search
|
|
@@ -144,68 +145,76 @@ export const search = css`
|
|
|
144
145
|
/**
|
|
145
146
|
* @tokens AI Search
|
|
146
147
|
*/
|
|
147
|
-
|
|
148
|
+
|
|
148
149
|
--search-ai-gradient: linear-gradient(to right, #715efe, #ff5cdc);
|
|
149
150
|
|
|
150
|
-
--search-ai-spinner-icon-color: var(--icon-color-interactive);
|
|
151
|
-
--search-ai-checkmark-icon-color: var(--icon-color-interactive);
|
|
152
151
|
--search-ai-response-padding: var(--spacing-lg);
|
|
153
152
|
--search-ai-response-gap: var(--spacing-sm);
|
|
154
|
-
|
|
155
153
|
--search-ai-response-header-gap: var(--spacing-md);
|
|
154
|
+
--search-ai-response-body-gap: var(--spacing-xl);
|
|
155
|
+
--search-ai-response-body-padding: 0 40px;
|
|
156
156
|
|
|
157
157
|
--search-ai-question-font-size: var(--font-size-xl);
|
|
158
158
|
--search-ai-question-font-weight: var(--font-weight-semibold);
|
|
159
159
|
--search-ai-question-line-height: var(--line-height-xl);
|
|
160
160
|
--search-ai-question-text-color: var(--text-color-primary);
|
|
161
161
|
|
|
162
|
-
--search-ai-response-body-gap: var(--spacing-xl);
|
|
163
|
-
--search-ai-response-body-padding: 0 40px;
|
|
164
|
-
|
|
165
162
|
--search-ai-text-color: var(--text-color-secondary);
|
|
166
163
|
--search-ai-text-font-size: var(--font-size-lg);
|
|
167
164
|
--search-ai-text-line-height: var(--line-height-lg);
|
|
165
|
+
--search-ai-thinking-text-margin: var(--md-pre-margin) 0;
|
|
168
166
|
|
|
169
167
|
--search-ai-user-bg-color: var(--color-blue-6);
|
|
170
168
|
--search-ai-user-text-color: var(--color-static-white);
|
|
171
169
|
--search-ai-assistant-bg-color: var(--layer-color);
|
|
172
170
|
--search-ai-assistant-text-color: var(--text-color-primary);
|
|
173
171
|
--search-ai-assistant-border: 1px solid var(--border-color-primary);
|
|
172
|
+
--search-ai-assistant-message-max-width: 80%;
|
|
174
173
|
|
|
175
|
-
--search-ai-
|
|
174
|
+
--search-ai-icon-size: 32px;
|
|
175
|
+
--search-ai-icon-bg-color: var(--search-ai-gradient);
|
|
176
|
+
--search-ai-icon-color: var(--color-static-white);
|
|
177
|
+
--search-ai-icon-wrapper-padding: var(--spacing-xs);
|
|
178
|
+
|
|
179
|
+
--search-ai-resources-gap: var(--spacing-xxs);
|
|
176
180
|
--search-ai-resources-title-font-weight: var(--font-weight-medium);
|
|
177
181
|
--search-ai-resources-title-font-size: var(--font-size-lg);
|
|
178
182
|
--search-ai-resources-title-line-height: var(--line-height-lg);
|
|
179
183
|
|
|
180
|
-
--search-ai-resource-tags-gap: var(--spacing-
|
|
184
|
+
--search-ai-resource-tags-gap: var(--spacing-xxs);
|
|
181
185
|
--search-ai-resource-tag-text-color: var(--text-color-secondary);
|
|
182
186
|
--search-ai-resource-tag-icon-color: var(--text-color-secondary);
|
|
183
187
|
--search-ai-resource-tag-icon-size: 16px;
|
|
184
188
|
|
|
185
|
-
--search-ai-
|
|
186
|
-
--search-ai-
|
|
187
|
-
--search-ai-
|
|
188
|
-
|
|
189
|
-
--search-ai-
|
|
189
|
+
--search-ai-suggestions-gap: var(--spacing-sm);
|
|
190
|
+
--search-ai-suggestions-margin-left: var(--spacing-xs);
|
|
191
|
+
--search-ai-suggestion-item-gap: var(--spacing-xxs);
|
|
192
|
+
--search-ai-suggestions-title-text-color: var(--text-color-description);
|
|
193
|
+
--search-ai-suggestions-title-font-size: var(--font-size-base);
|
|
194
|
+
--search-ai-suggestions-title-line-height: var(--line-height-base);
|
|
195
|
+
--search-ai-suggestions-title-font-weight: var(--font-weight-light);
|
|
196
|
+
--search-ai-suggestions-text-color: var(--text-color-description);
|
|
190
197
|
|
|
191
198
|
--search-ai-thinking-dots-gap: 4px;
|
|
192
199
|
--search-ai-thinking-dots-padding: 4px 0;
|
|
193
200
|
--search-ai-thinking-dot-size: 6px;
|
|
194
201
|
--search-ai-thinking-dot-color: var(--search-ai-gradient);
|
|
195
202
|
|
|
203
|
+
--search-ai-spinner-icon-color: var(--icon-color-interactive);
|
|
204
|
+
--search-ai-checkmark-icon-color: var(--icon-color-interactive);
|
|
205
|
+
|
|
206
|
+
--search-ai-feedback-gap: var(--spacing-xxs);
|
|
207
|
+
|
|
208
|
+
--search-ai-feedback-form-bg-color: var(--background-color-secondary);
|
|
209
|
+
--search-ai-feedback-form-border-color: var(--border-color-primary);
|
|
210
|
+
|
|
196
211
|
--search-ai-disclaimer-font-size: var(--font-size-sm);
|
|
197
212
|
--search-ai-disclaimer-line-height: var(--line-height-sm);
|
|
198
213
|
--search-ai-disclaimer-text-color: var(--text-color-secondary);
|
|
199
214
|
|
|
200
|
-
|
|
201
215
|
--search-ai-welcome-margin: var(--spacing-md);
|
|
202
|
-
--search-ai-icon-wrapper-padding: var(--spacing-xs);
|
|
203
216
|
|
|
204
|
-
--search-ai-
|
|
205
|
-
--search-ai-suggestions-title-font-size: var(--font-size-base);
|
|
206
|
-
--search-ai-suggestions-title-line-height: var(--line-height-base);
|
|
207
|
-
--search-ai-suggestions-title-font-weight: var(--font-weight-light);
|
|
208
|
-
--search-ai-suggestions-text-color: var(--text-color-description);
|
|
217
|
+
--search-ai-button-icon-color: none;
|
|
209
218
|
|
|
210
219
|
--search-ai-conversation-input-send-button-bg-color: var(--button-bg-color-primary);
|
|
211
220
|
--search-ai-conversation-input-send-button-bg-color-hover: var(--button-bg-color-primary-hover);
|
|
@@ -232,6 +241,7 @@ export const search = css`
|
|
|
232
241
|
* @tokens AI Search Conversation Input
|
|
233
242
|
*/
|
|
234
243
|
--search-ai-conversation-input-bg-color: var(--bg-color);
|
|
244
|
+
--search-ai-conversation-input-bg-color-disabled: var(--color-warm-grey-1);
|
|
235
245
|
--search-ai-conversation-input-padding: var(--spacing-sm) var(--spacing-md);
|
|
236
246
|
--search-ai-conversation-input-border: 1px solid var(--border-color-secondary);
|
|
237
247
|
--search-ai-conversation-input-border-radius: var(--border-radius-lg);
|
|
@@ -241,51 +251,15 @@ export const search = css`
|
|
|
241
251
|
--search-ai-conversation-input-border-color-disabled: var(--border-color-secondary);
|
|
242
252
|
|
|
243
253
|
--search-ai-conversation-input-send-button-right: 12px;
|
|
244
|
-
--search-ai-conversation-input-send-button-
|
|
245
|
-
--search-ai-conversation-input-send-button-
|
|
246
|
-
--search-ai-conversation-input-send-button-bg-color-disabled: var(--button-bg-color-disabled);
|
|
254
|
+
--search-ai-conversation-input-send-button-padding: 5px;
|
|
255
|
+
--search-ai-conversation-input-send-button-border-radius: var(--border-radius);
|
|
247
256
|
--search-ai-conversation-input-send-button-border-disabled: 1px solid var(--button-border-color-disabled);
|
|
248
257
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
--search-ai-
|
|
253
|
-
--search-ai-response-gap: var(--spacing-sm);
|
|
254
|
-
--search-ai-response-header-gap: var(--spacing-md);
|
|
255
|
-
--search-ai-response-body-gap: var(--spacing-xl);
|
|
256
|
-
--search-ai-response-body-padding: 0 40px;
|
|
257
|
-
|
|
258
|
-
--search-ai-text-color: var(--text-color-secondary);
|
|
259
|
-
--search-ai-text-font-size: var(--font-size-lg);
|
|
260
|
-
--search-ai-text-line-height: var(--line-height-lg);
|
|
261
|
-
|
|
262
|
-
--search-ai-thinking-text-margin: var(--md-pre-margin) 0;
|
|
263
|
-
|
|
264
|
-
--search-ai-question-font-size: var(--font-size-xl);
|
|
265
|
-
--search-ai-question-font-weight: var(--font-weight-semibold);
|
|
266
|
-
--search-ai-question-line-height: var(--line-height-xl);
|
|
267
|
-
--search-ai-question-text-color: var(--text-color-primary);
|
|
268
|
-
|
|
269
|
-
--search-ai-resources-gap: var(--spacing-base);
|
|
270
|
-
--search-ai-resources-title-font-weight: var(--font-weight-medium);
|
|
271
|
-
--search-ai-resources-title-font-size: var(--font-size-lg);
|
|
272
|
-
--search-ai-resources-title-line-height: var(--line-height-lg);
|
|
273
|
-
|
|
274
|
-
--search-ai-resource-tags-gap: var(--spacing-base);
|
|
275
|
-
--search-ai-resource-tag-text-color: var(--text-color-secondary);
|
|
276
|
-
--search-ai-resource-tag-icon-color: var(--text-color-secondary);
|
|
277
|
-
|
|
278
|
-
--search-ai-suggestions-gap: var(--spacing-sm);
|
|
279
|
-
--search-ai-suggestions-margin-left: var(--spacing-xs);
|
|
280
|
-
--search-ai-suggestion-item-gap: var(--spacing-xs);
|
|
281
|
-
|
|
282
|
-
--search-ai-suggestions-title-text-color: var(--text-color-description);
|
|
283
|
-
--search-ai-suggestions-title-font-size: var(--font-size-base);
|
|
284
|
-
--search-ai-suggestions-title-line-height: var(--line-height-base);
|
|
285
|
-
--search-ai-suggestions-title-font-weight: var(--font-weight-light);
|
|
286
|
-
|
|
287
|
-
--search-ai-spinner-icon-color: var(--icon-color-interactive);
|
|
288
|
-
--search-ai-checkmark-icon-color: var(--icon-color-interactive);
|
|
258
|
+
--search-ai-conversation-input-min-height: 48px;
|
|
259
|
+
--search-ai-conversation-input-max-height: 120px;
|
|
260
|
+
--search-ai-conversation-input-padding-right: calc(var(--search-ai-conversation-input-send-button-right) + 30px);
|
|
261
|
+
--search-ai-conversation-input-send-button-bottom: calc(var(--search-ai-conversation-input-min-height) / 2);
|
|
289
262
|
|
|
290
263
|
// @tokens End
|
|
291
264
|
`;
|
|
265
|
+
/* eslint-enable theme/no-raw-colors-in-styles */
|
|
@@ -2,17 +2,9 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { ForwardedRef, ReactElement } from 'react';
|
|
5
|
-
import type {
|
|
5
|
+
import type { SegmentedProps } from '@redocly/theme/core/types';
|
|
6
6
|
|
|
7
|
-
import { typedMemo } from '@redocly/theme/core/hoc/
|
|
8
|
-
|
|
9
|
-
export type SegmentedProps<T> = {
|
|
10
|
-
options: SelectOption<T>[];
|
|
11
|
-
value: T;
|
|
12
|
-
onChange: ({ label, value }: SelectOption<T>) => void;
|
|
13
|
-
className?: string;
|
|
14
|
-
size?: 'regular' | 'small';
|
|
15
|
-
};
|
|
7
|
+
import { typedMemo } from '@redocly/theme/core/hoc/typed-memo';
|
|
16
8
|
|
|
17
9
|
function SegmentedComponent<T>(
|
|
18
10
|
{ options, onChange, value, className = '', size = 'regular' }: SegmentedProps<T>,
|
|
@@ -25,17 +17,20 @@ function SegmentedComponent<T>(
|
|
|
25
17
|
className={`tag-grey ${size} ${className}`}
|
|
26
18
|
role="tablist"
|
|
27
19
|
>
|
|
28
|
-
{options.map((opt) => (
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
{options.map((opt, index) => (
|
|
21
|
+
<React.Fragment key={index}>
|
|
22
|
+
{opt.divider}
|
|
23
|
+
<SegmentedItem
|
|
24
|
+
key={opt.label}
|
|
25
|
+
role="tab"
|
|
26
|
+
title={opt.label}
|
|
27
|
+
onClick={() => onChange(opt)}
|
|
28
|
+
$isActive={value == opt.value}
|
|
29
|
+
$size={size}
|
|
30
|
+
>
|
|
31
|
+
{opt.element || opt.label}
|
|
32
|
+
</SegmentedItem>
|
|
33
|
+
</React.Fragment>
|
|
39
34
|
))}
|
|
40
35
|
</SegmentedGroup>
|
|
41
36
|
);
|