@redocly/theme 0.61.0 → 0.62.0-custom.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 (199) hide show
  1. package/lib/components/Admonition/Admonition.js +14 -18
  2. package/lib/components/Admonition/variables.dark.d.ts +1 -0
  3. package/lib/components/Admonition/variables.dark.js +18 -0
  4. package/lib/components/Admonition/variables.js +24 -28
  5. package/lib/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.d.ts +1 -0
  6. package/lib/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.js +12 -0
  7. package/lib/components/Badge/Badge.d.ts +2 -1
  8. package/lib/components/Badge/Badge.js +24 -2
  9. package/lib/components/Banner/Banner.js +19 -1
  10. package/lib/components/Banner/variables.js +1 -0
  11. package/lib/components/Breadcrumbs/Breadcrumb.js +1 -1
  12. package/lib/components/Breadcrumbs/BreadcrumbDropdown.js +9 -6
  13. package/lib/components/Breadcrumbs/Breadcrumbs.js +24 -15
  14. package/lib/components/Buttons/AIAssistantButton.js +7 -4
  15. package/lib/components/Catalog/CatalogEntities.js +10 -8
  16. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +2 -2
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +5 -3
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +2 -2
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +13 -11
  20. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +7 -5
  21. package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +9 -7
  22. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +1 -1
  23. package/lib/components/Catalog/CatalogTagsWithTooltip.js +2 -2
  24. package/lib/components/CatalogClassic/CatalogClassicInfoBlock.js +1 -1
  25. package/lib/components/CodeBlock/CodeBlockControls.js +8 -6
  26. package/lib/components/Filter/FilterCheckboxes.js +1 -1
  27. package/lib/components/JsonViewer/JsonViewer.js +2 -2
  28. package/lib/components/JsonViewer/{Helpers.js → helpers.js} +2 -1
  29. package/lib/components/LanguagePicker/LanguagePicker.js +1 -1
  30. package/lib/components/Markdown/Markdown.js +2 -2
  31. package/lib/components/Menu/MenuItem.js +41 -15
  32. package/lib/components/Navbar/NavbarItem.js +1 -1
  33. package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.d.ts +1 -0
  34. package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.js +12 -0
  35. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +1 -0
  36. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +6 -0
  37. package/lib/components/PageActions/PageActions.js +25 -8
  38. package/lib/components/Search/SearchAiDialog.d.ts +4 -2
  39. package/lib/components/Search/SearchAiDialog.js +23 -4
  40. package/lib/components/Search/SearchAiMessage.d.ts +4 -2
  41. package/lib/components/Search/SearchAiMessage.js +82 -23
  42. package/lib/components/Search/SearchDialog.js +50 -25
  43. package/lib/components/Select/variables.js +2 -2
  44. package/lib/components/SvgViewer/SvgViewer.d.ts +15 -0
  45. package/lib/components/SvgViewer/SvgViewer.js +312 -0
  46. package/lib/components/SvgViewer/variables.d.ts +1 -0
  47. package/lib/components/SvgViewer/variables.dark.d.ts +1 -0
  48. package/lib/components/SvgViewer/variables.dark.js +8 -0
  49. package/lib/components/SvgViewer/variables.js +17 -0
  50. package/lib/components/Tag/Tag.js +1 -1
  51. package/lib/components/Tag/variables.dark.js +6 -0
  52. package/lib/components/Tag/variables.js +6 -0
  53. package/lib/components/Tooltip/Tooltip.d.ts +2 -3
  54. package/lib/components/Tooltip/Tooltip.js +66 -113
  55. package/lib/components/Tooltip/variables.dark.js +4 -0
  56. package/lib/components/Tooltip/variables.js +3 -3
  57. package/lib/components/UserMenu/LoginButton.d.ts +8 -2
  58. package/lib/components/UserMenu/LoginButton.js +4 -3
  59. package/lib/core/constants/search.d.ts +5 -1
  60. package/lib/core/constants/search.js +24 -1
  61. package/lib/core/hooks/search/use-search-dialog.js +2 -2
  62. package/lib/core/hooks/use-color-switcher.d.ts +1 -0
  63. package/lib/core/hooks/use-color-switcher.js +8 -1
  64. package/lib/core/hooks/use-mcp-config.js +2 -1
  65. package/lib/core/hooks/use-modal-scroll-lock.js +24 -10
  66. package/lib/core/hooks/use-outside-click.d.ts +3 -1
  67. package/lib/core/hooks/use-outside-click.js +8 -4
  68. package/lib/core/hooks/use-page-actions.d.ts +1 -1
  69. package/lib/core/hooks/use-page-actions.js +44 -11
  70. package/lib/core/hooks/use-product-picker.js +1 -1
  71. package/lib/core/hooks/use-unique-svg-ids.d.ts +6 -0
  72. package/lib/core/hooks/use-unique-svg-ids.js +15 -0
  73. package/lib/core/openapi/index.d.ts +1 -0
  74. package/lib/core/openapi/index.js +3 -1
  75. package/lib/core/styles/dark.js +4 -0
  76. package/lib/core/styles/global.js +31 -15
  77. package/lib/core/types/catalog.d.ts +1 -1
  78. package/lib/core/types/hooks.d.ts +23 -2
  79. package/lib/core/types/l10n.d.ts +1 -1
  80. package/lib/core/types/search.d.ts +24 -0
  81. package/lib/core/types/search.js +9 -1
  82. package/lib/core/utils/content-segments.d.ts +2 -0
  83. package/lib/core/utils/content-segments.js +22 -0
  84. package/lib/core/utils/index.d.ts +1 -0
  85. package/lib/core/utils/index.js +1 -0
  86. package/lib/core/utils/transform-revisions-to-version-history.js +8 -51
  87. package/lib/ext/process-scorecard.d.ts +5 -0
  88. package/lib/ext/process-scorecard.js +11 -0
  89. package/lib/icons/FitToViewIcon/FitToViewIcon.d.ts +9 -0
  90. package/lib/icons/FitToViewIcon/FitToViewIcon.js +25 -0
  91. package/lib/icons/WarningCycleIcon/WarningCycleIcon.d.ts +9 -0
  92. package/lib/icons/WarningCycleIcon/WarningCycleIcon.js +24 -0
  93. package/lib/index.d.ts +9 -0
  94. package/lib/index.js +9 -0
  95. package/lib/layouts/DocumentationLayout.js +4 -25
  96. package/lib/layouts/DocumentationLayoutBottom.d.ts +11 -0
  97. package/lib/layouts/DocumentationLayoutBottom.js +28 -0
  98. package/lib/layouts/DocumentationLayoutTop.d.ts +13 -0
  99. package/lib/layouts/DocumentationLayoutTop.js +33 -0
  100. package/lib/layouts/Forbidden.js +22 -18
  101. package/lib/markdoc/components/Cards/Card.js +1 -0
  102. package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +1 -1
  103. package/lib/markdoc/components/Heading/Heading.js +40 -2
  104. package/lib/markdoc/components/LoginButton/LoginButton.d.ts +9 -0
  105. package/lib/markdoc/components/LoginButton/LoginButton.js +48 -0
  106. package/lib/markdoc/components/Mermaid/Mermaid.js +70 -2
  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/login-button.d.ts +2 -0
  112. package/lib/markdoc/tags/login-button.js +32 -0
  113. package/package.json +9 -9
  114. package/src/components/Admonition/Admonition.tsx +14 -18
  115. package/src/components/Admonition/variables.dark.ts +15 -0
  116. package/src/components/Admonition/variables.ts +24 -28
  117. package/src/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.tsx +10 -0
  118. package/src/components/Badge/Badge.tsx +18 -2
  119. package/src/components/Banner/Banner.tsx +23 -1
  120. package/src/components/Banner/variables.ts +1 -0
  121. package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -3
  122. package/src/components/Breadcrumbs/BreadcrumbDropdown.tsx +11 -8
  123. package/src/components/Breadcrumbs/Breadcrumbs.tsx +24 -15
  124. package/src/components/Buttons/AIAssistantButton.tsx +7 -4
  125. package/src/components/Catalog/CatalogEntities.tsx +10 -8
  126. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +1 -1
  127. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +7 -4
  128. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +1 -1
  129. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +13 -11
  130. package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +7 -5
  131. package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +9 -7
  132. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +1 -2
  133. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +9 -5
  134. package/src/components/CatalogClassic/CatalogClassicInfoBlock.tsx +3 -1
  135. package/src/components/CodeBlock/CodeBlockControls.tsx +16 -10
  136. package/src/components/Filter/FilterCheckboxes.tsx +1 -1
  137. package/src/components/JsonViewer/JsonViewer.tsx +1 -2
  138. package/src/components/JsonViewer/{Helpers.tsx → helpers.tsx} +1 -0
  139. package/src/components/LanguagePicker/LanguagePicker.tsx +1 -1
  140. package/src/components/Markdown/Markdown.tsx +2 -2
  141. package/src/components/Menu/MenuItem.tsx +61 -16
  142. package/src/components/Navbar/NavbarItem.tsx +3 -1
  143. package/src/components/OpenApiDocs/hooks/AdditionalOverviewInfo.tsx +10 -0
  144. package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +2 -0
  145. package/src/components/PageActions/PageActions.tsx +38 -15
  146. package/src/components/Search/SearchAiDialog.tsx +31 -2
  147. package/src/components/Search/SearchAiMessage.tsx +103 -17
  148. package/src/components/Search/SearchDialog.tsx +70 -37
  149. package/src/components/Select/variables.ts +2 -2
  150. package/src/components/SvgViewer/SvgViewer.tsx +405 -0
  151. package/src/components/SvgViewer/variables.dark.ts +5 -0
  152. package/src/components/SvgViewer/variables.ts +14 -0
  153. package/src/components/Tag/Tag.tsx +2 -1
  154. package/src/components/Tag/variables.dark.ts +6 -0
  155. package/src/components/Tag/variables.ts +6 -0
  156. package/src/components/Tooltip/Tooltip.tsx +77 -120
  157. package/src/components/Tooltip/variables.dark.ts +4 -0
  158. package/src/components/Tooltip/variables.ts +3 -3
  159. package/src/components/UserMenu/LoginButton.tsx +23 -8
  160. package/src/core/constants/search.ts +27 -1
  161. package/src/core/hooks/__mocks__/use-theme-hooks.ts +10 -1
  162. package/src/core/hooks/search/use-search-dialog.ts +2 -2
  163. package/src/core/hooks/use-color-switcher.ts +10 -2
  164. package/src/core/hooks/use-mcp-config.ts +2 -1
  165. package/src/core/hooks/use-modal-scroll-lock.ts +29 -10
  166. package/src/core/hooks/use-outside-click.ts +16 -5
  167. package/src/core/hooks/use-page-actions.ts +66 -25
  168. package/src/core/hooks/use-product-picker.ts +1 -1
  169. package/src/core/hooks/use-unique-svg-ids.ts +12 -0
  170. package/src/core/openapi/index.ts +1 -0
  171. package/src/core/styles/dark.ts +4 -0
  172. package/src/core/styles/global.ts +31 -15
  173. package/src/core/types/catalog.ts +1 -1
  174. package/src/core/types/hooks.ts +29 -1
  175. package/src/core/types/l10n.ts +12 -1
  176. package/src/core/types/search.ts +19 -0
  177. package/src/core/utils/content-segments.ts +27 -0
  178. package/src/core/utils/index.ts +1 -0
  179. package/src/core/utils/transform-revisions-to-version-history.ts +8 -80
  180. package/src/ext/process-scorecard.ts +14 -0
  181. package/src/icons/FitToViewIcon/FitToViewIcon.tsx +26 -0
  182. package/src/icons/WarningCycleIcon/WarningCycleIcon.tsx +32 -0
  183. package/src/index.ts +9 -0
  184. package/src/layouts/DocumentationLayout.tsx +4 -30
  185. package/src/layouts/DocumentationLayoutBottom.tsx +42 -0
  186. package/src/layouts/DocumentationLayoutTop.tsx +52 -0
  187. package/src/layouts/Forbidden.tsx +36 -21
  188. package/src/markdoc/components/Cards/Card.tsx +1 -0
  189. package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +1 -1
  190. package/src/markdoc/components/Heading/Heading.tsx +52 -4
  191. package/src/markdoc/components/LoginButton/LoginButton.tsx +38 -0
  192. package/src/markdoc/components/Mermaid/Mermaid.tsx +57 -8
  193. package/src/markdoc/components/default.ts +1 -0
  194. package/src/markdoc/default.ts +2 -0
  195. package/src/markdoc/tags/login-button.ts +30 -0
  196. package/lib/components/Tooltip/TooltipWrapper.d.ts +0 -12
  197. package/lib/components/Tooltip/TooltipWrapper.js +0 -34
  198. package/src/components/Tooltip/TooltipWrapper.tsx +0 -70
  199. /package/lib/components/JsonViewer/{Helpers.d.ts → helpers.d.ts} +0 -0
@@ -34,113 +34,58 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Tooltip = void 0;
37
- exports.TooltipComponent = TooltipComponent;
38
37
  const react_1 = __importStar(require("react"));
39
38
  const styled_components_1 = __importStar(require("styled-components"));
40
39
  const hooks_1 = require("../../core/hooks");
41
40
  const Portal_1 = require("../../components/Portal/Portal");
42
41
  function TooltipComponent({ children, isOpen, tip, withArrow = true, placement = 'top', className = 'default', width, dataTestId, disabled = false, arrowPosition = 'center', }) {
43
- const ref = (0, react_1.useRef)(null);
42
+ const tooltipWrapperRef = (0, react_1.useRef)(null);
43
+ const tooltipBodyRef = (0, react_1.useRef)(null);
44
44
  const { isOpened, handleOpen, handleClose } = (0, hooks_1.useControl)(isOpen);
45
- const [tooltipPosition, setTooltipPosition] = (0, react_1.useState)({ top: 0, left: 0 });
46
- (0, hooks_1.useOutsideClick)(ref, handleClose);
45
+ const anchorName = `--tooltip${(0, react_1.useId)().replace(/:/g, '')}`;
46
+ (0, hooks_1.useOutsideClick)(isOpened ? [tooltipWrapperRef, tooltipBodyRef] : tooltipWrapperRef, handleClose);
47
47
  const isControlled = isOpen !== undefined;
48
- const updateTooltipPosition = (0, react_1.useCallback)(() => {
49
- if (isOpened && ref.current) {
50
- const rect = ref.current.getBoundingClientRect();
51
- let top = 0;
52
- let left = 0;
53
- switch (placement) {
54
- case 'top':
55
- top = rect.top;
56
- if (arrowPosition === 'left') {
57
- left = rect.left - 24;
58
- }
59
- else if (arrowPosition === 'right') {
60
- left = rect.right + 24;
61
- }
62
- else {
63
- left = rect.left + rect.width / 2;
64
- }
65
- break;
66
- case 'bottom':
67
- top = rect.bottom;
68
- if (arrowPosition === 'left') {
69
- left = rect.left - 24;
70
- }
71
- else if (arrowPosition === 'right') {
72
- left = rect.right + 24;
73
- }
74
- else {
75
- left = rect.left + rect.width / 2;
76
- }
77
- break;
78
- case 'left':
79
- top = rect.top + rect.height / 2;
80
- left = rect.left;
81
- break;
82
- case 'right':
83
- top = rect.top + rect.height / 2;
84
- left = rect.right;
85
- break;
86
- }
87
- setTooltipPosition({ top, left });
88
- }
89
- }, [isOpened, placement, arrowPosition]);
90
- (0, react_1.useEffect)(() => {
91
- if (isOpened && ref.current) {
92
- updateTooltipPosition();
93
- const handleScroll = () => updateTooltipPosition();
94
- const handleResize = () => updateTooltipPosition();
95
- window.addEventListener('scroll', handleScroll, true);
96
- window.addEventListener('resize', handleResize);
97
- return () => {
98
- window.removeEventListener('scroll', handleScroll, true);
99
- window.removeEventListener('resize', handleResize);
100
- };
101
- }
102
- }, [isOpened, placement, updateTooltipPosition]);
103
48
  (0, react_1.useEffect)(() => {
49
+ if (!isControlled)
50
+ return;
104
51
  if (isOpen && !disabled) {
105
52
  handleOpen();
106
53
  }
107
54
  else {
108
55
  handleClose();
109
56
  }
110
- }, [isOpen, handleOpen, handleClose, disabled]);
111
- const controllers = !isControlled &&
112
- !disabled && {
113
- onMouseEnter: handleOpen,
114
- onMouseLeave: handleClose,
115
- onClick: handleClose,
116
- onFocus: handleOpen,
117
- onBlur: handleClose,
118
- };
119
- return (react_1.default.createElement(TooltipWrapper, Object.assign({ ref: ref }, controllers, { className: `tooltip-${className}`, "data-component-name": "Tooltip/Tooltip" }),
57
+ }, [isOpen, disabled, isControlled, handleOpen, handleClose]);
58
+ const controllers = !isControlled && !disabled
59
+ ? {
60
+ onMouseEnter: handleOpen,
61
+ onMouseLeave: handleClose,
62
+ onClick: handleClose,
63
+ onFocus: handleOpen,
64
+ onBlur: handleClose,
65
+ }
66
+ : {};
67
+ return (react_1.default.createElement(TooltipWrapper, Object.assign({ ref: tooltipWrapperRef }, controllers, { className: `tooltip-${className}`, "data-component-name": "Tooltip/Tooltip", anchorName: anchorName }),
120
68
  children,
121
69
  isOpened && !disabled && (react_1.default.createElement(Portal_1.Portal, null,
122
- react_1.default.createElement(TooltipBody, { "data-testid": dataTestId || (typeof tip === 'string' ? tip : ''), placement: placement, width: width, withArrow: withArrow, arrowPosition: arrowPosition, style: {
123
- position: 'fixed',
124
- top: tooltipPosition.top,
125
- left: tooltipPosition.left,
126
- } }, tip)))));
70
+ react_1.default.createElement(TooltipBody, { ref: tooltipBodyRef, "data-testid": dataTestId || (typeof tip === 'string' ? tip : ''), placement: placement, width: width, withArrow: withArrow, arrowPosition: arrowPosition, anchorName: anchorName }, tip)))));
127
71
  }
128
72
  exports.Tooltip = (0, react_1.memo)(TooltipComponent);
129
73
  const PLACEMENTS = {
130
74
  top: (0, styled_components_1.css) `
75
+ bottom: anchor(top);
131
76
  ${({ withArrow, arrowPosition }) => withArrow && arrowPosition === 'left'
132
77
  ? (0, styled_components_1.css) `
133
- transform: translate(0, -100%);
134
- margin-top: -10px;
78
+ transform: translate(-32px, -6px);
79
+ left: anchor(center);
135
80
  `
136
81
  : arrowPosition === 'right'
137
82
  ? (0, styled_components_1.css) `
138
- transform: translate(-100%, -100%);
139
- margin-top: -10px;
83
+ transform: translate(32px, -6px);
84
+ right: anchor(center);
140
85
  `
141
86
  : (0, styled_components_1.css) `
142
- transform: translate(-50%, -100%);
143
- margin-top: -10px;
87
+ transform: translate(-50%, -6px);
88
+ left: anchor(center);
144
89
  `}
145
90
 
146
91
  ${({ withArrow, arrowPosition }) => withArrow &&
@@ -152,26 +97,27 @@ const PLACEMENTS = {
152
97
  border-top-style: solid;
153
98
  border-radius: 2px;
154
99
  bottom: 0;
155
- ${arrowPosition === 'left' && 'left: 16px; transform: translateY(99%);'}
156
- ${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, 99%);'}
157
- ${arrowPosition === 'right' && 'right: 16px; transform: translateY(99%);'}
100
+ ${arrowPosition === 'left' && 'left: 16px; transform: translateY(100%);'}
101
+ ${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, 100%);'}
102
+ ${arrowPosition === 'right' && 'right: 16px; transform: translateY(100%);'}
158
103
  }
159
104
  `}
160
105
  `,
161
106
  bottom: (0, styled_components_1.css) `
107
+ top: anchor(bottom);
162
108
  ${({ withArrow, arrowPosition }) => withArrow && arrowPosition === 'left'
163
109
  ? (0, styled_components_1.css) `
164
- transform: translate(0, 10px);
165
- margin-top: 0;
110
+ transform: translate(-32px, 6px);
111
+ left: anchor(center);
166
112
  `
167
113
  : arrowPosition === 'right'
168
114
  ? (0, styled_components_1.css) `
169
- transform: translate(-100%, 10px);
170
- margin-top: 0;
115
+ transform: translate(32px, 6px);
116
+ right: anchor(center);
171
117
  `
172
118
  : (0, styled_components_1.css) `
173
- transform: translate(-50%, 10px);
174
- margin-top: 0;
119
+ transform: translate(-50%, 6px);
120
+ left: anchor(center);
175
121
  `}
176
122
 
177
123
  ${({ withArrow, arrowPosition }) => withArrow &&
@@ -183,17 +129,19 @@ const PLACEMENTS = {
183
129
  border-bottom-style: solid;
184
130
  border-radius: 0 0 2px 2px;
185
131
  top: 0;
186
- ${arrowPosition === 'left' && 'left: 16px; transform: translateY(-99%);'}
187
- ${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, -99%);'}
188
- ${arrowPosition === 'right' && 'right: 16px; transform: translateY(-99%);'}
132
+ ${arrowPosition === 'left' && 'left: 16px; transform: translateY(-100%);'}
133
+ ${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, -100%);'}
134
+ ${arrowPosition === 'right' && 'right: 16px; transform: translateY(-100%);'}
189
135
  }
190
136
  `}
191
137
  `,
192
138
  left: (0, styled_components_1.css) `
193
139
  transform: translate(-100%, -50%);
194
- margin-left: -10px;
140
+ margin-left: -7px;
141
+ top: anchor(center);
142
+ left: anchor(left);
195
143
 
196
- ${({ withArrow, arrowPosition }) => withArrow &&
144
+ ${({ withArrow }) => withArrow &&
197
145
  (0, styled_components_1.css) `
198
146
  &::after {
199
147
  border-top: 14px solid transparent;
@@ -201,19 +149,19 @@ const PLACEMENTS = {
201
149
  border-left-width: 8px;
202
150
  border-left-style: solid;
203
151
  border-radius: 2px 0 0 2px;
152
+ right: -9px;
204
153
  top: 50%;
205
- right: 0;
206
- ${arrowPosition === 'top' && 'top: 16px; transform: translateX(99%);'}
207
- ${arrowPosition === 'center' && 'top: 50%; transform: translate(99%, -50%);'}
208
- ${arrowPosition === 'bottom' && 'bottom: 16px; transform: translateX(99%);'}
154
+ transform: translateY(-50%);
209
155
  }
210
156
  `}
211
157
  `,
212
158
  right: (0, styled_components_1.css) `
213
159
  transform: translate(0, -50%);
214
- margin-left: 10px;
160
+ margin-left: 7px;
161
+ top: anchor(center);
162
+ left: anchor(right);
215
163
 
216
- ${({ withArrow, arrowPosition }) => withArrow &&
164
+ ${({ withArrow }) => withArrow &&
217
165
  (0, styled_components_1.css) `
218
166
  &::after {
219
167
  border-top: 14px solid transparent;
@@ -221,28 +169,33 @@ const PLACEMENTS = {
221
169
  border-right-width: 8px;
222
170
  border-right-style: solid;
223
171
  border-radius: 0 2px 2px 0;
172
+ left: -9px;
224
173
  top: 50%;
225
- left: 0;
226
- ${arrowPosition === 'top' && 'top: 16px; transform: translateX(-99%);'}
227
- ${arrowPosition === 'center' && 'top: 50%; transform: translate(-99%, -50%);'}
228
- ${arrowPosition === 'bottom' && 'bottom: 16px; transform: translateX(-99%);'}
174
+ transform: translateY(-50%);
229
175
  }
230
176
  `}
231
177
  `,
232
178
  };
233
- const TooltipWrapper = styled_components_1.default.div `
234
- position: relative;
179
+ const TooltipWrapper = styled_components_1.default.div.attrs(({ anchorName }) => ({
180
+ style: {
181
+ anchorName: anchorName,
182
+ },
183
+ })) `
235
184
  display: flex;
236
185
  `;
237
- /* eslint-disable theme/no-raw-colors-in-styles */
238
- const TooltipBody = styled_components_1.default.span `
239
- display: inline-block;
240
-
186
+ const TooltipBody = styled_components_1.default.span.attrs(({ anchorName }) => ({
187
+ style: {
188
+ positionAnchor: anchorName,
189
+ },
190
+ })) `
191
+ position: fixed;
192
+ min-width: 64px;
241
193
  padding: var(--tooltip-padding);
242
- max-width: ${({ width }) => width || 'var(--tooltip-max-width)'};
194
+ max-width: var(--tooltip-max-width);
243
195
  white-space: normal;
244
196
  word-break: normal;
245
197
  overflow-wrap: break-word;
198
+ text-align: left;
246
199
 
247
200
  border-radius: var(--border-radius-md);
248
201
  transition: opacity 0.3s ease-out;
@@ -270,10 +223,10 @@ const TooltipBody = styled_components_1.default.span `
270
223
  0px 8px 24px 8px #0000000a,
271
224
  0px 4px 12px 0px #00000014;
272
225
 
273
- width: ${({ width }) => width || 'auto'};
226
+ width: ${({ width }) => width || 'max-content'};
227
+
274
228
  ${({ placement }) => (0, styled_components_1.css) `
275
229
  ${PLACEMENTS[placement]};
276
230
  `}
277
231
  `;
278
- /* eslint-enable theme/no-raw-colors-in-styles */
279
232
  //# sourceMappingURL=Tooltip.js.map
@@ -5,5 +5,9 @@ const styled_components_1 = require("styled-components");
5
5
  exports.tooltipDarkMode = (0, styled_components_1.css) `
6
6
  --tooltip-bg-color: var(--color-warm-grey-4);
7
7
  --tooltip-border-color: var(--color-warm-grey-5);
8
+
9
+ .tooltip-copy-button {
10
+ --tooltip-bg-color: var(--color-warm-grey-4);
11
+ }
8
12
  `;
9
13
  //# sourceMappingURL=variables.dark.js.map
@@ -20,9 +20,9 @@ exports.tooltip = (0, styled_components_1.css) `
20
20
  --tooltip-max-width: 400px;
21
21
 
22
22
  .tooltip-copy-button {
23
- --tooltip-text-color: var(--text-color-secondary);
24
- --tooltip-bg-color: var(--bg-color-raised);
25
- --tooltip-arrow-color: var(--tooltip-bg-color);
23
+ --tooltip-text-color: var(--color-static-white);
24
+ --tooltip-bg-color: var(--color-warm-grey-10);
25
+ --tooltip-arrow-color: var(--tooltip-border-color);
26
26
  }
27
27
 
28
28
  .tooltip-catalog {
@@ -1,6 +1,12 @@
1
- import type { JSX } from 'react';
1
+ import React from 'react';
2
+ import type { ButtonVariant, ButtonSize } from '../../components/Button/Button';
2
3
  export type LoginButtonProps = {
3
4
  href: string;
4
5
  className?: string;
6
+ variant?: ButtonVariant;
7
+ size?: ButtonSize;
8
+ label?: string;
9
+ labelTranslationKey?: string;
10
+ ['data-component-name']?: string;
5
11
  };
6
- export declare function LoginButton({ href, className }: LoginButtonProps): JSX.Element;
12
+ export declare function LoginButton({ href, className, variant, size, label, labelTranslationKey, 'data-component-name': componentName, }: LoginButtonProps): React.JSX.Element;
@@ -7,11 +7,12 @@ exports.LoginButton = LoginButton;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const hooks_1 = require("../../core/hooks");
9
9
  const Button_1 = require("../../components/Button/Button");
10
- function LoginButton({ href, className }) {
10
+ function LoginButton({ href, className, variant = 'primary', size = 'medium', label, labelTranslationKey = 'userMenu.login', 'data-component-name': componentName = 'UserMenu/LoginButton', }) {
11
11
  const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
12
12
  const { translate } = useTranslate();
13
13
  const telemetry = useTelemetry();
14
- return (react_1.default.createElement("div", { "data-component-name": "UserMenu/LoginButton", className: className },
15
- react_1.default.createElement(Button_1.Button, { "data-translation-key": "userMenu.login", to: href, onClick: () => telemetry.sendLoginButtonClickedMessage(), "data-testid": "login-btn", extraClass: className, variant: "primary", size: "medium" }, translate('userMenu.login', 'Login'))));
14
+ const buttonLabel = label || translate(labelTranslationKey, 'Login');
15
+ return (react_1.default.createElement("span", { "data-component-name": componentName, className: className },
16
+ react_1.default.createElement(Button_1.Button, { "data-translation-key": label ? undefined : labelTranslationKey, to: href, onClick: () => telemetry.sendLoginButtonClickedMessage(), "data-testid": "login-btn", extraClass: className, variant: variant, size: size }, buttonLabel)));
16
17
  }
17
18
  //# sourceMappingURL=LoginButton.js.map
@@ -1,4 +1,4 @@
1
- import type { AiSearchErrorConfig } from '../types/search';
1
+ import { type AiSearchErrorConfig, ToolCallName } from '../types/search';
2
2
  export declare enum AiSearchError {
3
3
  Unauthorized = "ai_search_unauthorized",
4
4
  Forbidden = "ai_search_forbidden",
@@ -14,3 +14,7 @@ export type AiSearchConversationRole = (typeof AiSearchConversationRole)[keyof t
14
14
  export declare const AI_SEARCH_ERROR_CONFIG: Record<AiSearchError, AiSearchErrorConfig>;
15
15
  export declare const AI_SEARCH_MAX_MESSAGE_LENGTH = 45000;
16
16
  export declare const SEARCH_DEBOUNCE_TIME_MS = 300;
17
+ export declare const TOOL_CALL_DISPLAY_TEXT: Record<ToolCallName, {
18
+ inProgressText: string;
19
+ completedText: string;
20
+ }>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SEARCH_DEBOUNCE_TIME_MS = exports.AI_SEARCH_MAX_MESSAGE_LENGTH = exports.AI_SEARCH_ERROR_CONFIG = exports.AiSearchConversationRole = exports.AiSearchError = void 0;
3
+ exports.TOOL_CALL_DISPLAY_TEXT = exports.SEARCH_DEBOUNCE_TIME_MS = exports.AI_SEARCH_MAX_MESSAGE_LENGTH = exports.AI_SEARCH_ERROR_CONFIG = exports.AiSearchConversationRole = exports.AiSearchError = void 0;
4
+ const search_1 = require("../types/search");
4
5
  var AiSearchError;
5
6
  (function (AiSearchError) {
6
7
  AiSearchError["Unauthorized"] = "ai_search_unauthorized";
@@ -38,4 +39,26 @@ exports.AI_SEARCH_ERROR_CONFIG = {
38
39
  };
39
40
  exports.AI_SEARCH_MAX_MESSAGE_LENGTH = 45000;
40
41
  exports.SEARCH_DEBOUNCE_TIME_MS = 300;
42
+ exports.TOOL_CALL_DISPLAY_TEXT = {
43
+ [search_1.ToolCallName.SearchDocumentation]: {
44
+ inProgressText: 'Searching documentation...',
45
+ completedText: 'Search completed',
46
+ },
47
+ [search_1.ToolCallName.ListApis]: {
48
+ inProgressText: 'Browsing APIs...',
49
+ completedText: 'Browsed APIs',
50
+ },
51
+ [search_1.ToolCallName.GetEndpoints]: {
52
+ inProgressText: 'Browsing endpoints for API...',
53
+ completedText: 'Browsed endpoints for API',
54
+ },
55
+ [search_1.ToolCallName.GetSecuritySchemes]: {
56
+ inProgressText: 'Browsing security schemes for API...',
57
+ completedText: 'Browsed security schemes for API',
58
+ },
59
+ [search_1.ToolCallName.GetFullApiDescription]: {
60
+ inProgressText: 'Reading API description...',
61
+ completedText: 'Read API description',
62
+ },
63
+ };
41
64
  //# sourceMappingURL=search.js.map
@@ -24,7 +24,7 @@ function useSearchDialog() {
24
24
  if (hotKeys) {
25
25
  (0, hotkeys_js_1.default)(hotKeys, (ev) => {
26
26
  setIsOpen(true);
27
- telemetry.sendSearchOpenedMessage({ method: 'shortcut' });
27
+ telemetry.sendSearchOpenedMessage([{ object: 'search', method: 'shortcut' }]);
28
28
  ev.preventDefault();
29
29
  });
30
30
  return () => hotkeys_js_1.default.unbind(hotKeys);
@@ -32,7 +32,7 @@ function useSearchDialog() {
32
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
33
33
  }, [hotKeys]);
34
34
  const onOpen = (0, react_1.useCallback)(function () {
35
- telemetry.sendSearchOpenedMessage({ method: 'click' });
35
+ telemetry.sendSearchOpenedMessage([{ object: 'search', method: 'click' }]);
36
36
  setIsOpen(true);
37
37
  // eslint-disable-next-line react-hooks/exhaustive-deps
38
38
  }, []);
@@ -1,4 +1,5 @@
1
1
  export declare const useColorSwitcher: () => {
2
+ initActiveColorMode: () => void;
2
3
  isSwitcherHidden: boolean | undefined;
3
4
  switchColorMode: (mode?: string) => void;
4
5
  activeColorMode: string;
@@ -35,10 +35,17 @@ const useColorSwitcher = () => {
35
35
  window.requestAnimationFrame(() => {
36
36
  root.classList.remove('notransition');
37
37
  });
38
- telemetry.sendColorModeSwitchedMessage({ from: activeColorMode, to: newMode });
38
+ telemetry.sendColorModeSwitchedMessage([
39
+ { object: 'color_mode', from: activeColorMode, to: newMode },
40
+ ]);
39
41
  setActiveColorMode(newMode);
40
42
  };
43
+ /**
44
+ * @deprecated color mode is automatically initialized when the hook is mounted
45
+ */
46
+ const initActiveColorMode = (0, react_1.useCallback)(() => { }, []);
41
47
  return {
48
+ initActiveColorMode,
42
49
  isSwitcherHidden: themeColorMode === null || themeColorMode === void 0 ? void 0 : themeColorMode.hide,
43
50
  switchColorMode,
44
51
  activeColorMode,
@@ -6,6 +6,7 @@ const use_theme_hooks_1 = require("./use-theme-hooks");
6
6
  const dom_1 = require("../utils/dom");
7
7
  const constants_1 = require("../constants");
8
8
  const mcp_1 = require("../utils/mcp");
9
+ const urls_1 = require("../utils/urls");
9
10
  function useMCPConfig() {
10
11
  var _a;
11
12
  const { useMcpData } = (0, use_theme_hooks_1.useThemeHooks)();
@@ -14,7 +15,7 @@ function useMCPConfig() {
14
15
  ? window.location.origin
15
16
  : ((_a = globalThis['SSR_HOSTNAME']) !== null && _a !== void 0 ? _a : '');
16
17
  const serverName = name || constants_1.DEFAULT_MCP_SERVER_NAME;
17
- const serverUrl = `${origin}/mcp`;
18
+ const serverUrl = `${origin}${(0, urls_1.withPathPrefix)('/mcp')}`;
18
19
  const isMcpDisabled = !enabled || false;
19
20
  const cursorUrl = (0, react_1.useMemo)(() => (0, mcp_1.generateMCPDeepLink)('cursor', { serverName, url: serverUrl }), [serverName, serverUrl]);
20
21
  const vscodeUrl = (0, react_1.useMemo)(() => (0, mcp_1.generateMCPDeepLink)('vscode', { serverName, url: serverUrl }), [serverName, serverUrl]);
@@ -4,19 +4,33 @@ exports.useModalScrollLock = useModalScrollLock;
4
4
  const react_1 = require("react");
5
5
  function useModalScrollLock(isOpen) {
6
6
  (0, react_1.useEffect)(() => {
7
- const originalOverflow = document.body.style.overflow;
8
- const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
9
- if (isOpen) {
10
- document.body.style.overflow = 'hidden';
11
- document.body.style.marginRight = `${scrollbarWidth}px`;
7
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
8
+ return;
12
9
  }
13
- else {
14
- document.body.style.overflow = originalOverflow;
15
- document.body.style.marginRight = '';
10
+ const { body, documentElement } = document;
11
+ const originalOverflow = body.style.overflow;
12
+ const originalPaddingRight = body.style.paddingRight;
13
+ const originalScrollbarWidth = documentElement.style.getPropertyValue('--modal-scrollbar-width');
14
+ const restoreScrollState = () => {
15
+ body.style.overflow = originalOverflow;
16
+ body.style.paddingRight = originalPaddingRight;
17
+ if (originalScrollbarWidth) {
18
+ documentElement.style.setProperty('--modal-scrollbar-width', originalScrollbarWidth);
19
+ }
20
+ else {
21
+ documentElement.style.removeProperty('--modal-scrollbar-width');
22
+ }
23
+ };
24
+ if (isOpen) {
25
+ const scrollbarWidth = window.innerWidth - documentElement.clientWidth;
26
+ body.style.overflow = 'hidden';
27
+ if (scrollbarWidth > 0) {
28
+ body.style.paddingRight = `${scrollbarWidth}px`;
29
+ documentElement.style.setProperty('--modal-scrollbar-width', `${scrollbarWidth}px`);
30
+ }
16
31
  }
17
32
  return () => {
18
- document.body.style.overflow = originalOverflow;
19
- document.body.style.marginRight = '';
33
+ restoreScrollState();
20
34
  };
21
35
  }, [isOpen]);
22
36
  }
@@ -1,2 +1,4 @@
1
1
  import type { RefObject } from 'react';
2
- export declare function useOutsideClick(ref: RefObject<HTMLElement | null>, handler?: (event: MouseEvent | TouchEvent) => void): void;
2
+ type OutsideClickRef = RefObject<HTMLElement | null>;
3
+ export declare function useOutsideClick(refs: OutsideClickRef | OutsideClickRef[], handler?: (event: MouseEvent | TouchEvent) => void): void;
4
+ export {};
@@ -2,13 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useOutsideClick = useOutsideClick;
4
4
  const react_1 = require("react");
5
- function useOutsideClick(ref, handler) {
5
+ function useOutsideClick(refs, handler) {
6
6
  (0, react_1.useEffect)(() => {
7
+ const refList = Array.isArray(refs) ? refs : [refs];
7
8
  const listener = (event) => {
8
- if (!handler || !ref.current || ref.current.contains(event.target)) {
9
+ if (!handler)
9
10
  return;
11
+ const target = event.target;
12
+ const isInside = refList.some((ref) => ref.current && ref.current.contains(target));
13
+ if (!isInside) {
14
+ handler(event);
10
15
  }
11
- handler(event);
12
16
  };
13
17
  document.addEventListener('mousedown', listener);
14
18
  document.addEventListener('touchstart', listener);
@@ -16,6 +20,6 @@ function useOutsideClick(ref, handler) {
16
20
  document.removeEventListener('mousedown', listener);
17
21
  document.removeEventListener('touchstart', listener);
18
22
  };
19
- }, [ref, handler]);
23
+ }, [refs, handler]);
20
24
  }
21
25
  //# sourceMappingURL=use-outside-click.js.map
@@ -1,3 +1,3 @@
1
1
  import type { PageAction } from '../types';
2
- export type PageActionType = 'copy' | 'view' | 'chatgpt' | 'claude' | 'docs-mcp-cursor' | 'docs-mcp-vscode' | 'mcp-cursor' | 'mcp-vscode';
2
+ export type PageActionType = 'copy' | 'view' | 'chatgpt' | 'claude' | 'docs-mcp-cursor' | 'docs-mcp-vscode' | 'docs-mcp-json' | 'mcp-cursor' | 'mcp-vscode';
3
3
  export declare function usePageActions(pageSlug: string, mcpUrl?: string, actions?: PageActionType[]): PageAction[];