@redocly/theme 0.67.0-next.0 → 0.67.0-next.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/Admonition/Admonition.js +9 -9
- package/lib/components/Badge/Badge.d.ts +1 -1
- package/lib/components/Badge/Badge.js +4 -4
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.js +16 -17
- package/lib/components/Buttons/AIAssistantButton.js +2 -0
- package/lib/components/Catalog/CatalogActionsRow.js +3 -1
- package/lib/components/Catalog/CatalogAvatar.d.ts +3 -1
- package/lib/components/Catalog/CatalogAvatar.js +3 -3
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +4 -4
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.js +7 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +6 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +4 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +3 -5
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +15 -11
- package/lib/components/Catalog/CatalogEntityTypeTag.js +5 -5
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +5 -3
- package/lib/components/CatalogClassic/CatalogClassic.d.ts +4 -2
- package/lib/components/CatalogClassic/CatalogClassic.js +3 -1
- package/lib/components/CodeBlock/CodeBlockContainer.js +16 -4
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +2 -1
- package/lib/components/CodeBlock/CodeBlockControls.js +9 -7
- package/lib/components/CodeBlock/CodeBlockTabs.js +2 -2
- package/lib/components/Dropdown/Dropdown.js +6 -6
- package/lib/components/Dropdown/DropdownMenuItem.d.ts +1 -1
- package/lib/components/Feedback/Comment.js +3 -3
- package/lib/components/Feedback/Mood.js +3 -3
- package/lib/components/Filter/FilterContent.js +2 -2
- package/lib/components/Footer/Footer.js +2 -2
- package/lib/components/Footer/FooterColumn.js +2 -2
- package/lib/components/Footer/FooterItem.js +5 -5
- package/lib/components/Image/Image.js +2 -2
- package/lib/components/LastUpdated/LastUpdated.js +2 -2
- package/lib/components/Link/Link.d.ts +2 -19
- package/lib/components/Link/Link.js +2 -9
- package/lib/components/Loaders/Loading.js +2 -2
- package/lib/components/Loaders/SpinnerLoader.js +4 -4
- package/lib/components/Markdown/Markdown.d.ts +7 -10
- package/lib/components/Markdown/Markdown.js +6 -3
- package/lib/components/Marker/Marker.js +3 -3
- package/lib/components/Menu/MenuContainer.d.ts +2 -2
- package/lib/components/Menu/MenuContainer.js +9 -11
- package/lib/components/Menu/MenuItem.js +14 -14
- package/lib/components/Menu/MenuMobile.js +8 -8
- package/lib/components/Navbar/NavbarItem.js +7 -7
- package/lib/components/PageNavigation/NavigationButton.js +3 -3
- package/lib/components/Panel/PanelBody.d.ts +5 -5
- package/lib/components/Panel/PanelBody.js +6 -3
- package/lib/components/Panel/PanelHeader.d.ts +2 -5
- package/lib/components/Panel/PanelHeader.js +6 -2
- package/lib/components/Search/SearchAiMessage.js +10 -8
- package/lib/components/Search/SearchDialog.js +6 -0
- package/lib/components/Search/SearchSuggestedPages.js +2 -2
- package/lib/components/Select/Select.js +3 -1
- package/lib/components/Select/SelectInput.d.ts +1 -0
- package/lib/components/Select/SelectInput.js +8 -8
- package/lib/components/Sidebar/Sidebar.d.ts +4 -2
- package/lib/components/Sidebar/Sidebar.js +10 -8
- package/lib/components/SidebarActions/styled.d.ts +6 -6
- package/lib/components/SidebarActions/styled.js +12 -4
- package/lib/components/StatusCode/StatusCode.d.ts +6 -4
- package/lib/components/StatusCode/StatusCode.js +8 -2
- package/lib/components/Switch/Switch.js +13 -13
- package/lib/components/TableOfContent/TableOfContent.js +2 -2
- package/lib/components/Tag/Tag.js +11 -11
- package/lib/components/Tooltip/AnchorTooltip.js +26 -25
- package/lib/components/Tooltip/JsTooltip.js +5 -5
- package/lib/components/Typography/CompactTypography.d.ts +27 -11
- package/lib/components/Typography/CompactTypography.js +2 -2
- package/lib/components/Typography/Typography.d.ts +6 -2
- package/lib/components/Typography/Typography.js +18 -3
- package/lib/components/UserMenu/UserAvatar.js +5 -5
- package/lib/core/contexts/ThemeDataContext.d.ts +1 -1
- package/lib/core/hooks/feedback/use-report-dialog.d.ts +8 -5
- package/lib/core/styles/global.js +1 -0
- package/lib/core/templates/Markdown.js +5 -6
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/link.d.ts +19 -0
- package/lib/core/types/link.js +3 -0
- package/lib/core/utils/details.d.ts +1 -1
- package/lib/core/utils/details.js +3 -0
- package/lib/core/utils/dom.d.ts +0 -1
- package/lib/core/utils/dom.js +0 -9
- package/lib/core/utils/index.d.ts +0 -1
- package/lib/core/utils/index.js +0 -1
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.d.ts +1 -1
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +6 -1
- package/lib/icons/AiStarsIcon/AiStarsIcon.d.ts +1 -1
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +6 -1
- package/lib/icons/MagicWandIcon/MagicWandIcon.d.ts +23 -0
- package/lib/icons/MagicWandIcon/MagicWandIcon.js +25 -0
- package/lib/icons/ReturnKeyIcon/ReturnKeyIcon.d.ts +25 -5
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/layouts/DocumentationLayout.js +2 -2
- package/lib/layouts/ThreePanelLayout.d.ts +27 -7
- package/lib/layouts/ThreePanelLayout.js +11 -8
- package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +4 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +6 -2
- package/lib/markdoc/components/Image/Image.js +3 -3
- package/lib/markdoc/components/Tabs/TabItemFragment.d.ts +9 -0
- package/lib/markdoc/components/Tabs/TabItemFragment.js +11 -0
- package/lib/markdoc/components/Tabs/TabList.d.ts +7 -4
- package/lib/markdoc/components/Tabs/TabList.js +6 -4
- package/lib/markdoc/components/Tabs/Tabs.d.ts +3 -9
- package/lib/markdoc/components/Tabs/Tabs.js +12 -5
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/tags/tab.js +1 -1
- package/lib/markdoc/tags/tabs.js +1 -1
- package/package.json +1 -2
- package/src/components/Admonition/Admonition.tsx +11 -11
- package/src/components/Badge/Badge.tsx +11 -6
- package/src/components/Button/Button.tsx +51 -21
- package/src/components/Buttons/AIAssistantButton.tsx +2 -0
- package/src/components/Catalog/CatalogActionsRow.tsx +3 -1
- package/src/components/Catalog/CatalogAvatar.tsx +6 -10
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +6 -6
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent.tsx +14 -14
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +11 -11
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +4 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +8 -11
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +10 -9
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +22 -16
- package/src/components/Catalog/CatalogEntityTypeTag.tsx +8 -8
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +8 -6
- package/src/components/CatalogClassic/CatalogClassic.tsx +3 -1
- package/src/components/CodeBlock/CodeBlockContainer.tsx +23 -7
- package/src/components/CodeBlock/CodeBlockControls.tsx +16 -10
- package/src/components/CodeBlock/CodeBlockTabs.tsx +4 -4
- package/src/components/Dropdown/Dropdown.tsx +9 -9
- package/src/components/Dropdown/DropdownMenuItem.tsx +1 -1
- package/src/components/Feedback/Comment.tsx +5 -5
- package/src/components/Feedback/Mood.tsx +5 -5
- package/src/components/Filter/FilterContent.tsx +4 -4
- package/src/components/Filter/FilterPopover.tsx +1 -1
- package/src/components/Footer/Footer.tsx +4 -4
- package/src/components/Footer/FooterColumn.tsx +3 -3
- package/src/components/Footer/FooterItem.tsx +9 -9
- package/src/components/Image/Image.tsx +3 -3
- package/src/components/LastUpdated/LastUpdated.tsx +4 -4
- package/src/components/Link/Link.tsx +6 -51
- package/src/components/Loaders/Loading.tsx +3 -3
- package/src/components/Loaders/SpinnerLoader.tsx +5 -5
- package/src/components/Markdown/Markdown.tsx +7 -7
- package/src/components/Marker/Marker.tsx +4 -4
- package/src/components/Menu/MenuContainer.tsx +32 -16
- package/src/components/Menu/MenuItem.tsx +34 -29
- package/src/components/Menu/MenuMobile.tsx +12 -12
- package/src/components/Navbar/NavbarItem.tsx +13 -13
- package/src/components/PageNavigation/NavigationButton.tsx +4 -4
- package/src/components/Panel/PanelBody.tsx +7 -4
- package/src/components/Panel/PanelHeader.tsx +9 -4
- package/src/components/Search/SearchAiMessage.tsx +17 -15
- package/src/components/Search/SearchDialog.tsx +6 -0
- package/src/components/Search/SearchSuggestedPages.tsx +20 -5
- package/src/components/Select/Select.tsx +3 -1
- package/src/components/Select/SelectInput.tsx +10 -9
- package/src/components/Sidebar/Sidebar.tsx +15 -13
- package/src/components/SidebarActions/styled.ts +12 -4
- package/src/components/StatusCode/StatusCode.tsx +12 -4
- package/src/components/Switch/Switch.tsx +21 -21
- package/src/components/TableOfContent/TableOfContent.tsx +3 -3
- package/src/components/Tag/Tag.tsx +34 -27
- package/src/components/Tooltip/AnchorTooltip.tsx +50 -42
- package/src/components/Tooltip/JsTooltip.tsx +14 -13
- package/src/components/Typography/CompactTypography.tsx +4 -4
- package/src/components/Typography/Typography.tsx +21 -5
- package/src/components/UserMenu/UserAvatar.tsx +7 -7
- package/src/core/contexts/ThemeDataContext.tsx +1 -1
- package/src/core/hooks/feedback/use-report-dialog.ts +1 -5
- package/src/core/styles/dark.ts +1 -1
- package/src/core/styles/global.ts +1 -0
- package/src/core/templates/Markdown.tsx +6 -7
- package/src/core/types/index.ts +1 -0
- package/src/core/types/link.ts +20 -0
- package/src/core/utils/details.ts +4 -0
- package/src/core/utils/dom.ts +0 -8
- package/src/core/utils/index.ts +0 -1
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +9 -3
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +9 -3
- package/src/icons/MagicWandIcon/MagicWandIcon.tsx +26 -0
- package/src/icons/ReturnKeyIcon/ReturnKeyIcon.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/layouts/DocumentationLayout.tsx +3 -3
- package/src/layouts/ThreePanelLayout.tsx +27 -14
- package/src/markdoc/components/CodeWalkthrough/CodeContainer.tsx +4 -4
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +4 -4
- package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +3 -3
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +6 -2
- package/src/markdoc/components/Image/Image.tsx +4 -4
- package/src/markdoc/components/Tabs/TabItemFragment.tsx +15 -0
- package/src/markdoc/components/Tabs/TabList.tsx +9 -6
- package/src/markdoc/components/Tabs/Tabs.tsx +21 -15
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/tags/tab.ts +1 -1
- package/src/markdoc/tags/tabs.ts +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
type CatalogAvatarSize = 'small' | 'medium' | 'large';
|
|
5
|
+
|
|
4
6
|
const extractInitials = (value: string): string => {
|
|
5
7
|
const trimmed = value.trim();
|
|
6
8
|
if (!trimmed) return '';
|
|
@@ -23,21 +25,15 @@ const extractInitials = (value: string): string => {
|
|
|
23
25
|
return initials[0] + initials[initials.length - 1];
|
|
24
26
|
};
|
|
25
27
|
|
|
26
|
-
export function CatalogAvatar({
|
|
27
|
-
value,
|
|
28
|
-
size,
|
|
29
|
-
}: {
|
|
30
|
-
value: string;
|
|
31
|
-
size: 'small' | 'medium' | 'large';
|
|
32
|
-
}) {
|
|
28
|
+
export function CatalogAvatar({ value, size }: { value: string; size: CatalogAvatarSize }) {
|
|
33
29
|
return (
|
|
34
|
-
<CatalogAvatarWrapper data-component-name="Catalog/CatalogAvatar" size={size}>
|
|
30
|
+
<CatalogAvatarWrapper data-component-name="Catalog/CatalogAvatar" $size={size}>
|
|
35
31
|
{extractInitials(value)}
|
|
36
32
|
</CatalogAvatarWrapper>
|
|
37
33
|
);
|
|
38
34
|
}
|
|
39
35
|
|
|
40
|
-
const CatalogAvatarWrapper = styled.div<{ size:
|
|
36
|
+
const CatalogAvatarWrapper = styled.div<{ $size: CatalogAvatarSize }>`
|
|
41
37
|
display: flex;
|
|
42
38
|
align-items: center;
|
|
43
39
|
justify-content: center;
|
|
@@ -46,7 +42,7 @@ const CatalogAvatarWrapper = styled.div<{ size: 'small' | 'medium' | 'large' }>`
|
|
|
46
42
|
flex-shrink: 0;
|
|
47
43
|
font-weight: var(--catalog-avatar-font-weight);
|
|
48
44
|
line-height: var(--catalog-avatar-line-height);
|
|
49
|
-
${({ size }) => SIZES[size]};
|
|
45
|
+
${({ $size }) => SIZES[$size]};
|
|
50
46
|
`;
|
|
51
47
|
|
|
52
48
|
const SIZES = {
|
|
@@ -39,7 +39,7 @@ export function CatalogCard({ entity, catalogConfig }: CatalogCardProps): JSX.El
|
|
|
39
39
|
<HeaderIconWrapper>
|
|
40
40
|
<CatalogEntityIcon entityType={entity.type} />
|
|
41
41
|
</HeaderIconWrapper>
|
|
42
|
-
<HeaderIconText entityType={entity.type}>{entity.type}</HeaderIconText>
|
|
42
|
+
<HeaderIconText $entityType={entity.type}>{entity.type}</HeaderIconText>
|
|
43
43
|
</CardHeader>
|
|
44
44
|
|
|
45
45
|
<CardDescription>
|
|
@@ -91,7 +91,7 @@ export function CatalogCard({ entity, catalogConfig }: CatalogCardProps): JSX.El
|
|
|
91
91
|
|
|
92
92
|
<Divider />
|
|
93
93
|
|
|
94
|
-
<CardFooter hasTags={!!entity.tags?.length}>
|
|
94
|
+
<CardFooter $hasTags={!!entity.tags?.length}>
|
|
95
95
|
<CatalogTags
|
|
96
96
|
items={entity.tags || []}
|
|
97
97
|
tagProps={{
|
|
@@ -128,8 +128,8 @@ const HeaderIconWrapper = styled.div`
|
|
|
128
128
|
margin-right: var(--catalog-card-icon-margin-right);
|
|
129
129
|
`;
|
|
130
130
|
|
|
131
|
-
const HeaderIconText = styled.div<{ entityType: string }>`
|
|
132
|
-
color: ${({ entityType }) => `var(--catalog-entity-icon-color-${entityType})`};
|
|
131
|
+
const HeaderIconText = styled.div<{ $entityType: string }>`
|
|
132
|
+
color: ${({ $entityType }) => `var(--catalog-entity-icon-color-${$entityType})`};
|
|
133
133
|
`;
|
|
134
134
|
|
|
135
135
|
const CardHeader = styled.div`
|
|
@@ -180,11 +180,11 @@ const CardContent = styled.div`
|
|
|
180
180
|
padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
|
|
181
181
|
`;
|
|
182
182
|
|
|
183
|
-
const CardFooter = styled.div<{ hasTags: boolean }>`
|
|
183
|
+
const CardFooter = styled.div<{ $hasTags: boolean }>`
|
|
184
184
|
height: var(--catalog-card-footer-height);
|
|
185
185
|
display: flex;
|
|
186
186
|
align-items: center;
|
|
187
|
-
justify-content: ${({ hasTags }) => (hasTags ? 'space-between' : 'flex-end')};
|
|
187
|
+
justify-content: ${({ $hasTags }) => ($hasTags ? 'space-between' : 'flex-end')};
|
|
188
188
|
padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
|
|
189
189
|
`;
|
|
190
190
|
|
|
@@ -19,10 +19,10 @@ export function CatalogEntityRelationsNodeContent({
|
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
21
|
<CatalogEntityRelationsNodeContentWrapper
|
|
22
|
-
isRoot={isRoot}
|
|
22
|
+
$isRoot={isRoot}
|
|
23
23
|
data-component-name="Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNodeContent"
|
|
24
24
|
>
|
|
25
|
-
<CatalogEntityRelationsNodeTypeRow isRoot={isRoot}>
|
|
25
|
+
<CatalogEntityRelationsNodeTypeRow $isRoot={isRoot}>
|
|
26
26
|
{isRoot ? (
|
|
27
27
|
<CatalogEntityIcon
|
|
28
28
|
entityType={entityType}
|
|
@@ -33,36 +33,36 @@ export function CatalogEntityRelationsNodeContent({
|
|
|
33
33
|
)}
|
|
34
34
|
<span>{formattedEntityType}</span>
|
|
35
35
|
</CatalogEntityRelationsNodeTypeRow>
|
|
36
|
-
<CatalogEntityRelationsNodeLabelRow isRoot={isRoot}>
|
|
36
|
+
<CatalogEntityRelationsNodeLabelRow $isRoot={isRoot}>
|
|
37
37
|
{label}
|
|
38
38
|
</CatalogEntityRelationsNodeLabelRow>
|
|
39
39
|
</CatalogEntityRelationsNodeContentWrapper>
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const CatalogEntityRelationsNodeTypeRow = styled.div<{ isRoot: boolean }>`
|
|
43
|
+
const CatalogEntityRelationsNodeTypeRow = styled.div<{ $isRoot: boolean }>`
|
|
44
44
|
display: flex;
|
|
45
45
|
align-items: center;
|
|
46
46
|
gap: var(--catalog-entity-relations-node-gap);
|
|
47
47
|
line-height: var(--line-height-sm);
|
|
48
48
|
font-size: var(--font-size-sm);
|
|
49
|
-
color: ${({ isRoot }) =>
|
|
50
|
-
isRoot
|
|
49
|
+
color: ${({ $isRoot }) =>
|
|
50
|
+
$isRoot
|
|
51
51
|
? 'var(--catalog-entity-relations-node-root-text-color)'
|
|
52
52
|
: 'var(--text-color-description)'};
|
|
53
53
|
`;
|
|
54
54
|
|
|
55
|
-
const CatalogEntityRelationsNodeLabelRow = styled.div<{ isRoot: boolean }>`
|
|
55
|
+
const CatalogEntityRelationsNodeLabelRow = styled.div<{ $isRoot: boolean }>`
|
|
56
56
|
display: flex;
|
|
57
57
|
align-items: center;
|
|
58
58
|
gap: var(--catalog-entity-relations-node-gap);
|
|
59
59
|
line-height: var(--line-height-lg);
|
|
60
60
|
font-size: var(--font-size-lg);
|
|
61
|
-
color: ${({ isRoot }) =>
|
|
62
|
-
isRoot ? 'var(--catalog-entity-relations-node-root-text-color)' : 'var(--text-color-primary)'};
|
|
61
|
+
color: ${({ $isRoot }) =>
|
|
62
|
+
$isRoot ? 'var(--catalog-entity-relations-node-root-text-color)' : 'var(--text-color-primary)'};
|
|
63
63
|
`;
|
|
64
64
|
|
|
65
|
-
const CatalogEntityRelationsNodeContentWrapper = styled.div<{ isRoot: boolean }>`
|
|
65
|
+
const CatalogEntityRelationsNodeContentWrapper = styled.div<{ $isRoot: boolean }>`
|
|
66
66
|
display: flex;
|
|
67
67
|
flex-direction: column;
|
|
68
68
|
align-items: flex-start;
|
|
@@ -71,12 +71,12 @@ const CatalogEntityRelationsNodeContentWrapper = styled.div<{ isRoot: boolean }>
|
|
|
71
71
|
border-radius: var(--catalog-entity-relations-node-border-radius);
|
|
72
72
|
font-style: normal;
|
|
73
73
|
font-weight: var(--catalog-entity-relations-node-font-weight);
|
|
74
|
-
background: ${({ isRoot }) =>
|
|
75
|
-
isRoot
|
|
74
|
+
background: ${({ $isRoot }) =>
|
|
75
|
+
$isRoot
|
|
76
76
|
? 'var(--catalog-entity-relations-node-root-bg-color)'
|
|
77
77
|
: 'var(--catalog-entity-relations-node-bg-color)'};
|
|
78
|
-
border: ${({ isRoot }) =>
|
|
79
|
-
isRoot
|
|
78
|
+
border: ${({ $isRoot }) =>
|
|
79
|
+
$isRoot
|
|
80
80
|
? 'none'
|
|
81
81
|
: `var(--catalog-entity-relations-node-border-width) var(--catalog-entity-relations-node-border-style) var(--catalog-entity-relations-node-border-color)`};
|
|
82
82
|
`;
|
|
@@ -19,15 +19,15 @@ export function CatalogEntityInfoBar({
|
|
|
19
19
|
return (
|
|
20
20
|
<InfoBarWrapper
|
|
21
21
|
data-component-name="Catalog/CatalogEntity/CatalogEntityInfoBar"
|
|
22
|
-
hoverEffect={hoverEffect}
|
|
22
|
+
$hoverEffect={hoverEffect}
|
|
23
23
|
>
|
|
24
|
-
<LeftColumn withSeparator={withSeparator}>{leftContent}</LeftColumn>
|
|
25
|
-
{rightContent && <RightColumn isCodeBlock={isCodeBlock}>{rightContent}</RightColumn>}
|
|
24
|
+
<LeftColumn $withSeparator={withSeparator}>{leftContent}</LeftColumn>
|
|
25
|
+
{rightContent && <RightColumn $isCodeBlock={isCodeBlock}>{rightContent}</RightColumn>}
|
|
26
26
|
</InfoBarWrapper>
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const InfoBarWrapper = styled.div<{ hoverEffect: boolean }>`
|
|
30
|
+
const InfoBarWrapper = styled.div<{ $hoverEffect: boolean }>`
|
|
31
31
|
display: grid;
|
|
32
32
|
grid-template-columns: 1fr 1fr;
|
|
33
33
|
grid-template-areas: 'left right';
|
|
@@ -43,8 +43,8 @@ const InfoBarWrapper = styled.div<{ hoverEffect: boolean }>`
|
|
|
43
43
|
padding: var(--catalog-card-gap);
|
|
44
44
|
margin-bottom: var(--spacing-xs);
|
|
45
45
|
|
|
46
|
-
${({ hoverEffect }) =>
|
|
47
|
-
hoverEffect &&
|
|
46
|
+
${({ $hoverEffect }) =>
|
|
47
|
+
$hoverEffect &&
|
|
48
48
|
`
|
|
49
49
|
&:hover {
|
|
50
50
|
border-color: var(--catalog-card-border-color-hover);
|
|
@@ -53,25 +53,25 @@ const InfoBarWrapper = styled.div<{ hoverEffect: boolean }>`
|
|
|
53
53
|
`}
|
|
54
54
|
`;
|
|
55
55
|
|
|
56
|
-
const LeftColumn = styled.div<{ withSeparator
|
|
56
|
+
const LeftColumn = styled.div<{ $withSeparator: boolean }>`
|
|
57
57
|
font-weight: var(--font-weight-medium);
|
|
58
58
|
color: var(--catalog-metadata-label-color);
|
|
59
59
|
width: 100%;
|
|
60
60
|
grid-area: left;
|
|
61
61
|
justify-self: start;
|
|
62
62
|
text-align: left;
|
|
63
|
-
border-right: ${({ withSeparator }) =>
|
|
64
|
-
withSeparator ? '1px solid var(--border-color-primary)' : 'none'};
|
|
63
|
+
border-right: ${({ $withSeparator }) =>
|
|
64
|
+
$withSeparator ? '1px solid var(--border-color-primary)' : 'none'};
|
|
65
65
|
height: 100%;
|
|
66
66
|
display: flex;
|
|
67
67
|
align-items: center;
|
|
68
68
|
`;
|
|
69
69
|
|
|
70
|
-
const RightColumn = styled.div<{ isCodeBlock
|
|
70
|
+
const RightColumn = styled.div<{ $isCodeBlock: boolean }>`
|
|
71
71
|
color: var(--catalog-metadata-value-color);
|
|
72
72
|
font-weight: var(--font-weight-medium);
|
|
73
73
|
grid-area: right;
|
|
74
74
|
justify-self: end;
|
|
75
75
|
text-align: right;
|
|
76
|
-
width: ${({ isCodeBlock }) => (isCodeBlock ? '100%' : 'auto')};
|
|
76
|
+
width: ${({ $isCodeBlock }) => ($isCodeBlock ? '100%' : 'auto')};
|
|
77
77
|
`;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx
CHANGED
|
@@ -18,7 +18,7 @@ export function CatalogEntityPropertyCard({
|
|
|
18
18
|
<CatalogEntityPropertyWrapper
|
|
19
19
|
data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard"
|
|
20
20
|
onClick={onClick}
|
|
21
|
-
hoverEffect={hoverEffect}
|
|
21
|
+
$hoverEffect={hoverEffect}
|
|
22
22
|
>
|
|
23
23
|
<CardHeader>{header}</CardHeader>
|
|
24
24
|
<CardContent>{content}</CardContent>
|
|
@@ -26,7 +26,7 @@ export function CatalogEntityPropertyCard({
|
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const CatalogEntityPropertyWrapper = styled.div<{ hoverEffect: boolean }>`
|
|
29
|
+
const CatalogEntityPropertyWrapper = styled.div<{ $hoverEffect: boolean }>`
|
|
30
30
|
display: flex;
|
|
31
31
|
flex-direction: column;
|
|
32
32
|
color: var(--catalog-card-text-color);
|
|
@@ -39,8 +39,8 @@ const CatalogEntityPropertyWrapper = styled.div<{ hoverEffect: boolean }>`
|
|
|
39
39
|
padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
|
|
40
40
|
gap: var(--catalog-card-content-gap-vertical);
|
|
41
41
|
|
|
42
|
-
${({ hoverEffect }) =>
|
|
43
|
-
hoverEffect &&
|
|
42
|
+
${({ $hoverEffect }) =>
|
|
43
|
+
$hoverEffect &&
|
|
44
44
|
`
|
|
45
45
|
&:hover {
|
|
46
46
|
border-color: var(--catalog-card-border-color-hover);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { JSX
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
5
5
|
import type { BffCatalogEntity, BffCatalogRelatedEntity } from '@redocly/theme/core/types';
|
|
6
6
|
|
|
7
7
|
import { Tabs, TabsSize } from '@redocly/theme/markdoc/components/Tabs/Tabs';
|
|
8
|
+
import { TabItemFragment } from '@redocly/theme/markdoc/components/Tabs/TabItemFragment';
|
|
8
9
|
import { EntityTypeIcon } from '@redocly/theme/icons/EntityTypeIcon/EntityTypeIcon';
|
|
9
10
|
import { CatalogEntityDefaultRelations } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations';
|
|
10
11
|
import { MoleculesIcon } from '@redocly/theme/icons/MoleculesIcon/MoleculesIcon';
|
|
@@ -48,7 +49,7 @@ export function CatalogEntityApiDescriptionRelations({
|
|
|
48
49
|
return (
|
|
49
50
|
<TabsWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations">
|
|
50
51
|
<Tabs key={entity.id} size={TabsSize.MEDIUM}>
|
|
51
|
-
<
|
|
52
|
+
<TabItemFragment
|
|
52
53
|
label="Operations"
|
|
53
54
|
icon={<MoleculesIcon />}
|
|
54
55
|
onClick={() => setFilter('type:api-operation')}
|
|
@@ -70,8 +71,8 @@ export function CatalogEntityApiDescriptionRelations({
|
|
|
70
71
|
shouldShowHeading={false}
|
|
71
72
|
listType="api-operation"
|
|
72
73
|
/>
|
|
73
|
-
</
|
|
74
|
-
<
|
|
74
|
+
</TabItemFragment>
|
|
75
|
+
<TabItemFragment
|
|
75
76
|
label="Schemas"
|
|
76
77
|
icon={<NetworkIcon />}
|
|
77
78
|
onClick={() => setFilter('type:data-schema')}
|
|
@@ -93,8 +94,8 @@ export function CatalogEntityApiDescriptionRelations({
|
|
|
93
94
|
shouldShowHeading={false}
|
|
94
95
|
listType="data-schema"
|
|
95
96
|
/>
|
|
96
|
-
</
|
|
97
|
-
<
|
|
97
|
+
</TabItemFragment>
|
|
98
|
+
<TabItemFragment
|
|
98
99
|
label="Related entities"
|
|
99
100
|
icon={<EntityTypeIcon />}
|
|
100
101
|
onClick={() => setFilter('-type:api-operation,data-schema')}
|
|
@@ -115,16 +116,12 @@ export function CatalogEntityApiDescriptionRelations({
|
|
|
115
116
|
shouldShowLoadMore={shouldShowLoadMore}
|
|
116
117
|
shouldShowHeading={false}
|
|
117
118
|
/>
|
|
118
|
-
</
|
|
119
|
+
</TabItemFragment>
|
|
119
120
|
</Tabs>
|
|
120
121
|
</TabsWrapper>
|
|
121
122
|
);
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
const TabItem = styled.div<{ label: string; icon?: ReactNode }>`
|
|
125
|
-
padding: var(--spacing-sm);
|
|
126
|
-
`;
|
|
127
|
-
|
|
128
125
|
const TabsWrapper = styled.div`
|
|
129
126
|
--md-tabs-container-margin: none;
|
|
130
127
|
`;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { JSX
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
5
5
|
import type { BffCatalogEntity, BffCatalogRelatedEntity } from '@redocly/theme/core/types';
|
|
6
6
|
|
|
7
7
|
import { Tabs, TabsSize } from '@redocly/theme/markdoc/components/Tabs/Tabs';
|
|
8
|
+
import { TabItemFragment } from '@redocly/theme/markdoc/components/Tabs/TabItemFragment';
|
|
8
9
|
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
9
10
|
import { EntityTypeIcon } from '@redocly/theme/icons/EntityTypeIcon/EntityTypeIcon';
|
|
10
11
|
import { CatalogColumn } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
@@ -86,7 +87,11 @@ export function CatalogEntityTeamRelations({
|
|
|
86
87
|
return (
|
|
87
88
|
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations">
|
|
88
89
|
<Tabs size={TabsSize.MEDIUM}>
|
|
89
|
-
<
|
|
90
|
+
<TabItemFragment
|
|
91
|
+
label="Members"
|
|
92
|
+
icon={<PeopleIcon />}
|
|
93
|
+
onClick={() => setFilter('type:user')}
|
|
94
|
+
>
|
|
90
95
|
<CatalogEntityRelationsTable
|
|
91
96
|
key="members-table"
|
|
92
97
|
entity={entity}
|
|
@@ -104,8 +109,8 @@ export function CatalogEntityTeamRelations({
|
|
|
104
109
|
shouldShowLoadMore={shouldShowLoadMore}
|
|
105
110
|
listType="team"
|
|
106
111
|
/>
|
|
107
|
-
</
|
|
108
|
-
<
|
|
112
|
+
</TabItemFragment>
|
|
113
|
+
<TabItemFragment
|
|
109
114
|
label="Related entities"
|
|
110
115
|
icon={<EntityTypeIcon />}
|
|
111
116
|
onClick={() => setFilter('-type:user')}
|
|
@@ -126,16 +131,12 @@ export function CatalogEntityTeamRelations({
|
|
|
126
131
|
shouldShowLoadMore={shouldShowLoadMore}
|
|
127
132
|
shouldShowHeading={false}
|
|
128
133
|
/>
|
|
129
|
-
</
|
|
134
|
+
</TabItemFragment>
|
|
130
135
|
</Tabs>
|
|
131
136
|
</div>
|
|
132
137
|
);
|
|
133
138
|
}
|
|
134
139
|
|
|
135
|
-
const TabItem = styled.div<{ label: string; icon?: ReactNode }>`
|
|
136
|
-
padding: var(--spacing-sm);
|
|
137
|
-
`;
|
|
138
|
-
|
|
139
140
|
const EntityDescription = styled.div`
|
|
140
141
|
font-size: var(--catalog-table-entity-summary-font-size);
|
|
141
142
|
line-height: var(--catalog-table-entity-summary-line-height);
|
|
@@ -18,9 +18,9 @@ export function CatalogEntityTypeIcon({
|
|
|
18
18
|
return (
|
|
19
19
|
<IconContainer
|
|
20
20
|
data-component-name="Catalog/CatalogEntityTypeIcon"
|
|
21
|
-
entityType={entityType}
|
|
22
|
-
defaultColors={defaultColors}
|
|
23
|
-
size={size}
|
|
21
|
+
$entityType={entityType}
|
|
22
|
+
$defaultColors={defaultColors}
|
|
23
|
+
$size={size}
|
|
24
24
|
>
|
|
25
25
|
<CatalogEntityIcon entityType={entityType} defaultColor={false} />
|
|
26
26
|
</IconContainer>
|
|
@@ -28,33 +28,39 @@ export function CatalogEntityTypeIcon({
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const IconContainer = styled.div<{
|
|
31
|
-
entityType: string;
|
|
32
|
-
defaultColors: boolean;
|
|
33
|
-
size: 'large' | 'medium';
|
|
31
|
+
$entityType: string;
|
|
32
|
+
$defaultColors: boolean;
|
|
33
|
+
$size: 'large' | 'medium';
|
|
34
34
|
}>`
|
|
35
35
|
display: flex;
|
|
36
36
|
align-items: center;
|
|
37
37
|
justify-content: center;
|
|
38
|
-
width: ${({ size }) =>
|
|
39
|
-
|
|
38
|
+
width: ${({ $size }) =>
|
|
39
|
+
$size === 'large'
|
|
40
|
+
? 'var(--catalog-table-icon-width-large)'
|
|
41
|
+
: 'var(--catalog-table-icon-width-medium)'};
|
|
42
|
+
height: ${({ $size }) =>
|
|
43
|
+
$size === 'large'
|
|
44
|
+
? 'var(--catalog-table-icon-height-large)'
|
|
45
|
+
: 'var(--catalog-table-icon-height-medium)'};
|
|
40
46
|
border-radius: var(--catalog-table-icon-border-radius);
|
|
41
|
-
background-color: ${({ defaultColors, entityType }) => {
|
|
42
|
-
if (defaultColors) {
|
|
47
|
+
background-color: ${({ $defaultColors, $entityType }) => {
|
|
48
|
+
if ($defaultColors) {
|
|
43
49
|
return 'var(--catalog-entity-bg-color)';
|
|
44
50
|
}
|
|
45
|
-
if (PREDEFINED_ENTITY_TYPES.includes(entityType)) {
|
|
46
|
-
return `var(--catalog-entity-bg-color-${entityType})`;
|
|
51
|
+
if (PREDEFINED_ENTITY_TYPES.includes($entityType)) {
|
|
52
|
+
return `var(--catalog-entity-bg-color-${$entityType})`;
|
|
47
53
|
}
|
|
48
54
|
return 'var(--catalog-entity-bg-color-custom)';
|
|
49
55
|
}};
|
|
50
56
|
flex-shrink: 0;
|
|
51
57
|
border: 1px solid
|
|
52
|
-
${({ defaultColors, entityType }) => {
|
|
53
|
-
if (defaultColors) {
|
|
58
|
+
${({ $defaultColors, $entityType }) => {
|
|
59
|
+
if ($defaultColors) {
|
|
54
60
|
return 'var(--catalog-entity-border-color)';
|
|
55
61
|
}
|
|
56
|
-
if (PREDEFINED_ENTITY_TYPES.includes(entityType)) {
|
|
57
|
-
return `var(--catalog-entity-border-color-${entityType})`;
|
|
62
|
+
if (PREDEFINED_ENTITY_TYPES.includes($entityType)) {
|
|
63
|
+
return `var(--catalog-entity-border-color-${$entityType})`;
|
|
58
64
|
}
|
|
59
65
|
return 'var(--catalog-entity-border-color-custom)';
|
|
60
66
|
}};
|
|
@@ -33,7 +33,7 @@ export const getEntityTagColor = (type: EntityType): string => {
|
|
|
33
33
|
export function CatalogEntityTypeTag({ entityType }: CatalogEntityTypeTagProps): JSX.Element {
|
|
34
34
|
return (
|
|
35
35
|
<EntityTypeTagWrapper
|
|
36
|
-
entityType={entityType as EntityType}
|
|
36
|
+
$entityType={entityType as EntityType}
|
|
37
37
|
data-component-name="Catalog/CatalogEntityTypeTag"
|
|
38
38
|
>
|
|
39
39
|
<CatalogHighlight>{entityType}</CatalogHighlight>
|
|
@@ -41,17 +41,17 @@ export function CatalogEntityTypeTag({ entityType }: CatalogEntityTypeTagProps):
|
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const EntityTypeTagWrapper = styled(Tag)<{ entityType: EntityType }>`
|
|
44
|
+
const EntityTypeTagWrapper = styled(Tag)<{ $entityType: EntityType }>`
|
|
45
45
|
font-size: var(--font-size-base);
|
|
46
46
|
background-color: transparent;
|
|
47
47
|
text-transform: none;
|
|
48
48
|
border: 1px solid
|
|
49
|
-
${({ entityType }) =>
|
|
50
|
-
!PREDEFINED_ENTITY_TYPES.includes(entityType)
|
|
49
|
+
${({ $entityType }) =>
|
|
50
|
+
!PREDEFINED_ENTITY_TYPES.includes($entityType)
|
|
51
51
|
? 'var(--catalog-entity-border-color-custom)'
|
|
52
|
-
: `var(--catalog-entity-border-color-${entityType})`};
|
|
53
|
-
color: ${({ entityType }) =>
|
|
54
|
-
!PREDEFINED_ENTITY_TYPES.includes(entityType)
|
|
52
|
+
: `var(--catalog-entity-border-color-${$entityType})`};
|
|
53
|
+
color: ${({ $entityType }) =>
|
|
54
|
+
!PREDEFINED_ENTITY_TYPES.includes($entityType)
|
|
55
55
|
? 'var(--catalog-entity-icon-color-custom)'
|
|
56
|
-
: `var(--catalog-entity-icon-color-${entityType})`};
|
|
56
|
+
: `var(--catalog-entity-icon-color-${$entityType})`};
|
|
57
57
|
`;
|
|
@@ -115,8 +115,8 @@ export const CatalogTableView = <T extends BaseEntity>({
|
|
|
115
115
|
const tableContent = (
|
|
116
116
|
<>
|
|
117
117
|
<CatalogTableHeader
|
|
118
|
-
columnsWidths={columns.map((column) => column.width || '1fr')}
|
|
119
|
-
columnsMinWidths={columns.map((column) => column.minWidth || 'auto')}
|
|
118
|
+
$columnsWidths={columns.map((column) => column.width || '1fr')}
|
|
119
|
+
$columnsMinWidths={columns.map((column) => column.minWidth || 'auto')}
|
|
120
120
|
>
|
|
121
121
|
{columns.map((column) => (
|
|
122
122
|
<CatalogTableHeaderCell<T>
|
|
@@ -174,12 +174,14 @@ const CatalogTableContentInner = styled.div<{ $contentMinWidth: number }>`
|
|
|
174
174
|
min-width: ${({ $contentMinWidth }) => $contentMinWidth}px;
|
|
175
175
|
`;
|
|
176
176
|
|
|
177
|
-
const CatalogTableHeader = styled.div<{ columnsWidths: string[]; columnsMinWidths: string[] }>`
|
|
177
|
+
const CatalogTableHeader = styled.div<{ $columnsWidths: string[]; $columnsMinWidths: string[] }>`
|
|
178
178
|
display: grid;
|
|
179
|
-
grid-template-columns: ${({ columnsWidths, columnsMinWidths }) =>
|
|
180
|
-
columnsWidths
|
|
179
|
+
grid-template-columns: ${({ $columnsWidths, $columnsMinWidths }) =>
|
|
180
|
+
$columnsWidths
|
|
181
181
|
.map((width, index) =>
|
|
182
|
-
columnsMinWidths[index] !== 'auto'
|
|
182
|
+
$columnsMinWidths[index] !== 'auto'
|
|
183
|
+
? `minmax(${$columnsMinWidths[index]}, ${width})`
|
|
184
|
+
: width,
|
|
183
185
|
)
|
|
184
186
|
.join(' ')};
|
|
185
187
|
background: var(--catalog-table-header-bg-color);
|
|
@@ -124,7 +124,9 @@ export const CatalogDescription = styled.p`
|
|
|
124
124
|
margin: var(--catalog-classic-description-margin);
|
|
125
125
|
`;
|
|
126
126
|
|
|
127
|
-
export const CatalogPageWrapper = styled.div
|
|
127
|
+
export const CatalogPageWrapper = styled.div.withConfig({
|
|
128
|
+
shouldForwardProp: (prop) => prop !== 'withoutFilters',
|
|
129
|
+
})<{ withoutFilters?: boolean; className?: string }>`
|
|
128
130
|
--sidebar-width: var(--catalog-classic-sidebar-width, 285px);
|
|
129
131
|
|
|
130
132
|
display: flex;
|
|
@@ -20,12 +20,28 @@ export type CodeBlockContainerProps = PropsWithChildren<{
|
|
|
20
20
|
}>;
|
|
21
21
|
|
|
22
22
|
export function CodeBlockContainer(props: CodeBlockContainerProps): JSX.Element {
|
|
23
|
+
const { hideCodeColors, wrapContents, maxHeight, ...rest } = props;
|
|
23
24
|
return (
|
|
24
|
-
<CodeBlockContainerComponent
|
|
25
|
+
<CodeBlockContainerComponent
|
|
26
|
+
{...rest}
|
|
27
|
+
$hideCodeColors={hideCodeColors}
|
|
28
|
+
$wrapContents={wrapContents}
|
|
29
|
+
$maxHeight={maxHeight}
|
|
30
|
+
data-component-name="CodeBlock/CodeBlockContainer"
|
|
31
|
+
/>
|
|
25
32
|
);
|
|
26
33
|
}
|
|
27
34
|
|
|
28
|
-
const CodeBlockContainerComponent = styled.pre<
|
|
35
|
+
const CodeBlockContainerComponent = styled.pre<{
|
|
36
|
+
$hideCodeColors?: boolean;
|
|
37
|
+
$wrapContents?: boolean;
|
|
38
|
+
$maxHeight?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
withLineNumbers?: boolean;
|
|
41
|
+
dangerouslySetInnerHTML?: CodeBlockContainerProps['dangerouslySetInnerHTML'];
|
|
42
|
+
suppressHydrationWarning?: boolean;
|
|
43
|
+
tabIndex?: number;
|
|
44
|
+
}>`
|
|
29
45
|
&& {
|
|
30
46
|
overflow-x: auto;
|
|
31
47
|
font-family: var(--code-block-font-family);
|
|
@@ -35,9 +51,9 @@ const CodeBlockContainerComponent = styled.pre<CodeBlockContainerProps>`
|
|
|
35
51
|
margin: var(--code-block-margin);
|
|
36
52
|
color: var(--code-block-text-color);
|
|
37
53
|
font-size: var(--code-block-font-size);
|
|
38
|
-
white-space: ${({ wrapContents }) => (wrapContents ? 'pre-wrap' : 'var(--code-wrap, pre)')};
|
|
39
|
-
max-height: ${({ maxHeight }) =>
|
|
40
|
-
maxHeight ? maxHeight : 'var(--code-block-max-height, 600px);'};
|
|
54
|
+
white-space: ${({ $wrapContents }) => ($wrapContents ? 'pre-wrap' : 'var(--code-wrap, pre)')};
|
|
55
|
+
max-height: ${({ $maxHeight }) =>
|
|
56
|
+
$maxHeight ? $maxHeight : 'var(--code-block-max-height, 600px);'};
|
|
41
57
|
word-break: var(--code-block-word-break, initial);
|
|
42
58
|
|
|
43
59
|
pre,
|
|
@@ -321,8 +337,8 @@ const CodeBlockContainerComponent = styled.pre<CodeBlockContainerProps>`
|
|
|
321
337
|
|
|
322
338
|
${generateCodeBlockTokens()}
|
|
323
339
|
|
|
324
|
-
${({ hideCodeColors }) =>
|
|
325
|
-
hideCodeColors &&
|
|
340
|
+
${({ $hideCodeColors }) =>
|
|
341
|
+
$hideCodeColors &&
|
|
326
342
|
css`
|
|
327
343
|
.line-number:not(.highlighted),
|
|
328
344
|
.line-number:not(.highlighted) > span,
|
|
@@ -7,7 +7,7 @@ import type { CodeBlockItems } from '@redocly/theme/components/CodeBlock/CodeBlo
|
|
|
7
7
|
import { CodeBlockTabs } from '@redocly/theme/components/CodeBlock/CodeBlockTabs';
|
|
8
8
|
import { CopyButton } from '@redocly/theme/components/Buttons/CopyButton';
|
|
9
9
|
import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
|
|
10
|
-
import { useThemeHooks, useThemeConfig } from '@redocly/theme/core/hooks';
|
|
10
|
+
import { useThemeHooks, useThemeConfig, ReportButtonProps } from '@redocly/theme/core/hooks';
|
|
11
11
|
import { DeselectIcon } from '@redocly/theme/icons/DeselectIcon/DeselectIcon';
|
|
12
12
|
import { MaximizeIcon } from '@redocly/theme/icons/MaximizeIcon/MaximizeIcon';
|
|
13
13
|
import { MinimizeIcon } from '@redocly/theme/icons/MinimizeIcon/MinimizeIcon';
|
|
@@ -39,8 +39,7 @@ type ControlProps = {
|
|
|
39
39
|
label?: string;
|
|
40
40
|
tooltipText?: string;
|
|
41
41
|
onClick?: () => void;
|
|
42
|
-
|
|
43
|
-
props?: Record<string, any>;
|
|
42
|
+
props?: ReportButtonProps;
|
|
44
43
|
};
|
|
45
44
|
|
|
46
45
|
type CopyControlProps = ControlProps & {
|
|
@@ -87,7 +86,10 @@ export function CodeBlockControls({
|
|
|
87
86
|
{dropdown && <CodeBlockDropdown {...dropdown} />}
|
|
88
87
|
{report && !report.hidden && !report?.props?.hide ? (
|
|
89
88
|
<Tooltip
|
|
90
|
-
tip={
|
|
89
|
+
tip={
|
|
90
|
+
report.props?.tooltip ||
|
|
91
|
+
translate('codeSnippet.report.tooltipText', 'Report a problem')
|
|
92
|
+
}
|
|
91
93
|
placement="top"
|
|
92
94
|
arrowPosition="right"
|
|
93
95
|
>
|
|
@@ -97,16 +99,15 @@ export function CodeBlockControls({
|
|
|
97
99
|
data-testid="report-button"
|
|
98
100
|
icon={controlsType === 'icon' ? <WarningSquareIcon size="18px" /> : undefined}
|
|
99
101
|
aria-label="Report a problem"
|
|
100
|
-
{
|
|
102
|
+
onClick={report.props?.onClick}
|
|
101
103
|
>
|
|
102
|
-
{controlsType
|
|
104
|
+
{controlsType !== 'icon' && (report.props?.buttonText || 'Report')}
|
|
103
105
|
</ControlButton>
|
|
104
106
|
</Tooltip>
|
|
105
107
|
) : null}
|
|
106
|
-
|
|
107
108
|
{expand && !codeSnippet?.expand?.hide ? (
|
|
108
109
|
<Tooltip
|
|
109
|
-
tip={translate('codeSnippet.expand.tooltipText', 'Expand all')}
|
|
110
|
+
tip={expand.props?.tooltip || translate('codeSnippet.expand.tooltipText', 'Expand all')}
|
|
110
111
|
placement="top"
|
|
111
112
|
arrowPosition="right"
|
|
112
113
|
>
|
|
@@ -125,7 +126,10 @@ export function CodeBlockControls({
|
|
|
125
126
|
|
|
126
127
|
{collapse && !codeSnippet?.collapse?.hide ? (
|
|
127
128
|
<Tooltip
|
|
128
|
-
tip={
|
|
129
|
+
tip={
|
|
130
|
+
collapse.props?.tooltip ||
|
|
131
|
+
translate('codeSnippet.collapse.tooltipText', 'Collapse all')
|
|
132
|
+
}
|
|
129
133
|
placement="top"
|
|
130
134
|
arrowPosition="right"
|
|
131
135
|
>
|
|
@@ -137,7 +141,7 @@ export function CodeBlockControls({
|
|
|
137
141
|
onClick={collapse?.onClick}
|
|
138
142
|
aria-label="Collapse all"
|
|
139
143
|
>
|
|
140
|
-
{controlsType !== 'icon' && (
|
|
144
|
+
{controlsType !== 'icon' && (collapse?.label || 'Collapse all')}
|
|
141
145
|
</ControlButton>
|
|
142
146
|
</Tooltip>
|
|
143
147
|
) : null}
|
|
@@ -149,6 +153,7 @@ export function CodeBlockControls({
|
|
|
149
153
|
data-testid="select-all"
|
|
150
154
|
icon={controlsType === 'icon' ? <SelectIcon /> : undefined}
|
|
151
155
|
onClick={select?.onClick}
|
|
156
|
+
aria-label="Select all"
|
|
152
157
|
>
|
|
153
158
|
{controlsType !== 'icon' && select?.label ? select.label : 'Select all'}
|
|
154
159
|
</ControlButton>
|
|
@@ -161,6 +166,7 @@ export function CodeBlockControls({
|
|
|
161
166
|
data-testid="clear-all"
|
|
162
167
|
icon={controlsType === 'icon' ? <DeselectIcon /> : undefined}
|
|
163
168
|
onClick={deselect?.onClick}
|
|
169
|
+
aria-label="Clear all"
|
|
164
170
|
>
|
|
165
171
|
{controlsType !== 'icon' && deselect?.label ? deselect.label : 'Clear all'}
|
|
166
172
|
</ControlButton>
|