@redocly/theme 0.59.0-rc.1 → 0.59.0

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.
Files changed (195) hide show
  1. package/LICENSE +7 -1
  2. package/lib/components/Buttons/AIAssistantButton.js +6 -2
  3. package/lib/components/Buttons/ConnectMCPButton.d.ts +8 -0
  4. package/lib/components/Buttons/ConnectMCPButton.js +145 -0
  5. package/lib/components/Buttons/variables.d.ts +1 -0
  6. package/lib/components/Buttons/variables.js +42 -2
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +1 -0
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
  9. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
  10. package/lib/components/Catalog/CatalogEntityIcon.js +2 -1
  11. package/lib/components/Catalog/CatalogFilter/CatalogFilter.js +4 -0
  12. package/lib/components/Catalog/CatalogTagsWithTooltip.js +1 -1
  13. package/lib/components/Catalog/variables.js +1 -1
  14. package/lib/components/Dropdown/Dropdown.d.ts +16 -2
  15. package/lib/components/Dropdown/Dropdown.js +5 -5
  16. package/lib/components/Menu/MenuItem.js +1 -1
  17. package/lib/components/Navbar/NavbarItem.js +3 -3
  18. package/lib/components/PageActions/PageActions.js +4 -1
  19. package/lib/components/PageActions/variables.js +2 -0
  20. package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +1 -2
  21. package/lib/components/Search/SearchAiActionButtons.d.ts +10 -0
  22. package/lib/components/Search/SearchAiActionButtons.js +43 -0
  23. package/lib/components/Search/SearchAiConversationInput.d.ts +3 -1
  24. package/lib/components/Search/SearchAiConversationInput.js +39 -7
  25. package/lib/components/Search/SearchAiDialog.d.ts +3 -6
  26. package/lib/components/Search/SearchAiDialog.js +20 -9
  27. package/lib/components/Search/SearchAiMessage.d.ts +9 -5
  28. package/lib/components/Search/SearchAiMessage.js +146 -22
  29. package/lib/components/Search/SearchAiNegativeFeedbackForm.d.ts +8 -0
  30. package/lib/components/Search/SearchAiNegativeFeedbackForm.js +169 -0
  31. package/lib/components/Search/SearchDialog.js +36 -5
  32. package/lib/components/Search/SearchGroups.js +2 -2
  33. package/lib/components/Search/variables.js +36 -64
  34. package/lib/components/Segmented/Segmented.d.ts +1 -8
  35. package/lib/components/Segmented/Segmented.js +3 -1
  36. package/lib/components/Select/SelectInput.js +1 -1
  37. package/lib/components/Select/variables.js +2 -2
  38. package/lib/components/Tag/Tag.d.ts +2 -1
  39. package/lib/components/Tag/Tag.js +66 -17
  40. package/lib/components/Tag/variables.dark.js +135 -36
  41. package/lib/components/Tag/variables.js +78 -61
  42. package/lib/core/constants/index.d.ts +1 -0
  43. package/lib/core/constants/index.js +1 -0
  44. package/lib/core/constants/mcp.d.ts +1 -0
  45. package/lib/core/constants/mcp.js +5 -0
  46. package/lib/core/constants/search.d.ts +5 -4
  47. package/lib/core/constants/search.js +4 -5
  48. package/lib/core/hooks/index.d.ts +3 -0
  49. package/lib/core/hooks/index.js +3 -0
  50. package/lib/core/hooks/menu/use-nested-menu.js +1 -1
  51. package/lib/core/hooks/search/use-feedback-tooltip.d.ts +6 -0
  52. package/lib/core/hooks/search/use-feedback-tooltip.js +26 -0
  53. package/lib/core/hooks/use-connect-mcp-button.d.ts +13 -0
  54. package/lib/core/hooks/use-connect-mcp-button.js +50 -0
  55. package/lib/core/hooks/use-mcp-config.d.ts +9 -0
  56. package/lib/core/hooks/use-mcp-config.js +27 -0
  57. package/lib/core/hooks/use-page-actions.d.ts +1 -1
  58. package/lib/core/hooks/use-page-actions.js +98 -95
  59. package/lib/core/hooks/use-product-picker.js +2 -1
  60. package/lib/core/hooks/use-tabs.d.ts +3 -2
  61. package/lib/core/hooks/use-tabs.js +115 -57
  62. package/lib/core/hooks/use-telemetry-fallback.d.ts +10 -8
  63. package/lib/core/hooks/use-telemetry-fallback.js +10 -8
  64. package/lib/core/openapi/index.d.ts +1 -0
  65. package/lib/core/styles/dark.js +4 -0
  66. package/lib/core/styles/global.js +5 -0
  67. package/lib/core/types/hooks.d.ts +2 -2
  68. package/lib/core/types/index.d.ts +1 -0
  69. package/lib/core/types/index.js +1 -0
  70. package/lib/core/types/l10n.d.ts +1 -1
  71. package/lib/core/types/mcp.d.ts +6 -0
  72. package/lib/core/types/mcp.js +3 -0
  73. package/lib/core/types/search.d.ts +11 -4
  74. package/lib/core/types/search.js +6 -0
  75. package/lib/core/types/segmented.d.ts +12 -0
  76. package/lib/core/types/segmented.js +3 -0
  77. package/lib/core/utils/frontmatter-translate.d.ts +6 -0
  78. package/lib/core/utils/frontmatter-translate.js +14 -0
  79. package/lib/core/utils/index.d.ts +2 -0
  80. package/lib/core/utils/index.js +2 -0
  81. package/lib/core/utils/mcp.d.ts +2 -0
  82. package/lib/core/utils/mcp.js +31 -0
  83. package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +44 -4
  84. package/lib/icons/AiStarsIcon/AiStarsIcon.js +11 -2
  85. package/lib/icons/ConnectIcon/ConnectIcon.d.ts +9 -0
  86. package/lib/icons/ConnectIcon/ConnectIcon.js +17 -0
  87. package/lib/icons/CubeIcon/CubeIcon.d.ts +9 -0
  88. package/lib/icons/CubeIcon/CubeIcon.js +17 -0
  89. package/lib/icons/HashtagIcon/HashtagIcon.d.ts +9 -0
  90. package/lib/icons/HashtagIcon/HashtagIcon.js +22 -0
  91. package/lib/icons/RedoclyIcon/RedoclyIcon.js +4 -7
  92. package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.d.ts +9 -0
  93. package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.js +34 -0
  94. package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.d.ts +9 -0
  95. package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.js +34 -0
  96. package/lib/icons/VSCodeIcon/VSCodeIcon.d.ts +9 -0
  97. package/lib/icons/VSCodeIcon/VSCodeIcon.js +17 -0
  98. package/lib/index.d.ts +1 -2
  99. package/lib/index.js +1 -2
  100. package/lib/markdoc/components/Cards/Card.js +1 -28
  101. package/lib/markdoc/components/ConnectMCP/ConnectMCP.d.ts +8 -0
  102. package/lib/markdoc/components/ConnectMCP/ConnectMCP.js +19 -0
  103. package/lib/markdoc/components/Tabs/TabList.d.ts +3 -1
  104. package/lib/markdoc/components/Tabs/TabList.js +197 -47
  105. package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
  106. package/lib/markdoc/components/Tabs/Tabs.js +57 -12
  107. package/lib/markdoc/components/default.d.ts +1 -0
  108. package/lib/markdoc/components/default.js +1 -0
  109. package/lib/markdoc/default.d.ts +6 -0
  110. package/lib/markdoc/default.js +2 -0
  111. package/lib/markdoc/tags/card.js +0 -1
  112. package/lib/markdoc/tags/connect-mcp.d.ts +2 -0
  113. package/lib/markdoc/tags/connect-mcp.js +27 -0
  114. package/package.json +6 -6
  115. package/src/components/Buttons/AIAssistantButton.tsx +6 -2
  116. package/src/components/Buttons/ConnectMCPButton.tsx +180 -0
  117. package/src/components/Buttons/variables.ts +42 -1
  118. package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +1 -0
  119. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
  120. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
  121. package/src/components/Catalog/CatalogEntityIcon.tsx +2 -1
  122. package/src/components/Catalog/CatalogFilter/CatalogFilter.tsx +5 -0
  123. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +1 -5
  124. package/src/components/Catalog/variables.ts +1 -1
  125. package/src/components/Dropdown/Dropdown.tsx +84 -79
  126. package/src/components/Menu/MenuItem.tsx +1 -0
  127. package/src/components/Navbar/NavbarItem.tsx +6 -5
  128. package/src/components/PageActions/PageActions.tsx +5 -1
  129. package/src/components/PageActions/variables.ts +2 -0
  130. package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +3 -3
  131. package/src/components/Search/SearchAiActionButtons.tsx +76 -0
  132. package/src/components/Search/SearchAiConversationInput.tsx +61 -18
  133. package/src/components/Search/SearchAiDialog.tsx +52 -23
  134. package/src/components/Search/SearchAiMessage.tsx +172 -43
  135. package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +210 -0
  136. package/src/components/Search/SearchDialog.tsx +49 -13
  137. package/src/components/Search/SearchGroups.tsx +2 -0
  138. package/src/components/Search/variables.ts +36 -64
  139. package/src/components/Segmented/Segmented.tsx +15 -20
  140. package/src/components/Select/SelectInput.tsx +1 -0
  141. package/src/components/Select/variables.ts +2 -2
  142. package/src/components/Tag/Tag.tsx +35 -19
  143. package/src/components/Tag/variables.dark.ts +135 -36
  144. package/src/components/Tag/variables.ts +78 -61
  145. package/src/core/constants/index.ts +1 -0
  146. package/src/core/constants/mcp.ts +1 -0
  147. package/src/core/constants/search.ts +8 -4
  148. package/src/core/hooks/index.ts +3 -0
  149. package/src/core/hooks/menu/use-nested-menu.ts +2 -2
  150. package/src/core/hooks/search/use-feedback-tooltip.ts +32 -0
  151. package/src/core/hooks/use-connect-mcp-button.ts +79 -0
  152. package/src/core/hooks/use-mcp-config.ts +43 -0
  153. package/src/core/hooks/use-page-actions.ts +148 -126
  154. package/src/core/hooks/use-product-picker.ts +2 -1
  155. package/src/core/hooks/use-tabs.ts +168 -86
  156. package/src/core/hooks/use-telemetry-fallback.ts +10 -8
  157. package/src/core/openapi/index.ts +1 -0
  158. package/src/core/styles/dark.ts +4 -0
  159. package/src/core/styles/global.ts +6 -1
  160. package/src/core/types/hooks.ts +5 -1
  161. package/src/core/types/index.ts +1 -0
  162. package/src/core/types/l10n.ts +13 -0
  163. package/src/core/types/mcp.ts +8 -0
  164. package/src/core/types/search.ts +13 -4
  165. package/src/core/types/segmented.ts +14 -0
  166. package/src/core/utils/frontmatter-translate.ts +9 -0
  167. package/src/core/utils/index.ts +2 -0
  168. package/src/core/utils/mcp.ts +34 -0
  169. package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +13 -4
  170. package/src/icons/AiStarsIcon/AiStarsIcon.tsx +11 -2
  171. package/src/icons/ConnectIcon/ConnectIcon.tsx +27 -0
  172. package/src/icons/CubeIcon/CubeIcon.tsx +27 -0
  173. package/src/icons/HashtagIcon/HashtagIcon.tsx +23 -0
  174. package/src/icons/RedoclyIcon/RedoclyIcon.tsx +4 -22
  175. package/src/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.tsx +38 -0
  176. package/src/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.tsx +35 -0
  177. package/src/icons/VSCodeIcon/VSCodeIcon.tsx +29 -0
  178. package/src/index.ts +1 -2
  179. package/src/markdoc/components/Cards/Card.tsx +1 -28
  180. package/src/markdoc/components/ConnectMCP/ConnectMCP.tsx +28 -0
  181. package/src/markdoc/components/Tabs/TabList.tsx +312 -105
  182. package/src/markdoc/components/Tabs/Tabs.tsx +136 -11
  183. package/src/markdoc/components/default.ts +1 -0
  184. package/src/markdoc/default.ts +2 -0
  185. package/src/markdoc/tags/card.ts +0 -1
  186. package/src/markdoc/tags/connect-mcp.ts +25 -0
  187. package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.d.ts +0 -1
  188. package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.js +0 -11
  189. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +0 -1
  190. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +0 -5
  191. package/lib/ext/process-scorecard.d.ts +0 -5
  192. package/lib/ext/process-scorecard.js +0 -11
  193. package/src/components/OpenApiDocs/hooks/AdditionalOverviewInfo.tsx +0 -9
  194. package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +0 -1
  195. package/src/ext/process-scorecard.ts +0 -13
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useConnectMCPButton = useConnectMCPButton;
7
+ const react_1 = require("react");
8
+ const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
9
+ const use_theme_hooks_1 = require("./use-theme-hooks");
10
+ const use_mcp_config_1 = require("./use-mcp-config");
11
+ const clipboard_service_1 = require("../utils/clipboard-service");
12
+ const COPIED_RESET_TIMEOUT = 1000;
13
+ function useConnectMCPButton({ options = ['cursor', 'vscode', 'copy'], } = {}) {
14
+ const { useTranslate } = (0, use_theme_hooks_1.useThemeHooks)();
15
+ const { translate } = useTranslate();
16
+ const { serverName, serverUrl, cursorUrl, vscodeUrl } = (0, use_mcp_config_1.useMCPConfig)();
17
+ const [isCopied, setIsCopied] = (0, react_1.useState)(false);
18
+ // eslint-disable-next-line react-hooks/exhaustive-deps
19
+ const resetCopied = (0, react_1.useCallback)((0, lodash_debounce_1.default)(() => setIsCopied(false), COPIED_RESET_TIMEOUT), []);
20
+ const handleAction = (0, react_1.useCallback)((action) => {
21
+ if (action === 'copy') {
22
+ const config = {
23
+ [serverName]: {
24
+ url: serverUrl,
25
+ description: 'MCP Server',
26
+ },
27
+ };
28
+ clipboard_service_1.ClipboardService.copyCustom(JSON.stringify(config, null, 2));
29
+ setIsCopied(true);
30
+ resetCopied();
31
+ return;
32
+ }
33
+ const urlMap = {
34
+ cursor: cursorUrl,
35
+ vscode: vscodeUrl,
36
+ };
37
+ window.open(urlMap[action], '_blank');
38
+ }, [cursorUrl, vscodeUrl, serverUrl, serverName, resetCopied]);
39
+ const triggerButtonText = (0, react_1.useMemo)(() => translate('page.actions.connectMcp', 'Connect MCP'), [translate]);
40
+ const visibleOptions = (0, react_1.useMemo)(() => options.filter(Boolean), [options]);
41
+ return {
42
+ isCopied,
43
+ cursorUrl,
44
+ vscodeUrl,
45
+ triggerButtonText,
46
+ visibleOptions,
47
+ handleAction,
48
+ };
49
+ }
50
+ //# sourceMappingURL=use-connect-mcp-button.js.map
@@ -0,0 +1,9 @@
1
+ export type McpConfig = {
2
+ serverName: string;
3
+ origin: string;
4
+ serverUrl: string;
5
+ cursorUrl: string;
6
+ vscodeUrl: string;
7
+ isMcpDisabled: boolean;
8
+ };
9
+ export declare function useMCPConfig(): McpConfig;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMCPConfig = useMCPConfig;
4
+ const react_1 = require("react");
5
+ const use_theme_config_1 = require("./use-theme-config");
6
+ const dom_1 = require("../utils/dom");
7
+ const constants_1 = require("../constants");
8
+ const mcp_1 = require("../utils/mcp");
9
+ function useMCPConfig() {
10
+ var _a, _b, _c, _d, _e;
11
+ const themeConfig = (0, use_theme_config_1.useThemeConfig)();
12
+ const origin = dom_1.IS_BROWSER ? window.location.origin : globalThis['SSR_HOSTNAME'];
13
+ const serverName = ((_b = (_a = themeConfig.mcp) === null || _a === void 0 ? void 0 : _a.docs) === null || _b === void 0 ? void 0 : _b.name) || constants_1.DEFAULT_MCP_SERVER_NAME;
14
+ const serverUrl = `${origin}/mcp`;
15
+ const isMcpDisabled = ((_c = themeConfig.mcp) === null || _c === void 0 ? void 0 : _c.hide) || ((_e = (_d = themeConfig.mcp) === null || _d === void 0 ? void 0 : _d.docs) === null || _e === void 0 ? void 0 : _e.hide) || false;
16
+ const cursorUrl = (0, react_1.useMemo)(() => (0, mcp_1.generateMCPDeepLink)('cursor', { serverName, url: serverUrl }), [serverName, serverUrl]);
17
+ const vscodeUrl = (0, react_1.useMemo)(() => (0, mcp_1.generateMCPDeepLink)('vscode', { serverName, url: serverUrl }), [serverName, serverUrl]);
18
+ return {
19
+ serverName,
20
+ origin,
21
+ serverUrl,
22
+ cursorUrl,
23
+ vscodeUrl,
24
+ isMcpDisabled,
25
+ };
26
+ }
27
+ //# sourceMappingURL=use-mcp-config.js.map
@@ -1,3 +1,3 @@
1
1
  import type { PageAction } from '../types';
2
- export type PageActionType = 'copy' | 'view' | 'chatgpt' | 'claude' | 'mcp-cursor';
2
+ export type PageActionType = 'copy' | 'view' | 'chatgpt' | 'claude' | 'docs-mcp-cursor' | 'docs-mcp-vscode' | 'mcp-cursor' | 'mcp-vscode';
3
3
  export declare function usePageActions(pageSlug: string, mcpUrl?: string, actions?: PageActionType[]): PageAction[];
@@ -15,13 +15,22 @@ const CopyIcon_1 = require("../../icons/CopyIcon/CopyIcon");
15
15
  const ChatGptIcon_1 = require("../../icons/ChatGptIcon/ChatGptIcon");
16
16
  const ClaudeIcon_1 = require("../../icons/ClaudeIcon/ClaudeIcon");
17
17
  const MarkdownFullIcon_1 = require("../../icons/MarkdownFullIcon/MarkdownFullIcon");
18
+ const VSCodeIcon_1 = require("../../icons/VSCodeIcon/VSCodeIcon");
19
+ const CursorIcon_1 = require("../../icons/CursorIcon/CursorIcon");
18
20
  const use_theme_hooks_1 = require("./use-theme-hooks");
19
21
  const use_theme_config_1 = require("./use-theme-config");
22
+ const use_mcp_config_1 = require("./use-mcp-config");
20
23
  const clipboard_service_1 = require("../utils/clipboard-service");
21
24
  const dom_1 = require("../utils/dom");
22
- const CursorIcon_1 = require("../../icons/CursorIcon/CursorIcon");
23
- const DEFAULT_ENABLED_ACTIONS = ['copy', 'view', 'chatgpt', 'claude'];
24
- const CURSOR_URL = 'cursor://anysphere.cursor-deeplink/mcp/install?name=$NAME&config=$BASE64_ENCODED_CONFIG';
25
+ const mcp_1 = require("../utils/mcp");
26
+ const DEFAULT_ENABLED_ACTIONS = [
27
+ 'copy',
28
+ 'view',
29
+ 'chatgpt',
30
+ 'claude',
31
+ 'docs-mcp-cursor',
32
+ 'docs-mcp-vscode',
33
+ ];
25
34
  function usePageActions(pageSlug, mcpUrl, actions) {
26
35
  var _a, _b, _c;
27
36
  const { useTranslate, usePageData, usePageProps, usePageSharedData } = (0, use_theme_hooks_1.useThemeHooks)();
@@ -29,8 +38,19 @@ function usePageActions(pageSlug, mcpUrl, actions) {
29
38
  const themeConfig = (0, use_theme_config_1.useThemeConfig)();
30
39
  const pageProps = usePageProps();
31
40
  const openApiSharedData = usePageSharedData('openAPIDocsStore');
41
+ const mcpConfig = (0, use_mcp_config_1.useMCPConfig)();
32
42
  const shouldHideAllActions = shouldHidePageActions(pageProps, themeConfig, (_a = openApiSharedData === null || openApiSharedData === void 0 ? void 0 : openApiSharedData.options) === null || _a === void 0 ? void 0 : _a.excludeFromSearch);
33
43
  const { isPublic } = usePageData() || {};
44
+ const createMCPHandler = (0, react_1.useCallback)((clientType, requiresMcpUrl = false) => () => {
45
+ if (requiresMcpUrl && !mcpUrl)
46
+ return null;
47
+ if (!requiresMcpUrl && (mcpUrl || mcpConfig.isMcpDisabled))
48
+ return null;
49
+ const config = requiresMcpUrl
50
+ ? { serverName: mcpConfig.serverName, url: mcpUrl || '' }
51
+ : { serverName: mcpConfig.serverName, url: mcpConfig.serverUrl || '' };
52
+ return createMCPAction({ clientType, mcpConfig: config, translate });
53
+ }, [mcpUrl, mcpConfig, translate]);
34
54
  const result = (0, react_1.useMemo)(() => {
35
55
  var _a, _b;
36
56
  if (shouldHideAllActions) {
@@ -39,111 +59,94 @@ function usePageActions(pageSlug, mcpUrl, actions) {
39
59
  const origin = dom_1.IS_BROWSER ? window.location.origin : globalThis['SSR_HOSTNAME'];
40
60
  const normalizedSlug = pageSlug.startsWith('/') ? pageSlug : '/' + pageSlug;
41
61
  const mdPageUrl = new URL(origin + normalizedSlug + (normalizedSlug === '/' ? 'index.html.md' : '.md')).toString();
42
- function getExternalAiPromptLink(baseUrl) {
43
- const externalAiPrompt = `Read ${mdPageUrl} and answer questions based on the content.`;
44
- const url = new URL(baseUrl);
45
- url.searchParams.set('q', externalAiPrompt);
46
- return url.toString();
47
- }
48
- return (((_b = (_a = themeConfig.navigation) === null || _a === void 0 ? void 0 : _a.actions) === null || _b === void 0 ? void 0 : _b.items) || actions || DEFAULT_ENABLED_ACTIONS)
49
- .map((action) => {
50
- function generateMCPConfig(isCursor) {
51
- const jsonConfig = {
52
- 'mcp-server': {
53
- url: mcpUrl,
54
- description: 'MCP Server',
55
- },
56
- };
57
- if (isCursor) {
58
- const url = CURSOR_URL.replace('$NAME', 'mcp-server').replace('$BASE64_ENCODED_CONFIG', btoa(JSON.stringify(jsonConfig['mcp-server'])));
59
- return url;
60
- }
61
- return JSON.stringify(jsonConfig, null, 2);
62
- }
63
- switch (action) {
64
- case 'mcp-cursor':
65
- if (!mcpUrl) {
66
- return null;
62
+ const actionHandlers = {
63
+ 'docs-mcp-cursor': createMCPHandler('cursor'),
64
+ 'docs-mcp-vscode': createMCPHandler('vscode'),
65
+ 'mcp-cursor': createMCPHandler('cursor', true),
66
+ 'mcp-vscode': createMCPHandler('vscode', true),
67
+ copy: () => ({
68
+ buttonText: translate('page.actions.copyButtonText', 'Copy'),
69
+ title: translate('page.actions.copyTitle', 'Copy for LLM'),
70
+ description: translate('page.actions.copyDescription', 'Copy page as Markdown for LLMs'),
71
+ iconComponent: CopyIcon_1.CopyIcon,
72
+ onClick: () => __awaiter(this, void 0, void 0, function* () {
73
+ try {
74
+ const result = yield fetch(mdPageUrl);
75
+ if (result.status !== 200) {
76
+ return;
77
+ }
78
+ const text = yield result.text();
79
+ clipboard_service_1.ClipboardService.copyCustom(text);
67
80
  }
68
- return {
69
- buttonText: translate('page.actions.cursorMcpButtonText', 'Connect to Cursor'),
70
- title: translate('page.actions.cursorMcpTitle', 'Connect to Cursor'),
71
- description: translate('page.actions.cursorMcpDescription', 'Install MCP server on Cursor'),
72
- iconComponent: CursorIcon_1.CursorIcon,
73
- onClick: () => {
74
- try {
75
- const url = generateMCPConfig(true);
76
- window.open(url, '_blank');
77
- }
78
- catch (error) {
79
- console.error(error);
80
- }
81
- },
82
- };
83
- case 'copy':
84
- return {
85
- buttonText: translate('page.actions.copyButtonText', 'Copy'),
86
- title: translate('page.actions.copyTitle', 'Copy for LLM'),
87
- description: translate('page.actions.copyDescription', 'Copy page as Markdown for LLMs'),
88
- iconComponent: CopyIcon_1.CopyIcon,
89
- onClick: () => __awaiter(this, void 0, void 0, function* () {
90
- try {
91
- const result = yield fetch(mdPageUrl);
92
- if (result.status !== 200) {
93
- throw new Error('Failed to fetch markdown content');
94
- }
95
- const text = yield result.text();
96
- clipboard_service_1.ClipboardService.copyCustom(text);
97
- }
98
- catch (error) {
99
- console.error(error);
100
- }
101
- }),
102
- };
103
- case 'view':
104
- return {
105
- buttonText: translate('page.actions.viewAsMdButtonText', 'View as Markdown'),
106
- title: translate('page.actions.viewAsMdTitle', 'View as Markdown'),
107
- description: translate('page.actions.viewAsMdDescription', 'Open this page as Markdown'),
108
- iconComponent: MarkdownFullIcon_1.MarkdownFullIcon,
109
- link: mdPageUrl,
110
- };
111
- case 'chatgpt':
112
- if (!isPublic) {
113
- return null;
81
+ catch (error) {
82
+ console.error(error);
114
83
  }
115
- return {
116
- buttonText: translate('page.actions.chatGptButtonText', 'Open in ChatGPT'),
117
- title: translate('page.actions.chatGptTitle', 'Open in ChatGPT'),
118
- description: translate('page.actions.chatGptDescription', 'Get insights from ChatGPT'),
119
- iconComponent: ChatGptIcon_1.ChatGptIcon,
120
- link: getExternalAiPromptLink('https://chat.openai.com'),
121
- };
122
- case 'claude':
123
- if (!isPublic) {
124
- return null;
125
- }
126
- return {
127
- buttonText: translate('page.actions.claudeButtonText', 'Open in Claude'),
128
- title: translate('page.actions.claudeTitle', 'Open in Claude'),
129
- description: translate('page.actions.claudeDescription', 'Get insights from Claude'),
130
- iconComponent: ClaudeIcon_1.ClaudeIcon,
131
- link: getExternalAiPromptLink('https://claude.ai/new'),
132
- };
133
- }
134
- })
84
+ }),
85
+ }),
86
+ view: () => ({
87
+ buttonText: translate('page.actions.viewAsMdButtonText', 'View as Markdown'),
88
+ title: translate('page.actions.viewAsMdTitle', 'View as Markdown'),
89
+ description: translate('page.actions.viewAsMdDescription', 'Open this page as Markdown'),
90
+ iconComponent: MarkdownFullIcon_1.MarkdownFullIcon,
91
+ link: mdPageUrl,
92
+ }),
93
+ chatgpt: () => {
94
+ if (!isPublic) {
95
+ return null;
96
+ }
97
+ return {
98
+ buttonText: translate('page.actions.chatGptButtonText', 'Open in ChatGPT'),
99
+ title: translate('page.actions.chatGptTitle', 'Open in ChatGPT'),
100
+ description: translate('page.actions.chatGptDescription', 'Get insights from ChatGPT'),
101
+ iconComponent: ChatGptIcon_1.ChatGptIcon,
102
+ link: getExternalAiPromptLink('https://chat.openai.com', mdPageUrl),
103
+ };
104
+ },
105
+ claude: () => {
106
+ if (!isPublic) {
107
+ return null;
108
+ }
109
+ return {
110
+ buttonText: translate('page.actions.claudeButtonText', 'Open in Claude'),
111
+ title: translate('page.actions.claudeTitle', 'Open in Claude'),
112
+ description: translate('page.actions.claudeDescription', 'Get insights from Claude'),
113
+ iconComponent: ClaudeIcon_1.ClaudeIcon,
114
+ link: getExternalAiPromptLink('https://claude.ai/new', mdPageUrl),
115
+ };
116
+ },
117
+ };
118
+ return (((_b = (_a = themeConfig.navigation) === null || _a === void 0 ? void 0 : _a.actions) === null || _b === void 0 ? void 0 : _b.items) || actions || DEFAULT_ENABLED_ACTIONS)
119
+ .map((action) => { var _a; return (_a = actionHandlers[action]) === null || _a === void 0 ? void 0 : _a.call(actionHandlers); })
135
120
  .filter((action) => action !== null);
136
121
  }, [
137
122
  shouldHideAllActions,
138
123
  pageSlug,
139
124
  (_c = (_b = themeConfig.navigation) === null || _b === void 0 ? void 0 : _b.actions) === null || _c === void 0 ? void 0 : _c.items,
140
125
  actions,
141
- mcpUrl,
142
126
  translate,
143
127
  isPublic,
128
+ createMCPHandler,
144
129
  ]);
145
130
  return result;
146
131
  }
132
+ function getExternalAiPromptLink(baseUrl, mdPageUrl) {
133
+ const externalAiPrompt = `Read ${mdPageUrl} and answer questions based on the content.`;
134
+ const url = new URL(baseUrl);
135
+ url.searchParams.set('q', externalAiPrompt);
136
+ return url.toString();
137
+ }
138
+ function createMCPAction({ clientType, mcpConfig, translate }) {
139
+ const url = (0, mcp_1.generateMCPDeepLink)(clientType, mcpConfig);
140
+ const sharedProps = {
141
+ onClick: () => {
142
+ window.open(url, '_blank');
143
+ },
144
+ };
145
+ if (clientType === 'cursor') {
146
+ return Object.assign(Object.assign({}, sharedProps), { buttonText: translate('page.actions.connectMcp.cursor', 'Connect to Cursor'), title: translate('page.actions.connectMcp.cursor', 'Connect to Cursor'), description: translate('page.actions.connectMcp.cursorDescription', 'Install MCP server on Cursor'), iconComponent: CursorIcon_1.CursorIcon });
147
+ }
148
+ return Object.assign(Object.assign({}, sharedProps), { buttonText: translate('page.actions.connectMcp.vscode', 'Connect to VS Code'), title: translate('page.actions.connectMcp.vscode', 'Connect to VS Code'), description: translate('page.actions.connectMcp.vscodeDescription', 'Install MCP server on VS Code'), iconComponent: VSCodeIcon_1.VSCodeIcon });
149
+ }
147
150
  function shouldHidePageActions(pageProps, themeConfig, openapiExcludeFromSearch) {
148
151
  var _a, _b, _c, _d, _e, _f;
149
152
  // Can't use any actions if no markdown files are generated for LLMs
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useProductPicker = useProductPicker;
4
4
  const react_router_dom_1 = require("react-router-dom");
5
5
  const use_theme_hooks_1 = require("./use-theme-hooks");
6
+ const utils_1 = require("../utils");
6
7
  function useProductPicker() {
7
8
  const { useCurrentProduct, useProducts, useTelemetry, useLoadAndNavigate } = (0, use_theme_hooks_1.useThemeHooks)();
8
9
  const currentProduct = useCurrentProduct();
@@ -14,7 +15,7 @@ function useProductPicker() {
14
15
  if (!product)
15
16
  return;
16
17
  telemetry.sendProductPickedMessage({ product: product.slug });
17
- loadAndNavigate({ navigate, to: product.link });
18
+ loadAndNavigate({ navigate, to: (0, utils_1.withPathPrefix)(product.link) });
18
19
  }
19
20
  return {
20
21
  currentProduct,
@@ -4,18 +4,19 @@ type UseTabsProps = {
4
4
  totalTabs: number;
5
5
  containerRef?: React.RefObject<HTMLElement | null>;
6
6
  };
7
- export declare function useTabs({ activeTab, onTabChange, totalTabs, containerRef }: UseTabsProps): {
7
+ type UseTabsReturn = {
8
8
  setTabRef: (element: HTMLButtonElement | null, index: number) => void;
9
9
  onTabClick: (labelOrIndex: string | number) => void;
10
10
  handleKeyboard: (event: React.KeyboardEvent, index: number) => void;
11
11
  visibleTabs: number[];
12
12
  overflowTabs: number[];
13
- allTabsHidden: boolean;
13
+ isReady: boolean;
14
14
  };
15
15
  type UseActiveTabProps = {
16
16
  initialTab: string;
17
17
  tabsId?: string;
18
18
  };
19
+ export declare function useTabs({ activeTab, onTabChange, totalTabs, containerRef, }: UseTabsProps): UseTabsReturn;
19
20
  export declare const useActiveTab: ({ initialTab, tabsId }: UseActiveTabProps) => {
20
21
  activeTab: string;
21
22
  setActiveTab: import("react").Dispatch<import("react").SetStateAction<string>>;
@@ -6,15 +6,20 @@ const react_1 = require("react");
6
6
  const react_router_dom_1 = require("react-router-dom");
7
7
  const MORE_BUTTON_WIDTH = 80;
8
8
  const TABS_GAP = 8;
9
- function useTabs({ activeTab, onTabChange, totalTabs, containerRef }) {
9
+ function useTabs({ activeTab, onTabChange, totalTabs, containerRef, }) {
10
10
  const [tabs, setTabs] = (0, react_1.useState)({
11
11
  visible: Array.from({ length: totalTabs }, (_, i) => i),
12
12
  overflow: [],
13
13
  });
14
+ const [isReady, setIsReady] = (0, react_1.useState)(false);
15
+ const isFirstCalculation = (0, react_1.useRef)(true);
14
16
  const tabRefs = (0, react_1.useRef)([]);
15
17
  const tabWidthsRef = (0, react_1.useRef)([]);
16
18
  const tabLabelsRef = (0, react_1.useRef)([]);
17
- const allTabsHidden = (0, react_1.useMemo)(() => tabs.visible.length === 0, [tabs.visible]);
19
+ const activeTabRef = (0, react_1.useRef)(activeTab);
20
+ const calculateVisibleTabsRef = (0, react_1.useRef)(null);
21
+ // Synchronously update ref before any callbacks or effects run
22
+ activeTabRef.current = activeTab;
18
23
  const setTabRef = (0, react_1.useCallback)((element, index) => {
19
24
  tabRefs.current[index] = element;
20
25
  const width = element === null || element === void 0 ? void 0 : element.offsetWidth;
@@ -25,18 +30,25 @@ function useTabs({ activeTab, onTabChange, totalTabs, containerRef }) {
25
30
  if (label) {
26
31
  tabLabelsRef.current[index] = label;
27
32
  }
28
- }, []);
29
- const focusTab = (index) => {
33
+ // Trigger calculation once all tabs are registered
34
+ if (isFirstCalculation.current &&
35
+ tabWidthsRef.current.length >= totalTabs &&
36
+ tabLabelsRef.current.length >= totalTabs &&
37
+ calculateVisibleTabsRef.current) {
38
+ requestAnimationFrame(calculateVisibleTabsRef.current);
39
+ }
40
+ }, [totalTabs]);
41
+ const focusTab = (0, react_1.useCallback)((index) => {
30
42
  const currentElement = tabRefs.current[index];
31
43
  currentElement === null || currentElement === void 0 ? void 0 : currentElement.focus();
32
- };
44
+ }, []);
33
45
  const onTabSelect = (0, react_1.useCallback)((index) => {
34
46
  var _a;
35
47
  focusTab(index);
36
48
  const label = (_a = tabRefs.current[index]) === null || _a === void 0 ? void 0 : _a.getAttribute('data-label');
37
49
  if (label)
38
50
  onTabChange(label);
39
- }, [onTabChange]);
51
+ }, [onTabChange, focusTab]);
40
52
  const handleKeyboard = (0, react_1.useCallback)((event, index) => {
41
53
  let newIndex = index;
42
54
  if (event.key === 'ArrowRight') {
@@ -59,109 +71,155 @@ function useTabs({ activeTab, onTabChange, totalTabs, containerRef }) {
59
71
  onTabSelect(newIndex);
60
72
  }, [totalTabs, onTabSelect]);
61
73
  const replaceLastVisibleTabWithClickedOverflowTab = (0, react_1.useCallback)((clickedIndex) => {
62
- const { visible: visibleTabs, overflow: overflowTabs } = tabs;
63
- // Indexes of visible tabs should be sorted(asc), to replace the last visible tab with the clicked tab
64
- const newVisibleTabs = [...visibleTabs].sort((a, b) => a - b);
65
- const newOverflowTabs = [...overflowTabs];
66
- const clickedIdxInOverflow = newOverflowTabs.indexOf(clickedIndex);
67
- if (clickedIdxInOverflow !== -1) {
68
- const lastVisible = newVisibleTabs[newVisibleTabs.length - 1];
69
- newOverflowTabs.splice(clickedIdxInOverflow, 1);
70
- newOverflowTabs.unshift(lastVisible);
71
- newVisibleTabs.splice(newVisibleTabs.length - 1, 1);
72
- newVisibleTabs.unshift(clickedIndex);
73
- }
74
- setTabs({
75
- visible: newVisibleTabs,
76
- overflow: newOverflowTabs,
74
+ setTabs((prevTabs) => {
75
+ const { visible: visibleTabs, overflow: overflowTabs } = prevTabs;
76
+ const sortedVisible = [...visibleTabs].sort((a, b) => a - b);
77
+ const lastVisible = sortedVisible[sortedVisible.length - 1];
78
+ return {
79
+ visible: visibleTabs.map((idx) => (idx === lastVisible ? clickedIndex : idx)),
80
+ overflow: overflowTabs.map((idx) => (idx === clickedIndex ? lastVisible : idx)),
81
+ };
77
82
  });
78
- }, [tabs]);
83
+ }, []);
79
84
  const onTabClick = (0, react_1.useCallback)((labelOrIndex) => {
80
85
  const clickedIndex = typeof labelOrIndex === 'string'
81
86
  ? tabRefs.current.findIndex((ref) => (ref === null || ref === void 0 ? void 0 : ref.getAttribute('data-label')) === labelOrIndex)
82
87
  : labelOrIndex;
83
88
  if (clickedIndex === -1)
84
89
  return;
85
- const hasOverflowTabs = tabs.overflow.length > 0;
86
- if (hasOverflowTabs && !allTabsHidden && tabs.overflow.includes(clickedIndex)) {
87
- replaceLastVisibleTabWithClickedOverflowTab(clickedIndex);
88
- }
89
90
  const label = tabLabelsRef.current[clickedIndex];
90
- if (label) {
91
- onTabChange(label);
92
- focusTab(clickedIndex);
91
+ if (!label)
92
+ return;
93
+ // If this is an overflow tab, replace it with a visible one
94
+ if (tabs.overflow.includes(clickedIndex)) {
95
+ replaceLastVisibleTabWithClickedOverflowTab(clickedIndex);
93
96
  }
94
- }, [allTabsHidden, tabs.overflow, onTabChange, replaceLastVisibleTabWithClickedOverflowTab]);
97
+ onTabChange(label);
98
+ focusTab(clickedIndex);
99
+ }, [tabs.overflow, onTabChange, replaceLastVisibleTabWithClickedOverflowTab, focusTab]);
95
100
  const calculateVisibleTabs = (0, react_1.useCallback)(() => {
96
101
  const container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
97
102
  if (!container)
98
103
  return;
99
104
  const containerWidth = container.offsetWidth;
100
105
  const tabWidths = tabWidthsRef.current;
101
- const activeTabIndex = tabRefs.current.findIndex((ref) => (ref === null || ref === void 0 ? void 0 : ref.getAttribute('data-label')) === activeTab);
102
- // Active tab should always be visible, so we include it at the beginning of the array
106
+ const tabLabels = tabLabelsRef.current;
107
+ // Wait until all tabs are registered before calculating
108
+ if (tabWidths.length < totalTabs || tabLabels.length < totalTabs) {
109
+ return;
110
+ }
111
+ // Check if container has proper width (not zero)
112
+ if (containerWidth === 0) {
113
+ return;
114
+ }
115
+ // Find active tab index by label in tabLabelsRef, not by DOM element
116
+ // because tab might not be rendered if it's in overflow
117
+ const activeTabIndex = tabLabels.findIndex((label) => label === activeTabRef.current);
103
118
  let tabsWidth = activeTabIndex !== -1 ? tabWidths[activeTabIndex] : 0;
104
- const visible = activeTabIndex !== -1 ? [activeTabIndex] : [];
105
- const overflow = [];
119
+ const visibleTabs = activeTabIndex !== -1 ? [activeTabIndex] : [];
120
+ const overflowTabs = [];
106
121
  for (let i = 0; i < tabWidths.length; i++) {
107
- // Skip active tab, it was added initially
108
- if (i === activeTabIndex) {
122
+ if (i === activeTabIndex)
109
123
  continue;
110
- }
111
124
  const tabWidthWithGap = tabWidths[i] + TABS_GAP;
112
125
  const projectedWidth = tabsWidth + tabWidthWithGap;
113
126
  if (projectedWidth <= containerWidth) {
114
- visible.push(i);
127
+ visibleTabs.push(i);
115
128
  tabsWidth += tabWidthWithGap;
116
129
  }
117
130
  else {
118
- overflow.push(i);
131
+ overflowTabs.push(i);
119
132
  }
120
133
  }
121
- if (overflow.length > 0) {
134
+ if (overflowTabs.length > 0) {
122
135
  tabsWidth += MORE_BUTTON_WIDTH;
123
- // Remove tabs starting from the end of the array until the width of the visible tabs is less than the container width
124
- while (tabsWidth > containerWidth && visible.length) {
125
- const removed = visible.pop();
126
- if (removed !== undefined) {
127
- overflow.unshift(removed);
136
+ while (tabsWidth > containerWidth && visibleTabs.length > 1) {
137
+ const removed = visibleTabs.pop();
138
+ // Never remove the active tab - it should always stay visible or be the last one
139
+ if (removed !== undefined && removed !== activeTabIndex) {
140
+ overflowTabs.unshift(removed);
128
141
  tabsWidth -= tabWidths[removed];
129
142
  }
143
+ else if (removed === activeTabIndex) {
144
+ // Put it back if we accidentally removed the active tab
145
+ visibleTabs.push(removed);
146
+ break;
147
+ }
148
+ }
149
+ // If even with only the active tab visible, it doesn't fit with More button,
150
+ // move all tabs to overflow (show only dropdown)
151
+ if (tabsWidth > containerWidth && visibleTabs.length === 1) {
152
+ overflowTabs.unshift(...visibleTabs);
153
+ visibleTabs.length = 0;
130
154
  }
131
155
  }
132
156
  setTabs({
133
- visible,
134
- overflow,
157
+ visible: visibleTabs,
158
+ overflow: overflowTabs,
135
159
  });
136
- }, [containerRef, activeTab]);
160
+ // Set ready state on first calculation
161
+ if (isFirstCalculation.current) {
162
+ isFirstCalculation.current = false;
163
+ setIsReady(true);
164
+ }
165
+ }, [containerRef, totalTabs]);
166
+ // Store calculateVisibleTabs in ref for use in setTabRef
167
+ calculateVisibleTabsRef.current = calculateVisibleTabs;
168
+ // Reset isFirstCalculation when totalTabs changes (new page/tabs)
137
169
  (0, react_1.useEffect)(() => {
138
- if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current))
170
+ isFirstCalculation.current = true;
171
+ setIsReady(false);
172
+ // Clear refs so we wait for new tabs to register
173
+ tabWidthsRef.current = [];
174
+ tabLabelsRef.current = [];
175
+ }, [totalTabs]);
176
+ // Call calculateVisibleTabs on first render and resize
177
+ (0, react_1.useEffect)(() => {
178
+ const container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
179
+ if (!container)
139
180
  return;
140
- let resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
181
+ let resizeTimeout = null;
182
+ // Use ResizeObserver to wait until container has proper size
183
+ const resizeObserver = new ResizeObserver(() => {
184
+ if (resizeTimeout)
185
+ cancelAnimationFrame(resizeTimeout);
186
+ resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
187
+ });
188
+ resizeObserver.observe(container);
141
189
  const handleResize = () => {
142
- if (resizeTimeout) {
190
+ if (resizeTimeout)
143
191
  cancelAnimationFrame(resizeTimeout);
144
- }
145
192
  resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
146
193
  };
147
194
  window.addEventListener('resize', handleResize);
148
195
  return () => {
196
+ resizeObserver.disconnect();
149
197
  window.removeEventListener('resize', handleResize);
150
- cancelAnimationFrame(resizeTimeout);
198
+ if (resizeTimeout)
199
+ cancelAnimationFrame(resizeTimeout);
151
200
  };
152
201
  }, [containerRef, totalTabs, calculateVisibleTabs]);
202
+ // Recalculate when activeTab changes to ensure it's visible
203
+ (0, react_1.useEffect)(() => {
204
+ if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || isFirstCalculation.current)
205
+ return;
206
+ requestAnimationFrame(calculateVisibleTabs);
207
+ }, [activeTab, containerRef, calculateVisibleTabs]);
153
208
  return {
154
209
  setTabRef,
155
210
  onTabClick,
156
211
  handleKeyboard,
157
212
  visibleTabs: tabs.visible,
158
213
  overflowTabs: tabs.overflow,
159
- allTabsHidden,
214
+ isReady,
160
215
  };
161
216
  }
162
217
  const useActiveTab = ({ initialTab, tabsId }) => {
163
218
  const [searchParams, setSearchParams] = (0, react_router_dom_1.useSearchParams)();
164
- const [activeTab, setActiveTab] = (0, react_1.useState)(getInitialTab({ initialTab, searchParams, tabsId }));
219
+ const initialTabValue = (0, react_1.useMemo)(() => getInitialTab({ initialTab, searchParams, tabsId }),
220
+ // eslint-disable-next-line react-hooks/exhaustive-deps
221
+ []);
222
+ const [activeTab, setActiveTab] = (0, react_1.useState)(initialTabValue);
165
223
  const prevActiveTabRef = (0, react_1.useRef)(activeTab);
166
224
  (0, react_1.useEffect)(() => {
167
225
  const hasActiveTabChanged = prevActiveTabRef.current !== activeTab;
@@ -174,10 +232,10 @@ const useActiveTab = ({ initialTab, tabsId }) => {
174
232
  return searchParams;
175
233
  });
176
234
  }, [activeTab, setSearchParams, tabsId]);
177
- return {
235
+ return (0, react_1.useMemo)(() => ({
178
236
  activeTab,
179
237
  setActiveTab,
180
- };
238
+ }), [activeTab]);
181
239
  };
182
240
  exports.useActiveTab = useActiveTab;
183
241
  const getInitialTab = ({ initialTab, searchParams, tabsId }) => {