@redocly/theme 0.62.0-next.2 → 0.62.0-next.4
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/Search/SearchDialog.js +11 -2
- package/lib/components/UserMenu/LoginButton.d.ts +8 -2
- package/lib/components/UserMenu/LoginButton.js +4 -3
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/markdoc/components/LoginButton/LoginButton.d.ts +9 -0
- package/lib/markdoc/components/LoginButton/LoginButton.js +48 -0
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/default.d.ts +6 -0
- package/lib/markdoc/default.js +2 -0
- package/lib/markdoc/tags/login-button.d.ts +2 -0
- package/lib/markdoc/tags/login-button.js +32 -0
- package/package.json +1 -1
- package/src/components/Search/SearchDialog.tsx +29 -14
- package/src/components/UserMenu/LoginButton.tsx +22 -7
- package/src/core/types/l10n.ts +1 -0
- package/src/markdoc/components/LoginButton/LoginButton.tsx +38 -0
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/login-button.ts +30 -0
|
@@ -194,13 +194,15 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
194
194
|
});
|
|
195
195
|
} }, translate('search.ai.button', 'Search with AI'))) : null,
|
|
196
196
|
showSearchFilterButton && (react_1.default.createElement(SearchFilterToggleButton, { icon: react_1.default.createElement(SettingsIcon_1.SettingsIcon, null), onClick: onFilterToggle })))))) : (react_1.default.createElement(AiDialogHeaderWrapper, null,
|
|
197
|
-
react_1.default.createElement(
|
|
197
|
+
initialMode === 'ai-dialog' ? (react_1.default.createElement(AiDialogHeaderTitle, null,
|
|
198
|
+
react_1.default.createElement(AiStarsGradientIcon_1.AiStarsGradientIcon, { color: "var(--search-ai-button-icon-color)", size: "1.25rem" }),
|
|
199
|
+
translate('search.ai.assistant', 'Assistant'))) : (react_1.default.createElement(Button_1.Button, { variant: "secondary", onClick: () => {
|
|
198
200
|
setMode('search');
|
|
199
201
|
aiSearch.clearConversation();
|
|
200
202
|
focusSearchInput();
|
|
201
203
|
}, tabIndex: 0, icon: react_1.default.createElement(ChevronLeftIcon_1.ChevronLeftIcon, null) }, isMobile
|
|
202
204
|
? translate('search.ai.back', 'Back')
|
|
203
|
-
: translate('search.ai.backToSearch', 'Back to search')),
|
|
205
|
+
: translate('search.ai.backToSearch', 'Back to search'))),
|
|
204
206
|
react_1.default.createElement(AiDialogHeaderActionsWrapper, null,
|
|
205
207
|
react_1.default.createElement(Button_1.Button, { variant: "secondary", disabled: !aiSearch.conversation.length, onClick: () => {
|
|
206
208
|
refreshSearchSessionId();
|
|
@@ -345,6 +347,13 @@ const AiDialogHeaderActionsWrapper = styled_components_1.default.div `
|
|
|
345
347
|
display: flex;
|
|
346
348
|
gap: var(--spacing-xxs);
|
|
347
349
|
`;
|
|
350
|
+
const AiDialogHeaderTitle = styled_components_1.default.span `
|
|
351
|
+
display: flex;
|
|
352
|
+
align-items: center;
|
|
353
|
+
gap: var(--spacing-xs);
|
|
354
|
+
font-weight: var(--font-weight-semibold);
|
|
355
|
+
font-size: var(--font-size-lg);
|
|
356
|
+
`;
|
|
348
357
|
const SearchDialogBody = styled_components_1.default.div `
|
|
349
358
|
display: flex;
|
|
350
359
|
flex-direction: row-reverse;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonVariant, ButtonSize } from '../../components/Button/Button';
|
|
2
3
|
export type LoginButtonProps = {
|
|
3
4
|
href: string;
|
|
4
5
|
className?: string;
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
label?: string;
|
|
9
|
+
labelTranslationKey?: string;
|
|
10
|
+
['data-component-name']?: string;
|
|
5
11
|
};
|
|
6
|
-
export declare function LoginButton({ href, className }: LoginButtonProps): JSX.Element;
|
|
12
|
+
export declare function LoginButton({ href, className, variant, size, label, labelTranslationKey, 'data-component-name': componentName, }: LoginButtonProps): React.JSX.Element;
|
|
@@ -7,11 +7,12 @@ exports.LoginButton = LoginButton;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const hooks_1 = require("../../core/hooks");
|
|
9
9
|
const Button_1 = require("../../components/Button/Button");
|
|
10
|
-
function LoginButton({ href, className }) {
|
|
10
|
+
function LoginButton({ href, className, variant = 'primary', size = 'medium', label, labelTranslationKey = 'userMenu.login', 'data-component-name': componentName = 'UserMenu/LoginButton', }) {
|
|
11
11
|
const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
12
12
|
const { translate } = useTranslate();
|
|
13
13
|
const telemetry = useTelemetry();
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const buttonLabel = label || translate(labelTranslationKey, 'Login');
|
|
15
|
+
return (react_1.default.createElement("div", { "data-component-name": componentName, className: className },
|
|
16
|
+
react_1.default.createElement(Button_1.Button, { "data-translation-key": label ? undefined : labelTranslationKey, to: href, onClick: () => telemetry.sendLoginButtonClickedMessage(), "data-testid": "login-btn", extraClass: className, variant: variant, size: size }, buttonLabel)));
|
|
16
17
|
}
|
|
17
18
|
//# sourceMappingURL=LoginButton.js.map
|
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.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.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.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';
|
|
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.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.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';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ButtonVariant, ButtonSize } from '../../../components/Button/Button';
|
|
3
|
+
export type MarkdocLoginButtonProps = {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
size?: ButtonSize;
|
|
6
|
+
label?: string;
|
|
7
|
+
labelTranslationKey?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function LoginButton({ variant, size, label, labelTranslationKey, }: MarkdocLoginButtonProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.LoginButton = LoginButton;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const hooks_1 = require("../../../core/hooks");
|
|
39
|
+
const LoginButton_1 = require("../../../components/UserMenu/LoginButton");
|
|
40
|
+
function LoginButton({ variant, size, label, labelTranslationKey, }) {
|
|
41
|
+
const { useUserMenu } = (0, hooks_1.useThemeHooks)();
|
|
42
|
+
const { userData, loginUrl } = useUserMenu();
|
|
43
|
+
if (userData === null || userData === void 0 ? void 0 : userData.isAuthenticated) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return (React.createElement(LoginButton_1.LoginButton, { href: loginUrl || '', variant: variant, size: size, label: label, labelTranslationKey: labelTranslationKey, "data-component-name": "Markdoc/LoginButton" }));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=LoginButton.js.map
|
|
@@ -21,3 +21,4 @@ export * from '../../markdoc/components/CodeWalkthrough/CodeContainer';
|
|
|
21
21
|
export * from '../../markdoc/components/CodeGroup/CodeGroup';
|
|
22
22
|
export * from '../../markdoc/components/Icon/Icon';
|
|
23
23
|
export * from '../../markdoc/components/ConnectMCP/ConnectMCP';
|
|
24
|
+
export * from '../../markdoc/components/LoginButton/LoginButton';
|
|
@@ -37,4 +37,5 @@ __exportStar(require("../../markdoc/components/CodeWalkthrough/CodeContainer"),
|
|
|
37
37
|
__exportStar(require("../../markdoc/components/CodeGroup/CodeGroup"), exports);
|
|
38
38
|
__exportStar(require("../../markdoc/components/Icon/Icon"), exports);
|
|
39
39
|
__exportStar(require("../../markdoc/components/ConnectMCP/ConnectMCP"), exports);
|
|
40
|
+
__exportStar(require("../../markdoc/components/LoginButton/LoginButton"), exports);
|
|
40
41
|
//# sourceMappingURL=default.js.map
|
package/lib/markdoc/default.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { toggle } from '../markdoc/tags/code-toggle';
|
|
|
23
23
|
import { codeGroup } from '../markdoc/tags/code-group';
|
|
24
24
|
import { icon } from '../markdoc/tags/icon';
|
|
25
25
|
import { connectMcp } from '../markdoc/tags/connect-mcp';
|
|
26
|
+
import { loginButton } from '../markdoc/tags/login-button';
|
|
26
27
|
export declare const tags: {
|
|
27
28
|
[admonition.tagName]: import("@markdoc/markdoc").Schema & {
|
|
28
29
|
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
@@ -119,4 +120,9 @@ export declare const tags: {
|
|
|
119
120
|
resolver?: string;
|
|
120
121
|
}>;
|
|
121
122
|
};
|
|
123
|
+
[loginButton.tagName]: import("@markdoc/markdoc").Schema & {
|
|
124
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
125
|
+
resolver?: string;
|
|
126
|
+
}>;
|
|
127
|
+
};
|
|
122
128
|
};
|
package/lib/markdoc/default.js
CHANGED
|
@@ -65,6 +65,7 @@ const code_toggle_1 = require("../markdoc/tags/code-toggle");
|
|
|
65
65
|
const code_group_1 = require("../markdoc/tags/code-group");
|
|
66
66
|
const icon_1 = require("../markdoc/tags/icon");
|
|
67
67
|
const connect_mcp_1 = require("../markdoc/tags/connect-mcp");
|
|
68
|
+
const login_button_1 = require("../markdoc/tags/login-button");
|
|
68
69
|
exports.tags = {
|
|
69
70
|
[admonition_1.admonition.tagName]: admonition_1.admonition.schema,
|
|
70
71
|
[debug_1.debug.tagName]: debug_1.debug.schema,
|
|
@@ -85,5 +86,6 @@ exports.tags = {
|
|
|
85
86
|
[code_group_1.codeGroup.tagName]: code_group_1.codeGroup.schema,
|
|
86
87
|
[icon_1.icon.tagName]: icon_1.icon.schema,
|
|
87
88
|
[connect_mcp_1.connectMcp.tagName]: connect_mcp_1.connectMcp.schema,
|
|
89
|
+
[login_button_1.loginButton.tagName]: login_button_1.loginButton.schema,
|
|
88
90
|
};
|
|
89
91
|
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loginButton = void 0;
|
|
4
|
+
exports.loginButton = {
|
|
5
|
+
schema: {
|
|
6
|
+
render: 'LoginButton',
|
|
7
|
+
attributes: {
|
|
8
|
+
variant: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: 'primary',
|
|
11
|
+
matches: ['primary', 'secondary', 'outlined', 'text', 'link', 'ghost'],
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'medium',
|
|
16
|
+
matches: ['small', 'medium', 'large'],
|
|
17
|
+
},
|
|
18
|
+
label: {
|
|
19
|
+
type: String,
|
|
20
|
+
description: 'Custom button label text. Overrides translation.',
|
|
21
|
+
},
|
|
22
|
+
labelTranslationKey: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'userMenu.login',
|
|
25
|
+
description: 'Translation key for the button label.',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
selfClosing: true,
|
|
29
|
+
},
|
|
30
|
+
tagName: 'login-button',
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=login-button.js.map
|
package/package.json
CHANGED
|
@@ -262,20 +262,27 @@ export function SearchDialog({
|
|
|
262
262
|
</>
|
|
263
263
|
) : (
|
|
264
264
|
<AiDialogHeaderWrapper>
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
265
|
+
{initialMode === 'ai-dialog' ? (
|
|
266
|
+
<AiDialogHeaderTitle>
|
|
267
|
+
<AiStarsGradientIcon color="var(--search-ai-button-icon-color)" size="1.25rem" />
|
|
268
|
+
{translate('search.ai.assistant', 'Assistant')}
|
|
269
|
+
</AiDialogHeaderTitle>
|
|
270
|
+
) : (
|
|
271
|
+
<Button
|
|
272
|
+
variant="secondary"
|
|
273
|
+
onClick={() => {
|
|
274
|
+
setMode('search');
|
|
275
|
+
aiSearch.clearConversation();
|
|
276
|
+
focusSearchInput();
|
|
277
|
+
}}
|
|
278
|
+
tabIndex={0}
|
|
279
|
+
icon={<ChevronLeftIcon />}
|
|
280
|
+
>
|
|
281
|
+
{isMobile
|
|
282
|
+
? translate('search.ai.back', 'Back')
|
|
283
|
+
: translate('search.ai.backToSearch', 'Back to search')}
|
|
284
|
+
</Button>
|
|
285
|
+
)}
|
|
279
286
|
<AiDialogHeaderActionsWrapper>
|
|
280
287
|
<Button
|
|
281
288
|
variant="secondary"
|
|
@@ -567,6 +574,14 @@ const AiDialogHeaderActionsWrapper = styled.div`
|
|
|
567
574
|
gap: var(--spacing-xxs);
|
|
568
575
|
`;
|
|
569
576
|
|
|
577
|
+
const AiDialogHeaderTitle = styled.span`
|
|
578
|
+
display: flex;
|
|
579
|
+
align-items: center;
|
|
580
|
+
gap: var(--spacing-xs);
|
|
581
|
+
font-weight: var(--font-weight-semibold);
|
|
582
|
+
font-size: var(--font-size-lg);
|
|
583
|
+
`;
|
|
584
|
+
|
|
570
585
|
const SearchDialogBody = styled.div`
|
|
571
586
|
display: flex;
|
|
572
587
|
flex-direction: row-reverse;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { ButtonVariant, ButtonSize } from '@redocly/theme/components/Button/Button';
|
|
4
4
|
|
|
5
5
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
6
6
|
import { Button } from '@redocly/theme/components/Button/Button';
|
|
@@ -8,25 +8,40 @@ import { Button } from '@redocly/theme/components/Button/Button';
|
|
|
8
8
|
export type LoginButtonProps = {
|
|
9
9
|
href: string;
|
|
10
10
|
className?: string;
|
|
11
|
+
variant?: ButtonVariant;
|
|
12
|
+
size?: ButtonSize;
|
|
13
|
+
label?: string;
|
|
14
|
+
labelTranslationKey?: string;
|
|
15
|
+
['data-component-name']?: string;
|
|
11
16
|
};
|
|
12
17
|
|
|
13
|
-
export function LoginButton({
|
|
18
|
+
export function LoginButton({
|
|
19
|
+
href,
|
|
20
|
+
className,
|
|
21
|
+
variant = 'primary',
|
|
22
|
+
size = 'medium',
|
|
23
|
+
label,
|
|
24
|
+
labelTranslationKey = 'userMenu.login',
|
|
25
|
+
'data-component-name': componentName = 'UserMenu/LoginButton',
|
|
26
|
+
}: LoginButtonProps) {
|
|
14
27
|
const { useTranslate, useTelemetry } = useThemeHooks();
|
|
15
28
|
const { translate } = useTranslate();
|
|
16
29
|
const telemetry = useTelemetry();
|
|
17
30
|
|
|
31
|
+
const buttonLabel = label || translate(labelTranslationKey, 'Login');
|
|
32
|
+
|
|
18
33
|
return (
|
|
19
|
-
<div data-component-name=
|
|
34
|
+
<div data-component-name={componentName} className={className}>
|
|
20
35
|
<Button
|
|
21
|
-
data-translation-key=
|
|
36
|
+
data-translation-key={label ? undefined : labelTranslationKey}
|
|
22
37
|
to={href}
|
|
23
38
|
onClick={() => telemetry.sendLoginButtonClickedMessage()}
|
|
24
39
|
data-testid="login-btn"
|
|
25
40
|
extraClass={className}
|
|
26
|
-
variant=
|
|
27
|
-
size=
|
|
41
|
+
variant={variant}
|
|
42
|
+
size={size}
|
|
28
43
|
>
|
|
29
|
-
{
|
|
44
|
+
{buttonLabel}
|
|
30
45
|
</Button>
|
|
31
46
|
</div>
|
|
32
47
|
);
|
package/src/core/types/l10n.ts
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { ButtonVariant, ButtonSize } from '@redocly/theme/components/Button/Button';
|
|
4
|
+
|
|
5
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
6
|
+
import { LoginButton as UserMenuLoginButton } from '@redocly/theme/components/UserMenu/LoginButton';
|
|
7
|
+
|
|
8
|
+
export type MarkdocLoginButtonProps = {
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
label?: string;
|
|
12
|
+
labelTranslationKey?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function LoginButton({
|
|
16
|
+
variant,
|
|
17
|
+
size,
|
|
18
|
+
label,
|
|
19
|
+
labelTranslationKey,
|
|
20
|
+
}: MarkdocLoginButtonProps) {
|
|
21
|
+
const { useUserMenu } = useThemeHooks();
|
|
22
|
+
const { userData, loginUrl } = useUserMenu();
|
|
23
|
+
|
|
24
|
+
if (userData?.isAuthenticated) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<UserMenuLoginButton
|
|
30
|
+
href={loginUrl || ''}
|
|
31
|
+
variant={variant}
|
|
32
|
+
size={size}
|
|
33
|
+
label={label}
|
|
34
|
+
labelTranslationKey={labelTranslationKey}
|
|
35
|
+
data-component-name="Markdoc/LoginButton"
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -21,3 +21,4 @@ export * from '@redocly/theme/markdoc/components/CodeWalkthrough/CodeContainer';
|
|
|
21
21
|
export * from '@redocly/theme/markdoc/components/CodeGroup/CodeGroup';
|
|
22
22
|
export * from '@redocly/theme/markdoc/components/Icon/Icon';
|
|
23
23
|
export * from '@redocly/theme/markdoc/components/ConnectMCP/ConnectMCP';
|
|
24
|
+
export * from '@redocly/theme/markdoc/components/LoginButton/LoginButton';
|
package/src/markdoc/default.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { toggle } from '@redocly/theme/markdoc/tags/code-toggle';
|
|
|
26
26
|
import { codeGroup } from '@redocly/theme/markdoc/tags/code-group';
|
|
27
27
|
import { icon } from '@redocly/theme/markdoc/tags/icon';
|
|
28
28
|
import { connectMcp } from '@redocly/theme/markdoc/tags/connect-mcp';
|
|
29
|
+
import { loginButton } from '@redocly/theme/markdoc/tags/login-button';
|
|
29
30
|
|
|
30
31
|
export const tags = {
|
|
31
32
|
[admonition.tagName]: admonition.schema,
|
|
@@ -47,4 +48,5 @@ export const tags = {
|
|
|
47
48
|
[codeGroup.tagName]: codeGroup.schema,
|
|
48
49
|
[icon.tagName]: icon.schema,
|
|
49
50
|
[connectMcp.tagName]: connectMcp.schema,
|
|
51
|
+
[loginButton.tagName]: loginButton.schema,
|
|
50
52
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MarkdocSchemaWrapper } from '@redocly/theme/markdoc/tags/types';
|
|
2
|
+
|
|
3
|
+
export const loginButton: MarkdocSchemaWrapper = {
|
|
4
|
+
schema: {
|
|
5
|
+
render: 'LoginButton',
|
|
6
|
+
attributes: {
|
|
7
|
+
variant: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: 'primary',
|
|
10
|
+
matches: ['primary', 'secondary', 'outlined', 'text', 'link', 'ghost'],
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'medium',
|
|
15
|
+
matches: ['small', 'medium', 'large'],
|
|
16
|
+
},
|
|
17
|
+
label: {
|
|
18
|
+
type: String,
|
|
19
|
+
description: 'Custom button label text. Overrides translation.',
|
|
20
|
+
},
|
|
21
|
+
labelTranslationKey: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: 'userMenu.login',
|
|
24
|
+
description: 'Translation key for the button label.',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
selfClosing: true,
|
|
28
|
+
},
|
|
29
|
+
tagName: 'login-button',
|
|
30
|
+
};
|