@redocly/theme 0.55.0-next.7 → 0.55.0-next.8
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/Breadcrumbs/Breadcrumbs.d.ts +2 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.js +2 -1
- package/lib/components/Catalog/Catalog.d.ts +11 -0
- package/lib/components/Catalog/Catalog.js +138 -0
- package/lib/components/Catalog/CatalogActionsRow.d.ts +15 -0
- package/lib/components/Catalog/CatalogActionsRow.js +34 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCard.d.ts +8 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +179 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCardView.d.ts +8 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCardView.js +20 -0
- package/lib/components/Catalog/CatalogEntities.d.ts +18 -0
- package/lib/components/Catalog/CatalogEntities.js +63 -0
- package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +2 -0
- package/lib/components/Catalog/CatalogEntitiesEmptyState.js +38 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +12 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +133 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +49 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +48 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +111 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.js +25 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +69 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +48 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +19 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +20 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +20 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.js +23 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +21 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +24 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.js +21 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +21 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +37 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +10 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +31 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +25 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +27 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +22 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +60 -0
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +5 -0
- package/lib/components/Catalog/CatalogEntityIcon.js +38 -0
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +5 -0
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +42 -0
- package/lib/components/Catalog/CatalogHighlight.d.ts +4 -0
- package/lib/components/Catalog/CatalogHighlight.js +48 -0
- package/lib/components/Catalog/CatalogPageDescription.d.ts +9 -0
- package/lib/components/Catalog/CatalogPageDescription.js +52 -0
- package/lib/components/Catalog/CatalogSelector.d.ts +12 -0
- package/lib/components/Catalog/CatalogSelector.js +48 -0
- package/lib/components/Catalog/CatalogSortButton.d.ts +10 -0
- package/lib/components/Catalog/CatalogSortButton.js +71 -0
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.d.ts +5 -0
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +19 -0
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.d.ts +6 -0
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +63 -0
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.d.ts +5 -0
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +19 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +11 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +101 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +31 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +106 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +27 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +127 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.d.ts +6 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +20 -0
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.d.ts +7 -0
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +66 -0
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +9 -0
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +46 -0
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +7 -0
- package/lib/components/Catalog/CatalogViewModeToggle.js +67 -0
- package/lib/components/Catalog/variables.d.ts +1 -0
- package/lib/components/Catalog/variables.dark.d.ts +1 -0
- package/lib/components/Catalog/variables.dark.js +8 -0
- package/lib/components/Catalog/variables.js +354 -0
- package/lib/components/CatalogClassic/CatalogClassicHighlight.js +1 -1
- package/lib/components/Filter/Filter.d.ts +1 -1
- package/lib/components/Filter/Filter.js +2 -2
- package/lib/components/Filter/FilterCheckboxes.d.ts +1 -1
- package/lib/components/Filter/FilterCheckboxes.js +4 -4
- package/lib/components/Filter/FilterContent.d.ts +3 -1
- package/lib/components/Filter/FilterContent.js +34 -4
- package/lib/components/Filter/FilterInput.js +35 -3
- package/lib/components/Filter/FilterSelect.d.ts +1 -1
- package/lib/components/Filter/FilterSelect.js +4 -4
- package/lib/components/LoadMore/LoadMore.d.ts +8 -0
- package/lib/components/LoadMore/LoadMore.js +18 -0
- package/lib/components/Markdown/Markdown.js +1 -1
- package/lib/components/PageNavigation/NavigationButton.d.ts +13 -0
- package/lib/components/PageNavigation/NavigationButton.js +32 -0
- package/lib/components/PageNavigation/NextButton.js +10 -29
- package/lib/components/PageNavigation/PageNavigation.js +1 -1
- package/lib/components/PageNavigation/PreviousButton.js +11 -27
- package/lib/components/Search/SearchAiConversationInput.js +2 -1
- package/lib/components/Select/Select.js +3 -3
- package/lib/components/Sidebar/Sidebar.d.ts +3 -0
- package/lib/components/Sidebar/Sidebar.js +3 -2
- package/lib/components/Tag/Tag.d.ts +3 -1
- package/lib/components/Tag/Tag.js +54 -2
- package/lib/components/Tag/variables.js +21 -0
- package/lib/components/Tooltip/Tooltip.d.ts +2 -1
- package/lib/components/Tooltip/Tooltip.js +26 -19
- package/lib/components/Tooltip/variables.js +17 -0
- package/lib/core/constants/catalog.d.ts +1 -0
- package/lib/core/constants/catalog.js +5 -0
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/constants/search.d.ts +1 -0
- package/lib/core/constants/search.js +2 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -0
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -0
- package/lib/core/hooks/catalog/useCatalogEntities.d.ts +4 -0
- package/lib/core/hooks/catalog/useCatalogEntities.js +17 -0
- package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.d.ts +15 -0
- package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.js +23 -0
- package/lib/core/hooks/catalog/useCatalogTableViewRow.d.ts +11 -0
- package/lib/core/hooks/catalog/useCatalogTableViewRow.js +26 -0
- package/lib/core/hooks/index.d.ts +2 -0
- package/lib/core/hooks/index.js +2 -0
- package/lib/core/hooks/use-user-teams.d.ts +1 -0
- package/lib/core/hooks/use-user-teams.js +10 -0
- package/lib/core/styles/dark.js +2 -0
- package/lib/core/styles/global.js +63 -60
- package/lib/core/types/catalog.d.ts +118 -5
- package/lib/core/types/filter.d.ts +1 -0
- package/lib/core/types/hooks.d.ts +11 -4
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/index.js +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/telemetry.d.ts +32 -0
- package/lib/core/types/telemetry.js +3 -0
- package/lib/icons/AscSortIcon/AscSortIcon.d.ts +9 -0
- package/lib/icons/AscSortIcon/AscSortIcon.js +25 -0
- package/lib/icons/CardsIcon/CardsIcon.d.ts +9 -0
- package/lib/icons/CardsIcon/CardsIcon.js +25 -0
- package/lib/icons/CaretDownIcon/CaretDownIcon.d.ts +9 -0
- package/lib/icons/CaretDownIcon/CaretDownIcon.js +22 -0
- package/lib/icons/CaretUpIcon/CaretUpIcon.d.ts +9 -0
- package/lib/icons/CaretUpIcon/CaretUpIcon.js +22 -0
- package/lib/icons/DescSortIcon/DescSortIcon.d.ts +9 -0
- package/lib/icons/DescSortIcon/DescSortIcon.js +25 -0
- package/lib/icons/EntityTypeIcon/EntityTypeIcon.d.ts +9 -0
- package/lib/icons/EntityTypeIcon/EntityTypeIcon.js +26 -0
- package/lib/icons/GithubIcon/GithubIcon.d.ts +9 -0
- package/lib/icons/GithubIcon/GithubIcon.js +22 -0
- package/lib/icons/GraphIcon/GraphIcon.d.ts +9 -0
- package/lib/icons/GraphIcon/GraphIcon.js +22 -0
- package/lib/icons/PeopleIcon/PeopleIcon.d.ts +9 -0
- package/lib/icons/PeopleIcon/PeopleIcon.js +27 -0
- package/lib/icons/SlackIcon/SlackIcon.d.ts +9 -0
- package/lib/icons/SlackIcon/SlackIcon.js +29 -0
- package/lib/icons/SortIcon/SortIcon.d.ts +9 -0
- package/lib/icons/SortIcon/SortIcon.js +25 -0
- package/lib/icons/TableIcon/TableIcon.d.ts +9 -0
- package/lib/icons/TableIcon/TableIcon.js +22 -0
- package/lib/icons/TagsIcon/TagsIcon.d.ts +9 -0
- package/lib/icons/TagsIcon/TagsIcon.js +24 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +19 -0
- package/lib/markdoc/components/Tabs/Tab.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tab.js +10 -2
- package/lib/markdoc/components/Tabs/TabList.js +2 -2
- package/lib/markdoc/components/Tabs/Tabs.d.ts +3 -1
- package/lib/markdoc/components/Tabs/Tabs.js +2 -2
- package/package.json +2 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +7 -2
- package/src/components/Catalog/Catalog.tsx +235 -0
- package/src/components/Catalog/CatalogActionsRow.tsx +58 -0
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +227 -0
- package/src/components/Catalog/CatalogCardView/CatalogCardView.tsx +29 -0
- package/src/components/Catalog/CatalogEntities.tsx +107 -0
- package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +38 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +207 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +60 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +67 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +93 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +35 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +83 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +62 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +36 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +38 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +33 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +41 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +42 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +39 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +31 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +97 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +80 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +92 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +127 -0
- package/src/components/Catalog/CatalogEntityIcon.tsx +41 -0
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +48 -0
- package/src/components/Catalog/CatalogHighlight.tsx +56 -0
- package/src/components/Catalog/CatalogPageDescription.tsx +72 -0
- package/src/components/Catalog/CatalogSelector.tsx +67 -0
- package/src/components/Catalog/CatalogSortButton.tsx +78 -0
- package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +26 -0
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +77 -0
- package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +26 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +120 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +176 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +180 -0
- package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +28 -0
- package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +77 -0
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +83 -0
- package/src/components/Catalog/CatalogViewModeToggle.tsx +65 -0
- package/src/components/Catalog/variables.dark.ts +5 -0
- package/src/components/Catalog/variables.ts +351 -0
- package/src/components/CatalogClassic/CatalogClassicHighlight.tsx +1 -1
- package/src/components/Filter/Filter.tsx +10 -2
- package/src/components/Filter/FilterCheckboxes.tsx +8 -4
- package/src/components/Filter/FilterContent.tsx +21 -5
- package/src/components/Filter/FilterInput.tsx +16 -4
- package/src/components/Filter/FilterSelect.tsx +8 -4
- package/src/components/LoadMore/LoadMore.tsx +38 -0
- package/src/components/Markdown/Markdown.tsx +1 -1
- package/src/components/PageNavigation/NavigationButton.tsx +68 -0
- package/src/components/PageNavigation/NextButton.tsx +20 -43
- package/src/components/PageNavigation/PageNavigation.tsx +1 -1
- package/src/components/PageNavigation/PreviousButton.tsx +20 -43
- package/src/components/Search/SearchAiConversationInput.tsx +3 -0
- package/src/components/Select/Select.tsx +5 -3
- package/src/components/Sidebar/Sidebar.tsx +1 -1
- package/src/components/Tag/Tag.tsx +67 -1
- package/src/components/Tag/variables.ts +21 -0
- package/src/components/Tooltip/Tooltip.tsx +31 -22
- package/src/components/Tooltip/variables.ts +17 -0
- package/src/core/constants/catalog.ts +1 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/constants/search.ts +2 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/catalog/useCatalogEntities.ts +16 -0
- package/src/core/hooks/catalog/useCatalogTableHeaderCellActions.ts +38 -0
- package/src/core/hooks/catalog/useCatalogTableViewRow.ts +40 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/use-user-teams.ts +8 -0
- package/src/core/styles/dark.ts +2 -0
- package/src/core/styles/global.ts +3 -0
- package/src/core/types/catalog.ts +143 -5
- package/src/core/types/filter.ts +1 -0
- package/src/core/types/hooks.ts +32 -5
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +20 -0
- package/src/core/types/telemetry.ts +36 -0
- package/src/core/utils/load-and-navigate.ts +5 -4
- package/src/icons/AscSortIcon/AscSortIcon.tsx +29 -0
- package/src/icons/CardsIcon/CardsIcon.tsx +38 -0
- package/src/icons/CaretDownIcon/CaretDownIcon.tsx +26 -0
- package/src/icons/CaretUpIcon/CaretUpIcon.tsx +26 -0
- package/src/icons/DescSortIcon/DescSortIcon.tsx +29 -0
- package/src/icons/EntityTypeIcon/EntityTypeIcon.tsx +49 -0
- package/src/icons/GithubIcon/GithubIcon.tsx +35 -0
- package/src/icons/GraphIcon/GraphIcon.tsx +26 -0
- package/src/icons/PeopleIcon/PeopleIcon.tsx +46 -0
- package/src/icons/SlackIcon/SlackIcon.tsx +61 -0
- package/src/icons/SortIcon/SortIcon.tsx +29 -0
- package/src/icons/TableIcon/TableIcon.tsx +26 -0
- package/src/icons/TagsIcon/TagsIcon.tsx +41 -0
- package/src/index.ts +20 -0
- package/src/markdoc/components/Tabs/Tab.tsx +12 -1
- package/src/markdoc/components/Tabs/TabList.tsx +2 -1
- package/src/markdoc/components/Tabs/Tabs.tsx +8 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CatalogSelect = exports.CatalogSelectLabel = exports.CatalogSelectWrapper = void 0;
|
|
7
|
+
exports.CatalogSelector = CatalogSelector;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
11
|
+
const Select_1 = require("../../components/Select/Select");
|
|
12
|
+
const core_1 = require("../../core");
|
|
13
|
+
const ChevronDownIcon_1 = require("../../icons/ChevronDownIcon/ChevronDownIcon");
|
|
14
|
+
function CatalogSelector({ catalogSwitcherItems, setSearchQuery, setSortOption, }) {
|
|
15
|
+
const { useTranslate } = (0, core_1.useThemeHooks)();
|
|
16
|
+
const { translate } = useTranslate();
|
|
17
|
+
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
18
|
+
const pathPrefix = (0, core_1.getPathPrefix)();
|
|
19
|
+
const options = catalogSwitcherItems.map((item) => ({
|
|
20
|
+
value: item.slug,
|
|
21
|
+
element: translate(item.labelTranslationKey),
|
|
22
|
+
label: translate(item.labelTranslationKey),
|
|
23
|
+
}));
|
|
24
|
+
const selectedCatalogItem = catalogSwitcherItems.find((item) => item.selected);
|
|
25
|
+
return (react_1.default.createElement(exports.CatalogSelectWrapper, { "data-component-name": "Catalog/CatalogSelector" },
|
|
26
|
+
react_1.default.createElement(exports.CatalogSelectLabel, null, "Catalogs"),
|
|
27
|
+
react_1.default.createElement(exports.CatalogSelect, { value: selectedCatalogItem === null || selectedCatalogItem === void 0 ? void 0 : selectedCatalogItem.slug, options: options, onChange: (value) => {
|
|
28
|
+
navigate(`${pathPrefix}/catalogs/${value}`);
|
|
29
|
+
setSearchQuery('');
|
|
30
|
+
setSortOption(null);
|
|
31
|
+
}, icon: react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, { color: "var(--catalog-select-icon-color)" }) })));
|
|
32
|
+
}
|
|
33
|
+
exports.CatalogSelectWrapper = styled_components_1.default.div `
|
|
34
|
+
margin-top: var(--catalog-select-wrapper-margin-top);
|
|
35
|
+
margin-bottom: var(--catalog-select-wrapper-margin-bottom);
|
|
36
|
+
`;
|
|
37
|
+
exports.CatalogSelectLabel = styled_components_1.default.label `
|
|
38
|
+
display: block;
|
|
39
|
+
margin-bottom: var(--catalog-select-label-margin-bottom);
|
|
40
|
+
font-weight: var(--catalog-select-label-font-weight);
|
|
41
|
+
font-size: var(--catalog-select-label-font-size);
|
|
42
|
+
line-height: var(--catalog-select-label-line-height);
|
|
43
|
+
`;
|
|
44
|
+
exports.CatalogSelect = (0, styled_components_1.default)(Select_1.Select) `
|
|
45
|
+
border-radius: var(--catalog-select-border-radius);
|
|
46
|
+
--select-input-padding: var(--catalog-select-input-padding);
|
|
47
|
+
`;
|
|
48
|
+
//# sourceMappingURL=CatalogSelector.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SortOption } from '../../core/types';
|
|
3
|
+
export type CatalogSortButtonProps = {
|
|
4
|
+
onSortChange: (sortOption: SortOption | null) => void;
|
|
5
|
+
currentSort?: SortOption | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function CatalogSortButton({ onSortChange, currentSort, }: {
|
|
8
|
+
onSortChange: (sortOption: SortOption | null) => void;
|
|
9
|
+
currentSort?: SortOption | null;
|
|
10
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.CatalogSortButton = CatalogSortButton;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const AscSortIcon_1 = require("../../icons/AscSortIcon/AscSortIcon");
|
|
33
|
+
const DescSortIcon_1 = require("../../icons/DescSortIcon/DescSortIcon");
|
|
34
|
+
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
35
|
+
const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
|
|
36
|
+
const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
|
|
37
|
+
function CatalogSortButton({ onSortChange, currentSort, }) {
|
|
38
|
+
const toggleSort = (0, react_1.useCallback)((field) => {
|
|
39
|
+
const newSort = currentSort === `-${field}` ? field : `-${field}`;
|
|
40
|
+
onSortChange(newSort);
|
|
41
|
+
}, [currentSort, onSortChange]);
|
|
42
|
+
return (react_1.default.createElement(CatalogSortButtonWrapper, { "data-component-name": "Catalog/CatalogSortButton", trigger: react_1.default.createElement(SortTrigger, null,
|
|
43
|
+
react_1.default.createElement(SortIconWrapper, null, currentSort === '-title' ? react_1.default.createElement(DescSortIcon_1.DescSortIcon, null) : react_1.default.createElement(AscSortIcon_1.AscSortIcon, null)),
|
|
44
|
+
react_1.default.createElement(SortText, null, "Sort")), alignment: "end" },
|
|
45
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, null,
|
|
46
|
+
react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { onAction: () => toggleSort('title') }, currentSort === '-title' ? 'Title | A → Z' : 'Title | Z → A'))));
|
|
47
|
+
}
|
|
48
|
+
const CatalogSortButtonWrapper = (0, styled_components_1.default)(Dropdown_1.Dropdown) ``;
|
|
49
|
+
const SortTrigger = styled_components_1.default.div `
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: var(--catalog-sort-trigger-gap);
|
|
53
|
+
padding: var(--catalog-sort-trigger-padding);
|
|
54
|
+
border-radius: var(--catalog-sort-trigger-border-radius);
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
&:hover {
|
|
57
|
+
background-color: var(--catalog-sort-trigger-hover-bg-color);
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
const SortIconWrapper = styled_components_1.default.div `
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
color: var(--catalog-sort-icon-color);
|
|
65
|
+
`;
|
|
66
|
+
const SortText = styled_components_1.default.span `
|
|
67
|
+
font-size: var(--catalog-sort-text-font-size);
|
|
68
|
+
color: var(--catalog-sort-text-color);
|
|
69
|
+
font-weight: var(--catalog-sort-text-font-weight);
|
|
70
|
+
`;
|
|
71
|
+
//# sourceMappingURL=CatalogSortButton.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CatalogDomainsCell = CatalogDomainsCell;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CatalogTagsWithTooltip_1 = require("../../../components/Catalog/CatalogTagsWithTooltip");
|
|
9
|
+
function CatalogDomainsCell({ domains }) {
|
|
10
|
+
return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogTableView/CatalogDomainsCell" },
|
|
11
|
+
react_1.default.createElement(CatalogTagsWithTooltip_1.CatalogTagsWithTooltip, { "data-testid": "catalog-domains-cell", items: domains, showPlaceholder: false, tagProps: {
|
|
12
|
+
style: {
|
|
13
|
+
fontSize: 'var(--font-size-base)',
|
|
14
|
+
backgroundColor: 'transparent',
|
|
15
|
+
borderRadius: 'var(--border-radius-xl)',
|
|
16
|
+
},
|
|
17
|
+
} })));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=CatalogDomainsCell.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BffCatalogRelatedEntity } from '../../../core/types';
|
|
3
|
+
export type CatalogEntityCellProps = {
|
|
4
|
+
entity: BffCatalogRelatedEntity;
|
|
5
|
+
};
|
|
6
|
+
export declare function CatalogEntityCell({ entity }: CatalogEntityCellProps): React.JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CatalogEntityCell = CatalogEntityCell;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const CatalogHighlight_1 = require("../../../components/Catalog/CatalogHighlight");
|
|
10
|
+
const CatalogEntityIcon_1 = require("../../../components/Catalog/CatalogEntityIcon");
|
|
11
|
+
function CatalogEntityCell({ entity }) {
|
|
12
|
+
return (react_1.default.createElement(EntityTitleCellWrapper, { "data-component-name": "Catalog/CatalogTableView/CatalogEntityCell" },
|
|
13
|
+
react_1.default.createElement(IconContainer, null,
|
|
14
|
+
react_1.default.createElement(CatalogEntityIcon_1.CatalogEntityIcon, { entityType: entity.type })),
|
|
15
|
+
react_1.default.createElement(EntityTitleContent, null,
|
|
16
|
+
react_1.default.createElement(EntityTitle, null,
|
|
17
|
+
react_1.default.createElement(CatalogHighlight_1.CatalogHighlight, null, entity.title)),
|
|
18
|
+
entity.summary && (react_1.default.createElement(EntitySummary, null,
|
|
19
|
+
react_1.default.createElement(CatalogHighlight_1.CatalogHighlight, null, entity.summary))))));
|
|
20
|
+
}
|
|
21
|
+
const EntityTitleCellWrapper = styled_components_1.default.div `
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: var(--catalog-table-title-cell-gap);
|
|
25
|
+
max-width: 100%;
|
|
26
|
+
`;
|
|
27
|
+
const IconContainer = styled_components_1.default.div `
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
width: var(--catalog-table-icon-width);
|
|
32
|
+
height: var(--catalog-table-icon-height);
|
|
33
|
+
border-radius: var(--catalog-table-icon-border-radius);
|
|
34
|
+
background-color: var(--catalog-table-icon-bg-color);
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
border: var(--catalog-table-icon-border-width) solid var(--catalog-table-icon-border-color);
|
|
37
|
+
`;
|
|
38
|
+
const EntityTitleContent = styled_components_1.default.div `
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
max-width: calc(
|
|
42
|
+
100% - var(--catalog-table-entity-title-content-offset)
|
|
43
|
+
); /* Account for icon width (30px) + gap (12px) */
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
`;
|
|
46
|
+
const EntityTitle = styled_components_1.default.div `
|
|
47
|
+
font-size: var(--catalog-table-entity-title-font-size);
|
|
48
|
+
line-height: var(--catalog-table-entity-title-line-height);
|
|
49
|
+
font-weight: var(--catalog-table-entity-title-font-weight);
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
text-overflow: ellipsis;
|
|
53
|
+
`;
|
|
54
|
+
const EntitySummary = styled_components_1.default.div `
|
|
55
|
+
font-size: var(--catalog-table-entity-summary-font-size);
|
|
56
|
+
line-height: var(--catalog-table-entity-summary-line-height);
|
|
57
|
+
color: var(--catalog-table-description-color);
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
text-overflow: ellipsis;
|
|
61
|
+
width: 100%;
|
|
62
|
+
`;
|
|
63
|
+
//# sourceMappingURL=CatalogEntityCell.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CatalogOwnersCell = CatalogOwnersCell;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const CatalogTagsWithTooltip_1 = require("../../../components/Catalog/CatalogTagsWithTooltip");
|
|
9
|
+
function CatalogOwnersCell({ owners }) {
|
|
10
|
+
return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogTableView/CatalogOwnersCell" },
|
|
11
|
+
react_1.default.createElement(CatalogTagsWithTooltip_1.CatalogTagsWithTooltip, { "data-testid": "catalog-owners-cell", items: owners, showPlaceholder: false, tagProps: {
|
|
12
|
+
style: {
|
|
13
|
+
fontSize: 'var(--font-size-base)',
|
|
14
|
+
backgroundColor: 'transparent',
|
|
15
|
+
borderRadius: 'var(--border-radius-xl)',
|
|
16
|
+
},
|
|
17
|
+
} })));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=CatalogOwnersCell.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SortOption } from '../../../core/types';
|
|
3
|
+
import { BaseEntity, CatalogColumn } from './CatalogTableView';
|
|
4
|
+
export type CatalogTableHeaderCellProps<T extends BaseEntity> = {
|
|
5
|
+
column: CatalogColumn<T>;
|
|
6
|
+
setSortOption: (sortOption: SortOption | null) => void;
|
|
7
|
+
currentSortOption?: SortOption | null;
|
|
8
|
+
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
9
|
+
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const CatalogTableHeaderCell: <T extends BaseEntity>({ column, handleSortClick, isColumnSorted, setSortOption, }: CatalogTableHeaderCellProps<T>) => React.JSX.Element;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.CatalogTableHeaderCell = void 0;
|
|
30
|
+
const react_1 = __importDefault(require("react"));
|
|
31
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
32
|
+
const CaretDownIcon_1 = require("../../../icons/CaretDownIcon/CaretDownIcon");
|
|
33
|
+
const CaretUpIcon_1 = require("../../../icons/CaretUpIcon/CaretUpIcon");
|
|
34
|
+
const useCatalogTableHeaderCellActions_1 = require("../../../core/hooks/catalog/useCatalogTableHeaderCellActions");
|
|
35
|
+
const CatalogTableHeaderCell = ({ column, handleSortClick, isColumnSorted, setSortOption, }) => {
|
|
36
|
+
const { handleCellClick, sortKey, isUpActive, isDownActive } = (0, useCatalogTableHeaderCellActions_1.useCatalogTableHeaderCellActions)({
|
|
37
|
+
column,
|
|
38
|
+
handleSortClick,
|
|
39
|
+
isColumnSorted,
|
|
40
|
+
setSortOption,
|
|
41
|
+
});
|
|
42
|
+
return (react_1.default.createElement(TableHeaderCellWrapper, { key: column.key, "data-component-name": "Catalog/CatalogTableView/CatalogTableHeaderCell", onClick: handleCellClick, "$sortable": Boolean(column.sortable && sortKey) },
|
|
43
|
+
react_1.default.createElement(HeaderContent, null,
|
|
44
|
+
react_1.default.createElement(HeaderTitle, null, column.title),
|
|
45
|
+
column.sortable && sortKey && (react_1.default.createElement(SortIndicator, null,
|
|
46
|
+
react_1.default.createElement(SortArrow, { "$isActive": isUpActive },
|
|
47
|
+
react_1.default.createElement(CaretUpIcon_1.CaretUpIcon, { size: "9px", color: isUpActive
|
|
48
|
+
? 'var(--catalog-table-header-sort-icon-color-active)'
|
|
49
|
+
: 'var(--catalog-table-header-sort-icon-color-inactive)' })),
|
|
50
|
+
react_1.default.createElement(SortArrow, { "$isActive": isDownActive },
|
|
51
|
+
react_1.default.createElement(CaretDownIcon_1.CaretDownIcon, { size: "9px", color: isDownActive
|
|
52
|
+
? 'var(--catalog-table-header-sort-icon-color-active)'
|
|
53
|
+
: 'var(--catalog-table-header-sort-icon-color-inactive)' })))))));
|
|
54
|
+
};
|
|
55
|
+
exports.CatalogTableHeaderCell = CatalogTableHeaderCell;
|
|
56
|
+
const TableHeaderCellWrapper = styled_components_1.default.div `
|
|
57
|
+
padding: var(--catalog-table-header-cell-padding);
|
|
58
|
+
border-bottom: 1px solid var(--catalog-table-border-color);
|
|
59
|
+
${(props) => props.$sortable &&
|
|
60
|
+
(0, styled_components_1.css) `
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
user-select: none;
|
|
63
|
+
`}
|
|
64
|
+
`;
|
|
65
|
+
const HeaderContent = styled_components_1.default.div `
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: space-between;
|
|
69
|
+
width: 100%;
|
|
70
|
+
`;
|
|
71
|
+
const HeaderTitle = styled_components_1.default.span `
|
|
72
|
+
flex: 1;
|
|
73
|
+
`;
|
|
74
|
+
const SortIndicator = styled_components_1.default.div `
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
margin-left: 8px;
|
|
80
|
+
gap: 2px;
|
|
81
|
+
color: var(--catalog-table-header-sort-indicator-color);
|
|
82
|
+
`;
|
|
83
|
+
const SortArrow = styled_components_1.default.div `
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
width: 14px;
|
|
88
|
+
height: 9px;
|
|
89
|
+
border-radius: 2px;
|
|
90
|
+
transition: background-color 0.2s ease;
|
|
91
|
+
|
|
92
|
+
svg {
|
|
93
|
+
display: block;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
${(props) => props.$isActive &&
|
|
97
|
+
(0, styled_components_1.css) `
|
|
98
|
+
background-color: var(--catalog-table-header-sort-arrow-bg-active);
|
|
99
|
+
`}
|
|
100
|
+
`;
|
|
101
|
+
//# sourceMappingURL=CatalogTableHeaderCell.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
3
|
+
import { EntityType, SortOption } from '../../../core/types';
|
|
4
|
+
export type BaseEntity = {
|
|
5
|
+
id: string;
|
|
6
|
+
key: string;
|
|
7
|
+
type: string;
|
|
8
|
+
title: string;
|
|
9
|
+
summary?: string | null;
|
|
10
|
+
};
|
|
11
|
+
export type CatalogTableViewProps<T extends BaseEntity> = {
|
|
12
|
+
entities: T[];
|
|
13
|
+
entitiesCatalogConfig?: EntitiesCatalogConfig;
|
|
14
|
+
catalogConfig: CatalogEntityConfig;
|
|
15
|
+
columns?: CatalogColumn<T>[];
|
|
16
|
+
setSortOption: (sortOption: SortOption | null) => void;
|
|
17
|
+
currentSortOption?: SortOption | null;
|
|
18
|
+
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
19
|
+
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
20
|
+
};
|
|
21
|
+
export type CatalogColumn<T> = {
|
|
22
|
+
key: string;
|
|
23
|
+
title: string;
|
|
24
|
+
render: (entity: T) => ReactNode;
|
|
25
|
+
width?: string;
|
|
26
|
+
minWidth?: string;
|
|
27
|
+
sortable?: boolean;
|
|
28
|
+
sortKey?: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const getEntityTagColor: (type: EntityType) => string;
|
|
31
|
+
export declare const CatalogTableView: <T extends BaseEntity>({ entities, entitiesCatalogConfig, catalogConfig, columns, setSortOption, currentSortOption, handleSortClick, isColumnSorted, }: CatalogTableViewProps<T>) => React.JSX.Element;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CatalogTableView = exports.getEntityTagColor = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Tag_1 = require("../../../components/Tag/Tag");
|
|
10
|
+
const CatalogOwnersCell_1 = require("../../../components/Catalog/CatalogTableView/CatalogOwnersCell");
|
|
11
|
+
const CatalogDomainsCell_1 = require("../../../components/Catalog/CatalogTableView/CatalogDomainsCell");
|
|
12
|
+
const CatalogEntityCell_1 = require("../../../components/Catalog/CatalogTableView/CatalogEntityCell");
|
|
13
|
+
const CatalogTableHeaderCell_1 = require("../../../components/Catalog/CatalogTableView/CatalogTableHeaderCell");
|
|
14
|
+
const CatalogTagsCell_1 = require("../../../components/Catalog/CatalogTableView/CatalogTagsCell");
|
|
15
|
+
const CatalogTableViewRow_1 = require("../../../components/Catalog/CatalogTableView/CatalogTableViewRow");
|
|
16
|
+
const getEntityTagColor = (type) => {
|
|
17
|
+
switch (type) {
|
|
18
|
+
case 'service':
|
|
19
|
+
return 'blue';
|
|
20
|
+
case 'domain':
|
|
21
|
+
return 'grass';
|
|
22
|
+
case 'team':
|
|
23
|
+
return 'purple';
|
|
24
|
+
case 'user':
|
|
25
|
+
return 'yellow';
|
|
26
|
+
case 'api-description':
|
|
27
|
+
return 'sky';
|
|
28
|
+
default:
|
|
29
|
+
const exhaustiveCheck = type;
|
|
30
|
+
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.getEntityTagColor = getEntityTagColor;
|
|
34
|
+
const baseColumns = [
|
|
35
|
+
{
|
|
36
|
+
key: 'entity',
|
|
37
|
+
title: 'Entity',
|
|
38
|
+
render: (entity) => react_1.default.createElement(CatalogEntityCell_1.CatalogEntityCell, { entity: entity }),
|
|
39
|
+
width: '3fr',
|
|
40
|
+
minWidth: '250px',
|
|
41
|
+
sortable: true,
|
|
42
|
+
sortKey: 'title',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: 'type',
|
|
46
|
+
title: 'Type',
|
|
47
|
+
render: (entity) => (react_1.default.createElement(EntityTypeTag, { color: (0, exports.getEntityTagColor)(entity.type) }, entity.type)),
|
|
48
|
+
width: '2fr',
|
|
49
|
+
minWidth: '120px',
|
|
50
|
+
sortable: true,
|
|
51
|
+
sortKey: 'type',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: 'domains',
|
|
55
|
+
title: 'Domains',
|
|
56
|
+
render: (entity) => {
|
|
57
|
+
var _a;
|
|
58
|
+
return (react_1.default.createElement(CatalogDomainsCell_1.CatalogDomainsCell, { domains: ((_a = entity.domains) === null || _a === void 0 ? void 0 : _a.map((domain) => domain.title)) || [] }));
|
|
59
|
+
},
|
|
60
|
+
width: '2fr',
|
|
61
|
+
minWidth: '150px',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: 'owners',
|
|
65
|
+
title: 'Owners',
|
|
66
|
+
render: (entity) => {
|
|
67
|
+
var _a;
|
|
68
|
+
return (react_1.default.createElement(CatalogOwnersCell_1.CatalogOwnersCell, { owners: ((_a = entity.owners) === null || _a === void 0 ? void 0 : _a.map((owner) => owner.title)) || [] }));
|
|
69
|
+
},
|
|
70
|
+
width: '2fr',
|
|
71
|
+
minWidth: '150px',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: 'tags',
|
|
75
|
+
title: 'Tags',
|
|
76
|
+
render: (entity) => react_1.default.createElement(CatalogTagsCell_1.CatalogTagsCell, { entity: entity }),
|
|
77
|
+
width: '2fr',
|
|
78
|
+
minWidth: '120px',
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
const CatalogTableView = ({ entities, entitiesCatalogConfig, catalogConfig, columns = baseColumns, setSortOption, currentSortOption, handleSortClick, isColumnSorted, }) => {
|
|
82
|
+
return (react_1.default.createElement(CatalogTableWrapper, { "data-component-name": "Catalog/CatalogTableView" },
|
|
83
|
+
react_1.default.createElement(CatalogTableHeader, { columnsWidths: columns.map((column) => column.width || '1fr'), columnsMinWidths: columns.map((column) => column.minWidth || 'auto') }, columns.map((column) => (react_1.default.createElement(CatalogTableHeaderCell_1.CatalogTableHeaderCell, { key: column.key, column: column, setSortOption: setSortOption, currentSortOption: currentSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted })))),
|
|
84
|
+
react_1.default.createElement("div", null, entities.map((entity) => (react_1.default.createElement(CatalogTableViewRow_1.CatalogTableViewRow, { key: entity.id, entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, columns: columns }))))));
|
|
85
|
+
};
|
|
86
|
+
exports.CatalogTableView = CatalogTableView;
|
|
87
|
+
const EntityTypeTag = (0, styled_components_1.default)(Tag_1.Tag) `
|
|
88
|
+
font-size: var(--font-size-base);
|
|
89
|
+
background-color: transparent;
|
|
90
|
+
text-transform: lowercase;
|
|
91
|
+
`;
|
|
92
|
+
const CatalogTableWrapper = styled_components_1.default.div `
|
|
93
|
+
width: 100%;
|
|
94
|
+
border-bottom: 1px solid var(--catalog-table-border-color);
|
|
95
|
+
margin-bottom: var(--spacing-xl);
|
|
96
|
+
margin-top: var(--spacing-xl);
|
|
97
|
+
`;
|
|
98
|
+
const CatalogTableHeader = styled_components_1.default.div `
|
|
99
|
+
display: grid;
|
|
100
|
+
grid-template-columns: ${({ columnsWidths, columnsMinWidths }) => columnsWidths
|
|
101
|
+
.map((width, index) => columnsMinWidths[index] !== 'auto' ? `minmax(${columnsMinWidths[index]}, ${width})` : width)
|
|
102
|
+
.join(' ')};
|
|
103
|
+
background: var(--catalog-table-header-bg-color);
|
|
104
|
+
font-weight: var(--catalog-table-header-font-weight);
|
|
105
|
+
`;
|
|
106
|
+
//# sourceMappingURL=CatalogTableView.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
3
|
+
import { EntityType } from '../../../core/types';
|
|
4
|
+
export type BaseEntity = {
|
|
5
|
+
id: string;
|
|
6
|
+
key: string;
|
|
7
|
+
type: string;
|
|
8
|
+
title: string;
|
|
9
|
+
summary?: string | null;
|
|
10
|
+
};
|
|
11
|
+
export type CatalogTableViewRowProps<T extends BaseEntity> = {
|
|
12
|
+
entity: T;
|
|
13
|
+
entitiesCatalogConfig?: EntitiesCatalogConfig;
|
|
14
|
+
catalogConfig: CatalogEntityConfig;
|
|
15
|
+
columns?: CatalogColumn<T>[];
|
|
16
|
+
};
|
|
17
|
+
export type CatalogColumn<T> = {
|
|
18
|
+
key: string;
|
|
19
|
+
title: string;
|
|
20
|
+
render: (entity: T) => ReactNode;
|
|
21
|
+
width?: string;
|
|
22
|
+
minWidth?: string;
|
|
23
|
+
sortable?: boolean;
|
|
24
|
+
sortKey?: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const getEntityTagColor: (type: EntityType) => string;
|
|
27
|
+
export declare const CatalogTableViewRow: <T extends BaseEntity>({ entity, entitiesCatalogConfig, catalogConfig, columns, }: CatalogTableViewRowProps<T>) => React.JSX.Element;
|