@redocly/theme 0.63.0-next.4 → 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.
- package/lib/components/Buttons/DownloadButton.d.ts +6 -0
- package/lib/components/Buttons/DownloadButton.js +20 -0
- package/lib/components/Buttons/EmailButton.js +6 -1
- package/lib/components/Buttons/NewTabButton.js +6 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/Search/SearchDialog.js +1 -1
- package/lib/components/SidebarActions/SidebarActions.js +1 -1
- package/lib/components/Tooltip/AnchorTooltip.js +5 -2
- package/lib/components/Tooltip/JsTooltip.js +5 -2
- package/lib/core/types/hooks.d.ts +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/tooltip.d.ts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +2 -2
- package/src/components/Buttons/DownloadButton.tsx +41 -0
- package/src/components/Buttons/EmailButton.tsx +18 -8
- package/src/components/Buttons/NewTabButton.tsx +19 -8
- package/src/components/Menu/MenuItem.tsx +1 -0
- package/src/components/Search/SearchDialog.tsx +1 -1
- package/src/components/SidebarActions/SidebarActions.tsx +1 -0
- package/src/components/Tooltip/AnchorTooltip.tsx +5 -1
- package/src/components/Tooltip/JsTooltip.tsx +5 -1
- package/src/core/types/hooks.ts +1 -1
- package/src/core/types/l10n.ts +5 -0
- package/src/core/types/tooltip.ts +1 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DownloadButton = DownloadButton;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Button_1 = require("../../components/Button/Button");
|
|
9
|
+
const DownloadIcon_1 = require("../../icons/DownloadIcon/DownloadIcon");
|
|
10
|
+
const Tooltip_1 = require("../../components/Tooltip/Tooltip");
|
|
11
|
+
const hooks_1 = require("../../core/hooks");
|
|
12
|
+
function DownloadButton({ data, dataTestId = 'download-button', }) {
|
|
13
|
+
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
14
|
+
const { translate } = useTranslate();
|
|
15
|
+
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 })))));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=DownloadButton.js.map
|
|
@@ -7,11 +7,16 @@ exports.EmailButton = EmailButton;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const Button_1 = require("../../components/Button/Button");
|
|
9
9
|
const EmailIcon_1 = require("../../icons/EmailIcon/EmailIcon");
|
|
10
|
+
const Tooltip_1 = require("../../components/Tooltip/Tooltip");
|
|
11
|
+
const hooks_1 = require("../../core/hooks");
|
|
10
12
|
function EmailButton({ data, dataTestId = 'email-button' }) {
|
|
13
|
+
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
14
|
+
const { translate } = useTranslate();
|
|
11
15
|
const onClick = () => {
|
|
12
16
|
window.location.href = `mailto:${data}`;
|
|
13
17
|
};
|
|
14
18
|
return (react_1.default.createElement("div", { "data-component-name": "Buttons/EmailButton" },
|
|
15
|
-
react_1.default.createElement(
|
|
19
|
+
react_1.default.createElement(Tooltip_1.Tooltip, { tip: translate('button.email.tooltipText', 'Send email'), placement: "top", arrowPosition: "right" },
|
|
20
|
+
react_1.default.createElement(Button_1.Button, { onClick: onClick, icon: react_1.default.createElement(EmailIcon_1.EmailIcon, null), size: "small", variant: "text", "data-testid": dataTestId, "aria-label": "Email" }))));
|
|
16
21
|
}
|
|
17
22
|
//# sourceMappingURL=EmailButton.js.map
|
|
@@ -7,11 +7,16 @@ exports.NewTabButton = NewTabButton;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const Button_1 = require("../../components/Button/Button");
|
|
9
9
|
const ArrowUpRightIcon_1 = require("../../icons/ArrowUpRightIcon/ArrowUpRightIcon");
|
|
10
|
+
const Tooltip_1 = require("../../components/Tooltip/Tooltip");
|
|
11
|
+
const hooks_1 = require("../../core/hooks");
|
|
10
12
|
function NewTabButton({ data, dataTestId = 'new-tab-button', }) {
|
|
13
|
+
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
14
|
+
const { translate } = useTranslate();
|
|
11
15
|
const onClick = () => {
|
|
12
16
|
window.open(data, '_blank');
|
|
13
17
|
};
|
|
14
18
|
return (react_1.default.createElement("div", { "data-component-name": "Buttons/NewTabButton" },
|
|
15
|
-
react_1.default.createElement(
|
|
19
|
+
react_1.default.createElement(Tooltip_1.Tooltip, { tip: translate('button.externalLink.tooltipText', 'Open in new tab'), placement: "top", arrowPosition: "right" },
|
|
20
|
+
react_1.default.createElement(Button_1.Button, { onClick: onClick, icon: react_1.default.createElement(ArrowUpRightIcon_1.ArrowUpRightIcon, null), "data-testid": dataTestId, "aria-label": "Open in new tab", size: "small", variant: "text" }))));
|
|
16
21
|
}
|
|
17
22
|
//# sourceMappingURL=NewTabButton.js.map
|
|
@@ -100,7 +100,7 @@ function MenuItem(props) {
|
|
|
100
100
|
item.sublabel ? (react_1.default.createElement(MenuItemSubLabel, null, translate(item.subLabelTranslationKey, item.sublabel))) : null),
|
|
101
101
|
isDrilldown ? react_1.default.createElement(ArrowRightIcon_1.ArrowRightIcon, { size: "12px" }) : null,
|
|
102
102
|
hasHttpTag ? (react_1.default.createElement(HttpTag_1.HttpTag, { color: httpColor || '' }, item.httpVerb === 'hook' ? 'event' : item.httpVerb)) : null));
|
|
103
|
-
return (react_1.default.createElement(MenuItemWrapper, { "data-component-name": "Menu/MenuItem", className: generateClassName({ type, item, className }) },
|
|
103
|
+
return (react_1.default.createElement(MenuItemWrapper, { "data-component-name": "Menu/MenuItem", className: generateClassName({ type, item, className }), role: "listitem" },
|
|
104
104
|
item.link ? (react_1.default.createElement(MenuItemLink, { to: item.link, external: item.external, target: item.target, languageInsensitive: item.languageInsensitive, onKeyDown: handleExpandOnEnter }, label)) : (label),
|
|
105
105
|
isNested ? (react_1.default.createElement(MenuItemNestedWrapper, { depth: depth, ref: nestedMenuRef, style: style }, isExpanded || !canUnmount ? props.children : null)) : null,
|
|
106
106
|
item.separatorLine ? (react_1.default.createElement(MenuItemSeparatorLine, { depth: depth, linePosition: item.linePosition })) : null));
|
|
@@ -73,7 +73,7 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
73
73
|
const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, groupField, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
|
|
74
74
|
const { isFilterOpen, onFilterToggle, onFilterChange, onFilterReset, onFacetReset, onQuickFilterReset, } = (0, hooks_1.useSearchFilter)(filter, setFilter);
|
|
75
75
|
const { addSearchHistoryItem } = (0, hooks_1.useRecentSearches)();
|
|
76
|
-
const aiSearch = useAiSearch({ filter });
|
|
76
|
+
const aiSearch = useAiSearch({ filter: filter, product: product === null || product === void 0 ? void 0 : product.name });
|
|
77
77
|
(0, hooks_1.useModalScrollLock)(true);
|
|
78
78
|
const searchInputRef = (0, react_1.useRef)(null);
|
|
79
79
|
const modalRef = (0, react_1.useRef)(null);
|
|
@@ -30,7 +30,7 @@ const SidebarActions = ({ layout, hideCollapseSidebarButton = false, collapsedSi
|
|
|
30
30
|
else {
|
|
31
31
|
telemetry.sendSidebarItemCollapsedMessage();
|
|
32
32
|
}
|
|
33
|
-
}, size: "small", variant: "outlined", icon: collapsedSidebar ? react_1.default.createElement(SidePanelOpenIcon_1.SidePanelOpenIcon, null) : react_1.default.createElement(SidePanelCloseIcon_1.SidePanelCloseIcon, null) }))),
|
|
33
|
+
}, size: "small", variant: "outlined", "aria-label": collapsedSidebar ? 'Show sidebar' : 'Hide sidebar', icon: collapsedSidebar ? react_1.default.createElement(SidePanelOpenIcon_1.SidePanelOpenIcon, null) : react_1.default.createElement(SidePanelCloseIcon_1.SidePanelCloseIcon, null) }))),
|
|
34
34
|
isApiDocs && (react_1.default.createElement(styled_1.ControlsWrapChangeLayoutButtons, { isCollapsed: collapsedSidebar },
|
|
35
35
|
react_1.default.createElement(ChangeViewButton_1.ChangeViewButton, { collapsedSidebar: collapsedSidebar, layout: layout, onClick: () => {
|
|
36
36
|
onChangeViewClick();
|
|
@@ -38,7 +38,7 @@ const react_1 = __importStar(require("react"));
|
|
|
38
38
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
39
39
|
const hooks_1 = require("../../core/hooks");
|
|
40
40
|
const Portal_1 = require("../../components/Portal/Portal");
|
|
41
|
-
function TooltipComponent({ children, isOpen, tip, withArrow = true, placement = 'top', className = 'default', width, dataTestId, disabled = false, arrowPosition = 'center', }) {
|
|
41
|
+
function TooltipComponent({ children, isOpen, tip, withArrow = true, placement = 'top', className = 'default', width, dataTestId, disabled = false, arrowPosition = 'center', onClick, }) {
|
|
42
42
|
const tooltipWrapperRef = (0, react_1.useRef)(null);
|
|
43
43
|
const tooltipBodyRef = (0, react_1.useRef)(null);
|
|
44
44
|
const { isOpened, handleOpen, handleClose } = (0, hooks_1.useControl)(isOpen);
|
|
@@ -59,7 +59,10 @@ function TooltipComponent({ children, isOpen, tip, withArrow = true, placement =
|
|
|
59
59
|
? {
|
|
60
60
|
onMouseEnter: handleOpen,
|
|
61
61
|
onMouseLeave: handleClose,
|
|
62
|
-
onClick:
|
|
62
|
+
onClick: (e) => {
|
|
63
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
64
|
+
handleClose();
|
|
65
|
+
},
|
|
63
66
|
onFocus: handleOpen,
|
|
64
67
|
onBlur: handleClose,
|
|
65
68
|
}
|
|
@@ -38,7 +38,7 @@ const react_1 = __importStar(require("react"));
|
|
|
38
38
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
39
39
|
const hooks_1 = require("../../core/hooks");
|
|
40
40
|
const Portal_1 = require("../../components/Portal/Portal");
|
|
41
|
-
function TooltipComponent({ children, isOpen, tip, withArrow = true, placement = 'top', className = 'default', width, dataTestId, disabled = false, arrowPosition = 'center', }) {
|
|
41
|
+
function TooltipComponent({ children, isOpen, tip, withArrow = true, placement = 'top', className = 'default', width, dataTestId, disabled = false, arrowPosition = 'center', onClick, }) {
|
|
42
42
|
const ref = (0, react_1.useRef)(null);
|
|
43
43
|
const { isOpened, handleOpen, handleClose } = (0, hooks_1.useControl)(isOpen);
|
|
44
44
|
const [tooltipPosition, setTooltipPosition] = (0, react_1.useState)({ top: 0, left: 0 });
|
|
@@ -111,7 +111,10 @@ function TooltipComponent({ children, isOpen, tip, withArrow = true, placement =
|
|
|
111
111
|
!disabled && {
|
|
112
112
|
onMouseEnter: handleOpen,
|
|
113
113
|
onMouseLeave: handleClose,
|
|
114
|
-
onClick:
|
|
114
|
+
onClick: (e) => {
|
|
115
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
116
|
+
handleClose();
|
|
117
|
+
},
|
|
115
118
|
onFocus: handleOpen,
|
|
116
119
|
onBlur: handleClose,
|
|
117
120
|
};
|
package/lib/core/types/l10n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TOptions } from 'i18next';
|
|
2
|
-
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.assistant' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.toolResult.found' | 'search.ai.toolResult.found.documents' | 'search.ai.toolCall.searching' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.forbidden.description' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.maxLength' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to' | 'mermaid.openFullscreen' | 'mermaid.zoomIn' | 'mermaid.zoomOut' | 'mermaid.reset' | 'mermaid.close' | 'mermaid.viewer';
|
|
2
|
+
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.assistant' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.toolResult.found' | 'search.ai.toolResult.found.documents' | 'search.ai.toolCall.searching' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.forbidden.description' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.maxLength' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.languages.moreButton.tooltipText' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'button.copy.tooltipText' | 'button.download.tooltipText' | 'button.externalLink.tooltipText' | 'button.email.tooltipText' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to' | 'mermaid.openFullscreen' | 'mermaid.zoomIn' | 'mermaid.zoomOut' | 'mermaid.reset' | 'mermaid.close' | 'mermaid.viewer';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
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);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.63.0-next.
|
|
3
|
+
"version": "0.63.0-next.5",
|
|
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.
|
|
66
|
+
"@redocly/realm-asyncapi-sdk": "0.9.0-next.4"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@tanstack/react-query": "5.62.3",
|
|
@@ -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
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
}
|
|
@@ -142,6 +142,7 @@ export function MenuItem(props: React.PropsWithChildren<MenuItemProps>): JSX.Ele
|
|
|
142
142
|
<MenuItemWrapper
|
|
143
143
|
data-component-name="Menu/MenuItem"
|
|
144
144
|
className={generateClassName({ type, item, className })}
|
|
145
|
+
role="listitem"
|
|
145
146
|
>
|
|
146
147
|
{item.link ? (
|
|
147
148
|
<MenuItemLink
|
|
@@ -75,7 +75,7 @@ export function SearchDialog({
|
|
|
75
75
|
onQuickFilterReset,
|
|
76
76
|
} = useSearchFilter(filter, setFilter);
|
|
77
77
|
const { addSearchHistoryItem } = useRecentSearches();
|
|
78
|
-
const aiSearch = useAiSearch({ filter });
|
|
78
|
+
const aiSearch = useAiSearch({ filter: filter, product: product?.name });
|
|
79
79
|
useModalScrollLock(true);
|
|
80
80
|
const searchInputRef = useRef<HTMLInputElement>(null);
|
|
81
81
|
const modalRef = useRef<HTMLDivElement>(null);
|
|
@@ -22,6 +22,7 @@ function TooltipComponent({
|
|
|
22
22
|
dataTestId,
|
|
23
23
|
disabled = false,
|
|
24
24
|
arrowPosition = 'center',
|
|
25
|
+
onClick,
|
|
25
26
|
}: PropsWithChildren<Props>): JSX.Element {
|
|
26
27
|
const tooltipWrapperRef = useRef<HTMLDivElement | null>(null);
|
|
27
28
|
const tooltipBodyRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -47,7 +48,10 @@ function TooltipComponent({
|
|
|
47
48
|
? {
|
|
48
49
|
onMouseEnter: handleOpen,
|
|
49
50
|
onMouseLeave: handleClose,
|
|
50
|
-
onClick:
|
|
51
|
+
onClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
|
52
|
+
onClick?.(e);
|
|
53
|
+
handleClose();
|
|
54
|
+
},
|
|
51
55
|
onFocus: handleOpen,
|
|
52
56
|
onBlur: handleClose,
|
|
53
57
|
}
|
|
@@ -18,6 +18,7 @@ function TooltipComponent({
|
|
|
18
18
|
dataTestId,
|
|
19
19
|
disabled = false,
|
|
20
20
|
arrowPosition = 'center',
|
|
21
|
+
onClick,
|
|
21
22
|
}: PropsWithChildren<TooltipProps>): JSX.Element {
|
|
22
23
|
const ref = useRef<HTMLDivElement | null>(null);
|
|
23
24
|
const { isOpened, handleOpen, handleClose } = useControl(isOpen);
|
|
@@ -98,7 +99,10 @@ function TooltipComponent({
|
|
|
98
99
|
!disabled && {
|
|
99
100
|
onMouseEnter: handleOpen,
|
|
100
101
|
onMouseLeave: handleClose,
|
|
101
|
-
onClick:
|
|
102
|
+
onClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
|
103
|
+
onClick?.(e);
|
|
104
|
+
handleClose();
|
|
105
|
+
},
|
|
102
106
|
onFocus: handleOpen,
|
|
103
107
|
onBlur: handleClose,
|
|
104
108
|
};
|
package/src/core/types/hooks.ts
CHANGED
|
@@ -117,7 +117,7 @@ export type ThemeHooks = {
|
|
|
117
117
|
advancedSearch?: boolean;
|
|
118
118
|
askAi?: boolean;
|
|
119
119
|
};
|
|
120
|
-
useAiSearch: (options?: { filter?: SearchFilterItem[] }) => {
|
|
120
|
+
useAiSearch: (options?: { filter?: SearchFilterItem[]; product?: string }) => {
|
|
121
121
|
askQuestion: (question: string, history?: AiSearchConversationItem[]) => void;
|
|
122
122
|
isGeneratingResponse: boolean;
|
|
123
123
|
question: string;
|
package/src/core/types/l10n.ts
CHANGED
|
@@ -275,6 +275,7 @@ export type TranslationKey =
|
|
|
275
275
|
| 'openapi.actions.hide'
|
|
276
276
|
| 'openapi.actions.more'
|
|
277
277
|
| 'openapi.languages.title'
|
|
278
|
+
| 'openapi.languages.moreButton.tooltipText'
|
|
278
279
|
| 'openapi.servers.title'
|
|
279
280
|
| 'openapi.operations'
|
|
280
281
|
| 'openapi.webhooks'
|
|
@@ -395,6 +396,10 @@ export type TranslationKey =
|
|
|
395
396
|
| 'graphql.sample'
|
|
396
397
|
| 'graphql.referenced'
|
|
397
398
|
| 'graphql.content.fragment'
|
|
399
|
+
| 'button.copy.tooltipText'
|
|
400
|
+
| 'button.download.tooltipText'
|
|
401
|
+
| 'button.externalLink.tooltipText'
|
|
402
|
+
| 'button.email.tooltipText'
|
|
398
403
|
| 'codeWalkthrough.download'
|
|
399
404
|
| 'codeWalkthrough.preview'
|
|
400
405
|
| 'time.justNow'
|
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';
|