@redocly/theme 0.63.0-next.3 → 0.63.0-next.5

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 (54) hide show
  1. package/lib/components/Buttons/CopyButton.d.ts +1 -1
  2. package/lib/components/Buttons/CopyButton.js +1 -1
  3. package/lib/components/Buttons/DownloadButton.d.ts +6 -0
  4. package/lib/components/Buttons/DownloadButton.js +20 -0
  5. package/lib/components/Buttons/EmailButton.js +6 -1
  6. package/lib/components/Buttons/NewTabButton.js +6 -1
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +2 -2
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +6 -13
  9. package/lib/components/CodeBlock/CodeBlockControls.js +3 -3
  10. package/lib/components/Menu/MenuItem.js +1 -1
  11. package/lib/components/PageActions/PageActions.js +1 -1
  12. package/lib/components/Search/SearchDialog.js +1 -1
  13. package/lib/components/SidebarActions/SidebarActions.js +1 -1
  14. package/lib/components/SidebarActions/styled.d.ts +1 -1
  15. package/lib/components/Tooltip/AnchorTooltip.d.ts +7 -0
  16. package/lib/components/Tooltip/AnchorTooltip.js +233 -0
  17. package/lib/components/Tooltip/JsTooltip.d.ts +3 -0
  18. package/lib/components/Tooltip/JsTooltip.js +277 -0
  19. package/lib/components/Tooltip/Tooltip.d.ts +2 -13
  20. package/lib/components/Tooltip/Tooltip.js +14 -190
  21. package/lib/core/hooks/use-page-actions.js +9 -5
  22. package/lib/core/hooks/use-theme-hooks.js +1 -0
  23. package/lib/core/types/hooks.d.ts +4 -0
  24. package/lib/core/types/index.d.ts +1 -0
  25. package/lib/core/types/l10n.d.ts +1 -1
  26. package/lib/core/types/tooltip.d.ts +14 -0
  27. package/lib/core/types/tooltip.js +3 -0
  28. package/lib/core/utils/transform-revisions-to-version-history.js +13 -20
  29. package/lib/index.d.ts +1 -0
  30. package/lib/index.js +1 -0
  31. package/package.json +3 -3
  32. package/src/components/Buttons/CopyButton.tsx +2 -1
  33. package/src/components/Buttons/DownloadButton.tsx +41 -0
  34. package/src/components/Buttons/EmailButton.tsx +18 -8
  35. package/src/components/Buttons/NewTabButton.tsx +19 -8
  36. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +2 -2
  37. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +5 -21
  38. package/src/components/CodeBlock/CodeBlockControls.tsx +3 -0
  39. package/src/components/Menu/MenuItem.tsx +1 -0
  40. package/src/components/PageActions/PageActions.tsx +6 -1
  41. package/src/components/Search/SearchDialog.tsx +1 -1
  42. package/src/components/SidebarActions/SidebarActions.tsx +1 -0
  43. package/src/components/Tooltip/AnchorTooltip.tsx +259 -0
  44. package/src/components/Tooltip/JsTooltip.tsx +296 -0
  45. package/src/components/Tooltip/Tooltip.tsx +18 -257
  46. package/src/core/hooks/__mocks__/use-theme-hooks.ts +3 -0
  47. package/src/core/hooks/use-page-actions.ts +5 -0
  48. package/src/core/hooks/use-theme-hooks.ts +1 -0
  49. package/src/core/types/hooks.ts +2 -1
  50. package/src/core/types/index.ts +1 -0
  51. package/src/core/types/l10n.ts +5 -0
  52. package/src/core/types/tooltip.ts +15 -0
  53. package/src/core/utils/transform-revisions-to-version-history.ts +13 -21
  54. package/src/index.ts +1 -0
@@ -53,27 +53,19 @@ export function transformRevisionsToVersionHistory({
53
53
  // Check if any revision in this version group is the default version
54
54
  const isDefaultVersion = versionRevisions.some((rev) => rev.isDefaultVersion === true);
55
55
 
56
- const revisions =
57
- versionRevisions.length > 1
58
- ? versionRevisions.map((rev, index): CatalogEntityRevision => {
59
- const revisionMatches = currentRevisionDate
60
- ? rev.revision === currentRevisionDate
61
- : false;
62
- const isActiveRevision = revisionMatches && versionMatches;
63
- const isCurrentByDefault =
64
- !currentRevisionDate &&
65
- normalizedCurrentVersion === undefined &&
66
- index === 0 &&
67
- isCurrent;
68
- return {
69
- name: `r.${versionRevisions.length - index}`,
70
- date: toLocalizedShortDateTime(rev.revision, locale),
71
- revisionDate: rev.revision,
72
- isActive: isActiveRevision || isCurrentByDefault,
73
- isCurrent: rev.isCurrent ?? false,
74
- };
75
- })
76
- : undefined;
56
+ const revisions = versionRevisions.map((rev, index): CatalogEntityRevision => {
57
+ const revisionMatches = currentRevisionDate ? rev.revision === currentRevisionDate : false;
58
+ const isActiveRevision = revisionMatches && versionMatches;
59
+ const isCurrentByDefault =
60
+ !currentRevisionDate && normalizedCurrentVersion === undefined && index === 0 && isCurrent;
61
+ return {
62
+ name: `r.${versionRevisions.length - index}`,
63
+ date: toLocalizedShortDateTime(rev.revision, locale),
64
+ revisionDate: rev.revision,
65
+ isActive: isActiveRevision || isCurrentByDefault,
66
+ isCurrent: rev.isCurrent ?? false,
67
+ };
68
+ });
77
69
 
78
70
  return {
79
71
  version,
package/src/index.ts CHANGED
@@ -33,6 +33,7 @@ export * from '@redocly/theme/components/Buttons/CopyButton';
33
33
  export * from '@redocly/theme/components/Buttons/EditPageButton';
34
34
  export * from '@redocly/theme/components/Buttons/EmailButton';
35
35
  export * from '@redocly/theme/components/Buttons/NewTabButton';
36
+ export * from '@redocly/theme/components/Buttons/DownloadButton';
36
37
  export * from '@redocly/theme/components/Buttons/AIAssistantButton';
37
38
  /* Markdown */
38
39
  export * from '@redocly/theme/components/Markdown/Markdown';