@redocly/theme 0.64.0-next.1 → 0.64.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/Banner/Banner.js +3 -3
- package/lib/components/Catalog/CatalogActionsRow.d.ts +3 -3
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +4 -6
- package/lib/components/Catalog/CatalogEntities.d.ts +2 -2
- package/lib/components/Catalog/CatalogEntities.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +1 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +2 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +5 -5
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +15 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +14 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +13 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +4 -3
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +3 -2
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +9 -9
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.d.ts +2 -3
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.d.ts +2 -3
- package/lib/components/Catalog/CatalogPageDescription.js +1 -1
- package/lib/components/Catalog/CatalogSortButton.d.ts +4 -5
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +6 -2
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +2 -2
- package/lib/components/Catalog/CatalogTableView/CatalogLastUpdateCell.d.ts +5 -0
- package/lib/components/Catalog/CatalogTableView/CatalogLastUpdateCell.js +45 -0
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +5 -3
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +2 -3
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +3 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +1 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +15 -5
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +3 -2
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +2 -2
- package/lib/components/Catalog/CatalogTags.d.ts +11 -0
- package/lib/components/Catalog/CatalogTags.js +62 -0
- package/lib/components/Catalog/variables.js +22 -14
- package/lib/components/Search/SearchDialog.js +118 -116
- package/lib/core/constants/catalog.d.ts +1 -1
- package/lib/core/constants/catalog.js +1 -1
- package/lib/core/hooks/catalog/use-catalog-entity-link.d.ts +8 -0
- package/lib/core/hooks/catalog/use-catalog-entity-link.js +42 -0
- package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.d.ts +2 -1
- package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.js +5 -3
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/styles/dark.d.ts +3 -1
- package/lib/core/styles/dark.js +8 -1
- package/lib/core/styles/global.d.ts +6 -2
- package/lib/core/styles/global.js +18 -10
- package/lib/core/styles/palette.d.ts +6 -0
- package/lib/core/styles/palette.dark.d.ts +3 -0
- package/lib/core/styles/palette.dark.js +216 -0
- package/lib/core/styles/palette.js +179 -0
- package/lib/core/types/catalog.d.ts +23 -7
- package/lib/core/types/hooks.d.ts +6 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/markdoc/components/Heading/Heading.js +2 -2
- package/package.json +2 -2
- package/src/components/Banner/Banner.tsx +7 -7
- package/src/components/Catalog/CatalogActionsRow.tsx +3 -3
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +4 -6
- package/src/components/Catalog/CatalogEntities.tsx +3 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +3 -24
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +2 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +8 -10
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +13 -8
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +27 -15
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +9 -9
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +17 -9
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +4 -8
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +16 -10
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +4 -3
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +18 -11
- package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.tsx +3 -3
- package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.tsx +2 -3
- package/src/components/Catalog/CatalogPageDescription.tsx +1 -1
- package/src/components/Catalog/CatalogSortButton.tsx +5 -6
- package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +6 -2
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +2 -2
- package/src/components/Catalog/CatalogTableView/CatalogLastUpdateCell.tsx +54 -0
- package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +5 -2
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +4 -3
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +17 -7
- package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +3 -2
- package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +2 -2
- package/src/components/Catalog/CatalogTags.tsx +115 -0
- package/src/components/Catalog/variables.ts +22 -14
- package/src/components/Search/SearchDialog.tsx +299 -293
- package/src/core/constants/catalog.ts +1 -1
- package/src/core/hooks/catalog/use-catalog-entity-link.ts +46 -0
- package/src/core/hooks/catalog/use-catalog-table-header-cell-actions.ts +10 -2
- package/src/core/hooks/index.ts +1 -0
- package/src/core/styles/dark.ts +10 -2
- package/src/core/styles/global.ts +20 -12
- package/src/core/styles/palette.dark.ts +214 -0
- package/src/core/styles/palette.ts +177 -0
- package/src/core/types/catalog.ts +24 -8
- package/src/core/types/hooks.ts +5 -10
- package/src/index.ts +1 -1
- package/src/markdoc/components/Heading/Heading.tsx +2 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +0 -10
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +0 -57
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +0 -101
|
@@ -3,12 +3,11 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { CatalogSortButton } from '@redocly/theme/components/Catalog/CatalogSortButton';
|
|
5
5
|
import { CatalogViewModeToggle } from '@redocly/theme/components/Catalog/CatalogViewModeToggle';
|
|
6
|
-
import { SortOption } from '@redocly/theme/core';
|
|
7
6
|
import { CatalogViewMode } from '@redocly/theme/core';
|
|
8
7
|
|
|
9
8
|
type CatalogMobileTopBarControlsProps = {
|
|
10
|
-
setSortOption: (sortOption:
|
|
11
|
-
sortOption:
|
|
9
|
+
setSortOption: (sortOption: string | null) => void;
|
|
10
|
+
sortOption: string | null;
|
|
12
11
|
viewMode: CatalogViewMode;
|
|
13
12
|
setViewMode: (viewMode: CatalogViewMode) => void;
|
|
14
13
|
};
|
|
@@ -58,7 +58,7 @@ const CatalogDescription = styled.p`
|
|
|
58
58
|
color: var(--catalog-description-text-color);
|
|
59
59
|
font-weight: var(--catalog-description-font-weight);
|
|
60
60
|
font-size: var(--catalog-description-font-size);
|
|
61
|
-
margin:
|
|
61
|
+
margin: 0;
|
|
62
62
|
line-height: var(--catalog-description-line-height);
|
|
63
63
|
display: -webkit-box;
|
|
64
64
|
-webkit-line-clamp: 3;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { SortOption } from '@redocly/theme/core/types';
|
|
5
4
|
import { AscSortIcon } from '@redocly/theme/icons/AscSortIcon/AscSortIcon';
|
|
6
5
|
import { DescSortIcon } from '@redocly/theme/icons/DescSortIcon/DescSortIcon';
|
|
7
6
|
import { Dropdown } from '@redocly/theme/components/Dropdown/Dropdown';
|
|
@@ -10,16 +9,16 @@ import { DropdownMenuItem } from '@redocly/theme/components/Dropdown/DropdownMen
|
|
|
10
9
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
11
10
|
|
|
12
11
|
export type CatalogSortButtonProps = {
|
|
13
|
-
onSortChange: (sortOption:
|
|
14
|
-
currentSort?:
|
|
12
|
+
onSortChange: (sortOption: string | null) => void;
|
|
13
|
+
currentSort?: string | null;
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
export function CatalogSortButton({
|
|
18
17
|
onSortChange,
|
|
19
18
|
currentSort,
|
|
20
19
|
}: {
|
|
21
|
-
onSortChange: (sortOption:
|
|
22
|
-
currentSort?:
|
|
20
|
+
onSortChange: (sortOption: string | null) => void;
|
|
21
|
+
currentSort?: string | null;
|
|
23
22
|
}) {
|
|
24
23
|
const { useTranslate } = useThemeHooks();
|
|
25
24
|
const { translate } = useTranslate();
|
|
@@ -27,7 +26,7 @@ export function CatalogSortButton({
|
|
|
27
26
|
const toggleSort = useCallback(
|
|
28
27
|
(field: string): void => {
|
|
29
28
|
const newSort = currentSort === `-${field}` ? field : `-${field}`;
|
|
30
|
-
onSortChange(newSort
|
|
29
|
+
onSortChange(newSort);
|
|
31
30
|
},
|
|
32
31
|
[currentSort, onSortChange],
|
|
33
32
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { CatalogTags } from '@redocly/theme/components/Catalog/CatalogTags';
|
|
4
|
+
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
4
5
|
|
|
5
6
|
export type CatalogDomainsCellProps = {
|
|
6
7
|
domains: string[];
|
|
@@ -9,15 +10,18 @@ export type CatalogDomainsCellProps = {
|
|
|
9
10
|
export function CatalogDomainsCell({ domains }: CatalogDomainsCellProps) {
|
|
10
11
|
return (
|
|
11
12
|
<div data-component-name="Catalog/CatalogTableView/CatalogDomainsCell">
|
|
12
|
-
<
|
|
13
|
+
<CatalogTags
|
|
13
14
|
data-testid="catalog-domains-cell"
|
|
14
15
|
items={domains}
|
|
15
16
|
showPlaceholder={false}
|
|
16
17
|
tagProps={{
|
|
18
|
+
variant: 'outline',
|
|
19
|
+
icon: <GraphIcon />,
|
|
17
20
|
style: {
|
|
18
21
|
fontSize: 'var(--font-size-base)',
|
|
19
22
|
backgroundColor: 'transparent',
|
|
20
23
|
borderRadius: 'var(--border-radius-xl)',
|
|
24
|
+
margin: 0,
|
|
21
25
|
},
|
|
22
26
|
textTransform: 'none',
|
|
23
27
|
}}
|
|
@@ -13,7 +13,7 @@ export type CatalogEntityCellProps<T extends Entity> = {
|
|
|
13
13
|
export function CatalogEntityCell<T extends Entity>({ entity }: CatalogEntityCellProps<T>) {
|
|
14
14
|
return (
|
|
15
15
|
<EntityTitleCellWrapper data-component-name="Catalog/CatalogTableView/CatalogEntityCell">
|
|
16
|
-
<CatalogEntityTypeIcon entityType={entity.type} />
|
|
16
|
+
<CatalogEntityTypeIcon entityType={entity.type} size="large" defaultColors={true} />
|
|
17
17
|
<EntityTitleContent>
|
|
18
18
|
<EntityTitle data-component-name="Catalog/CatalogTableView/CatalogEntityTitle">
|
|
19
19
|
<CatalogHighlight>{entity.title}</CatalogHighlight>
|
|
@@ -40,7 +40,7 @@ const EntityTitleContent = styled.div`
|
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
max-width: calc(
|
|
42
42
|
100% - var(--catalog-table-entity-title-content-offset)
|
|
43
|
-
); /* Account for icon width (
|
|
43
|
+
); /* Account for icon width (32px) + gap (8px) */
|
|
44
44
|
overflow: hidden;
|
|
45
45
|
`;
|
|
46
46
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
|
|
5
|
+
|
|
6
|
+
export type CatalogLastUpdateCellProps = {
|
|
7
|
+
lastModified: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function formatLastModified(isoString: string): string {
|
|
11
|
+
const date = new Date(isoString);
|
|
12
|
+
if (Number.isNaN(date.getTime())) {
|
|
13
|
+
return isoString;
|
|
14
|
+
}
|
|
15
|
+
return date.toLocaleDateString('en-US', {
|
|
16
|
+
year: 'numeric',
|
|
17
|
+
month: 'short',
|
|
18
|
+
day: 'numeric',
|
|
19
|
+
timeZone: 'UTC',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function formatLastModifiedTooltip(isoString: string): string {
|
|
24
|
+
const date = new Date(isoString);
|
|
25
|
+
if (Number.isNaN(date.getTime())) {
|
|
26
|
+
return isoString;
|
|
27
|
+
}
|
|
28
|
+
return date.toLocaleString('en-US', {
|
|
29
|
+
year: 'numeric',
|
|
30
|
+
month: 'short',
|
|
31
|
+
day: 'numeric',
|
|
32
|
+
hour: '2-digit',
|
|
33
|
+
minute: '2-digit',
|
|
34
|
+
second: '2-digit',
|
|
35
|
+
hour12: false,
|
|
36
|
+
timeZone: 'UTC',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function CatalogLastUpdateCell({
|
|
41
|
+
lastModified,
|
|
42
|
+
}: CatalogLastUpdateCellProps): React.ReactElement {
|
|
43
|
+
return (
|
|
44
|
+
<CatalogLastUpdateCellWrapper data-component-name="Catalog/CatalogTableView/CatalogLastUpdateCell">
|
|
45
|
+
<Tooltip tip={formatLastModifiedTooltip(lastModified)} placement="bottom">
|
|
46
|
+
{formatLastModified(lastModified)}
|
|
47
|
+
</Tooltip>
|
|
48
|
+
</CatalogLastUpdateCellWrapper>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const CatalogLastUpdateCellWrapper = styled.div`
|
|
53
|
+
color: var(--text-color-helper);
|
|
54
|
+
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { CatalogTags } from '@redocly/theme/components/Catalog/CatalogTags';
|
|
4
4
|
|
|
5
5
|
export type CatalogOwnersCellProps = {
|
|
6
6
|
owners: string[];
|
|
@@ -9,18 +9,21 @@ export type CatalogOwnersCellProps = {
|
|
|
9
9
|
export function CatalogOwnersCell({ owners }: CatalogOwnersCellProps) {
|
|
10
10
|
return (
|
|
11
11
|
<div data-component-name="Catalog/CatalogTableView/CatalogOwnersCell">
|
|
12
|
-
<
|
|
12
|
+
<CatalogTags
|
|
13
13
|
data-testid="catalog-owners-cell"
|
|
14
14
|
items={owners}
|
|
15
15
|
showPlaceholder={false}
|
|
16
16
|
tagProps={{
|
|
17
|
+
variant: 'outline',
|
|
17
18
|
style: {
|
|
18
19
|
fontSize: 'var(--font-size-base)',
|
|
19
20
|
backgroundColor: 'transparent',
|
|
20
21
|
borderRadius: 'var(--border-radius-xl)',
|
|
22
|
+
margin: 0,
|
|
21
23
|
},
|
|
22
24
|
textTransform: 'none',
|
|
23
25
|
}}
|
|
26
|
+
showAvatars={true}
|
|
24
27
|
/>
|
|
25
28
|
</div>
|
|
26
29
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { SortOption } from '@redocly/theme/core/types';
|
|
5
4
|
import { CaretDownIcon } from '@redocly/theme/icons/CaretDownIcon/CaretDownIcon';
|
|
6
5
|
import { CaretUpIcon } from '@redocly/theme/icons/CaretUpIcon/CaretUpIcon';
|
|
7
6
|
import { useCatalogTableHeaderCellActions } from '@redocly/theme/core/hooks';
|
|
@@ -12,18 +11,20 @@ import {
|
|
|
12
11
|
|
|
13
12
|
export type CatalogTableHeaderCellProps<T extends BaseEntity> = {
|
|
14
13
|
column: CatalogColumn<T>;
|
|
15
|
-
currentSortOption?:
|
|
14
|
+
currentSortOption?: string | null;
|
|
16
15
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
17
16
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
export const CatalogTableHeaderCell = <T extends BaseEntity>({
|
|
21
20
|
column,
|
|
21
|
+
currentSortOption,
|
|
22
22
|
handleSortClick,
|
|
23
23
|
isColumnSorted,
|
|
24
24
|
}: CatalogTableHeaderCellProps<T>) => {
|
|
25
25
|
const { handleCellClick, sortKey, isUpActive, isDownActive } = useCatalogTableHeaderCellActions({
|
|
26
26
|
column,
|
|
27
|
+
currentSortOption,
|
|
27
28
|
handleSortClick,
|
|
28
29
|
isColumnSorted,
|
|
29
30
|
});
|
|
@@ -88,7 +89,7 @@ const SortIndicator = styled.div`
|
|
|
88
89
|
flex-direction: column;
|
|
89
90
|
align-items: center;
|
|
90
91
|
justify-content: center;
|
|
91
|
-
margin-left:
|
|
92
|
+
margin-left: 4px;
|
|
92
93
|
gap: 2px;
|
|
93
94
|
color: var(--catalog-table-header-sort-indicator-color);
|
|
94
95
|
`;
|
|
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
5
|
-
import type {
|
|
5
|
+
import type { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
6
6
|
|
|
7
7
|
import { CatalogOwnersCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogOwnersCell';
|
|
8
8
|
import { CatalogDomainsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogDomainsCell';
|
|
@@ -12,6 +12,7 @@ import { CatalogTagsCell } from '@redocly/theme/components/Catalog/CatalogTableV
|
|
|
12
12
|
import { CatalogTableViewRow } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableViewRow';
|
|
13
13
|
import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
|
|
14
14
|
import { breakpoints } from '@redocly/theme/core';
|
|
15
|
+
import { CatalogLastUpdateCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogLastUpdateCell';
|
|
15
16
|
|
|
16
17
|
export type BaseEntity = {
|
|
17
18
|
id: string;
|
|
@@ -26,7 +27,7 @@ export type CatalogTableViewProps<T extends BaseEntity> = {
|
|
|
26
27
|
entitiesCatalogConfig?: EntitiesCatalogConfig;
|
|
27
28
|
catalogConfig: CatalogEntityConfig;
|
|
28
29
|
columns?: CatalogColumn<T>[];
|
|
29
|
-
currentSortOption?:
|
|
30
|
+
currentSortOption?: string | null;
|
|
30
31
|
onRowClick?: (entity: T) => void;
|
|
31
32
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
32
33
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
@@ -50,7 +51,7 @@ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
|
50
51
|
title: 'Entity',
|
|
51
52
|
render: (entity) => <CatalogEntityCell entity={entity} />,
|
|
52
53
|
width: '3fr',
|
|
53
|
-
minWidth: '
|
|
54
|
+
minWidth: '164px',
|
|
54
55
|
sortable: true,
|
|
55
56
|
sortKey: 'title',
|
|
56
57
|
},
|
|
@@ -59,7 +60,7 @@ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
|
59
60
|
title: 'Type',
|
|
60
61
|
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
61
62
|
width: '2fr',
|
|
62
|
-
minWidth: '
|
|
63
|
+
minWidth: '162px',
|
|
63
64
|
sortable: true,
|
|
64
65
|
sortKey: 'type',
|
|
65
66
|
},
|
|
@@ -70,7 +71,7 @@ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
|
70
71
|
<CatalogDomainsCell domains={entity.domains?.map((domain) => domain.title) || []} />
|
|
71
72
|
),
|
|
72
73
|
width: '2fr',
|
|
73
|
-
minWidth: '
|
|
74
|
+
minWidth: '162px',
|
|
74
75
|
},
|
|
75
76
|
{
|
|
76
77
|
key: 'owners',
|
|
@@ -79,14 +80,23 @@ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
|
79
80
|
<CatalogOwnersCell owners={entity.owners?.map((owner) => owner.title) || []} />
|
|
80
81
|
),
|
|
81
82
|
width: '2fr',
|
|
82
|
-
minWidth: '
|
|
83
|
+
minWidth: '162px',
|
|
83
84
|
},
|
|
84
85
|
{
|
|
85
86
|
key: 'tags',
|
|
86
87
|
title: 'Tags',
|
|
87
88
|
render: (entity) => <CatalogTagsCell entity={entity} />,
|
|
88
89
|
width: '2fr',
|
|
89
|
-
minWidth: '
|
|
90
|
+
minWidth: '160px',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: 'lastUpdate',
|
|
94
|
+
title: 'Last update',
|
|
95
|
+
render: (entity) => <CatalogLastUpdateCell lastModified={entity.updatedAt} />,
|
|
96
|
+
width: '1fr',
|
|
97
|
+
minWidth: '112px',
|
|
98
|
+
sortable: true,
|
|
99
|
+
sortKey: 'updated_at',
|
|
90
100
|
},
|
|
91
101
|
];
|
|
92
102
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
-
import {
|
|
4
|
+
import { CatalogTags } from '@redocly/theme/components/Catalog/CatalogTags';
|
|
5
5
|
|
|
6
6
|
export type CatalogTagsCellProps = {
|
|
7
7
|
entity: BffCatalogEntity;
|
|
@@ -10,7 +10,7 @@ export type CatalogTagsCellProps = {
|
|
|
10
10
|
export function CatalogTagsCell({ entity }: CatalogTagsCellProps) {
|
|
11
11
|
return (
|
|
12
12
|
<div data-component-name="Catalog/CatalogTableView/CatalogTagsCell">
|
|
13
|
-
<
|
|
13
|
+
<CatalogTags
|
|
14
14
|
data-testid="catalog-tags-cell"
|
|
15
15
|
items={entity.tags || []}
|
|
16
16
|
showPlaceholder={false}
|
|
@@ -18,6 +18,7 @@ export function CatalogTagsCell({ entity }: CatalogTagsCellProps) {
|
|
|
18
18
|
style: {
|
|
19
19
|
fontSize: 'var(--font-size-base)',
|
|
20
20
|
borderRadius: 'var(--border-radius)',
|
|
21
|
+
margin: 0,
|
|
21
22
|
},
|
|
22
23
|
borderless: true,
|
|
23
24
|
color: 'grey',
|
|
@@ -48,8 +48,8 @@ const EntityTitle = styled.div`
|
|
|
48
48
|
`;
|
|
49
49
|
|
|
50
50
|
export const Email = styled.div`
|
|
51
|
-
font-size: var(--catalog-
|
|
52
|
-
line-height: var(--catalog-
|
|
51
|
+
font-size: var(--catalog-user-entity-cell-email-font-size);
|
|
52
|
+
line-height: var(--catalog-user-entity-cell-email-line-height);
|
|
53
53
|
color: var(--color-blue-6);
|
|
54
54
|
white-space: nowrap;
|
|
55
55
|
overflow: hidden;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { CATALOG_TAG_MAX_LENGTH } from '@redocly/theme/core/constants';
|
|
5
|
+
import { Tag, TagProps } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
import { Tooltip } from '@redocly/theme/components/Tooltip/Tooltip';
|
|
7
|
+
import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
|
|
8
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
9
|
+
import { CatalogAvatar } from '@redocly/theme/components/Catalog/CatalogAvatar';
|
|
10
|
+
|
|
11
|
+
export type CatalogTagsProps = {
|
|
12
|
+
items: string[];
|
|
13
|
+
itemsToShow?: number;
|
|
14
|
+
showPlaceholder?: boolean;
|
|
15
|
+
tagProps?: TagProps;
|
|
16
|
+
showAvatars?: boolean;
|
|
17
|
+
maxItemLength?: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function CatalogTags({
|
|
21
|
+
items,
|
|
22
|
+
itemsToShow = 1,
|
|
23
|
+
showPlaceholder = false,
|
|
24
|
+
showAvatars,
|
|
25
|
+
tagProps,
|
|
26
|
+
maxItemLength = CATALOG_TAG_MAX_LENGTH,
|
|
27
|
+
}: CatalogTagsProps): JSX.Element | null {
|
|
28
|
+
const { useTranslate } = useThemeHooks();
|
|
29
|
+
const { translate } = useTranslate();
|
|
30
|
+
|
|
31
|
+
if (!items || items.length === 0) {
|
|
32
|
+
if (showPlaceholder) {
|
|
33
|
+
return (
|
|
34
|
+
<CatalogTagsNotConnectedWrapper data-component-name="Catalog/CatalogTags">
|
|
35
|
+
{translate('catalog.notConnected', 'Not connected')}
|
|
36
|
+
</CatalogTagsNotConnectedWrapper>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const maxLength = showAvatars || tagProps?.icon ? maxItemLength - 3 : maxItemLength;
|
|
43
|
+
const isFirstItemTruncated = items[0]?.length > maxLength;
|
|
44
|
+
const anyItemHidden = items.length > itemsToShow;
|
|
45
|
+
|
|
46
|
+
const shouldUseVariantWithTooltip = anyItemHidden || isFirstItemTruncated;
|
|
47
|
+
|
|
48
|
+
if (shouldUseVariantWithTooltip) {
|
|
49
|
+
const displayedItems = items.slice(0, itemsToShow);
|
|
50
|
+
const remainingCount = items.length - itemsToShow;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Tooltip tip={items.join(', ')} placement="bottom" className="catalog">
|
|
54
|
+
<CatalogTagsWrapper data-component-name="Catalog/CatalogTags">
|
|
55
|
+
{displayedItems.map((item, index) => (
|
|
56
|
+
<Tag
|
|
57
|
+
key={`${item}-${index}`}
|
|
58
|
+
{...tagProps}
|
|
59
|
+
{...(showAvatars && {
|
|
60
|
+
icon: <CatalogAvatar value={item} size="small" />,
|
|
61
|
+
style: {
|
|
62
|
+
...tagProps?.style,
|
|
63
|
+
paddingLeft: 'var(--catalog-tags-tag-left-padding)',
|
|
64
|
+
},
|
|
65
|
+
})}
|
|
66
|
+
textTransform="none"
|
|
67
|
+
maxLength={maxLength}
|
|
68
|
+
>
|
|
69
|
+
<CatalogHighlight>{item}</CatalogHighlight>
|
|
70
|
+
</Tag>
|
|
71
|
+
))}
|
|
72
|
+
|
|
73
|
+
{remainingCount > 0 && <MoreTagsButton>+ {remainingCount}</MoreTagsButton>}
|
|
74
|
+
</CatalogTagsWrapper>
|
|
75
|
+
</Tooltip>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<CatalogTagsWrapper data-component-name="Catalog/CatalogTags">
|
|
81
|
+
{items.map((item, index) => (
|
|
82
|
+
<Tag
|
|
83
|
+
key={`${item}-${index}`}
|
|
84
|
+
{...tagProps}
|
|
85
|
+
{...(showAvatars && {
|
|
86
|
+
icon: <CatalogAvatar value={item} size="small" />,
|
|
87
|
+
style: {
|
|
88
|
+
...tagProps?.style,
|
|
89
|
+
paddingLeft: 'var(--catalog-tags-tag-left-padding)',
|
|
90
|
+
},
|
|
91
|
+
})}
|
|
92
|
+
maxLength={maxLength}
|
|
93
|
+
>
|
|
94
|
+
<CatalogHighlight>{item}</CatalogHighlight>
|
|
95
|
+
</Tag>
|
|
96
|
+
))}
|
|
97
|
+
</CatalogTagsWrapper>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const CatalogTagsWrapper = styled.div`
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-wrap: wrap;
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
const MoreTagsButton = styled.span`
|
|
107
|
+
font-size: var(--catalog-tags-more-button-font-size);
|
|
108
|
+
margin-left: var(--catalog-tags-more-button-margin-left);
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
const CatalogTagsNotConnectedWrapper = styled.span`
|
|
112
|
+
font-size: var(--catalog-tags-not-connected-font-size);
|
|
113
|
+
line-height: var(--catalog-tags-not-connected-line-height);
|
|
114
|
+
color: var(--catalog-tags-not-connected-color);
|
|
115
|
+
`;
|
|
@@ -47,7 +47,7 @@ export const catalog = css`
|
|
|
47
47
|
--catalog-description-text-color: var(--text-color-secondary);
|
|
48
48
|
--catalog-description-font-weight: var(--font-weight-regular);
|
|
49
49
|
--catalog-description-font-size: var(--font-size-lg);
|
|
50
|
-
--catalog-description-margin: 0 0 var(--spacing-
|
|
50
|
+
--catalog-description-margin: 0 0 var(--spacing-base) 0;
|
|
51
51
|
--catalog-description-line-height: var(--line-height-lg);
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -152,6 +152,7 @@ export const catalog = css`
|
|
|
152
152
|
--catalog-tags-not-connected-font-size: var(--font-size-base);
|
|
153
153
|
--catalog-tags-not-connected-line-height: var(--line-height-base);
|
|
154
154
|
--catalog-tags-not-connected-color: var(--text-color-disabled);
|
|
155
|
+
--catalog-tags-tag-left-padding: 2px;
|
|
155
156
|
|
|
156
157
|
/**
|
|
157
158
|
* @tokens Catalog empty state
|
|
@@ -206,7 +207,7 @@ export const catalog = css`
|
|
|
206
207
|
* @tokens Catalog card
|
|
207
208
|
*/
|
|
208
209
|
--catalog-card-height: 241px;
|
|
209
|
-
--catalog-card-padding-vertical: var(--spacing-
|
|
210
|
+
--catalog-card-padding-vertical: var(--spacing-md);
|
|
210
211
|
--catalog-card-padding-horizontal: var(--spacing-md);
|
|
211
212
|
--catalog-card-gap: var(--spacing-sm);
|
|
212
213
|
--catalog-card-text-color: var(--text-color-secondary);
|
|
@@ -281,7 +282,7 @@ export const catalog = css`
|
|
|
281
282
|
/**
|
|
282
283
|
* @tokens Catalog card footer
|
|
283
284
|
*/
|
|
284
|
-
--catalog-card-footer-height:
|
|
285
|
+
--catalog-card-footer-height: 68px;
|
|
285
286
|
|
|
286
287
|
/**
|
|
287
288
|
* @tokens Catalog card description
|
|
@@ -313,11 +314,6 @@ export const catalog = css`
|
|
|
313
314
|
--catalog-page-badge-dot-size: 6px;
|
|
314
315
|
--catalog-page-badge-dot-border-color: var(--color-static-white);
|
|
315
316
|
|
|
316
|
-
/**
|
|
317
|
-
* @tokens Catalog card metadata
|
|
318
|
-
*/
|
|
319
|
-
--catalog-card-metadata-owner-tag-left-padding: 2px;
|
|
320
|
-
|
|
321
317
|
|
|
322
318
|
/**
|
|
323
319
|
* @tokens Catalog table
|
|
@@ -325,13 +321,13 @@ export const catalog = css`
|
|
|
325
321
|
--catalog-table-border-color: var(--border-color-secondary);
|
|
326
322
|
--catalog-table-header-bg-color: var(--layer-color);
|
|
327
323
|
--catalog-table-header-font-weight: var(--font-weight-medium);
|
|
328
|
-
--catalog-table-header-cell-padding: 4px 8px;
|
|
329
|
-
--catalog-table-cell-padding: 4px 8px;
|
|
324
|
+
--catalog-table-header-cell-padding: 4px 6px 4px 8px;
|
|
325
|
+
--catalog-table-cell-padding: 4px 6px 4px 8px;
|
|
330
326
|
--catalog-table-row-hover-bg-color: var(--bg-color-hover, rgba(0, 0, 0, 0.04));
|
|
331
327
|
--catalog-table-empty-state-padding: 32px;
|
|
332
328
|
--catalog-table-empty-state-color: var(--text-color-secondary);
|
|
333
|
-
--catalog-table-title-cell-gap:
|
|
334
|
-
--catalog-table-entity-title-content-offset:
|
|
329
|
+
--catalog-table-title-cell-gap: var(--spacing-xs);
|
|
330
|
+
--catalog-table-entity-title-content-offset: 40px;
|
|
335
331
|
|
|
336
332
|
/**
|
|
337
333
|
* @tokens Catalog table header
|
|
@@ -501,8 +497,6 @@ export const catalog = css`
|
|
|
501
497
|
--catalog-history-pill-line-height: var(--line-height-base);
|
|
502
498
|
--catalog-history-pill-text-color: var(--text-color-primary);
|
|
503
499
|
--catalog-history-pill-min-width: calc(100% - 118px - var(--catalog-history-item-gap));
|
|
504
|
-
|
|
505
|
-
|
|
506
500
|
// @tokens End
|
|
507
501
|
|
|
508
502
|
/**
|
|
@@ -581,5 +575,19 @@ export const catalog = css`
|
|
|
581
575
|
--catalog-history-sidebar-version-tag-border-radius: var(--border-radius-xl);
|
|
582
576
|
--catalog-history-sidebar-revision-tag-border-radius: var(--border-radius-xl);
|
|
583
577
|
// @tokens End
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* @tokens Catalog entity type icon
|
|
581
|
+
*/
|
|
582
|
+
--catalog-table-icon-width-large: 32px;
|
|
583
|
+
--catalog-table-icon-height-large: 32px;
|
|
584
|
+
--catalog-table-icon-width-medium: 24px;
|
|
585
|
+
--catalog-table-icon-height-medium: 24px;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* @tokens Catalog user entity cell
|
|
589
|
+
*/
|
|
590
|
+
--catalog-user-entity-cell-email-font-size: var(--font-size-base);
|
|
591
|
+
--catalog-user-entity-cell-email-line-height: var(--line-height-base);
|
|
584
592
|
`;
|
|
585
593
|
/* eslint-enable theme/no-raw-colors-in-styles */
|