@redocly/theme 0.56.0-next.2 → 0.56.0-next.4
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 +4 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +1 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +4 -11
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +7 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +4 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +7 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.js +19 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +11 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +31 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +0 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +11 -5
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +55 -0
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityIcon.js +22 -23
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +11 -23
- package/lib/components/Catalog/CatalogEntityTypeTag.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntityTypeTag.js +36 -0
- package/lib/components/Catalog/CatalogPageDescription.js +2 -2
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.d.ts +6 -4
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +2 -14
- package/lib/components/Catalog/CatalogTableView/CatalogEntityRelationCell.d.ts +3 -0
- package/lib/components/Catalog/CatalogTableView/CatalogEntityRelationCell.js +11 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +1 -1
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +1 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +3 -26
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +0 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +5 -26
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +1 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +5 -6
- package/lib/components/Catalog/variables.js +36 -7
- package/lib/components/Menu/variables.js +2 -0
- package/lib/components/Tag/Tag.d.ts +2 -1
- package/lib/components/Tag/Tag.js +3 -3
- package/lib/components/Tag/variables.js +14 -0
- package/lib/components/Tags/CounterTag.d.ts +1 -1
- package/lib/components/Tags/HttpTag.d.ts +1 -1
- package/lib/core/constants/catalog.d.ts +3 -0
- package/lib/core/constants/catalog.js +55 -1
- package/lib/core/constants/index.d.ts +5 -5
- package/lib/core/constants/index.js +5 -5
- package/lib/core/constants/search.d.ts +1 -1
- package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.d.ts +1 -1
- package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.d.ts +1 -1
- package/lib/core/contexts/ThemeDataContext.d.ts +1 -1
- package/lib/core/contexts/index.d.ts +3 -3
- package/lib/core/contexts/index.js +3 -3
- package/lib/core/hoc/index.d.ts +1 -1
- package/lib/core/hoc/index.js +1 -1
- package/lib/core/hooks/__mocks__/index.d.ts +28 -28
- package/lib/core/hooks/__mocks__/index.js +28 -28
- package/lib/core/hooks/catalog/useCatalogEntities.d.ts +1 -1
- package/lib/core/hooks/catalog/useCatalogTableViewRow.js +2 -2
- package/lib/core/hooks/code-walkthrough/use-code-panel.js +6 -5
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +8 -5
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +9 -9
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +2 -2
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough.js +4 -3
- package/lib/core/hooks/code-walkthrough/use-renderable-files.js +6 -4
- package/lib/core/hooks/feedback/use-report-dialog.js +4 -3
- package/lib/core/hooks/index.d.ts +42 -42
- package/lib/core/hooks/index.js +42 -42
- package/lib/core/hooks/menu/use-menu-item-expanded.d.ts +1 -1
- package/lib/core/hooks/menu/use-mobile-menu-items.d.ts +1 -1
- package/lib/core/hooks/menu/use-mobile-menu-items.js +13 -12
- package/lib/core/hooks/menu/use-mobile-menu-levels.d.ts +1 -1
- package/lib/core/hooks/menu/use-mobile-menu-levels.js +8 -7
- package/lib/core/hooks/menu/use-nested-menu.d.ts +1 -1
- package/lib/core/hooks/menu/use-nested-menu.js +8 -6
- package/lib/core/hooks/search/use-recent-searches.js +3 -3
- package/lib/core/hooks/search/use-search-dialog.js +4 -3
- package/lib/core/hooks/search/use-search-filter.d.ts +1 -1
- package/lib/core/hooks/search/use-suggested-pages.js +2 -2
- package/lib/core/hooks/use-active-page-version.js +2 -2
- package/lib/core/hooks/use-active-section-id.js +2 -2
- package/lib/core/hooks/use-color-switcher.js +4 -3
- package/lib/core/hooks/use-input-key-commands.js +2 -2
- package/lib/core/hooks/use-language-picker.d.ts +1 -1
- package/lib/core/hooks/use-language-picker.js +4 -4
- package/lib/core/hooks/use-mobile-menu.js +2 -2
- package/lib/core/hooks/use-navbar-height.js +3 -3
- package/lib/core/hooks/use-page-versions.js +2 -2
- package/lib/core/hooks/use-product-picker.js +2 -2
- package/lib/core/hooks/use-theme-config.js +2 -2
- package/lib/core/hooks/use-theme-hooks.d.ts +1 -1
- package/lib/core/hooks/use-theme-hooks.js +2 -2
- package/lib/core/hooks/use-time-ago.js +2 -2
- package/lib/core/hooks/use-user-teams.js +2 -2
- package/lib/core/index.d.ts +7 -7
- package/lib/core/index.js +7 -7
- package/lib/core/openapi/index.d.ts +18 -0
- package/lib/core/openapi/index.js +48 -0
- package/lib/core/styles/global.js +1 -1
- package/lib/core/styles/index.d.ts +2 -2
- package/lib/core/styles/index.js +2 -2
- package/lib/core/templates/Markdown.d.ts +1 -1
- package/lib/core/templates/Markdown.js +8 -6
- package/lib/core/types/catalog.d.ts +6 -2
- package/lib/core/types/code-walkthrough.d.ts +1 -1
- package/lib/core/types/feedback.d.ts +1 -1
- package/lib/core/types/filter.d.ts +1 -1
- package/lib/core/types/hooks.d.ts +11 -3
- package/lib/core/types/index.d.ts +18 -18
- package/lib/core/types/index.js +18 -18
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +1 -1
- package/lib/core/types/sidebar.d.ts +1 -1
- package/lib/core/utils/download-code-walkthrough.js +6 -4
- package/lib/core/utils/get-code-walkthrough-file-text.js +4 -3
- package/lib/core/utils/index.d.ts +35 -35
- package/lib/core/utils/index.js +35 -35
- package/lib/core/utils/load-and-navigate.js +2 -2
- package/lib/core/utils/match-code-walkthrough-conditions.js +3 -3
- package/lib/core/utils/menu.d.ts +3 -2
- package/lib/core/utils/menu.js +12 -12
- package/lib/core/utils/toc.d.ts +1 -1
- package/lib/core/utils/type-guards.d.ts +1 -1
- package/lib/core/utils/type-guards.js +5 -5
- package/lib/core/utils/urls.d.ts +1 -1
- package/lib/core/utils/urls.js +2 -2
- package/lib/icons/MoleculesIcon/MoleculesIcon.d.ts +9 -0
- package/lib/icons/MoleculesIcon/MoleculesIcon.js +22 -0
- package/lib/icons/NetworkIcon/NetworkIcon.d.ts +9 -0
- package/lib/icons/NetworkIcon/NetworkIcon.js +23 -0
- package/lib/icons/NotesIcon/NotesIcon.d.ts +9 -0
- package/lib/icons/NotesIcon/NotesIcon.js +26 -0
- package/lib/markdoc/components/Tabs/TabList.js +2 -0
- package/package.json +2 -2
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +6 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +7 -15
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +7 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +4 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +2 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +10 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +36 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +19 -22
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +8 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +0 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +16 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +52 -0
- package/src/components/Catalog/CatalogEntityIcon.tsx +33 -27
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +23 -28
- package/src/components/Catalog/CatalogEntityTypeTag.tsx +43 -0
- package/src/components/Catalog/CatalogPageDescription.tsx +4 -3
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +7 -20
- package/src/components/Catalog/CatalogTableView/CatalogEntityRelationCell.tsx +19 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +4 -2
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +3 -31
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +5 -31
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +10 -19
- package/src/components/Catalog/variables.ts +36 -7
- package/src/components/Menu/variables.ts +2 -0
- package/src/components/Tag/Tag.tsx +11 -2
- package/src/components/Tag/variables.ts +14 -0
- package/src/core/constants/catalog.ts +58 -0
- package/src/core/constants/index.ts +5 -5
- package/src/core/constants/search.ts +1 -1
- package/src/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.tsx +1 -1
- package/src/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.tsx +1 -1
- package/src/core/contexts/ThemeDataContext.tsx +3 -3
- package/src/core/contexts/index.ts +3 -3
- package/src/core/hoc/index.ts +1 -1
- package/src/core/hooks/__mocks__/index.ts +28 -28
- package/src/core/hooks/catalog/useCatalogEntities.ts +1 -1
- package/src/core/hooks/catalog/useCatalogTableViewRow.ts +1 -1
- package/src/core/hooks/code-walkthrough/use-code-panel.ts +3 -5
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +4 -6
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +4 -3
- package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +3 -3
- package/src/core/hooks/code-walkthrough/use-renderable-files.ts +4 -6
- package/src/core/hooks/feedback/use-report-dialog.ts +3 -2
- package/src/core/hooks/index.ts +42 -42
- package/src/core/hooks/menu/use-menu-item-expanded.ts +1 -1
- package/src/core/hooks/menu/use-mobile-menu-items.ts +4 -7
- package/src/core/hooks/menu/use-mobile-menu-levels.ts +3 -2
- package/src/core/hooks/menu/use-nested-menu.ts +5 -3
- package/src/core/hooks/search/use-recent-searches.ts +1 -1
- package/src/core/hooks/search/use-search-dialog.ts +2 -1
- package/src/core/hooks/search/use-search-filter.ts +1 -1
- package/src/core/hooks/search/use-suggested-pages.ts +1 -1
- package/src/core/hooks/use-active-page-version.ts +1 -1
- package/src/core/hooks/use-active-section-id.ts +1 -1
- package/src/core/hooks/use-codeblock-tabs-controls.ts +1 -1
- package/src/core/hooks/use-color-switcher.ts +2 -1
- package/src/core/hooks/use-input-key-commands.ts +1 -1
- package/src/core/hooks/use-language-picker.ts +3 -3
- package/src/core/hooks/use-mobile-menu.ts +1 -1
- package/src/core/hooks/use-navbar-height.ts +1 -1
- package/src/core/hooks/use-page-versions.ts +1 -1
- package/src/core/hooks/use-product-picker.ts +1 -1
- package/src/core/hooks/use-theme-config.ts +2 -2
- package/src/core/hooks/use-theme-hooks.ts +2 -2
- package/src/core/hooks/use-time-ago.ts +3 -2
- package/src/core/hooks/use-user-teams.ts +1 -1
- package/src/core/index.ts +7 -7
- package/src/core/openapi/index.ts +31 -0
- package/src/core/styles/global.ts +2 -1
- package/src/core/styles/index.ts +2 -2
- package/src/core/templates/Markdown.tsx +8 -4
- package/src/core/types/catalog.ts +15 -2
- package/src/core/types/code-walkthrough.ts +1 -1
- package/src/core/types/feedback.ts +6 -6
- package/src/core/types/filter.ts +1 -1
- package/src/core/types/hooks.ts +17 -16
- package/src/core/types/index.ts +18 -18
- package/src/core/types/l10n.ts +4 -0
- package/src/core/types/search.ts +1 -1
- package/src/core/types/sidebar.ts +1 -1
- package/src/core/utils/download-code-walkthrough.ts +3 -5
- package/src/core/utils/get-code-walkthrough-file-text.ts +2 -1
- package/src/core/utils/index.ts +35 -35
- package/src/core/utils/load-and-navigate.ts +1 -1
- package/src/core/utils/match-code-walkthrough-conditions.ts +1 -1
- package/src/core/utils/menu.ts +4 -3
- package/src/core/utils/toc.ts +1 -1
- package/src/core/utils/type-guards.ts +2 -2
- package/src/core/utils/urls.ts +2 -2
- package/src/icons/MoleculesIcon/MoleculesIcon.tsx +23 -0
- package/src/icons/NetworkIcon/NetworkIcon.tsx +31 -0
- package/src/icons/NotesIcon/NotesIcon.tsx +43 -0
- package/src/markdoc/components/Tabs/TabList.tsx +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
6
|
+
import { JsonViewer } from '@redocly/theme/components/JsonViewer/JsonViewer';
|
|
7
|
+
|
|
8
|
+
export type CatalogEntitySchemaProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function CatalogEntitySchema({ entity }: CatalogEntitySchemaProps) {
|
|
13
|
+
const { useTranslate } = useThemeHooks();
|
|
14
|
+
const { translate } = useTranslate();
|
|
15
|
+
const { schema, ...metadataToShow } = entity.metadata || {};
|
|
16
|
+
const metadata = Object.entries(metadataToShow);
|
|
17
|
+
|
|
18
|
+
if (!metadata.length) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let parsedSchema;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
parsedSchema = JSON.parse(schema);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<MetadataWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityMetadata">
|
|
32
|
+
<Heading>{translate('catalog.entity.metadata.title')}</Heading>
|
|
33
|
+
<JsonViewer data={parsedSchema} expandLevel={3} title="JSON" />
|
|
34
|
+
</MetadataWrapper>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const MetadataWrapper = styled.div`
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: var(--spacing-xs);
|
|
42
|
+
border-radius: var(--border-radius);
|
|
43
|
+
background-color: var(--catalog-metadata-bg-color);
|
|
44
|
+
transition: all 0.2s ease-in-out;
|
|
45
|
+
margin: var(--spacing-lg) 0;
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const Heading = styled.h2`
|
|
49
|
+
margin-bottom: var(--spacing-base);
|
|
50
|
+
margin-top: 0;
|
|
51
|
+
font-size: var(--catalog-metadata-heading-size);
|
|
52
|
+
`;
|
|
@@ -5,37 +5,43 @@ import { CodeIcon } from '@redocly/theme/icons/CodeIcon/CodeIcon';
|
|
|
5
5
|
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
6
6
|
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
7
7
|
import { UserIcon } from '@redocly/theme/icons/UserIcon/UserIcon';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const entityIconMap: Record<EntityType, JSX.Element> = {
|
|
12
|
-
service: <CodeIcon color={iconColor} />,
|
|
13
|
-
domain: <GraphIcon color={iconColor} />,
|
|
14
|
-
team: <PeopleIcon color={iconColor} />,
|
|
15
|
-
user: <UserIcon color={iconColor} />,
|
|
16
|
-
'api-description': <CodeIcon color={iconColor} />,
|
|
17
|
-
};
|
|
8
|
+
import { NetworkIcon } from '@redocly/theme/icons/NetworkIcon/NetworkIcon';
|
|
9
|
+
import { MoleculesIcon } from '@redocly/theme/icons/MoleculesIcon/MoleculesIcon';
|
|
18
10
|
|
|
19
11
|
export type CatalogEntityIconProps = {
|
|
20
12
|
entityType: string;
|
|
13
|
+
defaultColor?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getIconColor = (entityType: EntityType) => `var(--catalog-entity-icon-color-${entityType})`;
|
|
17
|
+
|
|
18
|
+
const getEntityIcon = ({ entityType, defaultColor }: CatalogEntityIconProps) => {
|
|
19
|
+
const iconColor = defaultColor
|
|
20
|
+
? `var(--catalog-entity-icon-color)`
|
|
21
|
+
: getIconColor(entityType as EntityType);
|
|
22
|
+
|
|
23
|
+
const entityIconMap: Record<EntityType, JSX.Element> = {
|
|
24
|
+
service: <CodeIcon color={iconColor} />,
|
|
25
|
+
domain: <GraphIcon color={iconColor} />,
|
|
26
|
+
team: <PeopleIcon color={iconColor} />,
|
|
27
|
+
user: <UserIcon color={iconColor} />,
|
|
28
|
+
'api-description': <CodeIcon color={iconColor} />,
|
|
29
|
+
'data-schema': <NetworkIcon color={iconColor} />,
|
|
30
|
+
'api-operation': <MoleculesIcon color={iconColor} />,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return entityIconMap[entityType as EntityType];
|
|
21
34
|
};
|
|
22
35
|
|
|
23
|
-
export function CatalogEntityIcon({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
case 'team':
|
|
32
|
-
return entityIconMap.team;
|
|
33
|
-
case 'user':
|
|
34
|
-
return entityIconMap.user;
|
|
35
|
-
case 'api-description':
|
|
36
|
-
return entityIconMap['api-description'];
|
|
37
|
-
default:
|
|
38
|
-
const exhaustiveCheck: never = key;
|
|
39
|
-
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
36
|
+
export function CatalogEntityIcon({
|
|
37
|
+
entityType,
|
|
38
|
+
defaultColor = false,
|
|
39
|
+
}: CatalogEntityIconProps): JSX.Element {
|
|
40
|
+
const icon = getEntityIcon({ entityType, defaultColor });
|
|
41
|
+
|
|
42
|
+
if (!icon) {
|
|
43
|
+
throw new Error(`Unhandled entity type: ${entityType}`);
|
|
40
44
|
}
|
|
45
|
+
|
|
46
|
+
return icon;
|
|
41
47
|
}
|
|
@@ -1,48 +1,43 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
6
|
-
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
7
|
-
import { UserIcon } from '@redocly/theme/icons/UserIcon/UserIcon';
|
|
8
|
-
|
|
9
|
-
const getEntityIcon = (entityType: string): ReactNode => {
|
|
10
|
-
const iconColor = 'var(--catalog-entity-icon-color)';
|
|
11
|
-
|
|
12
|
-
switch (entityType.toLowerCase()) {
|
|
13
|
-
case 'service':
|
|
14
|
-
return <CodeIcon color={iconColor} />;
|
|
15
|
-
case 'domain':
|
|
16
|
-
return <GraphIcon color={iconColor} />;
|
|
17
|
-
case 'team':
|
|
18
|
-
return <PeopleIcon color={iconColor} />;
|
|
19
|
-
case 'user':
|
|
20
|
-
return <UserIcon color={iconColor} />;
|
|
21
|
-
default:
|
|
22
|
-
return <CodeIcon color={iconColor} />;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
4
|
+
import { CatalogEntityIcon } from '@redocly/theme/components/Catalog/CatalogEntityIcon';
|
|
25
5
|
|
|
26
6
|
export type CatalogEntityTypeIconProps = {
|
|
27
7
|
entityType: string;
|
|
8
|
+
defaultColor?: boolean;
|
|
28
9
|
};
|
|
29
10
|
|
|
30
|
-
export function CatalogEntityTypeIcon({
|
|
11
|
+
export function CatalogEntityTypeIcon({
|
|
12
|
+
entityType,
|
|
13
|
+
defaultColor = false,
|
|
14
|
+
}: CatalogEntityTypeIconProps) {
|
|
31
15
|
return (
|
|
32
|
-
<IconContainer
|
|
33
|
-
|
|
16
|
+
<IconContainer
|
|
17
|
+
data-component-name="Catalog/CatalogEntityTypeIcon"
|
|
18
|
+
entityType={entityType}
|
|
19
|
+
defaultColor={defaultColor}
|
|
20
|
+
>
|
|
21
|
+
<CatalogEntityIcon entityType={entityType} defaultColor={defaultColor} />
|
|
34
22
|
</IconContainer>
|
|
35
23
|
);
|
|
36
24
|
}
|
|
37
25
|
|
|
38
|
-
const IconContainer = styled.div
|
|
26
|
+
const IconContainer = styled.div<{ entityType: string; defaultColor: boolean }>`
|
|
39
27
|
display: flex;
|
|
40
28
|
align-items: center;
|
|
41
29
|
justify-content: center;
|
|
42
30
|
width: var(--catalog-table-icon-width);
|
|
43
31
|
height: var(--catalog-table-icon-height);
|
|
44
32
|
border-radius: var(--catalog-table-icon-border-radius);
|
|
45
|
-
background-color:
|
|
33
|
+
background-color: ${({ defaultColor, entityType }) =>
|
|
34
|
+
defaultColor
|
|
35
|
+
? 'var(--catalog-entity-bg-color)'
|
|
36
|
+
: `var(--catalog-entity-bg-color-${entityType})`};
|
|
46
37
|
flex-shrink: 0;
|
|
47
|
-
border:
|
|
38
|
+
border: 1px solid
|
|
39
|
+
${({ defaultColor, entityType }) =>
|
|
40
|
+
defaultColor
|
|
41
|
+
? 'var(--catalog-entity-border-color)'
|
|
42
|
+
: `var(--catalog-entity-border-color-${entityType})`};
|
|
48
43
|
`;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { EntityType } from '@redocly/theme/core/types';
|
|
5
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
|
|
7
|
+
export type CatalogEntityTypeTagProps = {
|
|
8
|
+
entityType: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const entityTagColorMap: Record<EntityType, string> = {
|
|
12
|
+
service: 'blue',
|
|
13
|
+
domain: 'grass',
|
|
14
|
+
team: 'purple',
|
|
15
|
+
user: 'yellow',
|
|
16
|
+
'api-description': 'sky',
|
|
17
|
+
'data-schema': 'carrot',
|
|
18
|
+
'api-operation': 'raspberry',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getEntityTagColor = (type: EntityType): string => {
|
|
22
|
+
const color = entityTagColorMap[type];
|
|
23
|
+
|
|
24
|
+
if (!color) {
|
|
25
|
+
throw new Error(`Unhandled entity type: ${type}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return color;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function CatalogEntityTypeTag({ entityType }: CatalogEntityTypeTagProps): JSX.Element {
|
|
32
|
+
return (
|
|
33
|
+
<EntityTypeTagWrapper color={getEntityTagColor(entityType as EntityType)}>
|
|
34
|
+
{entityType}
|
|
35
|
+
</EntityTypeTagWrapper>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const EntityTypeTagWrapper = styled(Tag)`
|
|
40
|
+
font-size: var(--font-size-base);
|
|
41
|
+
background-color: transparent;
|
|
42
|
+
text-transform: lowercase;
|
|
43
|
+
`;
|
|
@@ -3,8 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { breakpoints } from '@redocly/theme/core/utils';
|
|
5
5
|
import { H3 } from '@redocly/theme/components/Typography/H3';
|
|
6
|
-
|
|
7
|
-
import { CounterTag } from '../Tags/CounterTag';
|
|
6
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
8
7
|
|
|
9
8
|
export type CatalogPageDescriptionProps = {
|
|
10
9
|
title: string;
|
|
@@ -25,7 +24,9 @@ export function CatalogPageDescription({
|
|
|
25
24
|
<CatalogPageDescriptionWrapper>
|
|
26
25
|
<CatalogTitleWrapper>
|
|
27
26
|
<CatalogTitle data-translation-key={titleTranslationKey}>{title}</CatalogTitle>
|
|
28
|
-
<
|
|
27
|
+
<Tag borderless textTransform="none">
|
|
28
|
+
{tag}
|
|
29
|
+
</Tag>
|
|
29
30
|
</CatalogTitleWrapper>
|
|
30
31
|
<CatalogDescription data-translation-key={descriptionTranslationKey}>
|
|
31
32
|
{description}
|
|
@@ -2,19 +2,18 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { CatalogEntityTypeIcon } from '@redocly/theme/components/Catalog/CatalogEntityTypeIcon';
|
|
6
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type Entity = Pick<BffCatalogEntity, 'type' | 'title' | 'summary'>;
|
|
9
|
+
export type CatalogEntityCellProps<T extends Entity> = {
|
|
10
|
+
entity: T;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
export function CatalogEntityCell({ entity }: CatalogEntityCellProps) {
|
|
13
|
+
export function CatalogEntityCell<T extends Entity>({ entity }: CatalogEntityCellProps<T>) {
|
|
13
14
|
return (
|
|
14
15
|
<EntityTitleCellWrapper data-component-name="Catalog/CatalogTableView/CatalogEntityCell">
|
|
15
|
-
<
|
|
16
|
-
<CatalogEntityIcon entityType={entity.type} />
|
|
17
|
-
</IconContainer>
|
|
16
|
+
<CatalogEntityTypeIcon entityType={entity.type} defaultColor={true} />
|
|
18
17
|
<EntityTitleContent>
|
|
19
18
|
<EntityTitle>
|
|
20
19
|
<CatalogHighlight>{entity.title}</CatalogHighlight>
|
|
@@ -36,18 +35,6 @@ const EntityTitleCellWrapper = styled.div`
|
|
|
36
35
|
max-width: 100%;
|
|
37
36
|
`;
|
|
38
37
|
|
|
39
|
-
const IconContainer = styled.div`
|
|
40
|
-
display: flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
width: var(--catalog-table-icon-width);
|
|
44
|
-
height: var(--catalog-table-icon-height);
|
|
45
|
-
border-radius: var(--catalog-table-icon-border-radius);
|
|
46
|
-
background-color: var(--catalog-table-icon-bg-color);
|
|
47
|
-
flex-shrink: 0;
|
|
48
|
-
border: var(--catalog-table-icon-border-width) solid var(--catalog-table-icon-border-color);
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
38
|
const EntityTitleContent = styled.div`
|
|
52
39
|
display: flex;
|
|
53
40
|
flex-direction: column;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BffCatalogRelatedEntity } from '@redocly/theme/core/types';
|
|
2
|
+
|
|
3
|
+
import { reverseRelationMap } from '@redocly/theme/core/constants';
|
|
4
|
+
|
|
5
|
+
export type CatalogEntityRelationCellProps = Pick<
|
|
6
|
+
BffCatalogRelatedEntity,
|
|
7
|
+
'relationType' | 'relationRole'
|
|
8
|
+
>;
|
|
9
|
+
|
|
10
|
+
export function CatalogEntityRelationCell({
|
|
11
|
+
relationType,
|
|
12
|
+
relationRole,
|
|
13
|
+
}: CatalogEntityRelationCellProps) {
|
|
14
|
+
if (relationRole === 'source') {
|
|
15
|
+
return reverseRelationMap[relationType];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return relationType;
|
|
19
|
+
}
|
|
@@ -5,8 +5,10 @@ import { SortOption } from '@redocly/theme/core/types';
|
|
|
5
5
|
import { CaretDownIcon } from '@redocly/theme/icons/CaretDownIcon/CaretDownIcon';
|
|
6
6
|
import { CaretUpIcon } from '@redocly/theme/icons/CaretUpIcon/CaretUpIcon';
|
|
7
7
|
import { useCatalogTableHeaderCellActions } from '@redocly/theme/core/hooks/catalog/useCatalogTableHeaderCellActions';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
BaseEntity,
|
|
10
|
+
CatalogColumn,
|
|
11
|
+
} from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
10
12
|
|
|
11
13
|
export type CatalogTableHeaderCellProps<T extends BaseEntity> = {
|
|
12
14
|
column: CatalogColumn<T>;
|
|
@@ -2,14 +2,14 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
5
|
+
import { SortOption, BffCatalogEntity } from '@redocly/theme/core/types';
|
|
7
6
|
import { CatalogOwnersCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogOwnersCell';
|
|
8
7
|
import { CatalogDomainsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogDomainsCell';
|
|
9
8
|
import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
|
|
10
9
|
import { CatalogTableHeaderCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableHeaderCell';
|
|
11
10
|
import { CatalogTagsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTagsCell';
|
|
12
11
|
import { CatalogTableViewRow } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableViewRow';
|
|
12
|
+
import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
|
|
13
13
|
|
|
14
14
|
export type BaseEntity = {
|
|
15
15
|
id: string;
|
|
@@ -40,24 +40,6 @@ export type CatalogColumn<T> = {
|
|
|
40
40
|
sortKey?: string;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export const getEntityTagColor = (type: EntityType): string => {
|
|
44
|
-
switch (type) {
|
|
45
|
-
case 'service':
|
|
46
|
-
return 'blue';
|
|
47
|
-
case 'domain':
|
|
48
|
-
return 'grass';
|
|
49
|
-
case 'team':
|
|
50
|
-
return 'purple';
|
|
51
|
-
case 'user':
|
|
52
|
-
return 'yellow';
|
|
53
|
-
case 'api-description':
|
|
54
|
-
return 'sky';
|
|
55
|
-
default:
|
|
56
|
-
const exhaustiveCheck: never = type;
|
|
57
|
-
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
43
|
const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
62
44
|
{
|
|
63
45
|
key: 'entity',
|
|
@@ -71,11 +53,7 @@ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
|
71
53
|
{
|
|
72
54
|
key: 'type',
|
|
73
55
|
title: 'Type',
|
|
74
|
-
render: (entity) =>
|
|
75
|
-
<EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
|
|
76
|
-
{entity.type}
|
|
77
|
-
</EntityTypeTag>
|
|
78
|
-
),
|
|
56
|
+
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
79
57
|
width: '2fr',
|
|
80
58
|
minWidth: '120px',
|
|
81
59
|
sortable: true,
|
|
@@ -150,12 +128,6 @@ export const CatalogTableView = <T extends BaseEntity>({
|
|
|
150
128
|
);
|
|
151
129
|
};
|
|
152
130
|
|
|
153
|
-
const EntityTypeTag = styled(Tag)`
|
|
154
|
-
font-size: var(--font-size-base);
|
|
155
|
-
background-color: transparent;
|
|
156
|
-
text-transform: lowercase;
|
|
157
|
-
`;
|
|
158
|
-
|
|
159
131
|
const CatalogTableWrapper = styled.div`
|
|
160
132
|
width: 100%;
|
|
161
133
|
border-bottom: 1px solid var(--catalog-table-border-color);
|
|
@@ -2,13 +2,13 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
5
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
7
6
|
import { CatalogOwnersCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogOwnersCell';
|
|
8
7
|
import { CatalogDomainsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogDomainsCell';
|
|
9
8
|
import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
|
|
10
9
|
import { CatalogTagsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTagsCell';
|
|
11
10
|
import { useCatalogTableViewRow } from '@redocly/theme/core/hooks/catalog/useCatalogTableViewRow';
|
|
11
|
+
import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
|
|
12
12
|
|
|
13
13
|
export type BaseEntity = {
|
|
14
14
|
id: string;
|
|
@@ -35,24 +35,6 @@ export type CatalogColumn<T> = {
|
|
|
35
35
|
sortKey?: string;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
export const getEntityTagColor = (type: EntityType): string => {
|
|
39
|
-
switch (type) {
|
|
40
|
-
case 'service':
|
|
41
|
-
return 'blue';
|
|
42
|
-
case 'domain':
|
|
43
|
-
return 'grass';
|
|
44
|
-
case 'team':
|
|
45
|
-
return 'purple';
|
|
46
|
-
case 'user':
|
|
47
|
-
return 'yellow';
|
|
48
|
-
case 'api-description':
|
|
49
|
-
return 'sky';
|
|
50
|
-
default:
|
|
51
|
-
const exhaustiveCheck: never = type;
|
|
52
|
-
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
38
|
const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
57
39
|
{
|
|
58
40
|
key: 'entity',
|
|
@@ -66,11 +48,7 @@ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
|
66
48
|
{
|
|
67
49
|
key: 'type',
|
|
68
50
|
title: 'Type',
|
|
69
|
-
render: (entity) =>
|
|
70
|
-
<EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
|
|
71
|
-
{entity.type}
|
|
72
|
-
</EntityTypeTag>
|
|
73
|
-
),
|
|
51
|
+
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
74
52
|
width: '2fr',
|
|
75
53
|
minWidth: '120px',
|
|
76
54
|
sortable: true,
|
|
@@ -139,12 +117,6 @@ export const CatalogTableViewRow = <T extends BaseEntity>({
|
|
|
139
117
|
);
|
|
140
118
|
};
|
|
141
119
|
|
|
142
|
-
const EntityTypeTag = styled(Tag)`
|
|
143
|
-
font-size: var(--font-size-base);
|
|
144
|
-
background-color: transparent;
|
|
145
|
-
text-transform: lowercase;
|
|
146
|
-
`;
|
|
147
|
-
|
|
148
120
|
const TableRow = styled.div<{ columnsWidths: string[]; columnsMinWidths: string[] }>`
|
|
149
121
|
display: grid;
|
|
150
122
|
grid-template-columns: ${({ columnsWidths, columnsMinWidths }) =>
|
|
@@ -177,4 +149,6 @@ const TableCell = styled.div`
|
|
|
177
149
|
&.tooltip-cell-container {
|
|
178
150
|
overflow: visible;
|
|
179
151
|
}
|
|
152
|
+
|
|
153
|
+
height: 52px;
|
|
180
154
|
`;
|
|
@@ -2,10 +2,9 @@ import React, { JSX } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { CATALOG_TAG_MAX_LENGTH } from '@redocly/theme/core/constants';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import { CatalogHighlight } from '
|
|
8
|
-
import { TooltipComponent } from '../Tooltip/Tooltip';
|
|
5
|
+
import { Tag, TagProps } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
import { TooltipComponent } from '@redocly/theme/components/Tooltip/Tooltip';
|
|
7
|
+
import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
|
|
9
8
|
|
|
10
9
|
export type CatalogTagsWithTooltipProps = {
|
|
11
10
|
items: string[];
|
|
@@ -35,21 +34,13 @@ export function CatalogTagsWithTooltip({
|
|
|
35
34
|
|
|
36
35
|
if (items.length <= itemsToShow) {
|
|
37
36
|
return (
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
>
|
|
45
|
-
<CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
|
|
46
|
-
{items.map((item, index) => (
|
|
47
|
-
<Tag key={`${item}-${index}`} {...tagProps} maxLength={CATALOG_TAG_MAX_LENGTH}>
|
|
48
|
-
<CatalogHighlight>{item}</CatalogHighlight>
|
|
49
|
-
</Tag>
|
|
50
|
-
))}
|
|
51
|
-
</CatalogTagsWrapper>
|
|
52
|
-
</TooltipComponent>
|
|
37
|
+
<CatalogTagsWrapper data-component-name="Catalog/CatalogTagsWithTooltip">
|
|
38
|
+
{items.map((item, index) => (
|
|
39
|
+
<Tag key={`${item}-${index}`} {...tagProps} maxLength={CATALOG_TAG_MAX_LENGTH}>
|
|
40
|
+
<CatalogHighlight>{item}</CatalogHighlight>
|
|
41
|
+
</Tag>
|
|
42
|
+
))}
|
|
43
|
+
</CatalogTagsWrapper>
|
|
53
44
|
);
|
|
54
45
|
}
|
|
55
46
|
|
|
@@ -99,6 +99,36 @@ export const catalog = css`
|
|
|
99
99
|
* @tokens Catalog entity icon
|
|
100
100
|
*/
|
|
101
101
|
--catalog-entity-icon-color: var(--color-primary-base);
|
|
102
|
+
--catalog-entity-border-color: var(--border-color-secondary);
|
|
103
|
+
--catalog-entity-bg-color: var(--bg-color-tonal);
|
|
104
|
+
|
|
105
|
+
--catalog-entity-icon-color-service: var(--color-blue-6);
|
|
106
|
+
--catalog-entity-border-color-service: var(--color-blueberry-3);
|
|
107
|
+
--catalog-entity-bg-color-service: var(--color-blue-1);
|
|
108
|
+
|
|
109
|
+
--catalog-entity-icon-color-domain: var(--color-grass-8);
|
|
110
|
+
--catalog-entity-border-color-domain: var(--color-grass-4);
|
|
111
|
+
--catalog-entity-bg-color-domain: var(--color-grass-1);
|
|
112
|
+
|
|
113
|
+
--catalog-entity-icon-color-team: var(--color-purple-7);
|
|
114
|
+
--catalog-entity-border-color-team: var(--color-purple-4);
|
|
115
|
+
--catalog-entity-bg-color-team: var(--color-purple-1);
|
|
116
|
+
|
|
117
|
+
--catalog-entity-icon-color-user: var(--color-orange-7);
|
|
118
|
+
--catalog-entity-border-color-user: var(--color-orange-4);
|
|
119
|
+
--catalog-entity-bg-color-user: var(--color-orange-1);
|
|
120
|
+
|
|
121
|
+
--catalog-entity-icon-color-api-description: var(--color-sky-8);
|
|
122
|
+
--catalog-entity-border-color-api-description: var(--color-sky-5);
|
|
123
|
+
--catalog-entity-bg-color-api-description: var(--color-sky-1);
|
|
124
|
+
|
|
125
|
+
--catalog-entity-icon-color-data-schema: var(--color-carrot-8);
|
|
126
|
+
--catalog-entity-border-color-data-schema: var(--color-carrot-6);
|
|
127
|
+
--catalog-entity-bg-color-data-schema: var(--color-carrot-1);
|
|
128
|
+
|
|
129
|
+
--catalog-entity-icon-color-api-operation: var(--color-raspberry-7);
|
|
130
|
+
--catalog-entity-border-color-api-operation: var(--color-raspberry-3);
|
|
131
|
+
--catalog-entity-bg-color-api-operation: var(--color-raspberry-1);
|
|
102
132
|
|
|
103
133
|
/**
|
|
104
134
|
* @tokens Catalog tags
|
|
@@ -254,9 +284,9 @@ export const catalog = css`
|
|
|
254
284
|
*/
|
|
255
285
|
--catalog-table-border-color: var(--border-color-primary);
|
|
256
286
|
--catalog-table-header-bg-color: var(--bg-color-secondary);
|
|
257
|
-
--catalog-table-header-font-weight: var(--font-weight-
|
|
258
|
-
--catalog-table-header-cell-padding:
|
|
259
|
-
--catalog-table-cell-padding:
|
|
287
|
+
--catalog-table-header-font-weight: var(--font-weight-medium);
|
|
288
|
+
--catalog-table-header-cell-padding: 4px 8px;
|
|
289
|
+
--catalog-table-cell-padding: 4px 8px;
|
|
260
290
|
--catalog-table-row-hover-bg-color: var(--bg-color-hover, rgba(0, 0, 0, 0.04));
|
|
261
291
|
--catalog-table-empty-state-padding: 32px;
|
|
262
292
|
--catalog-table-empty-state-color: var(--text-color-secondary);
|
|
@@ -274,8 +304,8 @@ export const catalog = css`
|
|
|
274
304
|
/**
|
|
275
305
|
* @tokens Catalog table icon
|
|
276
306
|
*/
|
|
277
|
-
--catalog-table-icon-width:
|
|
278
|
-
--catalog-table-icon-height:
|
|
307
|
+
--catalog-table-icon-width: 32px;
|
|
308
|
+
--catalog-table-icon-height: 32px;
|
|
279
309
|
--catalog-table-icon-border-radius: 4px;
|
|
280
310
|
--catalog-table-icon-bg-color: var(--bg-color-tonal);
|
|
281
311
|
--catalog-table-icon-border-color: var(--border-color-secondary);
|
|
@@ -286,7 +316,7 @@ export const catalog = css`
|
|
|
286
316
|
*/
|
|
287
317
|
--catalog-table-entity-title-font-size: var(--catalog-card-title-font-size);
|
|
288
318
|
--catalog-table-entity-title-line-height: var(--line-height-lg);
|
|
289
|
-
--catalog-table-entity-title-font-weight: var(--font-weight-
|
|
319
|
+
--catalog-table-entity-title-font-weight: var(--font-weight-medium);
|
|
290
320
|
|
|
291
321
|
/**
|
|
292
322
|
* @tokens Catalog table description
|
|
@@ -345,7 +375,6 @@ export const catalog = css`
|
|
|
345
375
|
--catalog-empty-state-font-size: var(--font-size-base);
|
|
346
376
|
--catalog-empty-state-line-height: var(--line-height-base);
|
|
347
377
|
|
|
348
|
-
|
|
349
378
|
--catalog-avatar-bg-color: #ededf2;
|
|
350
379
|
// @tokens End
|
|
351
380
|
`;
|
|
@@ -128,7 +128,9 @@ export const mobileMenu = css`
|
|
|
128
128
|
/**
|
|
129
129
|
* @tokens Mobile Menu
|
|
130
130
|
* */
|
|
131
|
+
/* Fallback for older browsers. dvh accounts for dynamic UI elements like mobile address bars */
|
|
131
132
|
--menu-mobile-height: calc(100vh - var(--navbar-height));
|
|
133
|
+
--menu-mobile-height: calc(100dvh - var(--navbar-height));
|
|
132
134
|
--menu-mobile-width: 100%;
|
|
133
135
|
--menu-mobile-z-index: var(--z-index-raised);
|
|
134
136
|
--menu-mobile-left: 0;
|
|
@@ -51,6 +51,7 @@ export type TagProps = {
|
|
|
51
51
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
52
52
|
onClose?: (event: React.MouseEvent) => void;
|
|
53
53
|
maxLength?: number;
|
|
54
|
+
textTransform?: 'uppercase' | 'lowercase' | 'capitalize' | 'none';
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
export function Tag({
|
|
@@ -68,6 +69,7 @@ export function Tag({
|
|
|
68
69
|
withStatusDot,
|
|
69
70
|
statusDotColor = 'var(--tag-status-dot-color-default)',
|
|
70
71
|
maxLength,
|
|
72
|
+
textTransform,
|
|
71
73
|
...otherProps
|
|
72
74
|
}: TagProps): JSX.Element {
|
|
73
75
|
const truncateText = (text: string, maxLen: number): string => {
|
|
@@ -143,6 +145,7 @@ export function Tag({
|
|
|
143
145
|
onClick={onClick}
|
|
144
146
|
onKeyDown={onKeyDown}
|
|
145
147
|
hasCloseButton={closable}
|
|
148
|
+
textTransform={textTransform}
|
|
146
149
|
{...otherProps}
|
|
147
150
|
>
|
|
148
151
|
{withStatusDot ? <StatusDot color={statusDotColor} /> : icon ? icon : null}
|
|
@@ -187,7 +190,12 @@ const TagWrapper = styled.div.attrs(({ className, color, size }: TagProps) => ({
|
|
|
187
190
|
className:
|
|
188
191
|
(className || '') +
|
|
189
192
|
` tag-default ${color ? `tag-${color}` : ''} ${size ? `tag-size-${size}` : ''}`,
|
|
190
|
-
}))<
|
|
193
|
+
}))<
|
|
194
|
+
TagProps & {
|
|
195
|
+
hasCloseButton?: boolean;
|
|
196
|
+
textTransform?: 'uppercase' | 'lowercase' | 'capitalize' | 'none';
|
|
197
|
+
}
|
|
198
|
+
>`
|
|
191
199
|
display: inline-flex;
|
|
192
200
|
align-items: center;
|
|
193
201
|
justify-content: center;
|
|
@@ -209,7 +217,8 @@ const TagWrapper = styled.div.attrs(({ className, color, size }: TagProps) => ({
|
|
|
209
217
|
font-weight: var(--tag-font-weight);
|
|
210
218
|
line-height: var(--tag-line-height);
|
|
211
219
|
box-shadow: var(--tag-box-shadow);
|
|
212
|
-
|
|
220
|
+
${({ textTransform }) =>
|
|
221
|
+
`text-transform: ${textTransform ? `${textTransform}` : 'var(--tag-text-transform)'};`}
|
|
213
222
|
|
|
214
223
|
color: var(--tag-color);
|
|
215
224
|
background-color: var(--tag-bg-color);
|