@redocly/theme 0.61.1 → 0.62.0-custom.1
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/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.d.ts +1 -0
- package/lib/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.js +12 -0
- package/lib/components/Badge/Badge.d.ts +2 -1
- package/lib/components/Badge/Badge.js +24 -2
- package/lib/components/Banner/Banner.js +19 -1
- package/lib/components/Banner/variables.js +1 -0
- package/lib/components/Breadcrumbs/Breadcrumb.js +1 -1
- package/lib/components/Breadcrumbs/BreadcrumbDropdown.js +9 -6
- package/lib/components/Breadcrumbs/Breadcrumbs.js +24 -15
- package/lib/components/Buttons/AIAssistantButton.js +7 -4
- package/lib/components/Buttons/EditPageButton.js +4 -26
- package/lib/components/Catalog/CatalogEntities.js +10 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +6 -13
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +13 -11
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +7 -5
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +9 -7
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +1 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +2 -2
- package/lib/components/CatalogClassic/CatalogClassicInfoBlock.js +1 -1
- package/lib/components/CodeBlock/CodeBlockControls.js +8 -6
- package/lib/components/Dropdown/Dropdown.js +1 -1
- package/lib/components/Dropdown/variables.js +1 -0
- package/lib/components/Feedback/Comment.js +17 -4
- package/lib/components/Feedback/Mood.js +6 -3
- package/lib/components/Feedback/Rating.js +6 -3
- package/lib/components/Feedback/Scale.js +6 -3
- package/lib/components/Feedback/Sentiment.js +6 -3
- package/lib/components/Filter/FilterCheckboxes.js +1 -1
- package/lib/components/JsonViewer/JsonViewer.js +2 -2
- package/lib/components/JsonViewer/{Helpers.js → helpers.js} +2 -1
- package/lib/components/LanguagePicker/LanguagePicker.js +1 -1
- package/lib/components/Markdown/Markdown.js +2 -2
- package/lib/components/Menu/MenuItem.js +41 -15
- package/lib/components/Menu/variables.js +3 -3
- package/lib/components/Navbar/NavbarItem.js +1 -1
- package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.d.ts +1 -0
- package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.js +12 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +6 -0
- package/lib/components/PageActions/PageActions.js +25 -8
- package/lib/components/Search/SearchAiDialog.d.ts +4 -2
- package/lib/components/Search/SearchAiDialog.js +23 -4
- package/lib/components/Search/SearchAiMessage.d.ts +4 -2
- package/lib/components/Search/SearchAiMessage.js +82 -23
- package/lib/components/Search/SearchDialog.js +50 -25
- package/lib/components/Select/variables.js +2 -2
- package/lib/components/SvgViewer/SvgViewer.d.ts +15 -0
- package/lib/components/SvgViewer/SvgViewer.js +312 -0
- package/lib/components/SvgViewer/variables.d.ts +1 -0
- package/lib/components/SvgViewer/variables.dark.d.ts +1 -0
- package/lib/components/SvgViewer/variables.dark.js +8 -0
- package/lib/components/SvgViewer/variables.js +17 -0
- package/lib/components/Tag/Tag.js +1 -1
- package/lib/components/Tag/variables.dark.js +6 -0
- package/lib/components/Tag/variables.js +6 -0
- package/lib/components/Tooltip/Tooltip.d.ts +2 -3
- package/lib/components/Tooltip/Tooltip.js +66 -113
- package/lib/components/Tooltip/variables.dark.js +4 -0
- package/lib/components/Tooltip/variables.js +3 -3
- package/lib/components/UserMenu/LoginButton.d.ts +8 -2
- package/lib/components/UserMenu/LoginButton.js +4 -3
- package/lib/core/constants/feedback.d.ts +2 -0
- package/lib/core/constants/feedback.js +6 -0
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/constants/search.d.ts +5 -1
- package/lib/core/constants/search.js +24 -1
- package/lib/core/hooks/search/use-search-dialog.js +2 -2
- package/lib/core/hooks/use-color-switcher.js +3 -1
- package/lib/core/hooks/use-mcp-config.js +2 -1
- package/lib/core/hooks/use-modal-scroll-lock.js +24 -10
- package/lib/core/hooks/use-outside-click.d.ts +3 -1
- package/lib/core/hooks/use-outside-click.js +8 -4
- package/lib/core/hooks/use-page-actions.d.ts +1 -1
- package/lib/core/hooks/use-page-actions.js +50 -14
- package/lib/core/hooks/use-product-picker.js +1 -1
- package/lib/core/hooks/use-unique-svg-ids.d.ts +6 -0
- package/lib/core/hooks/use-unique-svg-ids.js +15 -0
- package/lib/core/openapi/index.d.ts +2 -0
- package/lib/core/openapi/index.js +5 -1
- package/lib/core/styles/dark.js +13 -0
- package/lib/core/styles/global.js +38 -15
- package/lib/core/types/catalog.d.ts +1 -1
- package/lib/core/types/hooks.d.ts +23 -2
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +24 -0
- package/lib/core/types/search.js +9 -1
- package/lib/core/utils/content-segments.d.ts +2 -0
- package/lib/core/utils/content-segments.js +22 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/transform-revisions-to-version-history.js +18 -68
- package/lib/ext/process-scorecard.d.ts +49 -0
- package/lib/ext/process-scorecard.js +12 -0
- package/lib/icons/DirectionRightIcon/DirectionRightIcon.d.ts +5 -0
- package/lib/icons/DirectionRightIcon/DirectionRightIcon.js +24 -0
- package/lib/icons/FitToViewIcon/FitToViewIcon.d.ts +9 -0
- package/lib/icons/FitToViewIcon/FitToViewIcon.js +25 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +8 -0
- package/lib/layouts/DocumentationLayout.js +4 -25
- package/lib/layouts/DocumentationLayoutBottom.d.ts +11 -0
- package/lib/layouts/DocumentationLayoutBottom.js +28 -0
- package/lib/layouts/DocumentationLayoutTop.d.ts +13 -0
- package/lib/layouts/DocumentationLayoutTop.js +33 -0
- package/lib/layouts/Forbidden.js +22 -18
- package/lib/markdoc/components/Cards/Card.js +1 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +1 -1
- package/lib/markdoc/components/Heading/Heading.js +40 -2
- package/lib/markdoc/components/LoginButton/LoginButton.d.ts +9 -0
- package/lib/markdoc/components/LoginButton/LoginButton.js +48 -0
- package/lib/markdoc/components/Mermaid/Mermaid.js +70 -2
- 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 +10 -10
- package/src/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.tsx +10 -0
- package/src/components/Badge/Badge.tsx +18 -2
- package/src/components/Banner/Banner.tsx +23 -1
- package/src/components/Banner/variables.ts +1 -0
- package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -3
- package/src/components/Breadcrumbs/BreadcrumbDropdown.tsx +11 -8
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +24 -15
- package/src/components/Buttons/AIAssistantButton.tsx +7 -4
- package/src/components/Buttons/EditPageButton.tsx +13 -34
- package/src/components/Catalog/CatalogEntities.tsx +10 -8
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +3 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +5 -21
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +13 -11
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +7 -5
- package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +9 -7
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +1 -2
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +9 -5
- package/src/components/CatalogClassic/CatalogClassicInfoBlock.tsx +3 -1
- package/src/components/CodeBlock/CodeBlockControls.tsx +16 -10
- package/src/components/Dropdown/Dropdown.tsx +1 -1
- package/src/components/Dropdown/variables.ts +1 -0
- package/src/components/Feedback/Comment.tsx +22 -4
- package/src/components/Feedback/Mood.tsx +6 -2
- package/src/components/Feedback/Rating.tsx +6 -2
- package/src/components/Feedback/Scale.tsx +6 -2
- package/src/components/Feedback/Sentiment.tsx +6 -2
- package/src/components/Filter/FilterCheckboxes.tsx +1 -1
- package/src/components/JsonViewer/JsonViewer.tsx +1 -2
- package/src/components/JsonViewer/{Helpers.tsx → helpers.tsx} +1 -0
- package/src/components/LanguagePicker/LanguagePicker.tsx +1 -1
- package/src/components/Markdown/Markdown.tsx +2 -2
- package/src/components/Menu/MenuItem.tsx +61 -16
- package/src/components/Menu/variables.ts +3 -3
- package/src/components/Navbar/NavbarItem.tsx +3 -1
- package/src/components/OpenApiDocs/hooks/AdditionalOverviewInfo.tsx +10 -0
- package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +2 -0
- package/src/components/PageActions/PageActions.tsx +38 -15
- package/src/components/Search/SearchAiDialog.tsx +31 -2
- package/src/components/Search/SearchAiMessage.tsx +103 -17
- package/src/components/Search/SearchDialog.tsx +70 -37
- package/src/components/Select/variables.ts +2 -2
- package/src/components/SvgViewer/SvgViewer.tsx +405 -0
- package/src/components/SvgViewer/variables.dark.ts +5 -0
- package/src/components/SvgViewer/variables.ts +14 -0
- package/src/components/Tag/Tag.tsx +2 -1
- package/src/components/Tag/variables.dark.ts +6 -0
- package/src/components/Tag/variables.ts +6 -0
- package/src/components/Tooltip/Tooltip.tsx +77 -120
- package/src/components/Tooltip/variables.dark.ts +4 -0
- package/src/components/Tooltip/variables.ts +3 -3
- package/src/components/UserMenu/LoginButton.tsx +23 -8
- package/src/core/constants/feedback.ts +2 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/constants/search.ts +27 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +10 -1
- package/src/core/hooks/search/use-search-dialog.ts +2 -2
- package/src/core/hooks/use-color-switcher.ts +3 -1
- package/src/core/hooks/use-mcp-config.ts +2 -1
- package/src/core/hooks/use-modal-scroll-lock.ts +29 -10
- package/src/core/hooks/use-outside-click.ts +16 -5
- package/src/core/hooks/use-page-actions.ts +77 -30
- package/src/core/hooks/use-product-picker.ts +1 -1
- package/src/core/hooks/use-unique-svg-ids.ts +12 -0
- package/src/core/openapi/index.ts +2 -0
- package/src/core/styles/dark.ts +14 -0
- package/src/core/styles/global.ts +38 -15
- package/src/core/types/catalog.ts +1 -1
- package/src/core/types/hooks.ts +29 -1
- package/src/core/types/l10n.ts +13 -1
- package/src/core/types/search.ts +19 -0
- package/src/core/utils/content-segments.ts +27 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/transform-revisions-to-version-history.ts +19 -99
- package/src/ext/process-scorecard.ts +59 -0
- package/src/icons/DirectionRightIcon/DirectionRightIcon.tsx +35 -0
- package/src/icons/FitToViewIcon/FitToViewIcon.tsx +26 -0
- package/src/index.ts +8 -0
- package/src/layouts/DocumentationLayout.tsx +4 -30
- package/src/layouts/DocumentationLayoutBottom.tsx +42 -0
- package/src/layouts/DocumentationLayoutTop.tsx +52 -0
- package/src/layouts/Forbidden.tsx +36 -21
- package/src/markdoc/components/Cards/Card.tsx +1 -0
- package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +1 -1
- package/src/markdoc/components/Heading/Heading.tsx +52 -4
- package/src/markdoc/components/LoginButton/LoginButton.tsx +38 -0
- package/src/markdoc/components/Mermaid/Mermaid.tsx +57 -8
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/login-button.ts +30 -0
- package/lib/components/Tooltip/TooltipWrapper.d.ts +0 -12
- package/lib/components/Tooltip/TooltipWrapper.js +0 -34
- package/src/components/Tooltip/TooltipWrapper.tsx +0 -70
- /package/lib/components/JsonViewer/{Helpers.d.ts → helpers.d.ts} +0 -0
|
@@ -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
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { JSX } from 'react';
|
|
5
5
|
|
|
6
6
|
import { concatClassNames } from '@redocly/theme/core/utils';
|
|
7
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
8
|
+
import { SvgViewer } from '@redocly/theme/components/SvgViewer/SvgViewer';
|
|
7
9
|
|
|
8
10
|
type MermaidProps = {
|
|
9
11
|
diagramHtml: string;
|
|
@@ -18,20 +20,55 @@ export function Mermaid({
|
|
|
18
20
|
'data-hash': dataHash,
|
|
19
21
|
className,
|
|
20
22
|
}: MermaidProps): JSX.Element {
|
|
23
|
+
const { useTranslate } = useThemeHooks();
|
|
24
|
+
const { translate } = useTranslate();
|
|
25
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
26
|
+
|
|
27
|
+
const open = () => setIsOpen(true);
|
|
28
|
+
const close = () => setIsOpen(false);
|
|
29
|
+
|
|
21
30
|
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
<>
|
|
32
|
+
<Wrapper
|
|
33
|
+
className={concatClassNames('mermaid-wrapper', className)}
|
|
34
|
+
dangerouslySetInnerHTML={{ __html: diagramHtml }}
|
|
35
|
+
data-component-name="Markdoc/Mermaid/Mermaid"
|
|
36
|
+
data-source={dataSource}
|
|
37
|
+
data-hash={dataHash}
|
|
38
|
+
onClick={open}
|
|
39
|
+
onKeyDown={(e) => e.key === 'Enter' || (e.key === ' ' && open())}
|
|
40
|
+
role="button"
|
|
41
|
+
tabIndex={0}
|
|
42
|
+
aria-label={translate('mermaid.openFullscreen', 'Click to open diagram in fullscreen')}
|
|
43
|
+
/>
|
|
44
|
+
<SvgViewer
|
|
45
|
+
isOpen={isOpen}
|
|
46
|
+
onClose={close}
|
|
47
|
+
labels={{
|
|
48
|
+
zoomIn: translate('mermaid.zoomIn', 'Zoom in'),
|
|
49
|
+
zoomOut: translate('mermaid.zoomOut', 'Zoom out'),
|
|
50
|
+
fitToView: translate('mermaid.reset', 'Fit to view'),
|
|
51
|
+
close: translate('mermaid.close', 'Close'),
|
|
52
|
+
dialogLabel: translate('mermaid.viewer', 'Mermaid diagram viewer'),
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
<ViewerContent dangerouslySetInnerHTML={{ __html: diagramHtml }} />
|
|
56
|
+
</SvgViewer>
|
|
57
|
+
</>
|
|
29
58
|
);
|
|
30
59
|
}
|
|
31
60
|
|
|
32
61
|
const Wrapper = styled.div`
|
|
33
62
|
background-color: var(--mermaid-bg-color);
|
|
34
63
|
border-radius: var(--mermaid-border-radius);
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
transition: box-shadow 0.2s ease;
|
|
66
|
+
|
|
67
|
+
&:hover,
|
|
68
|
+
&:focus {
|
|
69
|
+
outline: none;
|
|
70
|
+
box-shadow: 0 0 0 2px var(--border-color-input-focus);
|
|
71
|
+
}
|
|
35
72
|
|
|
36
73
|
* {
|
|
37
74
|
font-family: var(--mermaid-font-family) !important;
|
|
@@ -42,3 +79,15 @@ const Wrapper = styled.div`
|
|
|
42
79
|
max-width: 100%;
|
|
43
80
|
}
|
|
44
81
|
`;
|
|
82
|
+
|
|
83
|
+
const ViewerContent = styled.div`
|
|
84
|
+
* {
|
|
85
|
+
font-family: var(--mermaid-font-family) !important;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.mermaid > svg {
|
|
89
|
+
font-size: var(--font-size-base) !important;
|
|
90
|
+
display: block;
|
|
91
|
+
max-width: none !important;
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
@@ -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
|
+
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { JSX, ReactElement } from 'react';
|
|
2
|
-
import type { TooltipProps } from '../../components/Tooltip/Tooltip';
|
|
3
|
-
export type TooltipWrapperProps = {
|
|
4
|
-
children: ReactElement;
|
|
5
|
-
tip: string;
|
|
6
|
-
placement?: TooltipProps['placement'];
|
|
7
|
-
width?: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
showOnHover?: boolean;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
};
|
|
12
|
-
export declare function TooltipWrapper({ children, tip, placement, width, className, showOnHover, disabled, }: TooltipWrapperProps): JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
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.TooltipWrapper = TooltipWrapper;
|
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const hooks_1 = require("../../core/hooks");
|
|
10
|
-
const Tooltip_1 = require("../../components/Tooltip/Tooltip");
|
|
11
|
-
function TooltipWrapper({ children, tip, placement = 'top', width = 'max-content', className = '', showOnHover = true, disabled = false, }) {
|
|
12
|
-
const tooltip = (0, hooks_1.useControl)(false);
|
|
13
|
-
const handleMouseEnter = () => {
|
|
14
|
-
if (showOnHover && !disabled) {
|
|
15
|
-
tooltip.handleOpen();
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const handleMouseLeave = () => {
|
|
19
|
-
if (showOnHover) {
|
|
20
|
-
tooltip.handleClose();
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const handleClick = () => {
|
|
24
|
-
if (showOnHover) {
|
|
25
|
-
tooltip.handleClose();
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
return (react_1.default.createElement(Tooltip_1.Tooltip, { className: className, tip: tip, isOpen: tooltip.isOpened, placement: placement, width: width },
|
|
29
|
-
react_1.default.createElement(TooltipEventWrapper, { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: handleClick }, children)));
|
|
30
|
-
}
|
|
31
|
-
const TooltipEventWrapper = styled_components_1.default.div `
|
|
32
|
-
display: contents;
|
|
33
|
-
`;
|
|
34
|
-
//# sourceMappingURL=TooltipWrapper.js.map
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import type { JSX, ReactElement } from 'react';
|
|
5
|
-
import type { TooltipProps } from '@redocly/theme/components/Tooltip/Tooltip';
|
|
6
|
-
|
|
7
|
-
import { useControl } from '@redocly/theme/core/hooks';
|
|
8
|
-
import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
|
|
9
|
-
|
|
10
|
-
export type TooltipWrapperProps = {
|
|
11
|
-
children: ReactElement;
|
|
12
|
-
tip: string;
|
|
13
|
-
placement?: TooltipProps['placement'];
|
|
14
|
-
width?: string;
|
|
15
|
-
className?: string;
|
|
16
|
-
showOnHover?: boolean;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export function TooltipWrapper({
|
|
21
|
-
children,
|
|
22
|
-
tip,
|
|
23
|
-
placement = 'top',
|
|
24
|
-
width = 'max-content',
|
|
25
|
-
className = '',
|
|
26
|
-
showOnHover = true,
|
|
27
|
-
disabled = false,
|
|
28
|
-
}: TooltipWrapperProps): JSX.Element {
|
|
29
|
-
const tooltip = useControl(false);
|
|
30
|
-
|
|
31
|
-
const handleMouseEnter = (): void => {
|
|
32
|
-
if (showOnHover && !disabled) {
|
|
33
|
-
tooltip.handleOpen();
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const handleMouseLeave = (): void => {
|
|
38
|
-
if (showOnHover) {
|
|
39
|
-
tooltip.handleClose();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const handleClick = (): void => {
|
|
44
|
-
if (showOnHover) {
|
|
45
|
-
tooltip.handleClose();
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<Tooltip
|
|
51
|
-
className={className}
|
|
52
|
-
tip={tip}
|
|
53
|
-
isOpen={tooltip.isOpened}
|
|
54
|
-
placement={placement}
|
|
55
|
-
width={width}
|
|
56
|
-
>
|
|
57
|
-
<TooltipEventWrapper
|
|
58
|
-
onMouseEnter={handleMouseEnter}
|
|
59
|
-
onMouseLeave={handleMouseLeave}
|
|
60
|
-
onClick={handleClick}
|
|
61
|
-
>
|
|
62
|
-
{children}
|
|
63
|
-
</TooltipEventWrapper>
|
|
64
|
-
</Tooltip>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const TooltipEventWrapper = styled.div`
|
|
69
|
-
display: contents;
|
|
70
|
-
`;
|
|
File without changes
|