@redocly/theme 0.57.0-next.0 → 0.57.0-next.2
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/CatalogCardView/CatalogCard.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +36 -25
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.js +38 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +83 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.d.ts +2 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +29 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.d.ts +8 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.js +33 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.d.ts +16 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.js +24 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.js +30 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +5 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +7 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +3 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +22 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.js +18 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +2 -2
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityIcon.js +4 -6
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +1 -1
- package/lib/components/Catalog/variables.js +42 -0
- package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.js +13 -8
- package/lib/core/constants/catalog.d.ts +10 -0
- package/lib/core/constants/catalog.js +14 -1
- package/lib/core/hooks/__mocks__/search/use-recent-searches.d.ts +2 -2
- package/lib/core/hooks/__mocks__/search/use-recent-searches.js +2 -1
- package/lib/core/hooks/__mocks__/search/use-search-filter.d.ts +2 -2
- package/lib/core/hooks/__mocks__/search/use-search-filter.js +2 -1
- package/lib/core/hooks/__mocks__/search/use-suggested-pages.d.ts +2 -2
- package/lib/core/hooks/__mocks__/search/use-suggested-pages.js +2 -1
- package/lib/core/hooks/__mocks__/use-controlled-state.d.ts +1 -1
- package/lib/core/hooks/__mocks__/use-controlled-state.js +2 -1
- package/lib/core/hooks/__mocks__/use-input-key-commands.d.ts +3 -3
- package/lib/core/hooks/__mocks__/use-input-key-commands.js +3 -2
- package/lib/core/hooks/__mocks__/use-mobile-menu.d.ts +1 -1
- package/lib/core/hooks/__mocks__/use-mobile-menu.js +2 -1
- package/lib/core/hooks/__mocks__/use-theme-config.d.ts +2 -2
- package/lib/core/hooks/__mocks__/use-theme-config.js +2 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +47 -47
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +38 -37
- package/lib/core/hooks/__mocks__/use-time-ago.d.ts +2 -2
- package/lib/core/hooks/__mocks__/use-time-ago.js +2 -1
- package/lib/core/hooks/catalog/useGraph.d.ts +15 -0
- package/lib/core/hooks/catalog/useGraph.js +165 -0
- package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.js +4 -3
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.d.ts +1 -1
- package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.js +2 -1
- package/lib/core/hooks/use-page-actions.js +5 -1
- package/lib/core/openapi/index.d.ts +1 -0
- package/lib/core/openapi/index.js +3 -1
- package/lib/core/styles/index.d.ts +1 -0
- package/lib/core/styles/index.js +3 -0
- package/lib/core/styles/xyflow.d.ts +1 -0
- package/lib/core/styles/xyflow.js +623 -0
- package/lib/core/utils/dynamic.d.ts +9 -0
- package/lib/core/utils/dynamic.js +59 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/icons/GenericIcon/GenericIcon.d.ts +2 -2
- package/lib/icons/GenericIcon/GenericIcon.js +8 -3
- package/lib/icons/__tests__/IconTestUtils.d.ts +0 -1
- package/lib/icons/__tests__/IconTestUtils.js +8 -7
- package/package.json +11 -14
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +60 -42
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.tsx +63 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.tsx +7 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +91 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.tsx +48 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.tsx +45 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.tsx +49 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +6 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +8 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +24 -43
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +76 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +2 -2
- package/src/components/Catalog/CatalogEntityIcon.tsx +7 -5
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +1 -1
- package/src/components/Catalog/variables.ts +42 -0
- package/src/components/CatalogClassic/CatalogClassicVirtualizedGroups.tsx +29 -18
- package/src/core/constants/catalog.ts +13 -0
- package/src/core/hooks/__mocks__/search/use-recent-searches.ts +3 -1
- package/src/core/hooks/__mocks__/search/use-search-filter.ts +3 -1
- package/src/core/hooks/__mocks__/search/use-suggested-pages.ts +3 -1
- package/src/core/hooks/__mocks__/use-controlled-state.ts +3 -1
- package/src/core/hooks/__mocks__/use-input-key-commands.ts +4 -2
- package/src/core/hooks/__mocks__/use-mobile-menu.ts +3 -1
- package/src/core/hooks/__mocks__/use-theme-config.ts +3 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +39 -37
- package/src/core/hooks/__mocks__/use-time-ago.ts +3 -1
- package/src/core/hooks/catalog/useGraph.ts +236 -0
- package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +5 -3
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/menu/__mocks__/use-mobile-menu-items.ts +3 -1
- package/src/core/hooks/use-page-actions.ts +5 -1
- package/src/core/openapi/index.ts +1 -0
- package/src/core/styles/index.ts +1 -0
- package/src/core/styles/xyflow.ts +620 -0
- package/src/core/utils/dynamic.tsx +85 -0
- package/src/core/utils/index.ts +1 -0
- package/src/icons/GenericIcon/GenericIcon.tsx +13 -4
- package/src/icons/__tests__/IconTestUtils.tsx +5 -4
|
@@ -6,7 +6,7 @@ import { resolveIcon } from '@redocly/theme/core/utils';
|
|
|
6
6
|
import { InlineSvg } from '@redocly/theme/markdoc/components/InlineSvg/InlineSvg';
|
|
7
7
|
import { Image } from '@redocly/theme/components/Image/Image';
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export type GenericIconProps = {
|
|
10
10
|
icon: string | React.ReactNode;
|
|
11
11
|
srcSet?: string;
|
|
12
12
|
rawContent?: string;
|
|
@@ -14,7 +14,9 @@ export interface GenericIconProps {
|
|
|
14
14
|
color?: string;
|
|
15
15
|
alt?: string;
|
|
16
16
|
className?: string;
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const INVALID_ICON_NAME = 'image-slash';
|
|
18
20
|
|
|
19
21
|
export function GenericIcon({
|
|
20
22
|
icon,
|
|
@@ -26,7 +28,7 @@ export function GenericIcon({
|
|
|
26
28
|
className,
|
|
27
29
|
}: GenericIconProps) {
|
|
28
30
|
if (srcSet) {
|
|
29
|
-
return <
|
|
31
|
+
return <IconSrcSetImg srcSet={srcSet} alt={alt} className={className} />;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
const resolvedIcon = icon && typeof icon === 'string' ? resolveIcon(icon) : null;
|
|
@@ -42,6 +44,8 @@ export function GenericIcon({
|
|
|
42
44
|
color={color}
|
|
43
45
|
className={className}
|
|
44
46
|
/>
|
|
47
|
+
) : resolvedIcon?.type === 'invalid' ? (
|
|
48
|
+
<CDNIcon name={INVALID_ICON_NAME} size={size} color={color} className={className} />
|
|
45
49
|
) : (
|
|
46
50
|
icon
|
|
47
51
|
);
|
|
@@ -53,7 +57,12 @@ const IconImg = styled.img`
|
|
|
53
57
|
width: var(--icon-width, 16px);
|
|
54
58
|
height: var(--icon-height, 16px);
|
|
55
59
|
display: inline-block;
|
|
56
|
-
|
|
60
|
+
vertical-align: middle;
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
const IconSrcSetImg = styled(Image)`
|
|
64
|
+
width: var(--icon-width, 16px);
|
|
65
|
+
height: var(--icon-height, 16px);
|
|
57
66
|
`;
|
|
58
67
|
|
|
59
68
|
const IconSvg = styled(InlineSvg)`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
|
-
import '
|
|
3
|
+
import { expect } from 'vitest';
|
|
4
4
|
|
|
5
5
|
export function testIconComponent(IconComponent: React.ComponentType<any>, componentName: string) {
|
|
6
6
|
const dataName = `icons/${componentName}/${componentName}`;
|
|
@@ -9,7 +9,7 @@ export function testIconComponent(IconComponent: React.ComponentType<any>, compo
|
|
|
9
9
|
rendersCorrectlyWithDefaultProps: () => {
|
|
10
10
|
const { container } = render(<IconComponent />);
|
|
11
11
|
const svgElement = container.querySelector('svg');
|
|
12
|
-
expect(svgElement).
|
|
12
|
+
expect(svgElement).toBeTruthy();
|
|
13
13
|
|
|
14
14
|
// Check if styles are applied either via style attribute or CSS class
|
|
15
15
|
const element = container.firstChild as HTMLElement | SVGElement;
|
|
@@ -24,7 +24,7 @@ export function testIconComponent(IconComponent: React.ComponentType<any>, compo
|
|
|
24
24
|
const { container } = render(<IconComponent size="24px" color="--color-primary" />);
|
|
25
25
|
|
|
26
26
|
const svgElement = container.querySelector('svg');
|
|
27
|
-
expect(svgElement).
|
|
27
|
+
expect(svgElement).toBeTruthy();
|
|
28
28
|
|
|
29
29
|
const element = container.firstChild as HTMLElement | SVGElement;
|
|
30
30
|
const pathElement = container.querySelector('path') as SVGPathElement;
|
|
@@ -47,7 +47,8 @@ export function testIconComponent(IconComponent: React.ComponentType<any>, compo
|
|
|
47
47
|
|
|
48
48
|
hasCorrectDataComponentName: () => {
|
|
49
49
|
const { container } = render(<IconComponent />);
|
|
50
|
-
expect(container.firstChild).
|
|
50
|
+
expect(container.firstChild).toHaveProperty('getAttribute');
|
|
51
|
+
expect((container.firstChild as Element).getAttribute('data-component-name')).toBe(dataName);
|
|
51
52
|
},
|
|
52
53
|
};
|
|
53
54
|
}
|