@redocly/theme 0.69.0 → 0.70.0-next.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 (181) hide show
  1. package/lib/components/Buttons/DownloadButton.js +13 -3
  2. package/lib/components/Catalog/Catalog.d.ts +2 -2
  3. package/lib/components/Catalog/CatalogActionsRow.d.ts +3 -2
  4. package/lib/components/Catalog/CatalogCardView/CatalogCard.d.ts +2 -2
  5. package/lib/components/Catalog/CatalogEntities.d.ts +2 -2
  6. package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +1 -1
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.d.ts +2 -2
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +1 -2
  9. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.d.ts +3 -1
  10. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.js +45 -23
  11. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +67 -33
  12. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.d.ts +3 -1
  13. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.js +15 -3
  14. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.d.ts +3 -1
  15. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +48 -57
  16. package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.d.ts +1 -1
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.d.ts +1 -1
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.d.ts +1 -1
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.d.ts +1 -1
  20. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.d.ts +2 -2
  21. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.d.ts +1 -1
  22. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.d.ts +2 -2
  23. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.d.ts +2 -2
  24. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.d.ts +2 -2
  25. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.d.ts +2 -2
  26. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.d.ts +2 -2
  27. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.d.ts +2 -2
  28. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +1 -2
  29. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.d.ts +2 -2
  30. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.d.ts +2 -2
  31. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.d.ts +1 -1
  32. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +2 -3
  33. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +1 -1
  34. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +3 -4
  35. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +3 -4
  36. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +1 -1
  37. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -2
  38. package/lib/components/Catalog/CatalogEntityIcon.d.ts +1 -1
  39. package/lib/components/Catalog/CatalogEntityTypeTag.d.ts +2 -2
  40. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.d.ts +1 -1
  41. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +1 -2
  42. package/lib/components/Catalog/CatalogHighlight.d.ts +2 -1
  43. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.d.ts +2 -1
  44. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.d.ts +1 -1
  45. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.d.ts +2 -1
  46. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.d.ts +2 -2
  47. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.d.ts +2 -2
  48. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.d.ts +1 -1
  49. package/lib/components/Catalog/CatalogSelector.d.ts +3 -2
  50. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.d.ts +1 -1
  51. package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +1 -1
  52. package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +2 -1
  53. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +2 -1
  54. package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.d.ts +1 -1
  55. package/lib/components/Catalog/CatalogTags.d.ts +2 -2
  56. package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
  57. package/lib/components/Catalog/variables.js +24 -33
  58. package/lib/components/CatalogClassic/CatalogClassicInfoBlock.d.ts +1 -1
  59. package/lib/components/CatalogClassic/CatalogClassicInfoBlock.js +1 -2
  60. package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.d.ts +1 -1
  61. package/lib/components/CodeBlock/CodeBlockControls.d.ts +1 -1
  62. package/lib/components/Dropdown/Dropdown.js +7 -1
  63. package/lib/components/Filter/FilterOptionLabel.d.ts +1 -1
  64. package/lib/components/LoadMore/LoadMore.d.ts +1 -1
  65. package/lib/components/MCP/McpConnectionTabs.js +2 -2
  66. package/lib/components/PageActions/PageActions.d.ts +1 -1
  67. package/lib/components/Search/SearchAiDialog.d.ts +1 -1
  68. package/lib/components/Search/SearchAiMessage.d.ts +1 -2
  69. package/lib/components/Search/SearchAiMessage.js +8 -10
  70. package/lib/components/Search/SearchAiResponse.d.ts +1 -1
  71. package/lib/components/Search/SearchGroups.d.ts +1 -1
  72. package/lib/core/constants/markdown.d.ts +2 -0
  73. package/lib/core/constants/markdown.js +3 -1
  74. package/lib/core/hooks/catalog/use-catalog-entity-schema.d.ts +1 -1
  75. package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.d.ts +1 -1
  76. package/lib/core/hooks/catalog/use-graph.d.ts +3 -3
  77. package/lib/core/hooks/use-active-section-id.js +6 -0
  78. package/lib/core/hooks/use-element-size.d.ts +1 -1
  79. package/lib/core/types/catalog.d.ts +2 -3
  80. package/lib/core/types/common.d.ts +1 -1
  81. package/lib/core/types/hooks.d.ts +4 -7
  82. package/lib/core/utils/mcp.d.ts +0 -1
  83. package/lib/core/utils/mcp.js +0 -13
  84. package/lib/core/utils/menu.d.ts +2 -2
  85. package/lib/core/utils/urls.js +1 -3
  86. package/lib/ext/use-configure-replay.d.ts +1 -1
  87. package/lib/layouts/OIDCForbidden.js +1 -1
  88. package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.d.ts +1 -2
  89. package/lib/markdoc/components/Diagram/Diagram.d.ts +1 -1
  90. package/lib/markdoc/components/Diagram/Diagram.js +1 -2
  91. package/lib/markdoc/components/Tabs/Tab.d.ts +1 -1
  92. package/lib/markdoc/components/Tabs/TabList.d.ts +1 -1
  93. package/lib/markdoc/tags/code-walkthrough.d.ts +1 -1
  94. package/lib/markdoc/tags/markdoc-example.js +34 -22
  95. package/package.json +2 -2
  96. package/src/components/Buttons/DownloadButton.tsx +16 -8
  97. package/src/components/Catalog/Catalog.tsx +4 -4
  98. package/src/components/Catalog/CatalogActionsRow.tsx +3 -2
  99. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +3 -2
  100. package/src/components/Catalog/CatalogEntities.tsx +3 -2
  101. package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +2 -1
  102. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +6 -2
  103. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +4 -5
  104. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx +56 -35
  105. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +80 -42
  106. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.tsx +18 -2
  107. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +61 -75
  108. package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +2 -1
  109. package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +1 -1
  110. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -1
  111. package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +1 -1
  112. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +3 -2
  113. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +2 -1
  114. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +3 -2
  115. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +3 -2
  116. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +3 -2
  117. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +3 -2
  118. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +3 -2
  119. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +3 -4
  120. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +3 -2
  121. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +3 -2
  122. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +2 -1
  123. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +7 -4
  124. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +2 -1
  125. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +7 -4
  126. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +3 -4
  127. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +3 -2
  128. package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -2
  129. package/src/components/Catalog/CatalogEntityIcon.tsx +3 -2
  130. package/src/components/Catalog/CatalogEntityTypeTag.tsx +3 -2
  131. package/src/components/Catalog/CatalogFilter/CatalogFilterContent.tsx +2 -4
  132. package/src/components/Catalog/CatalogHighlight.tsx +2 -1
  133. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.tsx +2 -1
  134. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.tsx +2 -1
  135. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx +2 -1
  136. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.tsx +3 -2
  137. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.tsx +3 -2
  138. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.tsx +2 -1
  139. package/src/components/Catalog/CatalogSelector.tsx +3 -2
  140. package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +1 -1
  141. package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +1 -1
  142. package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +2 -1
  143. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +2 -1
  144. package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +1 -1
  145. package/src/components/Catalog/CatalogTags.tsx +4 -2
  146. package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
  147. package/src/components/Catalog/variables.ts +24 -33
  148. package/src/components/CatalogClassic/CatalogClassicInfoBlock.tsx +2 -5
  149. package/src/components/CatalogClassic/CatalogClassicVirtualizedGroups.tsx +1 -1
  150. package/src/components/CodeBlock/CodeBlockControls.tsx +2 -1
  151. package/src/components/Dropdown/Dropdown.tsx +5 -1
  152. package/src/components/Filter/FilterOptionLabel.tsx +1 -1
  153. package/src/components/LoadMore/LoadMore.tsx +2 -1
  154. package/src/components/MCP/McpConnectionTabs.tsx +3 -4
  155. package/src/components/PageActions/PageActions.tsx +2 -1
  156. package/src/components/Search/SearchAiDialog.tsx +1 -1
  157. package/src/components/Search/SearchAiMessage.tsx +3 -6
  158. package/src/components/Search/SearchAiResponse.tsx +2 -4
  159. package/src/components/Search/SearchGroups.tsx +1 -5
  160. package/src/core/constants/markdown.ts +4 -0
  161. package/src/core/hooks/catalog/use-catalog-entity-schema.ts +1 -1
  162. package/src/core/hooks/catalog/use-catalog-table-header-cell-actions.ts +1 -1
  163. package/src/core/hooks/catalog/use-graph.ts +4 -4
  164. package/src/core/hooks/menu/__mocks__/use-mobile-menu-items.ts +1 -1
  165. package/src/core/hooks/use-active-section-id.ts +8 -0
  166. package/src/core/hooks/use-element-size.ts +2 -1
  167. package/src/core/types/catalog.ts +7 -3
  168. package/src/core/types/common.ts +1 -1
  169. package/src/core/types/hooks.ts +15 -13
  170. package/src/core/utils/mcp.ts +0 -17
  171. package/src/core/utils/menu.ts +2 -2
  172. package/src/core/utils/urls.ts +1 -3
  173. package/src/ext/use-configure-replay.ts +3 -3
  174. package/src/layouts/OIDCForbidden.tsx +1 -1
  175. package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +2 -2
  176. package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +2 -4
  177. package/src/markdoc/components/Diagram/Diagram.tsx +2 -5
  178. package/src/markdoc/components/Tabs/Tab.tsx +1 -1
  179. package/src/markdoc/components/Tabs/TabList.tsx +1 -1
  180. package/src/markdoc/tags/code-walkthrough.ts +2 -1
  181. package/src/markdoc/tags/markdoc-example.ts +45 -28
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DownloadButton = DownloadButton;
7
7
  const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
8
9
  const Button_1 = require("../../components/Button/Button");
9
10
  const DownloadIcon_1 = require("../../icons/DownloadIcon/DownloadIcon");
10
11
  const Tooltip_1 = require("../../components/Tooltip/Tooltip");
@@ -12,9 +13,18 @@ const hooks_1 = require("../../core/hooks");
12
13
  function DownloadButton({ data, dataTestId = 'download-button', }) {
13
14
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
14
15
  const { translate } = useTranslate();
16
+ const label = translate('button.download.tooltipText', 'Download description');
15
17
  return (react_1.default.createElement("div", { "data-component-name": "Buttons/DownloadButton" },
16
- react_1.default.createElement(Tooltip_1.Tooltip, { tip: translate('button.download.tooltipText', 'Download description'), placement: "top", arrowPosition: "right" },
17
- react_1.default.createElement("a", { href: data, target: "_blank", download: true, rel: "noreferrer" },
18
- react_1.default.createElement(Button_1.Button, { variant: "text", size: "small", "aria-label": "Download", icon: react_1.default.createElement(DownloadIcon_1.DownloadIcon, null), "data-testid": dataTestId })))));
18
+ react_1.default.createElement(Tooltip_1.Tooltip, { tip: label, placement: "top", arrowPosition: "right" },
19
+ react_1.default.createElement(DownloadLink, { href: data, target: "_blank", download: true, rel: "noreferrer", "aria-label": label },
20
+ react_1.default.createElement(Button_1.Button, { variant: "text", size: "small", "aria-hidden": true, tabIndex: -1, icon: react_1.default.createElement(DownloadIcon_1.DownloadIcon, null), "data-testid": dataTestId })))));
19
21
  }
22
+ const DownloadLink = styled_components_1.default.a `
23
+ text-decoration: none;
24
+ border-radius: var(--button-border-radius);
25
+
26
+ &:focus-visible {
27
+ outline: 1px solid var(--button-border-color-focused);
28
+ }
29
+ `;
20
30
  //# sourceMappingURL=DownloadButton.js.map
@@ -1,6 +1,6 @@
1
- import { JSX } from 'react';
1
+ import { type JSX } from 'react';
2
2
  import type { CatalogEntityConfig } from '@redocly/config';
3
- import { BffCatalogEntityList, CatalogSwitcherItem, CatalogViewMode } from '../../core/types';
3
+ import type { BffCatalogEntityList, CatalogSwitcherItem, CatalogViewMode } from '../../core/types';
4
4
  type CatalogFiltersWithCounts = Record<string, {
5
5
  value: string;
6
6
  count: number;
@@ -1,5 +1,6 @@
1
- import React, { JSX } from 'react';
2
- import { CatalogViewMode } from '../../core/types';
1
+ import type { JSX } from 'react';
2
+ import React from 'react';
3
+ import type { CatalogViewMode } from '../../core/types';
3
4
  export type CatalogActionsRowProps = {
4
5
  searchQuery: string;
5
6
  setSearchQuery: (updatedTerm: string) => void;
@@ -1,6 +1,6 @@
1
- import { JSX } from 'react';
1
+ import type { JSX } from 'react';
2
2
  import type { CatalogEntityConfig } from '@redocly/config';
3
- import { BffCatalogEntity } from '../../../core/types';
3
+ import type { BffCatalogEntity } from '../../../core/types';
4
4
  export type CatalogCardProps = {
5
5
  entity: BffCatalogEntity;
6
6
  catalogConfig: CatalogEntityConfig;
@@ -1,6 +1,6 @@
1
- import { JSX } from 'react';
1
+ import type { JSX } from 'react';
2
2
  import type { CatalogEntityConfig } from '@redocly/config';
3
- import { BffCatalogEntityList } from '../../core/types';
3
+ import type { BffCatalogEntityList } from '../../core/types';
4
4
  export type CatalogEntitiesProps = {
5
5
  catalogConfig: CatalogEntityConfig;
6
6
  excludedEntities?: CatalogEntityConfig['excludes'];
@@ -1,4 +1,4 @@
1
- import { JSX } from 'react';
1
+ import type { JSX } from 'react';
2
2
  import type { ListType } from '../../core/types';
3
3
  interface CatalogEntitiesEmptyStateProps {
4
4
  listType?: ListType;
@@ -1,5 +1,5 @@
1
- import { JSX } from 'react';
2
- import { BffCatalogEntity } from '../../../../core/types';
1
+ import { type JSX } from 'react';
2
+ import type { BffCatalogEntity } from '../../../../core/types';
3
3
  export type CatalogEntityRelationsGraphProps = {
4
4
  entity: BffCatalogEntity;
5
5
  };
@@ -41,7 +41,6 @@ const react_1 = __importStar(require("react"));
41
41
  const react_2 = require("@xyflow/react");
42
42
  const styled_components_1 = __importDefault(require("styled-components"));
43
43
  const hooks_1 = require("../../../../core/hooks");
44
- const hooks_2 = require("../../../../core/hooks");
45
44
  const CatalogEntityRelationsNode_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode");
46
45
  const CatalogEntityRelationsEdge_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge");
47
46
  const styles_1 = require("../../../../core/styles");
@@ -73,7 +72,7 @@ function CatalogEntityRelationsGraph({ entity, }) {
73
72
  entityKey: entity.key,
74
73
  filter: combinedFilter,
75
74
  });
76
- const { nodes, edges, onNodesChange, onEdgesChange, onConnect } = (0, hooks_2.useGraph)({
75
+ const { nodes, edges, onNodesChange, onEdgesChange, onConnect } = (0, hooks_1.useGraph)({
77
76
  entity,
78
77
  relations: allRelations !== null && allRelations !== void 0 ? allRelations : [],
79
78
  });
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  export type CatalogHistoryButtonProps = {
3
3
  version: string | null;
4
+ /** Marks `version` as the group's default, shown as a "(latest)" suffix on the pill. */
5
+ isDefaultVersion?: boolean;
4
6
  className?: string;
5
7
  };
6
- export declare function CatalogEntityHistoryButton({ version, className, }: CatalogHistoryButtonProps): React.ReactElement;
8
+ export declare function CatalogEntityHistoryButton({ version, isDefaultVersion, className, }: CatalogHistoryButtonProps): React.ReactElement;
@@ -40,41 +40,63 @@ exports.CatalogEntityHistoryButton = CatalogEntityHistoryButton;
40
40
  const react_1 = __importStar(require("react"));
41
41
  const styled_components_1 = __importDefault(require("styled-components"));
42
42
  const RecentlyViewedIcon_1 = require("../../../../icons/RecentlyViewedIcon/RecentlyViewedIcon");
43
- const CheckmarkOutlineIcon_1 = require("../../../../icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon");
43
+ const RadioCheckButtonIcon_1 = require("../../../../icons/RadioCheckButtonIcon/RadioCheckButtonIcon");
44
44
  const hooks_1 = require("../../../../core/hooks");
45
45
  const constants_1 = require("../../../../core/constants");
46
46
  const Tooltip_1 = require("../../../../components/Tooltip/Tooltip");
47
- const hooks_2 = require("../../../../core/hooks");
48
- function CatalogEntityHistoryButton({ version, className, }) {
49
- const [label, setLabel] = (0, react_1.useState)(version === constants_1.VERSION_NOT_SPECIFIED ? null : version);
47
+ /**
48
+ * The pill label: the page's version, updated by the overlay's close event
49
+ * (which appends the revision while an old revision is open), with a
50
+ * "(latest)" suffix on the plain default-version label.
51
+ */
52
+ function useVersionPillLabel(version, isDefaultVersion) {
53
+ const pageLabel = version === constants_1.VERSION_NOT_SPECIFIED ? null : version;
54
+ const [label, setLabel] = (0, react_1.useState)(pageLabel);
55
+ // Keep the pill in sync when navigation changes the page version.
56
+ const [lastPageLabel, setLastPageLabel] = (0, react_1.useState)(pageLabel);
57
+ if (lastPageLabel !== pageLabel) {
58
+ setLastPageLabel(pageLabel);
59
+ setLabel(pageLabel);
60
+ }
50
61
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
51
62
  const { translate } = useTranslate();
52
- const [labelRef, isLabelTruncated] = (0, hooks_2.useIsTruncated)(label);
63
+ const latestWord = translate('catalog.history.version.latest', 'latest');
53
64
  const handleClose = (0, react_1.useCallback)((e) => {
54
- setLabel(e.detail.version === constants_1.VERSION_NOT_SPECIFIED
55
- ? e.detail.revision || 'r.1'
56
- : `${e.detail.version || version}, ${e.detail.revision || 'r.1'}`);
65
+ const closedVersion = e.detail.version === constants_1.VERSION_NOT_SPECIFIED ? null : e.detail.version || version;
66
+ setLabel([closedVersion, e.detail.revision].filter(Boolean).join(', ') || null);
57
67
  }, [version]);
58
68
  (0, react_1.useEffect)(() => {
59
- window.addEventListener('portal:sidebar:close-version-history', (e) => handleClose(e));
60
- return () => {
61
- window.removeEventListener('portal:sidebar:close-version-history', (e) => handleClose(e));
62
- };
69
+ const onClose = (e) => handleClose(e);
70
+ window.addEventListener('portal:sidebar:close-version-history', onClose);
71
+ return () => window.removeEventListener('portal:sidebar:close-version-history', onClose);
63
72
  }, [handleClose]);
73
+ // A label with a revision, or a version named "latest", stays as-is.
74
+ return label !== null &&
75
+ label === pageLabel &&
76
+ isDefaultVersion &&
77
+ label.toLowerCase() !== latestWord.toLowerCase()
78
+ ? `${label} (${latestWord})`
79
+ : label;
80
+ }
81
+ function CatalogEntityHistoryButton({ version, isDefaultVersion, className, }) {
82
+ const { useTranslate } = (0, hooks_1.useThemeHooks)();
83
+ const { translate } = useTranslate();
84
+ const displayLabel = useVersionPillLabel(version, isDefaultVersion);
85
+ const [labelRef, isLabelTruncated] = (0, hooks_1.useIsTruncated)(displayLabel);
64
86
  const handleClick = () => {
65
87
  window.dispatchEvent(new CustomEvent('portal:sidebar:open-version-history'));
66
88
  };
67
89
  return (react_1.default.createElement(CatalogHistoryButtonWrapper, { className: className, "data-component-name": "Catalog/CatalogHistoryButton" },
68
- react_1.default.createElement(Separator, null),
69
90
  react_1.default.createElement(HistoryItem, { onClick: handleClick },
70
91
  react_1.default.createElement(HistoryIcon, null),
71
92
  react_1.default.createElement(HistoryContent, null,
72
- react_1.default.createElement(HistoryText, null, translate('catalog.history.button.label', 'Version history')),
73
- label && (react_1.default.createElement(Tooltip_1.Tooltip, { tip: label, placement: "bottom", arrowPosition: "left", disabled: !isLabelTruncated },
93
+ react_1.default.createElement(HistoryText, null, translate('catalog.history.button.label', 'Version')),
94
+ displayLabel && (react_1.default.createElement(Tooltip_1.Tooltip, { tip: displayLabel, placement: "bottom", arrowPosition: "left", disabled: !isLabelTruncated },
74
95
  react_1.default.createElement(VersionPillWrapper, null,
75
96
  react_1.default.createElement(VersionPill, null,
76
97
  react_1.default.createElement(CheckmarkIcon, null),
77
- react_1.default.createElement("span", { ref: labelRef }, label)))))))));
98
+ react_1.default.createElement("span", { ref: labelRef }, displayLabel))))))),
99
+ react_1.default.createElement(Separator, null)));
78
100
  }
79
101
  const CatalogHistoryButtonWrapper = styled_components_1.default.div `
80
102
  width: var(--catalog-history-button-width);
@@ -83,18 +105,18 @@ const Separator = styled_components_1.default.div `
83
105
  width: 100%;
84
106
  height: 1px;
85
107
  background-color: var(--catalog-history-separator-border-color);
86
- margin-bottom: var(--catalog-history-separator-margin-bottom);
108
+ margin: var(--catalog-history-separator-margin);
87
109
  flex-shrink: 0;
88
110
  `;
89
111
  const HistoryItem = styled_components_1.default.button `
90
112
  all: unset;
113
+ box-sizing: border-box;
91
114
  display: flex;
92
115
  align-items: center;
93
116
  justify-content: space-between;
94
117
  gap: var(--catalog-history-item-gap);
95
118
  padding: var(--catalog-history-item-padding);
96
- margin-bottom: var(--catalog-history-item-margin-bottom);
97
- width: var(--catalog-history-button-item-width);
119
+ width: 100%;
98
120
  border-radius: var(--catalog-history-item-border-radius);
99
121
  cursor: pointer;
100
122
  transition: background-color 0.2s ease;
@@ -105,13 +127,11 @@ const HistoryItem = styled_components_1.default.button `
105
127
  `;
106
128
  const HistoryContent = styled_components_1.default.div `
107
129
  display: flex;
108
- flex-wrap: wrap;
109
130
  align-items: center;
110
131
  justify-content: space-between;
111
132
  flex: 1;
112
133
  gap: var(--catalog-history-item-gap);
113
134
  min-width: 0;
114
- max-width: var(--catalog-history-content-max-width);
115
135
  `;
116
136
  const HistoryText = styled_components_1.default.span `
117
137
  flex: 0 0 auto;
@@ -125,17 +145,19 @@ const HistoryText = styled_components_1.default.span `
125
145
  const VersionPillWrapper = styled_components_1.default.div `
126
146
  flex: 0 1 auto;
127
147
  min-width: 0;
128
- max-width: var(--catalog-history-content-max-width);
129
148
  `;
130
149
  const HistoryIcon = (0, styled_components_1.default)(RecentlyViewedIcon_1.RecentlyViewedIcon) `
131
150
  width: var(--catalog-history-icon-size);
132
151
  height: var(--catalog-history-icon-size);
133
152
  flex-shrink: 0;
153
+ margin-right: var(--catalog-history-icon-gap);
134
154
  `;
135
155
  const VersionPill = styled_components_1.default.div `
156
+ box-sizing: border-box;
136
157
  display: flex;
137
158
  align-items: center;
138
159
  gap: var(--catalog-history-pill-gap);
160
+ height: var(--catalog-history-pill-height);
139
161
  padding: var(--catalog-history-pill-padding-vertical) var(--catalog-history-pill-padding-horizontal);
140
162
  border: 1px solid var(--catalog-history-pill-border-color);
141
163
  border-radius: var(--catalog-history-pill-border-radius);
@@ -154,7 +176,7 @@ const VersionPill = styled_components_1.default.div `
154
176
  min-width: 0;
155
177
  }
156
178
  `;
157
- const CheckmarkIcon = (0, styled_components_1.default)(CheckmarkOutlineIcon_1.CheckmarkOutlineIcon) `
179
+ const CheckmarkIcon = (0, styled_components_1.default)(RadioCheckButtonIcon_1.RadioCheckButtonIcon) `
158
180
  width: var(--catalog-history-pill-icon-size);
159
181
  height: var(--catalog-history-pill-icon-size);
160
182
  min-width: var(--catalog-history-pill-icon-size);
@@ -47,13 +47,54 @@ const utils_1 = require("../../../../core/utils");
47
47
  const constants_1 = require("../../../../core/constants");
48
48
  const CatalogEntityVersionItem_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem");
49
49
  const RecentlyViewedIcon_1 = require("../../../../icons/RecentlyViewedIcon/RecentlyViewedIcon");
50
+ /**
51
+ * Overlay visibility, driven by the button's open event. The overlay stays
52
+ * open only on the location it was opened at, so navigation closes it; every
53
+ * close (explicit or by navigation) emits the close event that syncs the
54
+ * button pill with the given version/revision.
55
+ */
56
+ function useVersionHistoryOverlay(version, revisionLabel) {
57
+ const location = (0, react_router_1.useLocation)();
58
+ const locationKey = `${location.pathname}${location.search}`;
59
+ const locationKeyRef = (0, react_1.useRef)(locationKey);
60
+ locationKeyRef.current = locationKey;
61
+ const [openLocation, setOpenLocation] = (0, react_1.useState)(null);
62
+ const closeEventPending = (0, react_1.useRef)(false);
63
+ if (openLocation !== null && openLocation !== locationKey) {
64
+ closeEventPending.current = true;
65
+ setOpenLocation(null);
66
+ }
67
+ (0, react_1.useEffect)(() => {
68
+ const open = () => setOpenLocation(locationKeyRef.current);
69
+ window.addEventListener('portal:sidebar:open-version-history', open);
70
+ return () => window.removeEventListener('portal:sidebar:open-version-history', open);
71
+ }, []);
72
+ const emitClose = (0, react_1.useCallback)(() => {
73
+ window.dispatchEvent(new CustomEvent('portal:sidebar:close-version-history', {
74
+ detail: { version, revision: revisionLabel },
75
+ }));
76
+ }, [version, revisionLabel]);
77
+ // Dispatched after the post-navigation render so the close event carries
78
+ // the freshly navigated-to version/revision.
79
+ (0, react_1.useEffect)(() => {
80
+ if (!closeEventPending.current)
81
+ return;
82
+ closeEventPending.current = false;
83
+ emitClose();
84
+ }, [openLocation, emitClose]);
85
+ const close = (0, react_1.useCallback)(() => {
86
+ emitClose();
87
+ setOpenLocation(null);
88
+ }, [emitClose]);
89
+ return { isOpen: openLocation !== null && openLocation === locationKey, close };
90
+ }
50
91
  function CatalogEntityHistorySidebar({ entityKey, revision, version, className, }) {
51
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
52
92
  const location = (0, react_router_1.useLocation)();
53
93
  const basePath = location.pathname;
54
- const { useTranslate, useFetchCatalogEntityRevisions, useL10nConfig } = (0, hooks_1.useThemeHooks)();
94
+ const { useTranslate, useFetchCatalogEntityRevisions, useL10nConfig, usePageVersions } = (0, hooks_1.useThemeHooks)();
55
95
  const { translate } = useTranslate();
56
96
  const { currentLocale } = useL10nConfig();
97
+ const { versions: pageVersions } = usePageVersions();
57
98
  const { items: revisions } = useFetchCatalogEntityRevisions({ entityKey });
58
99
  const normalizedLocale = currentLocale && currentLocale !== constants_1.DEFAULT_LOCALE_PLACEHOLDER ? currentLocale : 'en-US';
59
100
  const versionHistoryItems = (0, react_1.useMemo)(() => (0, utils_1.transformRevisionsToVersionHistory)({
@@ -66,27 +107,14 @@ function CatalogEntityHistorySidebar({ entityKey, revision, version, className,
66
107
  var _a;
67
108
  const itemWithActiveRevision = versionHistoryItems.find((item) => { var _a; return (_a = item.revisions) === null || _a === void 0 ? void 0 : _a.some((revision) => revision.isActive); });
68
109
  const activeRevision = (_a = itemWithActiveRevision === null || itemWithActiveRevision === void 0 ? void 0 : itemWithActiveRevision.revisions) === null || _a === void 0 ? void 0 : _a.find((revision) => revision.isActive);
69
- return activeRevision === null || activeRevision === void 0 ? void 0 : activeRevision.name;
110
+ // Show the revision label only while an old revision is open.
111
+ return activeRevision && !activeRevision.isCurrent ? activeRevision.name : undefined;
70
112
  }, [versionHistoryItems]);
113
+ const { isOpen, close } = useVersionHistoryOverlay(version, activeRevisionLabel);
71
114
  const [expandedVersions, setExpandedVersions] = (0, react_1.useState)(new Set());
72
115
  (0, react_1.useEffect)(() => {
73
116
  setExpandedVersions(new Set(versionHistoryItems.filter((item) => item.isExpanded).map((item) => item.version)));
74
117
  }, [versionHistoryItems]);
75
- const handleOpenSidebar = (0, react_1.useCallback)(() => {
76
- setIsOpen(true);
77
- }, []);
78
- (0, react_1.useEffect)(() => {
79
- window.addEventListener('portal:sidebar:open-version-history', handleOpenSidebar);
80
- return () => {
81
- window.removeEventListener('portal:sidebar:open-version-history', handleOpenSidebar);
82
- };
83
- }, [handleOpenSidebar]);
84
- const handleClose = () => {
85
- window.dispatchEvent(new CustomEvent('portal:sidebar:close-version-history', {
86
- detail: { version, revision: activeRevisionLabel },
87
- }));
88
- setIsOpen(false);
89
- };
90
118
  const toggleVersion = (version) => {
91
119
  setExpandedVersions((prev) => {
92
120
  const newSet = new Set(prev);
@@ -104,13 +132,13 @@ function CatalogEntityHistorySidebar({ entityKey, revision, version, className,
104
132
  }
105
133
  return (react_1.default.createElement(SidebarOverlay, { className: className, "data-component-name": "Catalog/CatalogHistorySidebar" },
106
134
  react_1.default.createElement(SidebarHeader, null,
107
- react_1.default.createElement(HeaderWrapper, null,
108
- react_1.default.createElement(HistoryIcon, null),
109
- react_1.default.createElement(HeaderTitle, null, translate('catalog.history.sidebar.title', 'Version history'))),
110
- react_1.default.createElement(CloseButton, { onClick: handleClose, "aria-label": translate('catalog.history.sidebar.close', 'Close version history') },
111
- react_1.default.createElement(CloseIcon_1.CloseIcon, { size: "20px", color: "--catalog-history-sidebar-close-icon-color" }))),
135
+ react_1.default.createElement(HistoryIcon, null),
136
+ react_1.default.createElement(HeaderTitle, null, translate('catalog.history.sidebar.title', 'Version')),
137
+ react_1.default.createElement(CloseButton, { onClick: close, "aria-label": translate('catalog.history.sidebar.close', 'Close version history') },
138
+ react_1.default.createElement(CloseIcon_1.CloseIcon, { size: "14px", color: "--catalog-history-sidebar-close-icon-color" }))),
139
+ react_1.default.createElement(Divider, null),
112
140
  react_1.default.createElement(MenuContainer_1.MenuContainer, { growContent: true },
113
- react_1.default.createElement(VersionList, null, versionHistoryItems.map((group) => (react_1.default.createElement(CatalogEntityVersionItem_1.CatalogEntityVersionItem, { key: group.version, group: group, basePath: basePath, isExpanded: expandedVersions.has(group.version), onToggle: toggleVersion })))))));
141
+ react_1.default.createElement(VersionList, null, versionHistoryItems.map((group) => { var _a; return (react_1.default.createElement(CatalogEntityVersionItem_1.CatalogEntityVersionItem, { key: group.version, group: group, basePath: basePath, isExpanded: expandedVersions.has(group.version), onToggle: toggleVersion, versionLink: (_a = pageVersions === null || pageVersions === void 0 ? void 0 : pageVersions.find((pageVersion) => pageVersion.version === group.version)) === null || _a === void 0 ? void 0 : _a.link })); })))));
114
142
  }
115
143
  const SidebarOverlay = styled_components_1.default.div `
116
144
  position: fixed;
@@ -118,6 +146,7 @@ const SidebarOverlay = styled_components_1.default.div `
118
146
  left: 0;
119
147
  width: var(--sidebar-width);
120
148
  height: calc(100vh - var(--navbar-height) - var(--banner-height));
149
+ padding: var(--catalog-history-sidebar-padding);
121
150
  background-color: var(--catalog-history-sidebar-bg-color);
122
151
  border-right: 1px solid var(--catalog-history-sidebar-border-color);
123
152
  display: flex;
@@ -125,15 +154,25 @@ const SidebarOverlay = styled_components_1.default.div `
125
154
  z-index: calc(var(--z-index-raised) - 1);
126
155
  overflow: hidden;
127
156
  `;
157
+ // Same row geometry as the history button, so opening the overlay keeps the
158
+ // icon and title in place.
128
159
  const SidebarHeader = styled_components_1.default.div `
129
160
  display: flex;
130
161
  align-items: center;
131
- justify-content: space-between;
162
+ gap: var(--catalog-history-item-gap);
132
163
  padding: var(--catalog-history-sidebar-header-padding);
133
- border-bottom: 1px solid var(--catalog-history-sidebar-border-color);
164
+ border-radius: var(--border-radius-lg);
165
+ flex-shrink: 0;
166
+ `;
167
+ const Divider = styled_components_1.default.div `
168
+ height: 1px;
169
+ background-color: var(--catalog-history-sidebar-border-color);
170
+ margin: var(--catalog-history-sidebar-divider-margin);
134
171
  flex-shrink: 0;
135
172
  `;
136
173
  const HeaderTitle = styled_components_1.default.h2 `
174
+ flex: 1;
175
+ min-width: 0;
137
176
  margin: 0;
138
177
  font-family: var(--catalog-history-sidebar-header-font-family);
139
178
  font-size: var(--catalog-history-sidebar-header-font-size);
@@ -160,17 +199,12 @@ const CloseButton = styled_components_1.default.button `
160
199
  const VersionList = styled_components_1.default.ul `
161
200
  list-style: none;
162
201
  margin: 0;
163
- padding: var(--catalog-history-sidebar-content-padding);
164
- margin-top: var(--catalog-history-sidebar-content-margin-top);
202
+ padding: 0;
165
203
  `;
166
204
  const HistoryIcon = (0, styled_components_1.default)(RecentlyViewedIcon_1.RecentlyViewedIcon) `
167
205
  width: var(--catalog-history-icon-size);
168
206
  height: var(--catalog-history-icon-size);
169
207
  flex-shrink: 0;
170
- `;
171
- const HeaderWrapper = styled_components_1.default.div `
172
- display: flex;
173
- align-items: center;
174
- gap: var(--spacing-xs);
208
+ margin-right: var(--catalog-history-icon-gap);
175
209
  `;
176
210
  //# sourceMappingURL=CatalogEntityHistorySidebar.js.map
@@ -4,5 +4,7 @@ export type CatalogEntityRevisionItemProps = {
4
4
  revisionItem: CatalogEntityRevision;
5
5
  basePath: string;
6
6
  version?: string | null;
7
+ /** The version's own page URL (from the host's usePageVersions). */
8
+ versionLink?: string;
7
9
  };
8
- export declare function CatalogEntityRevisionItem({ revisionItem, basePath, version, }: CatalogEntityRevisionItemProps): React.ReactElement;
10
+ export declare function CatalogEntityRevisionItem({ revisionItem, basePath, version, versionLink, }: CatalogEntityRevisionItemProps): React.ReactElement;
@@ -10,11 +10,17 @@ const Link_1 = require("../../../../components/Link/Link");
10
10
  const Tag_1 = require("../../../../components/Tag/Tag");
11
11
  const utils_1 = require("../../../../core/utils");
12
12
  const hooks_1 = require("../../../../core/hooks");
13
- function CatalogEntityRevisionItem({ revisionItem, basePath, version, }) {
13
+ function CatalogEntityRevisionItem({ revisionItem, basePath, version, versionLink, }) {
14
14
  var _a, _b;
15
15
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
16
16
  const { translate } = useTranslate();
17
- const revisionFilter = (_a = (0, utils_1.buildRevisionUrl)(basePath, revisionItem.revisionDate, version)) !== null && _a !== void 0 ? _a : basePath;
17
+ // The current revision links to the version's live page. Older revisions
18
+ // add ?revision= to that URL. Hosts without page-version links keep the
19
+ // legacy ?revision=&version= contract.
20
+ const base = versionLink !== null && versionLink !== void 0 ? versionLink : basePath;
21
+ const revisionFilter = revisionItem.isCurrent
22
+ ? base
23
+ : ((_a = (0, utils_1.buildRevisionUrl)(base, revisionItem.revisionDate, versionLink ? undefined : version)) !== null && _a !== void 0 ? _a : base);
18
24
  const isActive = (_b = revisionItem.isActive) !== null && _b !== void 0 ? _b : false;
19
25
  return (react_1.default.createElement(RevisionItemWrapper, { to: revisionFilter, $isActive: isActive },
20
26
  react_1.default.createElement(RevisionNameRow, null,
@@ -34,11 +40,17 @@ const RevisionItemWrapper = (0, styled_components_1.default)(Link_1.Link) `
34
40
  padding-left: var(--catalog-history-sidebar-revisions-padding-left);
35
41
  border-radius: var(--catalog-history-sidebar-revision-item-border-radius);
36
42
  transition: 0.2s ease;
37
- text-decoration: none;
38
43
  color: inherit;
39
44
  cursor: pointer;
40
45
  background-color: ${({ $isActive }) => $isActive ? 'var(--catalog-history-sidebar-revision-item-bg-color-active)' : 'transparent'};
41
46
 
47
+ &,
48
+ &:hover,
49
+ &:focus,
50
+ &:visited {
51
+ text-decoration: none;
52
+ }
53
+
42
54
  &:hover {
43
55
  background-color: ${({ $isActive }) => $isActive
44
56
  ? 'var(--catalog-history-sidebar-revision-item-bg-color-active)'
@@ -5,5 +5,7 @@ export type CatalogEntityVersionItemProps = {
5
5
  basePath: string;
6
6
  isExpanded: boolean;
7
7
  onToggle: (version: string) => void;
8
+ /** This version's own page URL (from the host's usePageVersions). */
9
+ versionLink?: string;
8
10
  };
9
- export declare function CatalogEntityVersionItem({ group, basePath, isExpanded, onToggle, }: CatalogEntityVersionItemProps): React.ReactElement;
11
+ export declare function CatalogEntityVersionItem({ group, basePath, isExpanded, onToggle, versionLink, }: CatalogEntityVersionItemProps): React.ReactElement;