@redocly/theme 0.63.0-next.4 → 0.63.0-next.6

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 (136) hide show
  1. package/lib/components/Accordion/variables.js +2 -2
  2. package/lib/components/Buttons/DownloadButton.d.ts +6 -0
  3. package/lib/components/Buttons/DownloadButton.js +20 -0
  4. package/lib/components/Buttons/EmailButton.js +6 -1
  5. package/lib/components/Buttons/NewTabButton.js +6 -1
  6. package/lib/components/Catalog/Catalog.js +114 -50
  7. package/lib/components/Catalog/CatalogAvatar.d.ts +5 -0
  8. package/lib/components/Catalog/CatalogAvatar.js +92 -0
  9. package/lib/components/Catalog/CatalogCardView/CatalogCard.js +26 -7
  10. package/lib/components/Catalog/CatalogCardView/CatalogCardView.js +10 -2
  11. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +17 -17
  12. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.js +4 -20
  13. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.d.ts +7 -0
  14. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.js +53 -0
  15. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.js +3 -17
  16. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.js +30 -9
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +16 -3
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +8 -4
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +11 -5
  20. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +1 -1
  21. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +1 -1
  22. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
  23. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +4 -1
  24. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.js +7 -2
  25. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
  26. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
  27. package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +1 -1
  28. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.d.ts +4 -2
  29. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +25 -8
  30. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.d.ts +7 -0
  31. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.js +24 -0
  32. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.d.ts +6 -0
  33. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.js +26 -0
  34. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.d.ts +7 -0
  35. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.js +30 -0
  36. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.d.ts +13 -0
  37. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.js +30 -0
  38. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.d.ts +11 -0
  39. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.js +21 -0
  40. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.d.ts +7 -0
  41. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.js +25 -0
  42. package/lib/components/Catalog/CatalogPageDescription.js +0 -6
  43. package/lib/components/Catalog/CatalogSelector.d.ts +0 -1
  44. package/lib/components/Catalog/CatalogSelector.js +50 -16
  45. package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +2 -1
  46. package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +20 -5
  47. package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +2 -23
  48. package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +2 -1
  49. package/lib/components/Catalog/CatalogTagsWithTooltip.js +14 -6
  50. package/lib/components/Catalog/variables.js +78 -36
  51. package/lib/components/Filter/variables.js +1 -1
  52. package/lib/components/LoadMore/LoadMore.js +1 -0
  53. package/lib/components/Menu/MenuItem.js +1 -1
  54. package/lib/components/PageActions/PageActions.js +1 -2
  55. package/lib/components/Search/SearchDialog.js +1 -1
  56. package/lib/components/SidebarActions/SidebarActions.js +1 -1
  57. package/lib/components/Tooltip/AnchorTooltip.js +5 -2
  58. package/lib/components/Tooltip/JsTooltip.js +5 -2
  59. package/lib/components/UserMenu/UserMenu.js +1 -3
  60. package/lib/core/hooks/index.d.ts +1 -0
  61. package/lib/core/hooks/index.js +1 -0
  62. package/lib/core/hooks/use-is-truncated.d.ts +1 -0
  63. package/lib/core/hooks/use-is-truncated.js +19 -0
  64. package/lib/core/hooks/use-tabs.d.ts +1 -1
  65. package/lib/core/hooks/use-tabs.js +30 -17
  66. package/lib/core/types/hooks.d.ts +1 -0
  67. package/lib/core/types/l10n.d.ts +1 -1
  68. package/lib/core/types/tooltip.d.ts +1 -0
  69. package/lib/core/utils/custom-catalog-options-casing.d.ts +15 -0
  70. package/lib/core/utils/custom-catalog-options-casing.js +32 -0
  71. package/lib/core/utils/index.d.ts +1 -0
  72. package/lib/core/utils/index.js +1 -0
  73. package/lib/index.d.ts +1 -0
  74. package/lib/index.js +1 -0
  75. package/lib/markdoc/components/MarkdocExample/MarkdocExample.js +2 -2
  76. package/lib/markdoc/components/Tabs/Tabs.d.ts +1 -2
  77. package/lib/markdoc/components/Tabs/Tabs.js +9 -22
  78. package/package.json +4 -4
  79. package/src/components/Accordion/variables.ts +2 -2
  80. package/src/components/Buttons/DownloadButton.tsx +41 -0
  81. package/src/components/Buttons/EmailButton.tsx +18 -8
  82. package/src/components/Buttons/NewTabButton.tsx +19 -8
  83. package/src/components/Catalog/Catalog.tsx +157 -95
  84. package/src/components/Catalog/CatalogAvatar.tsx +68 -0
  85. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +29 -5
  86. package/src/components/Catalog/CatalogCardView/CatalogCardView.tsx +10 -2
  87. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +17 -17
  88. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.tsx +4 -21
  89. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.tsx +82 -0
  90. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.tsx +4 -22
  91. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx +39 -10
  92. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +19 -3
  93. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +8 -4
  94. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +12 -10
  95. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +5 -1
  96. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +1 -0
  97. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
  98. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +6 -2
  99. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +10 -2
  100. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
  101. package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
  102. package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +1 -1
  103. package/src/components/Catalog/CatalogFilter/CatalogFilterContent.tsx +30 -6
  104. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.tsx +31 -0
  105. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.tsx +34 -0
  106. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx +40 -0
  107. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.tsx +54 -0
  108. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.tsx +34 -0
  109. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.tsx +39 -0
  110. package/src/components/Catalog/CatalogPageDescription.tsx +0 -6
  111. package/src/components/Catalog/CatalogSelector.tsx +23 -21
  112. package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +37 -6
  113. package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +2 -26
  114. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +24 -9
  115. package/src/components/Catalog/variables.ts +78 -36
  116. package/src/components/Filter/variables.ts +1 -1
  117. package/src/components/LoadMore/LoadMore.tsx +1 -0
  118. package/src/components/Menu/MenuItem.tsx +1 -0
  119. package/src/components/PageActions/PageActions.tsx +1 -2
  120. package/src/components/Search/SearchDialog.tsx +1 -1
  121. package/src/components/SidebarActions/SidebarActions.tsx +1 -0
  122. package/src/components/Tooltip/AnchorTooltip.tsx +5 -1
  123. package/src/components/Tooltip/JsTooltip.tsx +5 -1
  124. package/src/components/UserMenu/UserMenu.tsx +1 -3
  125. package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +1 -1
  126. package/src/core/hooks/index.ts +1 -0
  127. package/src/core/hooks/use-is-truncated.ts +20 -0
  128. package/src/core/hooks/use-tabs.ts +40 -21
  129. package/src/core/types/hooks.ts +1 -1
  130. package/src/core/types/l10n.ts +7 -0
  131. package/src/core/types/tooltip.ts +1 -0
  132. package/src/core/utils/custom-catalog-options-casing.ts +29 -0
  133. package/src/core/utils/index.ts +1 -0
  134. package/src/index.ts +1 -0
  135. package/src/markdoc/components/MarkdocExample/MarkdocExample.tsx +2 -6
  136. package/src/markdoc/components/Tabs/Tabs.tsx +4 -37
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.customCatalogOptionsCasing = customCatalogOptionsCasing;
4
+ /**
5
+ * Converts a string to title case for catalog option labels.
6
+ * Splits on whitespace, hyphens, and underscores; capitalizes each word.
7
+ * The first word is rendered as "API" when it is "api" (case-insensitive).
8
+ *
9
+ * @param str - The raw string to format (e.g. from config or entity data).
10
+ * @returns The formatted label with words capitalized and joined by spaces.
11
+ *
12
+ * @example
13
+ * customCatalogOptionsCasing('api_spec') // 'API Spec'
14
+ * customCatalogOptionsCasing('my-custom-option') // 'My Custom Option'
15
+ * customCatalogOptionsCasing('user name') // 'User Name'
16
+ * customCatalogOptionsCasing(' api version ') // 'API Version'
17
+ */
18
+ function customCatalogOptionsCasing(str) {
19
+ const trimmedStr = str.trim();
20
+ if (!trimmedStr)
21
+ return trimmedStr;
22
+ const words = trimmedStr.split(/[\s-_]+/);
23
+ return words
24
+ .map((word, index) => {
25
+ if (index === 0 && word.toLowerCase() === 'api') {
26
+ return 'API';
27
+ }
28
+ return word[0].toUpperCase() + word.slice(1);
29
+ })
30
+ .join(' ');
31
+ }
32
+ //# sourceMappingURL=custom-catalog-options-casing.js.map
@@ -44,3 +44,4 @@ export * from './frontmatter-translate';
44
44
  export * from './transform-revisions-to-version-history';
45
45
  export * from './build-revision-url';
46
46
  export * from './content-segments';
47
+ export * from './custom-catalog-options-casing';
@@ -60,4 +60,5 @@ __exportStar(require("./frontmatter-translate"), exports);
60
60
  __exportStar(require("./transform-revisions-to-version-history"), exports);
61
61
  __exportStar(require("./build-revision-url"), exports);
62
62
  __exportStar(require("./content-segments"), exports);
63
+ __exportStar(require("./custom-catalog-options-casing"), exports);
63
64
  //# sourceMappingURL=index.js.map
package/lib/index.d.ts CHANGED
@@ -30,6 +30,7 @@ export * from './components/Buttons/CopyButton';
30
30
  export * from './components/Buttons/EditPageButton';
31
31
  export * from './components/Buttons/EmailButton';
32
32
  export * from './components/Buttons/NewTabButton';
33
+ export * from './components/Buttons/DownloadButton';
33
34
  export * from './components/Buttons/AIAssistantButton';
34
35
  export * from './components/Markdown/Markdown';
35
36
  export * from './components/Markdown/styles/base-table';
package/lib/index.js CHANGED
@@ -70,6 +70,7 @@ __exportStar(require("./components/Buttons/CopyButton"), exports);
70
70
  __exportStar(require("./components/Buttons/EditPageButton"), exports);
71
71
  __exportStar(require("./components/Buttons/EmailButton"), exports);
72
72
  __exportStar(require("./components/Buttons/NewTabButton"), exports);
73
+ __exportStar(require("./components/Buttons/DownloadButton"), exports);
73
74
  __exportStar(require("./components/Buttons/AIAssistantButton"), exports);
74
75
  /* Markdown */
75
76
  __exportStar(require("./components/Markdown/Markdown"), exports);
@@ -46,9 +46,9 @@ function MarkdocExample(props) {
46
46
  return (React.createElement("div", { "data-component-name": "Markdoc/MarkdocExample/MarkdocExample" },
47
47
  renderLabels ? React.createElement(Label, null, codeLabel ? codeLabel : 'Code:') : null,
48
48
  React.createElement(CodeBlock_1.CodeBlock, { lang: language, source: rawContent, header: { title, controls: { copy: {} } } }),
49
- renderDemo ? (React.createElement(React.Fragment, null,
49
+ renderDemo ? React.createElement(React.Fragment, null,
50
50
  renderLabels ? React.createElement(Label, null, resultLabel ? resultLabel : 'Result:') : null,
51
- ...demoContent)) : null));
51
+ ...demoContent) : null));
52
52
  }
53
53
  const Label = styled_components_1.default.div `
54
54
  margin: 10px 0;
@@ -17,9 +17,8 @@ type TabsProps = {
17
17
  className?: string;
18
18
  size: TabsSize;
19
19
  initialTab?: string;
20
- forceReady?: boolean;
21
20
  activeTab?: string;
22
21
  };
23
- export declare function Tabs({ id, children, className, size, initialTab: propInitialTab, forceReady, activeTab: controlledActiveTab, }: TabsProps): JSX.Element;
22
+ export declare function Tabs({ id, children, className, size, initialTab: propInitialTab, activeTab: controlledActiveTab, }: TabsProps): JSX.Element;
24
23
  export declare const TabContent: import("styled-components").StyledComponent<"div", any, {}, never>;
25
24
  export {};
@@ -32,12 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.TabContent = exports.TabsSize = void 0;
37
40
  exports.Tabs = Tabs;
38
41
  const react_1 = __importStar(require("react"));
39
42
  const react_router_dom_1 = require("react-router-dom");
40
- const styled_components_1 = __importStar(require("styled-components"));
43
+ const styled_components_1 = __importDefault(require("styled-components"));
41
44
  const hooks_1 = require("../../../core/hooks");
42
45
  const TabList_1 = require("../../../markdoc/components/Tabs/TabList");
43
46
  const utils_1 = require("../../../core/utils");
@@ -46,33 +49,24 @@ var TabsSize;
46
49
  TabsSize["SMALL"] = "small";
47
50
  TabsSize["MEDIUM"] = "medium";
48
51
  })(TabsSize || (exports.TabsSize = TabsSize = {}));
49
- function Tabs({ id, children, className, size, initialTab: propInitialTab, forceReady = false, activeTab: controlledActiveTab, }) {
52
+ function Tabs({ id, children, className, size, initialTab: propInitialTab, activeTab: controlledActiveTab, }) {
50
53
  var _a, _b;
51
54
  const childrenArray = react_1.default.Children.toArray(children);
52
- const [isReady, setIsReady] = (0, react_1.useState)(false);
53
55
  const containerRef = (0, react_1.useRef)(null);
54
56
  const initialTab = (_b = propInitialTab !== null && propInitialTab !== void 0 ? propInitialTab : (_a = childrenArray[0]) === null || _a === void 0 ? void 0 : _a.props.label) !== null && _b !== void 0 ? _b : '';
55
57
  const labelsHash = childrenArray.map((c) => c.props.label).join('|');
56
- const handleReadyChange = (0, react_1.useCallback)((ready) => {
57
- setIsReady(ready);
58
- }, []);
59
- // Reset isReady when children change (new page/tabs)
60
- // Use useLayoutEffect to run synchronously before paint
61
- (0, react_1.useLayoutEffect)(() => {
62
- setIsReady(false);
63
- }, [labelsHash]);
64
58
  const inRouter = (0, react_router_dom_1.useInRouterContext)();
65
- return (react_1.default.createElement(TabsView, { id: id, className: className, size: size, childrenArray: childrenArray, initialTab: initialTab, useActiveTab: inRouter ? useActiveTabWithRouter : useActiveTabWithoutRouter, isReady: isReady || forceReady, labelsHash: labelsHash, containerRef: containerRef, onReadyChange: handleReadyChange, externalActiveTab: controlledActiveTab }));
59
+ return (react_1.default.createElement(TabsView, { id: id, className: className, size: size, childrenArray: childrenArray, initialTab: initialTab, useActiveTab: inRouter ? useActiveTabWithRouter : useActiveTabWithoutRouter, labelsHash: labelsHash, containerRef: containerRef, externalActiveTab: controlledActiveTab }));
66
60
  }
67
- function TabsView({ id, className, size, childrenArray, useActiveTab, initialTab, isReady, labelsHash, containerRef, onReadyChange, externalActiveTab, }) {
61
+ function TabsView({ id, className, size, childrenArray, useActiveTab, initialTab, labelsHash, containerRef, externalActiveTab, }) {
68
62
  const { activeTab, setActiveTab } = useActiveTab(initialTab, id, childrenArray);
69
63
  (0, react_1.useEffect)(() => {
70
64
  if (externalActiveTab && externalActiveTab !== activeTab) {
71
65
  setActiveTab(externalActiveTab);
72
66
  }
73
67
  }, [externalActiveTab, activeTab, setActiveTab]);
74
- return (react_1.default.createElement(TabsContainer, { "data-component-name": "Markdoc/Tabs/Tabs", className: className, key: id, "$isReady": isReady },
75
- react_1.default.createElement(TabList_1.TabList, { key: labelsHash, size: size, childrenArray: childrenArray, activeTab: activeTab, onTabChange: setActiveTab, containerRef: containerRef, onReadyChange: onReadyChange }),
68
+ return (react_1.default.createElement(TabsContainer, { "data-component-name": "Markdoc/Tabs/Tabs", className: className, key: id },
69
+ react_1.default.createElement(TabList_1.TabList, { key: labelsHash, size: size, childrenArray: childrenArray, activeTab: activeTab, onTabChange: setActiveTab, containerRef: containerRef }),
76
70
  childrenArray.map((child, index) => {
77
71
  const { label } = child.props;
78
72
  const tabId = (0, utils_1.getTabId)(label, index);
@@ -123,13 +117,6 @@ const TabsContainer = styled_components_1.default.div `
123
117
  margin: 0;
124
118
  padding: 0;
125
119
  }
126
-
127
- ${({ $isReady }) => !$isReady &&
128
- (0, styled_components_1.css) `
129
- opacity: 0;
130
- pointer-events: none;
131
- overflow: hidden;
132
- `}
133
120
  `;
134
121
  exports.TabContent = styled_components_1.default.div `
135
122
  color: var(--md-tabs-content-text-color);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.63.0-next.4",
3
+ "version": "0.63.0-next.6",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -63,7 +63,7 @@
63
63
  "vitest": "4.0.10",
64
64
  "vitest-when": "0.6.2",
65
65
  "webpack": "5.105.2",
66
- "@redocly/realm-asyncapi-sdk": "0.9.0-next.3"
66
+ "@redocly/realm-asyncapi-sdk": "0.9.0-next.5"
67
67
  },
68
68
  "dependencies": {
69
69
  "@tanstack/react-query": "5.62.3",
@@ -78,10 +78,10 @@
78
78
  "lodash.debounce": "^4.0.8",
79
79
  "lodash.throttle": "4.1.1",
80
80
  "nprogress": "0.2.0",
81
- "openapi-sampler": "1.7.0",
81
+ "openapi-sampler": "^1.7.2",
82
82
  "react-calendar": "5.1.0",
83
83
  "react-date-picker": "11.0.0",
84
- "@redocly/config": "0.44.0"
84
+ "@redocly/config": "0.44.1"
85
85
  },
86
86
  "scripts": {
87
87
  "watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
@@ -28,7 +28,7 @@ export const accordion = css`
28
28
  --accordion-header-font-size: var(--font-size-base); // @presenter FontSize
29
29
  --accordion-header-font-weight: var(--font-weight-medium, 500); // @presenter FontWeight
30
30
  --accordion-header-text-color: var(--text-color-primary);
31
- --accordion-header-padding: var(--spacing-sm) var(--spacing-base);
31
+ --accordion-header-padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-xs) var(--spacing-base);
32
32
  --accordion-header-line-height: var(--line-height-base); // @presenter LineHeight
33
33
  --accordion-header-bg-color: transparent; // @presenter Color
34
34
  --accordion-header-border: none; // @presenter Border
@@ -41,7 +41,7 @@ export const accordion = css`
41
41
  --accordion-body-font-size: var(--font-size-base); // @presenter FontSize
42
42
  --accordion-body-font-weight: var(--font-weight-regular); // @presenter FontWeight
43
43
  --accordion-body-text-color: var(--text-color-secondary);
44
- --accordion-body-padding: 0 var(--spacing-xs) var(--spacing-sm);
44
+ --accordion-body-padding: 0 var(--spacing-sm) var(--spacing-sm) var(--spacing-base);
45
45
  --accordion-body-bg-color: transparent; // @presenter Color
46
46
  --accordion-body-border: none; // @presenter Border
47
47
 
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+
3
+ import type { JSX } from 'react';
4
+
5
+ import { Button } from '@redocly/theme/components/Button/Button';
6
+ import { DownloadIcon } from '@redocly/theme/icons/DownloadIcon/DownloadIcon';
7
+ import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
8
+ import { useThemeHooks } from '@redocly/theme/core/hooks';
9
+
10
+ export type DownloadButtonProps = {
11
+ data: string;
12
+ dataTestId?: string;
13
+ };
14
+
15
+ export function DownloadButton({
16
+ data,
17
+ dataTestId = 'download-button',
18
+ }: DownloadButtonProps): JSX.Element {
19
+ const { useTranslate } = useThemeHooks();
20
+ const { translate } = useTranslate();
21
+
22
+ return (
23
+ <div data-component-name="Buttons/DownloadButton">
24
+ <Tooltip
25
+ tip={translate('button.download.tooltipText', 'Download description')}
26
+ placement="top"
27
+ arrowPosition="right"
28
+ >
29
+ <a href={data} target="_blank" download rel="noreferrer">
30
+ <Button
31
+ variant="text"
32
+ size="small"
33
+ aria-label="Download"
34
+ icon={<DownloadIcon />}
35
+ data-testid={dataTestId}
36
+ />
37
+ </a>
38
+ </Tooltip>
39
+ </div>
40
+ );
41
+ }
@@ -4,6 +4,8 @@ import type { JSX } from 'react';
4
4
 
5
5
  import { Button } from '@redocly/theme/components/Button/Button';
6
6
  import { EmailIcon } from '@redocly/theme/icons/EmailIcon/EmailIcon';
7
+ import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
8
+ import { useThemeHooks } from '@redocly/theme/core/hooks';
7
9
 
8
10
  export type EmailButtonProps = {
9
11
  data: string;
@@ -11,20 +13,28 @@ export type EmailButtonProps = {
11
13
  };
12
14
 
13
15
  export function EmailButton({ data, dataTestId = 'email-button' }: EmailButtonProps): JSX.Element {
16
+ const { useTranslate } = useThemeHooks();
17
+ const { translate } = useTranslate();
14
18
  const onClick = () => {
15
19
  window.location.href = `mailto:${data}`;
16
20
  };
17
21
 
18
22
  return (
19
23
  <div data-component-name="Buttons/EmailButton">
20
- <Button
21
- onClick={onClick}
22
- icon={<EmailIcon />}
23
- size="small"
24
- variant="text"
25
- data-testid={dataTestId}
26
- aria-label="Email"
27
- />
24
+ <Tooltip
25
+ tip={translate('button.email.tooltipText', 'Send email')}
26
+ placement="top"
27
+ arrowPosition="right"
28
+ >
29
+ <Button
30
+ onClick={onClick}
31
+ icon={<EmailIcon />}
32
+ size="small"
33
+ variant="text"
34
+ data-testid={dataTestId}
35
+ aria-label="Email"
36
+ />
37
+ </Tooltip>
28
38
  </div>
29
39
  );
30
40
  }
@@ -4,6 +4,8 @@ import type { JSX } from 'react';
4
4
 
5
5
  import { Button } from '@redocly/theme/components/Button/Button';
6
6
  import { ArrowUpRightIcon } from '@redocly/theme/icons/ArrowUpRightIcon/ArrowUpRightIcon';
7
+ import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
8
+ import { useThemeHooks } from '@redocly/theme/core/hooks';
7
9
 
8
10
  export type NewTabButtonProps = {
9
11
  data: string;
@@ -14,20 +16,29 @@ export function NewTabButton({
14
16
  data,
15
17
  dataTestId = 'new-tab-button',
16
18
  }: NewTabButtonProps): JSX.Element {
19
+ const { useTranslate } = useThemeHooks();
20
+ const { translate } = useTranslate();
21
+
17
22
  const onClick = () => {
18
23
  window.open(data, '_blank');
19
24
  };
20
25
 
21
26
  return (
22
27
  <div data-component-name="Buttons/NewTabButton">
23
- <Button
24
- onClick={onClick}
25
- icon={<ArrowUpRightIcon />}
26
- data-testid={dataTestId}
27
- aria-label="Open in new tab"
28
- size="small"
29
- variant="text"
30
- />
28
+ <Tooltip
29
+ tip={translate('button.externalLink.tooltipText', 'Open in new tab')}
30
+ placement="top"
31
+ arrowPosition="right"
32
+ >
33
+ <Button
34
+ onClick={onClick}
35
+ icon={<ArrowUpRightIcon />}
36
+ data-testid={dataTestId}
37
+ aria-label="Open in new tab"
38
+ size="small"
39
+ variant="text"
40
+ />
41
+ </Tooltip>
31
42
  </div>
32
43
  );
33
44
  }