@redocly/theme 0.54.0-next.2 → 0.54.0-next.3
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/{Catalog/Catalog.d.ts → CatalogLegacy/CatalogLegacy.d.ts} +2 -2
- package/lib/components/{Catalog/Catalog.js → CatalogLegacy/CatalogLegacy.js} +23 -23
- package/lib/components/{Catalog/CatalogActions.d.ts → CatalogLegacy/CatalogLegacyActions.d.ts} +2 -2
- package/lib/components/{Catalog/CatalogActions.js → CatalogLegacy/CatalogLegacyActions.js} +9 -8
- package/lib/components/CatalogLegacy/CatalogLegacyCard.d.ts +5 -0
- package/lib/components/{Catalog/CatalogCard.js → CatalogLegacy/CatalogLegacyCard.js} +33 -33
- package/lib/components/CatalogLegacy/CatalogLegacyHighlight.d.ts +4 -0
- package/lib/components/{Catalog/CatalogHighlight.js → CatalogLegacy/CatalogLegacyHighlight.js} +4 -4
- package/lib/components/{Catalog/CatalogInfoBlock.d.ts → CatalogLegacy/CatalogLegacyInfoBlock.d.ts} +2 -2
- package/lib/components/{Catalog/CatalogInfoBlock.js → CatalogLegacy/CatalogLegacyInfoBlock.js} +10 -10
- package/lib/components/{Catalog/CatalogVirtualizedGroups.d.ts → CatalogLegacy/CatalogLegacyVirtualizedGroups.d.ts} +2 -2
- package/lib/components/{Catalog/CatalogVirtualizedGroups.js → CatalogLegacy/CatalogLegacyVirtualizedGroups.js} +23 -23
- package/lib/components/CatalogLegacy/variables.js +109 -0
- package/lib/components/Menu/MenuItem.js +4 -1
- package/lib/components/Search/SearchDialog.js +2 -1
- package/lib/components/Search/variables.js +2 -0
- package/lib/components/Tag/variables.dark.js +9 -9
- package/lib/components/Tag/variables.js +3 -3
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -1
- package/lib/core/styles/global.js +1 -1
- package/lib/core/types/hooks.d.ts +2 -1
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.d.ts +11 -0
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +58 -0
- package/lib/icons/AiStarsIcon/AiStarsIcon.d.ts +0 -1
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +12 -20
- package/lib/icons/RabbitMQIcon/RabbitMQIcon.d.ts +9 -0
- package/lib/icons/RabbitMQIcon/RabbitMQIcon.js +26 -0
- package/lib/index.d.ts +9 -6
- package/lib/index.js +9 -6
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +5 -0
- package/package.json +3 -3
- package/src/components/{Catalog/Catalog.tsx → CatalogLegacy/CatalogLegacy.tsx} +28 -21
- package/src/components/{Catalog/CatalogActions.tsx → CatalogLegacy/CatalogLegacyActions.tsx} +8 -7
- package/src/components/{Catalog/CatalogCard.tsx → CatalogLegacy/CatalogLegacyCard.tsx} +34 -32
- package/src/components/{Catalog/CatalogHighlight.tsx → CatalogLegacy/CatalogLegacyHighlight.tsx} +3 -3
- package/src/components/{Catalog/CatalogInfoBlock.tsx → CatalogLegacy/CatalogLegacyInfoBlock.tsx} +9 -9
- package/src/components/{Catalog/CatalogVirtualizedGroups.tsx → CatalogLegacy/CatalogLegacyVirtualizedGroups.tsx} +23 -23
- package/src/components/CatalogLegacy/variables.ts +106 -0
- package/src/components/Menu/MenuItem.tsx +5 -1
- package/src/components/Search/SearchDialog.tsx +2 -1
- package/src/components/Search/variables.ts +2 -0
- package/src/components/Tag/variables.dark.ts +9 -9
- package/src/components/Tag/variables.ts +3 -3
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -1
- package/src/core/styles/global.ts +1 -1
- package/src/core/types/hooks.ts +2 -1
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +69 -0
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +13 -24
- package/src/icons/RabbitMQIcon/RabbitMQIcon.tsx +40 -0
- package/src/index.ts +9 -6
- package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +5 -0
- package/lib/components/Catalog/CatalogCard.d.ts +0 -5
- package/lib/components/Catalog/CatalogHighlight.d.ts +0 -4
- package/lib/components/Catalog/variables.js +0 -109
- package/src/components/Catalog/variables.ts +0 -106
- /package/lib/components/{Catalog → CatalogLegacy}/variables.d.ts +0 -0
|
@@ -8,23 +8,23 @@ import { useThemeHooks, useModalScrollLock } from '@redocly/theme/core/hooks';
|
|
|
8
8
|
import { H2 } from '@redocly/theme/components/Typography/H2';
|
|
9
9
|
import { FilterContent } from '@redocly/theme/components/Filter/FilterContent';
|
|
10
10
|
import { FilterPopover } from '@redocly/theme/components/Filter/FilterPopover';
|
|
11
|
-
import { HighlightContext } from '@redocly/theme/components/
|
|
12
|
-
import {
|
|
11
|
+
import { HighlightContext } from '@redocly/theme/components/CatalogLegacy/CatalogLegacyHighlight';
|
|
12
|
+
import { CatalogLegacyActions } from '@redocly/theme/components/CatalogLegacy/CatalogLegacyActions';
|
|
13
13
|
import { Sidebar } from '@redocly/theme/components/Sidebar/Sidebar';
|
|
14
|
-
import {
|
|
14
|
+
import { CatalogLegacyVirtualizedGroups } from '@redocly/theme/components/CatalogLegacy/CatalogLegacyVirtualizedGroups';
|
|
15
15
|
|
|
16
|
-
export type
|
|
16
|
+
export type CatalogLegacyProps = {
|
|
17
17
|
pageProps: {
|
|
18
18
|
catalogId: string;
|
|
19
19
|
catalogConfig: CatalogConfig;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export default function
|
|
23
|
+
export default function CatalogLegacy(props: CatalogLegacyProps): JSX.Element {
|
|
24
24
|
const { catalogConfig } = props.pageProps;
|
|
25
|
-
const { useTranslate,
|
|
25
|
+
const { useTranslate, useCatalogLegacy } = useThemeHooks();
|
|
26
26
|
|
|
27
|
-
const { filterTerm, setFilterTerm, groups, filters } =
|
|
27
|
+
const { filterTerm, setFilterTerm, groups, filters } = useCatalogLegacy(catalogConfig);
|
|
28
28
|
const [filterPopoverVisible, setFilterPopoverVisible] = React.useState(false);
|
|
29
29
|
const { translate } = useTranslate();
|
|
30
30
|
|
|
@@ -32,7 +32,10 @@ export default function Catalog(props: CatalogProps): JSX.Element {
|
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<HighlightContext.Provider value={[filterTerm]}>
|
|
35
|
-
<CatalogPageWrapper
|
|
35
|
+
<CatalogPageWrapper
|
|
36
|
+
data-component-name="CatalogLegacy/CatalogLegacy"
|
|
37
|
+
withoutFilters={!filters.length}
|
|
38
|
+
>
|
|
36
39
|
<FiltersSidebar
|
|
37
40
|
menu={
|
|
38
41
|
<FilterContent
|
|
@@ -52,7 +55,7 @@ export default function Catalog(props: CatalogProps): JSX.Element {
|
|
|
52
55
|
filterValuesCasing={catalogConfig.filterValuesCasing}
|
|
53
56
|
/>
|
|
54
57
|
)}
|
|
55
|
-
<
|
|
58
|
+
<CatalogLegacyActions
|
|
56
59
|
onOpenFilter={() => setFilterPopoverVisible(true)}
|
|
57
60
|
filters={filters}
|
|
58
61
|
filterTerm={filterTerm}
|
|
@@ -73,7 +76,11 @@ export default function Catalog(props: CatalogProps): JSX.Element {
|
|
|
73
76
|
) : null}
|
|
74
77
|
</CatalogPageDescriptionWrapper>
|
|
75
78
|
|
|
76
|
-
<
|
|
79
|
+
<CatalogLegacyVirtualizedGroups
|
|
80
|
+
groups={groups}
|
|
81
|
+
filters={filters}
|
|
82
|
+
filterTerm={filterTerm}
|
|
83
|
+
/>
|
|
77
84
|
</CatalogPageContent>
|
|
78
85
|
</CatalogPageWrapper>
|
|
79
86
|
</HighlightContext.Provider>
|
|
@@ -87,26 +94,26 @@ export const CatalogPageContent = styled.main`
|
|
|
87
94
|
|
|
88
95
|
@media screen and (min-width: ${breakpoints.medium}) {
|
|
89
96
|
width: 100%;
|
|
90
|
-
padding: var(--catalog-page-padding);
|
|
97
|
+
padding: var(--catalog-legacy-page-padding);
|
|
91
98
|
}
|
|
92
99
|
`;
|
|
93
100
|
|
|
94
101
|
export const CatalogTitle = styled(H2)`
|
|
95
|
-
color: var(--catalog-title-text-color);
|
|
96
|
-
font-weight: var(--catalog-title-font-weight);
|
|
97
|
-
font-size: var(--catalog-title-font-size);
|
|
98
|
-
margin: var(--catalog-title-margin);
|
|
102
|
+
color: var(--catalog-legacy-title-text-color);
|
|
103
|
+
font-weight: var(--catalog-legacy-title-font-weight);
|
|
104
|
+
font-size: var(--catalog-legacy-title-font-size);
|
|
105
|
+
margin: var(--catalog-legacy-title-margin);
|
|
99
106
|
`;
|
|
100
107
|
|
|
101
108
|
export const CatalogDescription = styled.p`
|
|
102
|
-
color: var(--catalog-description-text-color);
|
|
103
|
-
font-weight: var(--catalog-description-font-weight);
|
|
104
|
-
font-size: var(--catalog-description-font-size);
|
|
105
|
-
margin: var(--catalog-description-margin);
|
|
109
|
+
color: var(--catalog-legacy-description-text-color);
|
|
110
|
+
font-weight: var(--catalog-legacy-description-font-weight);
|
|
111
|
+
font-size: var(--catalog-legacy-description-font-size);
|
|
112
|
+
margin: var(--catalog-legacy-description-margin);
|
|
106
113
|
`;
|
|
107
114
|
|
|
108
115
|
export const CatalogPageWrapper = styled.div<{ withoutFilters?: boolean }>`
|
|
109
|
-
--sidebar-width: var(--catalog-sidebar-width, 285px);
|
|
116
|
+
--sidebar-width: var(--catalog-legacy-sidebar-width, 285px);
|
|
110
117
|
|
|
111
118
|
display: flex;
|
|
112
119
|
flex-direction: column;
|
|
@@ -139,7 +146,7 @@ export const CatalogPageWrapper = styled.div<{ withoutFilters?: boolean }>`
|
|
|
139
146
|
`;
|
|
140
147
|
|
|
141
148
|
export const CatalogPageDescriptionWrapper = styled.div`
|
|
142
|
-
margin: var(--catalog-heading-margin);
|
|
149
|
+
margin: var(--catalog-legacy-heading-margin);
|
|
143
150
|
display: none;
|
|
144
151
|
|
|
145
152
|
@media screen and (min-width: ${breakpoints.medium}) {
|
package/src/components/{Catalog/CatalogActions.tsx → CatalogLegacy/CatalogLegacyActions.tsx}
RENAMED
|
@@ -9,13 +9,13 @@ import { Button } from '@redocly/theme/components/Button/Button';
|
|
|
9
9
|
import { FilterIcon } from '@redocly/theme/icons/FilterIcon/FilterIcon';
|
|
10
10
|
import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
|
|
11
11
|
|
|
12
|
-
export type
|
|
12
|
+
export type CatalogLegacyActionsProps = {
|
|
13
13
|
onOpenFilter: () => void;
|
|
14
14
|
filters: ResolvedFilter[];
|
|
15
15
|
filterTerm: string;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export function
|
|
18
|
+
export function CatalogLegacyActions(props: CatalogLegacyActionsProps): JSX.Element {
|
|
19
19
|
const { onOpenFilter, filterTerm, filters } = props;
|
|
20
20
|
|
|
21
21
|
let activeFilters = filterTerm.trim().length > 0 ? 1 : 0;
|
|
@@ -33,7 +33,7 @@ export function CatalogActions(props: CatalogActionsProps): JSX.Element {
|
|
|
33
33
|
const telemetry = useTelemetry();
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<CatalogActionsWrapper data-component-name="
|
|
36
|
+
<CatalogActionsWrapper data-component-name="CatalogLegacy/CatalogLegacyActions">
|
|
37
37
|
<Button
|
|
38
38
|
variant="ghost"
|
|
39
39
|
size="small"
|
|
@@ -55,10 +55,11 @@ export function CatalogActions(props: CatalogActionsProps): JSX.Element {
|
|
|
55
55
|
const CatalogActionsWrapper = styled.div`
|
|
56
56
|
display: flex;
|
|
57
57
|
align-items: center;
|
|
58
|
-
gap: var(--catalog-actions-gap);
|
|
59
|
-
padding: var(--catalog-actions-padding-vertical)
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
gap: var(--catalog-legacy-actions-gap);
|
|
59
|
+
padding: var(--catalog-legacy-actions-padding-vertical)
|
|
60
|
+
var(--catalog-legacy-actions-padding-horizontal);
|
|
61
|
+
min-height: var(--catalog-legacy-actions-min-height);
|
|
62
|
+
background-color: var(--catalog-legacy-actions-bg-color);
|
|
62
63
|
|
|
63
64
|
@media screen and (min-width: ${breakpoints.medium}) {
|
|
64
65
|
display: none;
|
|
@@ -8,37 +8,39 @@ import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
|
8
8
|
import { ArrowRightIcon } from '@redocly/theme/icons/ArrowRightIcon/ArrowRightIcon';
|
|
9
9
|
import { Link } from '@redocly/theme/components/Link/Link';
|
|
10
10
|
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
11
|
-
import {
|
|
11
|
+
import { CatalogLegacyHighlight } from '@redocly/theme/components/CatalogLegacy/CatalogLegacyHighlight';
|
|
12
12
|
import { Button } from '@redocly/theme/components/Button/Button';
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type CatalogLegacyCardProps = {
|
|
15
15
|
item: CatalogItem;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export function
|
|
18
|
+
export function CatalogLegacyCard({ item }: CatalogLegacyCardProps): JSX.Element {
|
|
19
19
|
const { useTelemetry } = useThemeHooks();
|
|
20
20
|
const telemetry = useTelemetry();
|
|
21
21
|
return (
|
|
22
22
|
<Link key={item.docsLink || item.link} to={item.docsLink || item.link}>
|
|
23
23
|
<StyledCard
|
|
24
|
-
data-component-name="
|
|
24
|
+
data-component-name="CatalogLegacy/CatalogLegacyCard"
|
|
25
25
|
onClick={() => telemetry.send('catalog_item_clicked', {})}
|
|
26
26
|
>
|
|
27
27
|
<CardContent>
|
|
28
28
|
<CardTitleWrapper>
|
|
29
29
|
<CardTitle>
|
|
30
|
-
<
|
|
30
|
+
<CatalogLegacyHighlight>{item.title}</CatalogLegacyHighlight>
|
|
31
31
|
</CardTitle>
|
|
32
32
|
</CardTitleWrapper>
|
|
33
33
|
<CardDescription>
|
|
34
|
-
<
|
|
34
|
+
<CatalogLegacyHighlight>
|
|
35
|
+
{item.summary ?? item.description ?? ''}
|
|
36
|
+
</CatalogLegacyHighlight>
|
|
35
37
|
</CardDescription>
|
|
36
38
|
</CardContent>
|
|
37
39
|
<CardFooter>
|
|
38
40
|
<CardTags>
|
|
39
41
|
{((item.tags as string[]) || []).map((tag, index) => (
|
|
40
42
|
<CardTag key={tag + index} color={slug(tag)}>
|
|
41
|
-
<
|
|
43
|
+
<CatalogLegacyHighlight>{capitalize(tag)}</CatalogLegacyHighlight>
|
|
42
44
|
</CardTag>
|
|
43
45
|
))}
|
|
44
46
|
{(item.scorecardLevel && (
|
|
@@ -50,7 +52,7 @@ export function CatalogCard({ item }: CatalogCardProps): JSX.Element {
|
|
|
50
52
|
Object.keys(item.scorecardLevels || {}).length,
|
|
51
53
|
)})`}
|
|
52
54
|
>
|
|
53
|
-
<
|
|
55
|
+
<CatalogLegacyHighlight>{item.scorecardLevel}</CatalogLegacyHighlight>
|
|
54
56
|
</Tag>
|
|
55
57
|
)) ||
|
|
56
58
|
null}
|
|
@@ -68,20 +70,20 @@ const SelectButton = styled(Button)`
|
|
|
68
70
|
`;
|
|
69
71
|
|
|
70
72
|
const StyledCard = styled.div`
|
|
71
|
-
min-height: var(--catalog-card-min-height);
|
|
73
|
+
min-height: var(--catalog-legacy-card-min-height);
|
|
72
74
|
height: 100%;
|
|
73
|
-
color: var(--catalog-card-text-color);
|
|
74
|
-
font-size: var(--catalog-card-font-size);
|
|
75
|
-
font-weight: var(--catalog-card-font-weight);
|
|
76
|
-
background-color: var(--catalog-card-bg-color);
|
|
77
|
-
border: var(--catalog-card-border-width) var(--catalog-card-border-style)
|
|
78
|
-
var(--catalog-card-border-color);
|
|
75
|
+
color: var(--catalog-legacy-card-text-color);
|
|
76
|
+
font-size: var(--catalog-legacy-card-font-size);
|
|
77
|
+
font-weight: var(--catalog-legacy-card-font-weight);
|
|
78
|
+
background-color: var(--catalog-legacy-card-bg-color);
|
|
79
|
+
border: var(--catalog-legacy-card-border-width) var(--catalog-legacy-card-border-style)
|
|
80
|
+
var(--catalog-legacy-card-border-color);
|
|
79
81
|
transition: all 0.2s ease-in-out;
|
|
80
|
-
border-radius: var(--catalog-card-border-radius);
|
|
82
|
+
border-radius: var(--catalog-legacy-card-border-radius);
|
|
81
83
|
cursor: pointer;
|
|
82
84
|
display: flex;
|
|
83
|
-
gap: var(--catalog-card-gap);
|
|
84
|
-
padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
|
|
85
|
+
gap: var(--catalog-legacy-card-gap);
|
|
86
|
+
padding: var(--catalog-legacy-card-padding-vertical) var(--catalog-legacy-card-padding-horizontal);
|
|
85
87
|
flex-direction: column;
|
|
86
88
|
|
|
87
89
|
&:hover ${SelectButton} {
|
|
@@ -92,40 +94,40 @@ const StyledCard = styled.div`
|
|
|
92
94
|
const CardTitleWrapper = styled.div`
|
|
93
95
|
display: flex;
|
|
94
96
|
align-items: center;
|
|
95
|
-
min-height: var(--catalog-card-title-min-height);
|
|
97
|
+
min-height: var(--catalog-legacy-card-title-min-height);
|
|
96
98
|
`;
|
|
97
99
|
|
|
98
100
|
const CardTitle = styled.div`
|
|
99
101
|
display: -webkit-box;
|
|
100
|
-
-webkit-line-clamp: var(--catalog-card-title-line-clamp);
|
|
102
|
+
-webkit-line-clamp: var(--catalog-legacy-card-title-line-clamp);
|
|
101
103
|
-webkit-box-orient: vertical;
|
|
102
104
|
overflow: hidden;
|
|
103
105
|
text-overflow: ellipsis;
|
|
104
106
|
|
|
105
|
-
color: var(--catalog-card-title-color);
|
|
106
|
-
font-size: var(--catalog-card-title-font-size);
|
|
107
|
-
font-weight: var(--catalog-card-title-font-weight);
|
|
108
|
-
line-height: var(--catalog-card-title-line-height);
|
|
107
|
+
color: var(--catalog-legacy-card-title-color);
|
|
108
|
+
font-size: var(--catalog-legacy-card-title-font-size);
|
|
109
|
+
font-weight: var(--catalog-legacy-card-title-font-weight);
|
|
110
|
+
line-height: var(--catalog-legacy-card-title-line-height);
|
|
109
111
|
margin: 0;
|
|
110
112
|
`;
|
|
111
113
|
|
|
112
114
|
const CardDescription = styled.div`
|
|
113
115
|
display: -webkit-box;
|
|
114
|
-
-webkit-line-clamp: var(--catalog-card-description-line-clamp);
|
|
116
|
+
-webkit-line-clamp: var(--catalog-legacy-card-description-line-clamp);
|
|
115
117
|
-webkit-box-orient: vertical;
|
|
116
118
|
overflow: hidden;
|
|
117
119
|
text-overflow: ellipsis;
|
|
118
|
-
color: var(--catalog-card-description-color);
|
|
119
|
-
font-size: var(--catalog-card-description-font-size);
|
|
120
|
-
font-weight: var(--catalog-card-description-font-weight);
|
|
121
|
-
line-height: var(--catalog-card-description-line-height);
|
|
122
|
-
height: var(--catalog-card-description-height);
|
|
120
|
+
color: var(--catalog-legacy-card-description-color);
|
|
121
|
+
font-size: var(--catalog-legacy-card-description-font-size);
|
|
122
|
+
font-weight: var(--catalog-legacy-card-description-font-weight);
|
|
123
|
+
line-height: var(--catalog-legacy-card-description-line-height);
|
|
124
|
+
height: var(--catalog-legacy-card-description-height);
|
|
123
125
|
`;
|
|
124
126
|
|
|
125
127
|
const CardContent = styled.div`
|
|
126
128
|
flex: 1;
|
|
127
129
|
display: flex;
|
|
128
|
-
gap: var(--catalog-card-content-gap);
|
|
130
|
+
gap: var(--catalog-legacy-card-content-gap);
|
|
129
131
|
flex-direction: column;
|
|
130
132
|
`;
|
|
131
133
|
|
|
@@ -146,5 +148,5 @@ const CardTags = styled.div`
|
|
|
146
148
|
const CardTag = styled(Tag)`
|
|
147
149
|
text-transform: inherit;
|
|
148
150
|
margin: 0;
|
|
149
|
-
background-color: var(--catalog-card-tag-bg);
|
|
151
|
+
background-color: var(--catalog-legacy-card-tag-bg);
|
|
150
152
|
`;
|
package/src/components/{Catalog/CatalogHighlight.tsx → CatalogLegacy/CatalogLegacyHighlight.tsx}
RENAMED
|
@@ -4,9 +4,9 @@ import styled from 'styled-components';
|
|
|
4
4
|
|
|
5
5
|
export const HighlightContext = React.createContext<string[]>([]);
|
|
6
6
|
|
|
7
|
-
export type
|
|
7
|
+
export type CatalogLegacyHighlightProps = React.PropsWithChildren;
|
|
8
8
|
|
|
9
|
-
export function
|
|
9
|
+
export function CatalogLegacyHighlight(props: CatalogLegacyHighlightProps): JSX.Element | null {
|
|
10
10
|
const { children } = props;
|
|
11
11
|
const searchWords = React.useContext(HighlightContext);
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@ export function CatalogHighlight(props: CatalogHighlightProps): JSX.Element | nu
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<span data-component-name="
|
|
24
|
+
<span data-component-name="CatalogLegacy/CatalogLegacyHighlight" key={childIdx}>
|
|
25
25
|
{chunks.map((chunk, idx) => {
|
|
26
26
|
const { end, highlight, start } = chunk;
|
|
27
27
|
const text = str.substr(start, end - start);
|
package/src/components/{Catalog/CatalogInfoBlock.tsx → CatalogLegacy/CatalogLegacyInfoBlock.tsx}
RENAMED
|
@@ -6,7 +6,7 @@ import { getScorecardColorVariable } from '@redocly/theme/core/utils';
|
|
|
6
6
|
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
7
7
|
import { Link } from '@redocly/theme/components/Link/Link';
|
|
8
8
|
|
|
9
|
-
export type
|
|
9
|
+
export type CatalogLegacyInfoBlockProps = {
|
|
10
10
|
metadata?: {
|
|
11
11
|
scorecardLevel?: string;
|
|
12
12
|
scoreCardSlug?: string;
|
|
@@ -17,7 +17,7 @@ export type CatalogInfoBlockProps = {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export function
|
|
20
|
+
export function CatalogLegacyInfoBlock(props: CatalogLegacyInfoBlockProps): JSX.Element {
|
|
21
21
|
const scorecardBadge = props.metadata?.scorecardLevel ? (
|
|
22
22
|
<ScorecardBadge
|
|
23
23
|
level={props.metadata.scorecardLevel as string}
|
|
@@ -31,7 +31,7 @@ export function CatalogInfoBlock(props: CatalogInfoBlockProps): JSX.Element {
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<CatalogInfoBlockWrapper>
|
|
34
|
-
<CatalogBadgesWrapper data-component-name="
|
|
34
|
+
<CatalogBadgesWrapper data-component-name="CatalogLegacy/CatalogLegacyInfoBlock">
|
|
35
35
|
{scorecardBadge}
|
|
36
36
|
</CatalogBadgesWrapper>
|
|
37
37
|
</CatalogInfoBlockWrapper>
|
|
@@ -74,10 +74,10 @@ const CatalogBadgesWrapper = styled.div`
|
|
|
74
74
|
right: 0;
|
|
75
75
|
margin-top: var(--panel-gap-vertical);
|
|
76
76
|
|
|
77
|
-
--badge-border-radius: var(--catalog-page-badge-border-radius);
|
|
78
|
-
--badge-padding: var(--catalog-page-badge-padding);
|
|
79
|
-
--badge-font-size: var(--catalog-page-badge-font-size);
|
|
80
|
-
--badge-line-height: var(--catalog-page-badge-line-height);
|
|
81
|
-
--badge-dot-size: var(--catalog-page-badge-dot-size);
|
|
82
|
-
--badge-dot-border-color: var(--catalog-page-badge-dot-border-color);
|
|
77
|
+
--badge-border-radius: var(--catalog-legacy-page-badge-border-radius);
|
|
78
|
+
--badge-padding: var(--catalog-legacy-page-badge-padding);
|
|
79
|
+
--badge-font-size: var(--catalog-legacy-page-badge-font-size);
|
|
80
|
+
--badge-line-height: var(--catalog-legacy-page-badge-line-height);
|
|
81
|
+
--badge-dot-size: var(--catalog-legacy-page-badge-dot-size);
|
|
82
|
+
--badge-dot-border-color: var(--catalog-legacy-page-badge-dot-border-color);
|
|
83
83
|
`;
|
|
@@ -4,14 +4,14 @@ import styled from 'styled-components';
|
|
|
4
4
|
|
|
5
5
|
import { CatalogItem, ResolvedFilter } from '@redocly/theme/core/types';
|
|
6
6
|
import { useElementSize } from '@redocly/theme/core/hooks';
|
|
7
|
-
import {
|
|
7
|
+
import { CatalogLegacyCard } from '@redocly/theme/components/CatalogLegacy/CatalogLegacyCard';
|
|
8
8
|
import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
|
|
9
9
|
import { SpinnerLoader } from '@redocly/theme/components/Loaders/SpinnerLoader';
|
|
10
10
|
|
|
11
11
|
const GAP_SIZE = 32;
|
|
12
12
|
const ESTIMATED_HEADER_HEIGHT = 43;
|
|
13
13
|
const ESTIMATED_CARD_HEIGHT = 194 + GAP_SIZE;
|
|
14
|
-
const CARD_MIN_WIDTH_VAR = '--catalog-card-min-width';
|
|
14
|
+
const CARD_MIN_WIDTH_VAR = '--catalog-legacy-card-min-width';
|
|
15
15
|
|
|
16
16
|
export type Group = {
|
|
17
17
|
title: string;
|
|
@@ -22,17 +22,17 @@ export type VirtualRowData =
|
|
|
22
22
|
| { type: 'header'; groupTitle: string; groupCount: number; key: string }
|
|
23
23
|
| { type: 'cardRow'; groupTitle: string; items: CatalogItem[]; key: string };
|
|
24
24
|
|
|
25
|
-
export type
|
|
25
|
+
export type CatalogLegacyVirtualizedGroupsProps = {
|
|
26
26
|
groups: Group[];
|
|
27
27
|
filters: (ResolvedFilter & { isFilterUsed?: boolean })[];
|
|
28
28
|
filterTerm: string;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export function
|
|
31
|
+
export function CatalogLegacyVirtualizedGroups({
|
|
32
32
|
groups,
|
|
33
33
|
filters,
|
|
34
34
|
filterTerm,
|
|
35
|
-
}:
|
|
35
|
+
}: CatalogLegacyVirtualizedGroupsProps) {
|
|
36
36
|
const [isClient, setIsClient] = useState(false);
|
|
37
37
|
const [size, parentRef] = useElementSize<HTMLDivElement>({ delay: 50, detectSizes: 'width' });
|
|
38
38
|
|
|
@@ -112,7 +112,7 @@ export function CatalogVirtualizedGroups({
|
|
|
112
112
|
|
|
113
113
|
if (!isClient) {
|
|
114
114
|
return (
|
|
115
|
-
<div ref={parentRef} data-component-name="
|
|
115
|
+
<div ref={parentRef} data-component-name="CatalogLegacy/CatalogLegacyVirtualizedGroups">
|
|
116
116
|
{flatRows.slice(0, 15).map((rowData) => {
|
|
117
117
|
if (rowData.type === 'header') {
|
|
118
118
|
return (
|
|
@@ -127,21 +127,21 @@ export function CatalogVirtualizedGroups({
|
|
|
127
127
|
<SSRRow key={rowData.key}>
|
|
128
128
|
{rowData.items.map((item) => (
|
|
129
129
|
<CardWrapper key={item.link}>
|
|
130
|
-
<
|
|
130
|
+
<CatalogLegacyCard item={item} />
|
|
131
131
|
</CardWrapper>
|
|
132
132
|
))}
|
|
133
133
|
</SSRRow>
|
|
134
134
|
);
|
|
135
135
|
})}
|
|
136
136
|
<LoadingWrapper>
|
|
137
|
-
<SpinnerLoader color="var(--catalog-description-text-color)" size="20px" />
|
|
137
|
+
<SpinnerLoader color="var(--catalog-legacy-description-text-color)" size="20px" />
|
|
138
138
|
</LoadingWrapper>
|
|
139
139
|
</div>
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
return (
|
|
144
|
-
<div ref={parentRef} data-component-name="
|
|
144
|
+
<div ref={parentRef} data-component-name="CatalogLegacy/CatalogLegacyVirtualizedGroups">
|
|
145
145
|
<div
|
|
146
146
|
style={{
|
|
147
147
|
position: 'relative',
|
|
@@ -172,7 +172,7 @@ export function CatalogVirtualizedGroups({
|
|
|
172
172
|
style={{ transform: `translateY(${virtualRow.start}px)` }}
|
|
173
173
|
>
|
|
174
174
|
{rowData.items.map((item) => (
|
|
175
|
-
<
|
|
175
|
+
<CatalogLegacyCard key={item.link} item={item} />
|
|
176
176
|
))}
|
|
177
177
|
</GridRow>
|
|
178
178
|
);
|
|
@@ -186,20 +186,20 @@ const SSRHeaderRow = styled.div`
|
|
|
186
186
|
width: 100%;
|
|
187
187
|
display: flex;
|
|
188
188
|
align-items: center;
|
|
189
|
-
padding: var(--catalog-separator-padding);
|
|
190
|
-
border-top: 1px solid var(--catalog-separator-border-color);
|
|
189
|
+
padding: var(--catalog-legacy-separator-padding);
|
|
190
|
+
border-top: 1px solid var(--catalog-legacy-separator-border-color);
|
|
191
191
|
padding-bottom: calc(4px * 4);
|
|
192
|
-
color: var(--catalog-separator-color);
|
|
193
|
-
font-size: var(--catalog-separator-font-size);
|
|
194
|
-
font-weight: var(--catalog-separator-font-weight);
|
|
192
|
+
color: var(--catalog-legacy-separator-color);
|
|
193
|
+
font-size: var(--catalog-legacy-separator-font-size);
|
|
194
|
+
font-weight: var(--catalog-legacy-separator-font-weight);
|
|
195
195
|
`;
|
|
196
196
|
|
|
197
197
|
const SSRRow = styled.div`
|
|
198
198
|
width: 100%;
|
|
199
199
|
display: flex;
|
|
200
200
|
flex-wrap: wrap;
|
|
201
|
-
gap: var(--catalog-cards-group-gap, 32px);
|
|
202
|
-
padding-bottom: var(--catalog-cards-group-gap, 32px);
|
|
201
|
+
gap: var(--catalog-legacy-cards-group-gap, 32px);
|
|
202
|
+
padding-bottom: var(--catalog-legacy-cards-group-gap, 32px);
|
|
203
203
|
`;
|
|
204
204
|
|
|
205
205
|
const HeaderRow = styled(SSRHeaderRow)`
|
|
@@ -213,20 +213,20 @@ const GridRow = styled.div`
|
|
|
213
213
|
left: 0;
|
|
214
214
|
width: 100%;
|
|
215
215
|
display: grid;
|
|
216
|
-
grid-template-columns: repeat(auto-fill, minmax(var(--catalog-card-min-width), 1fr));
|
|
217
|
-
gap: var(--catalog-cards-group-gap, 32px);
|
|
218
|
-
padding-bottom: var(--catalog-cards-group-gap, 32px);
|
|
216
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--catalog-legacy-card-min-width), 1fr));
|
|
217
|
+
gap: var(--catalog-legacy-cards-group-gap, 32px);
|
|
218
|
+
padding-bottom: var(--catalog-legacy-cards-group-gap, 32px);
|
|
219
219
|
will-change: transform;
|
|
220
220
|
`;
|
|
221
221
|
|
|
222
222
|
const CardWrapper = styled.div`
|
|
223
|
-
flex: 1 0 var(--catalog-card-min-width);
|
|
223
|
+
flex: 1 0 var(--catalog-legacy-card-min-width);
|
|
224
224
|
max-width: 100%;
|
|
225
|
-
min-width: var(--catalog-card-min-width);
|
|
225
|
+
min-width: var(--catalog-legacy-card-min-width);
|
|
226
226
|
`;
|
|
227
227
|
|
|
228
228
|
const CatalogSeparatorLabel = styled.div`
|
|
229
|
-
margin: var(--catalog-separator-label-margin);
|
|
229
|
+
margin: var(--catalog-legacy-separator-label-margin);
|
|
230
230
|
`;
|
|
231
231
|
|
|
232
232
|
const LoadingWrapper = styled.div`
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const catalog = css`
|
|
4
|
+
/* === Catalog === */
|
|
5
|
+
/**
|
|
6
|
+
* @tokens Catalog page
|
|
7
|
+
*/
|
|
8
|
+
--catalog-legacy-page-padding-vertical: var(--spacing-lg);
|
|
9
|
+
--catalog-legacy-page-padding-horizontal: var(--spacing-xl);
|
|
10
|
+
--catalog-legacy-page-padding: var(--catalog-legacy-page-padding-vertical) var(--catalog-legacy-page-padding-horizontal);
|
|
11
|
+
|
|
12
|
+
--catalog-legacy-filter-padding-vertical-mobile: 0;
|
|
13
|
+
--catalog-legacy-filter-padding-horizontal-mobile: var(--spacing-base);
|
|
14
|
+
|
|
15
|
+
--catalog-legacy-heading-margin: 0 0 var(--spacing-xl) 0;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @tokens Catalog page title
|
|
19
|
+
*/
|
|
20
|
+
--catalog-legacy-title-text-color: var(--text-color-primary);
|
|
21
|
+
--catalog-legacy-title-font-weight: var(--font-weight-bold);
|
|
22
|
+
--catalog-legacy-title-font-size: var(--font-size-heading-3);
|
|
23
|
+
--catalog-legacy-title-margin: 0 0 var(--spacing-sm) 0;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @tokens Catalog page description
|
|
27
|
+
*/
|
|
28
|
+
--catalog-legacy-description-text-color: var(--text-color-secondary);
|
|
29
|
+
--catalog-legacy-description-font-weight: var(--font-weight-regular);
|
|
30
|
+
--catalog-legacy-description-font-size: var(--font-size-base);
|
|
31
|
+
--catalog-legacy-description-margin: 0 0 var(--spacing-sm) 0;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @tokens Catalog page separator
|
|
35
|
+
*/
|
|
36
|
+
--catalog-legacy-separator-color: var(--text-color-secondary);
|
|
37
|
+
--catalog-legacy-separator-font-size: var(--font-size-base);
|
|
38
|
+
--catalog-legacy-separator-font-weight: var(--font-weight-regular);
|
|
39
|
+
--catalog-legacy-separator-border-color: var(--border-color-secondary);
|
|
40
|
+
--catalog-legacy-separator-margin: 0 0 var(--spacing-base) 0;
|
|
41
|
+
--catalog-legacy-separator-padding: var(--spacing-xxs) 0 0 0;
|
|
42
|
+
--catalog-legacy-separator-label-margin: 0 var(--spacing-xs);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @tokens Catalog card
|
|
46
|
+
*/
|
|
47
|
+
--catalog-legacy-card-min-height: 194px;
|
|
48
|
+
--catalog-legacy-card-min-width: 260px;
|
|
49
|
+
--catalog-legacy-card-padding-vertical: var(--spacing-base);
|
|
50
|
+
--catalog-legacy-card-padding-horizontal: var(--spacing-md);
|
|
51
|
+
--catalog-legacy-card-gap: var(--spacing-sm);
|
|
52
|
+
--catalog-legacy-card-text-color: var(--text-color-secondary);
|
|
53
|
+
--catalog-legacy-card-font-size: var(--font-size-base);
|
|
54
|
+
--catalog-legacy-card-font-weight: var(--font-weight-regular);
|
|
55
|
+
--catalog-legacy-card-bg-color: var(--layer-color);
|
|
56
|
+
--catalog-legacy-card-border-color: var(--border-color-secondary);
|
|
57
|
+
--catalog-legacy-card-border-width: var(--border-width);
|
|
58
|
+
--catalog-legacy-card-border-style: var(--border-style);
|
|
59
|
+
--catalog-legacy-card-border-color-hover: var(--border-color-primary);
|
|
60
|
+
--catalog-legacy-card-border-radius: var(--border-radius-xxl);
|
|
61
|
+
--catalog-legacy-cards-group-margin: 0 0 var(--spacing-base) 0;
|
|
62
|
+
--catalog-legacy-cards-group-gap: var(--spacing-xl);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @tokens Catalog card title
|
|
66
|
+
*/
|
|
67
|
+
--catalog-legacy-card-title-color: var(--text-color-primary);
|
|
68
|
+
--catalog-legacy-card-title-min-height: var(--spacing-xxl);
|
|
69
|
+
--catalog-legacy-card-title-font-size: var(--font-size-lg);
|
|
70
|
+
--catalog-legacy-card-title-font-weight: var(--font-weight-bold);
|
|
71
|
+
--catalog-legacy-card-title-line-height: var(--line-height-lg);
|
|
72
|
+
--catalog-legacy-card-title-line-clamp: 2;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @tokens Catalog card description
|
|
76
|
+
*/
|
|
77
|
+
--catalog-legacy-card-description-line-clamp: 3;
|
|
78
|
+
--catalog-legacy-card-description-color: var(--text-color-secondary);
|
|
79
|
+
--catalog-legacy-card-description-font-size: var(--font-size-base);
|
|
80
|
+
--catalog-legacy-card-description-line-height: var(--line-height-base);
|
|
81
|
+
--catalog-legacy-card-description-font-weight: var(--font-weight-regular);
|
|
82
|
+
--catalog-legacy-card-description-height: 62px;
|
|
83
|
+
|
|
84
|
+
--catalog-legacy-card-content-gap: var(--spacing-xxs);
|
|
85
|
+
|
|
86
|
+
--catalog-legacy-card-tag-bg: transparent;
|
|
87
|
+
|
|
88
|
+
--catalog-legacy-highlight-bg-color: none;
|
|
89
|
+
--catalog-legacy-highlight-text-color: var(--color-info-base);
|
|
90
|
+
|
|
91
|
+
--catalog-legacy-actions-gap: var(--spacing-xs);
|
|
92
|
+
--catalog-legacy-actions-padding-vertical: var(--spacing-xs);
|
|
93
|
+
--catalog-legacy-actions-padding-horizontal: 5%;
|
|
94
|
+
--catalog-legacy-actions-min-height: 40px;
|
|
95
|
+
--catalog-legacy-actions-bg-color: var(--bg-color-tonal);
|
|
96
|
+
|
|
97
|
+
--catalog-legacy-page-badge-border-radius: var(--border-radius);
|
|
98
|
+
--catalog-legacy-page-badge-padding: 0 var(--spacing-xs);
|
|
99
|
+
--catalog-legacy-page-badge-font-size: var(--font-size-base);
|
|
100
|
+
--catalog-legacy-page-badge-line-height: var(--line-height-base);
|
|
101
|
+
|
|
102
|
+
--catalog-legacy-page-badge-dot-size: 6px;
|
|
103
|
+
--catalog-legacy-page-badge-dot-border-color: #ffffff;
|
|
104
|
+
|
|
105
|
+
// @tokens End
|
|
106
|
+
`;
|
|
@@ -67,7 +67,7 @@ export function MenuItem(props: React.PropsWithChildren<MenuItemProps>): JSX.Ele
|
|
|
67
67
|
role={item.link ? 'none' : 'link'}
|
|
68
68
|
data-testid="menu-item-label"
|
|
69
69
|
>
|
|
70
|
-
{chevron}
|
|
70
|
+
<ChevronWrapper>{chevron}</ChevronWrapper>
|
|
71
71
|
{item.icon ? <MenuItemIcon src={item.icon} /> : null}
|
|
72
72
|
<MenuItemLabelTextWrapper>
|
|
73
73
|
<MenuItemLabel>
|
|
@@ -152,6 +152,10 @@ function generateClassName({
|
|
|
152
152
|
.trim();
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
const ChevronWrapper = styled.div`
|
|
156
|
+
flex-shrink: 0;
|
|
157
|
+
`;
|
|
158
|
+
|
|
155
159
|
const MenuItemWrapper = styled.div`
|
|
156
160
|
display: flex;
|
|
157
161
|
flex-direction: column;
|
|
@@ -29,6 +29,7 @@ import { AiStarsIcon } from '@redocly/theme/icons/AiStarsIcon/AiStarsIcon';
|
|
|
29
29
|
import { ReturnKeyIcon } from '@redocly/theme/icons/ReturnKeyIcon/ReturnKeyIcon';
|
|
30
30
|
import { ChevronLeftIcon } from '@redocly/theme/icons/ChevronLeftIcon/ChevronLeftIcon';
|
|
31
31
|
import { EditIcon } from '@redocly/theme/icons/EditIcon/EditIcon';
|
|
32
|
+
import { AiStarsGradientIcon } from '@redocly/theme/icons/AiStarsGradientIcon/AiStarsGradientIcon';
|
|
32
33
|
|
|
33
34
|
export type SearchDialogProps = {
|
|
34
35
|
onClose: () => void;
|
|
@@ -213,7 +214,7 @@ export function SearchDialog({ onClose, className }: SearchDialogProps): JSX.Ele
|
|
|
213
214
|
<SearchHeaderButtons>
|
|
214
215
|
{showAiSearchButton ? (
|
|
215
216
|
<SearchAiButton
|
|
216
|
-
icon={<
|
|
217
|
+
icon={<AiStarsGradientIcon color="var(--search-ai-button-icon-color)" />}
|
|
217
218
|
onClick={() => {
|
|
218
219
|
setMode('ai-dialog');
|
|
219
220
|
if (query.trim()) {
|
|
@@ -186,6 +186,8 @@ export const search = css`
|
|
|
186
186
|
--search-ai-icon-bg-color: var(--search-ai-gradient);
|
|
187
187
|
--search-ai-icon-color: var(--color-static-white);
|
|
188
188
|
|
|
189
|
+
--search-ai-button-icon-color: none;
|
|
190
|
+
|
|
189
191
|
--search-ai-thinking-dots-gap: 4px;
|
|
190
192
|
--search-ai-thinking-dots-padding: 4px 0;
|
|
191
193
|
--search-ai-thinking-dot-size: 6px;
|