@redocly/theme 0.55.0-next.7 → 0.55.0-next.9
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/SkipContent/SkipContent.d.ts +2 -0
- package/lib/components/SkipContent/SkipContent.js +68 -0
- package/lib/components/SkipContent/variables.d.ts +1 -0
- package/lib/components/SkipContent/variables.js +23 -0
- 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/common.d.ts +1 -0
- package/lib/core/constants/common.js +2 -1
- 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 +65 -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/layouts/PageLayout.js +2 -1
- package/lib/layouts/RootLayout.js +2 -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/SkipContent/SkipContent.tsx +47 -0
- package/src/components/SkipContent/variables.ts +20 -0
- 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/common.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 +5 -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 +22 -1
- 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/layouts/PageLayout.tsx +4 -1
- package/src/layouts/RootLayout.tsx +2 -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,65 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { TableIcon } from '@redocly/theme/icons/TableIcon/TableIcon';
|
|
5
|
+
import { CardsIcon } from '@redocly/theme/icons/CardsIcon/CardsIcon';
|
|
6
|
+
import { CatalogViewMode } from '@redocly/theme/core';
|
|
7
|
+
|
|
8
|
+
function useViewMode(initialViewMode: CatalogViewMode) {
|
|
9
|
+
const [viewMode, setViewMode] = useState<CatalogViewMode | null>(null);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setViewMode(initialViewMode);
|
|
13
|
+
}, [initialViewMode]);
|
|
14
|
+
|
|
15
|
+
return viewMode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type CatalogViewModeToggleProps = {
|
|
19
|
+
viewMode: CatalogViewMode;
|
|
20
|
+
onViewModeChange: (mode: CatalogViewMode) => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function CatalogViewModeToggle({
|
|
24
|
+
viewMode: initialViewMode,
|
|
25
|
+
onViewModeChange,
|
|
26
|
+
}: CatalogViewModeToggleProps) {
|
|
27
|
+
const viewMode = useViewMode(initialViewMode);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<ViewModeToggleWrapper data-component-name="Catalog/CatalogViewModeToggle">
|
|
31
|
+
<ViewModeButton
|
|
32
|
+
className={viewMode === 'table' ? 'active' : ''}
|
|
33
|
+
onClick={() => onViewModeChange('table')}
|
|
34
|
+
>
|
|
35
|
+
<TableIcon size="var(--catalog-view-mode-table-icon-size)" />
|
|
36
|
+
</ViewModeButton>
|
|
37
|
+
<ViewModeButton
|
|
38
|
+
className={viewMode === 'cards' ? 'active' : ''}
|
|
39
|
+
onClick={() => onViewModeChange('cards')}
|
|
40
|
+
>
|
|
41
|
+
<CardsIcon size="var(--catalog-view-mode-cards-icon-size)" />
|
|
42
|
+
</ViewModeButton>
|
|
43
|
+
</ViewModeToggleWrapper>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const ViewModeToggleWrapper = styled.div`
|
|
48
|
+
display: flex;
|
|
49
|
+
gap: var(--catalog-view-mode-toggle-gap);
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
const ViewModeButton = styled.button`
|
|
53
|
+
width: var(--catalog-view-mode-button-width);
|
|
54
|
+
height: var(--catalog-view-mode-button-height);
|
|
55
|
+
background-color: transparent;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
border-radius: var(--catalog-view-mode-button-border-radius);
|
|
61
|
+
|
|
62
|
+
&.active {
|
|
63
|
+
background-color: var(--catalog-view-mode-toggle-active-bg-color);
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const catalog = css`
|
|
4
|
+
/* === Catalog === */
|
|
5
|
+
/**
|
|
6
|
+
* @tokens Catalog page
|
|
7
|
+
*/
|
|
8
|
+
--catalog-page-padding-vertical: var(--spacing-xl);
|
|
9
|
+
--catalog-page-padding-horizontal: var(--spacing-xxl);
|
|
10
|
+
--catalog-page-padding: var(--catalog-page-padding-vertical) var(--catalog-page-padding-horizontal);
|
|
11
|
+
--catalog-page-content-height: calc(100vh - var(--navbar-height) - var(--spacing-lg) * 2);
|
|
12
|
+
|
|
13
|
+
--catalog-filter-padding-vertical-mobile: 0;
|
|
14
|
+
--catalog-filter-padding-horizontal-mobile: var(--spacing-base);
|
|
15
|
+
|
|
16
|
+
--catalog-heading-margin: 0 0 var(--spacing-xl) 0;
|
|
17
|
+
--catalog-sidebar-width: 285px;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @tokens Catalog page wrapper
|
|
21
|
+
*/
|
|
22
|
+
--catalog-page-wrapper-font-weight: var(--font-weight-regular);
|
|
23
|
+
--catalog-page-wrapper-text-color: var(--text-color-secondary);
|
|
24
|
+
--catalog-page-wrapper-font-size: var(--font-size-base);
|
|
25
|
+
--catalog-page-wrapper-font-family: var(--font-family-base);
|
|
26
|
+
--catalog-page-wrapper-line-height: var(--line-height-base);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @tokens Catalog page content
|
|
30
|
+
*/
|
|
31
|
+
--catalog-page-content-width-mobile: 90%;
|
|
32
|
+
--catalog-page-content-width-desktop: 100%;
|
|
33
|
+
--catalog-page-content-margin-mobile: 0 auto;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @tokens Catalog page title
|
|
37
|
+
*/
|
|
38
|
+
--catalog-title-text-color: var(--text-color-primary);
|
|
39
|
+
--catalog-title-font-weight: var(--font-weight-bold);
|
|
40
|
+
--catalog-title-font-size: var(--h3-font-size);
|
|
41
|
+
--catalog-title-margin: var(--spacing-sm) 0 var(--spacing-sm) 0;
|
|
42
|
+
--catalog-title-spacing-right: 8px;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @tokens Catalog page description
|
|
46
|
+
*/
|
|
47
|
+
--catalog-description-text-color: var(--text-color-secondary);
|
|
48
|
+
--catalog-description-font-weight: var(--font-weight-regular);
|
|
49
|
+
--catalog-description-font-size: var(--font-size-lg);
|
|
50
|
+
--catalog-description-margin: 0 0 var(--spacing-sm) 0;
|
|
51
|
+
--catalog-description-line-height: var(--line-height-lg);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @tokens Catalog page separator
|
|
55
|
+
*/
|
|
56
|
+
--catalog-separator-color: var(--text-color-secondary);
|
|
57
|
+
--catalog-separator-font-size: var(--font-size-base);
|
|
58
|
+
--catalog-separator-font-weight: var(--font-weight-regular);
|
|
59
|
+
--catalog-separator-border-color: var(--border-color-secondary);
|
|
60
|
+
--catalog-separator-margin: 0 0 var(--spacing-base) 0;
|
|
61
|
+
--catalog-separator-padding: var(--spacing-xxs) 0 0 0;
|
|
62
|
+
--catalog-separator-label-margin: 0 var(--spacing-xs);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @tokens Catalog separators and dividers
|
|
66
|
+
*/
|
|
67
|
+
--catalog-hr-border-color: var(--border-color-primary);
|
|
68
|
+
--catalog-hr-border-width: 1px;
|
|
69
|
+
--catalog-hr-width: calc(100% + 48px);
|
|
70
|
+
--catalog-hr-margin: auto -24px 0 -24px;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @tokens Catalog links
|
|
74
|
+
*/
|
|
75
|
+
--catalog-link-color: var(--link-color-primary);
|
|
76
|
+
--catalog-link-font-weight: var(--link-font-weight);
|
|
77
|
+
--catalog-link-text-decoration: none;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @tokens Catalog selector
|
|
81
|
+
*/
|
|
82
|
+
--catalog-select-wrapper-margin-top: var(--spacing-xxs);
|
|
83
|
+
--catalog-select-wrapper-margin-bottom: var(--spacing-base);
|
|
84
|
+
--catalog-select-label-margin-bottom: var(--spacing-xxs);
|
|
85
|
+
--catalog-select-label-font-weight: var(--filter-title-font-weight);
|
|
86
|
+
--catalog-select-label-font-size: var(--filter-title-font-size);
|
|
87
|
+
--catalog-select-label-line-height: var(--filter-title-line-height);
|
|
88
|
+
--catalog-select-border-radius: var(--filter-input-border-radius);
|
|
89
|
+
--catalog-select-input-padding: var(--select-input-padding-vertical) var(--spacing-sm);
|
|
90
|
+
--catalog-select-icon-color: var(--input-t-icon-color);
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @tokens Catalog highlight
|
|
94
|
+
*/
|
|
95
|
+
--catalog-highlight-bg-color: var(--search-highlight-bg-color);
|
|
96
|
+
--catalog-highlight-text-color: var(--search-highlight-text-color);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @tokens Catalog entity icon
|
|
100
|
+
*/
|
|
101
|
+
--catalog-entity-icon-color: var(--color-primary-base);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @tokens Catalog tags
|
|
105
|
+
*/
|
|
106
|
+
--catalog-tags-wrapper-gap: 4px;
|
|
107
|
+
--catalog-tags-more-button-font-size: var(--font-size-base);
|
|
108
|
+
--catalog-tags-more-button-margin-left: 4px;
|
|
109
|
+
--catalog-tags-placeholder-bg-color: var(--bg-color);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @tokens Catalog empty state
|
|
113
|
+
*/
|
|
114
|
+
--catalog-empty-state-padding: var(--catalog-table-empty-state-padding);
|
|
115
|
+
--catalog-empty-state-font-weight: var(--font-weight-regular);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @tokens Catalog actions
|
|
119
|
+
*/
|
|
120
|
+
--catalog-actions-row-margin-bottom: var(--spacing-xl);
|
|
121
|
+
--catalog-controls-wrapper-gap: var(--spacing-sm);
|
|
122
|
+
--catalog-filter-input-width: 360px;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @tokens Catalog search input wrapper
|
|
126
|
+
*/
|
|
127
|
+
--catalog-search-input-wrapper-width: var(--catalog-filter-input-width);
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @tokens Catalog controls wrapper
|
|
131
|
+
*/
|
|
132
|
+
--catalog-controls-wrapper-display: flex;
|
|
133
|
+
--catalog-controls-wrapper-align-items: center;
|
|
134
|
+
--catalog-controls-wrapper-margin-left: auto;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @tokens Catalog sort button
|
|
138
|
+
*/
|
|
139
|
+
--catalog-sort-trigger-gap: var(--spacing-xs);
|
|
140
|
+
--catalog-sort-trigger-padding: 6px 8px;
|
|
141
|
+
--catalog-sort-trigger-border-radius: var(--border-radius-md);
|
|
142
|
+
--catalog-sort-trigger-hover-bg-color: var(--button-bg-color-secondary-hover);
|
|
143
|
+
--catalog-sort-icon-color: var(--text-color-secondary);
|
|
144
|
+
--catalog-sort-text-font-size: var(--font-size-sm);
|
|
145
|
+
--catalog-sort-text-color: var(--text-color-secondary);
|
|
146
|
+
--catalog-sort-text-font-weight: var(--font-weight-medium);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @tokens Catalog sidebar
|
|
150
|
+
*/
|
|
151
|
+
--catalog-sidebar-display-mobile: none;
|
|
152
|
+
--catalog-sidebar-display-desktop: flex;
|
|
153
|
+
--catalog-sidebar-menu-container-padding-top: 0;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @tokens Catalog page description responsive
|
|
157
|
+
*/
|
|
158
|
+
--catalog-page-description-display-mobile: none;
|
|
159
|
+
--catalog-page-description-display-desktop: block;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @tokens Catalog card
|
|
163
|
+
*/
|
|
164
|
+
--catalog-card-min-height: 194px;
|
|
165
|
+
--catalog-card-min-width: 490px;
|
|
166
|
+
--catalog-card-padding-vertical: var(--spacing-base);
|
|
167
|
+
--catalog-card-padding-horizontal: var(--spacing-md);
|
|
168
|
+
--catalog-card-gap: var(--spacing-sm);
|
|
169
|
+
--catalog-card-text-color: var(--text-color-secondary);
|
|
170
|
+
--catalog-card-font-size: var(--font-size-base);
|
|
171
|
+
--catalog-card-font-weight: var(--font-weight-regular);
|
|
172
|
+
--catalog-card-bg-color: var(--layer-color);
|
|
173
|
+
--catalog-card-border-color: var(--border-color-secondary);
|
|
174
|
+
--catalog-card-divider-color: var(--border-color-secondary);
|
|
175
|
+
--catalog-card-border-width: var(--border-width);
|
|
176
|
+
--catalog-card-border-style: var(--border-style);
|
|
177
|
+
--catalog-card-border-color-hover: var(--border-color-primary);
|
|
178
|
+
--catalog-card-border-radius: var(--border-radius-lg);
|
|
179
|
+
--catalog-cards-group-margin: 0 0 var(--spacing-base) 0;
|
|
180
|
+
--catalog-cards-group-gap: var(--spacing-xl);
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @tokens Catalog card icon
|
|
184
|
+
*/
|
|
185
|
+
--catalog-card-icon-width: 30px;
|
|
186
|
+
--catalog-card-icon-height: 30px;
|
|
187
|
+
--catalog-card-icon-border-radius: 4px;
|
|
188
|
+
--catalog-card-icon-bg-color: var(--bg-color);
|
|
189
|
+
--catalog-card-icon-border-color: var(--border-color-secondary);
|
|
190
|
+
--catalog-card-icon-border-width: 1px;
|
|
191
|
+
--catalog-card-icon-margin-right: var(--spacing-xs);
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @tokens Catalog metadata
|
|
195
|
+
*/
|
|
196
|
+
--catalog-metadata-section-margin-top: var(--spacing-md);
|
|
197
|
+
--catalog-metadata-section-gap: var(--spacing-lg);
|
|
198
|
+
--catalog-metadata-label-font-size: var(--font-size-base);
|
|
199
|
+
--catalog-metadata-label-font-weight: var(--font-weight-medium);
|
|
200
|
+
--catalog-metadata-label-color: var(--text-color-secondary);
|
|
201
|
+
--catalog-metadata-label-margin-bottom: var(--spacing-unit);
|
|
202
|
+
--catalog-metadata-column-half-gap: var(--spacing-sm);
|
|
203
|
+
--catalog-metadata-heading-size: var(--font-size-md);
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @tokens Catalog arrow circle
|
|
207
|
+
*/
|
|
208
|
+
--catalog-arrow-circle-size: 32px;
|
|
209
|
+
--catalog-arrow-circle-radius: 16px;
|
|
210
|
+
--catalog-arrow-circle-bg-color: var(--button-bg-color-secondary);
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @tokens Catalog card title
|
|
214
|
+
*/
|
|
215
|
+
--catalog-card-title-color: var(--text-color-primary);
|
|
216
|
+
--catalog-card-title-min-height: var(--spacing-xxl);
|
|
217
|
+
--catalog-card-title-font-size: var(--font-size-lg);
|
|
218
|
+
--catalog-card-title-font-weight: var(--font-weight-bold);
|
|
219
|
+
--catalog-card-title-line-height: var(--line-height-lg);
|
|
220
|
+
--catalog-card-title-line-clamp: 2;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @tokens Catalog card description
|
|
224
|
+
*/
|
|
225
|
+
--catalog-card-description-line-clamp: 3;
|
|
226
|
+
--catalog-card-description-color: var(--text-color-description);
|
|
227
|
+
--catalog-card-description-font-size: var(--font-size-base);
|
|
228
|
+
--catalog-card-description-line-height: var(--line-height-base);
|
|
229
|
+
--catalog-card-description-font-weight: var(--font-weight-regular);
|
|
230
|
+
--catalog-card-description-height: 62px;
|
|
231
|
+
--catalog-card-description-margin-top: 2px;
|
|
232
|
+
|
|
233
|
+
--catalog-card-content-gap: var(--spacing-xs);
|
|
234
|
+
--catalog-card-content-gap-vertical: var(--spacing-sm);
|
|
235
|
+
|
|
236
|
+
--catalog-card-tag-bg: transparent;
|
|
237
|
+
|
|
238
|
+
--catalog-actions-gap: var(--spacing-xs);
|
|
239
|
+
--catalog-actions-padding-vertical: var(--spacing-xs);
|
|
240
|
+
--catalog-actions-padding-horizontal: 5%;
|
|
241
|
+
--catalog-actions-min-height: 40px;
|
|
242
|
+
--catalog-actions-bg-color: var(--bg-color-tonal);
|
|
243
|
+
|
|
244
|
+
--catalog-page-badge-border-radius: var(--border-radius);
|
|
245
|
+
--catalog-page-badge-padding: 0 var(--spacing-xs);
|
|
246
|
+
--catalog-page-badge-font-size: var(--font-size-base);
|
|
247
|
+
--catalog-page-badge-line-height: var(--line-height-base);
|
|
248
|
+
|
|
249
|
+
--catalog-page-badge-dot-size: 6px;
|
|
250
|
+
--catalog-page-badge-dot-border-color: #ffffff;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @tokens Catalog table
|
|
254
|
+
*/
|
|
255
|
+
--catalog-table-border-color: var(--border-color-primary);
|
|
256
|
+
--catalog-table-header-bg-color: var(--bg-color-secondary);
|
|
257
|
+
--catalog-table-header-font-weight: var(--font-weight-semibold);
|
|
258
|
+
--catalog-table-header-cell-padding: 5px 8px;
|
|
259
|
+
--catalog-table-cell-padding: 5px 8px;
|
|
260
|
+
--catalog-table-row-hover-bg-color: var(--bg-color-hover, rgba(0, 0, 0, 0.04));
|
|
261
|
+
--catalog-table-empty-state-padding: 32px;
|
|
262
|
+
--catalog-table-empty-state-color: var(--text-color-secondary);
|
|
263
|
+
--catalog-table-title-cell-gap: 12px;
|
|
264
|
+
--catalog-table-entity-title-content-offset: 42px;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @tokens Catalog table header
|
|
268
|
+
*/
|
|
269
|
+
--catalog-table-header-sort-icon-color-active: var(--text-color-primary);
|
|
270
|
+
--catalog-table-header-sort-icon-color-inactive: var(--text-color-helper);
|
|
271
|
+
--catalog-table-header-sort-indicator-color: var(--icon-color-primary);
|
|
272
|
+
--catalog-table-header-sort-arrow-bg-active: var(--bg-color-active);
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @tokens Catalog table icon
|
|
276
|
+
*/
|
|
277
|
+
--catalog-table-icon-width: 30px;
|
|
278
|
+
--catalog-table-icon-height: 30px;
|
|
279
|
+
--catalog-table-icon-border-radius: 4px;
|
|
280
|
+
--catalog-table-icon-bg-color: var(--bg-color-tonal);
|
|
281
|
+
--catalog-table-icon-border-color: var(--border-color-secondary);
|
|
282
|
+
--catalog-table-icon-border-width: 1px;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @tokens Catalog table entity title
|
|
286
|
+
*/
|
|
287
|
+
--catalog-table-entity-title-font-size: var(--catalog-card-title-font-size);
|
|
288
|
+
--catalog-table-entity-title-line-height: var(--line-height-lg);
|
|
289
|
+
--catalog-table-entity-title-font-weight: var(--font-weight-semibold);
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @tokens Catalog table description
|
|
293
|
+
*/
|
|
294
|
+
--catalog-table-description-line-clamp: 3;
|
|
295
|
+
--catalog-table-description-color: var(--text-color-description);
|
|
296
|
+
--catalog-table-description-font-size: var(--font-size-base);
|
|
297
|
+
--catalog-table-description-line-height: var(--line-height-base);
|
|
298
|
+
--catalog-table-description-font-weight: var(--font-weight-regular);
|
|
299
|
+
--catalog-table-description-height: 62px;
|
|
300
|
+
--catalog-table-entity-summary-font-size: var(--font-size-sm);
|
|
301
|
+
--catalog-table-entity-summary-line-height: var(--line-height-sm);
|
|
302
|
+
|
|
303
|
+
--catalog-table-content-gap: var(--spacing-xxs);
|
|
304
|
+
|
|
305
|
+
--catalog-table-tag-bg: transparent;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @tokens Catalog entity type tags
|
|
309
|
+
*/
|
|
310
|
+
--catalog-entity-service-tag-text-color: var(--color-blue-7);
|
|
311
|
+
--catalog-entity-service-tag-border-color: var(--color-blue-4);
|
|
312
|
+
|
|
313
|
+
--catalog-entity-domain-tag-text-color: var(--color-grass-8);
|
|
314
|
+
--catalog-entity-domain-tag-border-color: var(--color-grass-4);
|
|
315
|
+
|
|
316
|
+
--catalog-entity-team-tag-text-color: var(--color-purple-7);
|
|
317
|
+
--catalog-entity-team-tag-border-color: var(--color-purple-4);
|
|
318
|
+
|
|
319
|
+
--catalog-entity-user-tag-text-color: var(--color-green-7);
|
|
320
|
+
--catalog-entity-user-tag-border-color: var(--color-green-4);
|
|
321
|
+
|
|
322
|
+
--catalog-entity-api-description-tag-text-color: var(--color-sky-8);
|
|
323
|
+
--catalog-entity-api-description-tag-border-color: var(--color-sky-5);
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @tokens Catalog view mode toggle
|
|
327
|
+
*/
|
|
328
|
+
--catalog-view-mode-toggle-gap: var(--spacing-xxs);
|
|
329
|
+
--catalog-view-mode-toggle-active-bg-color: var(--button-bg-color-secondary-hover);
|
|
330
|
+
--catalog-view-mode-button-width: 32px;
|
|
331
|
+
--catalog-view-mode-button-height: 32px;
|
|
332
|
+
--catalog-view-mode-button-border-radius: var(--border-radius-md);
|
|
333
|
+
--catalog-view-mode-table-icon-size: 12px;
|
|
334
|
+
--catalog-view-mode-cards-icon-size: 13px;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @tokens Catalog empty state
|
|
338
|
+
*/
|
|
339
|
+
--catalog-empty-state-text-color: var(--text-color-description);
|
|
340
|
+
--catalog-empty-state-min-height: 300px;
|
|
341
|
+
--catalog-empty-state-header-text-color: var(--text-color-primary);
|
|
342
|
+
--catalog-empty-state-header-font-size: var(--font-size-xl);
|
|
343
|
+
--catalog-empty-state-header-font-weight: var(--font-weight-medium);
|
|
344
|
+
--catalog-empty-state-header-line-height: var(--line-height-xl);
|
|
345
|
+
--catalog-empty-state-font-size: var(--font-size-base);
|
|
346
|
+
--catalog-empty-state-line-height: var(--line-height-base);
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
--catalog-avatar-bg-color: #ededf2;
|
|
350
|
+
// @tokens End
|
|
351
|
+
`;
|
|
@@ -14,14 +14,22 @@ const filterComponents = {
|
|
|
14
14
|
checkboxes: FilterCheckboxes,
|
|
15
15
|
} as const;
|
|
16
16
|
|
|
17
|
-
export function Filter({
|
|
17
|
+
export function Filter({
|
|
18
|
+
filter,
|
|
19
|
+
filterValuesCasing,
|
|
20
|
+
showCounter = true,
|
|
21
|
+
}: FilterProps): JSX.Element | null {
|
|
18
22
|
if (!filter.parentUsed) return null;
|
|
19
23
|
|
|
20
24
|
const FilterComponent = filterComponents[(filter.type || 'checkboxes') as FilterTypes];
|
|
21
25
|
|
|
22
26
|
return (
|
|
23
27
|
<FilterGroup data-component-name="Filter/Filter" key={filter.property + filter.title}>
|
|
24
|
-
<FilterComponent
|
|
28
|
+
<FilterComponent
|
|
29
|
+
filter={filter}
|
|
30
|
+
filterValuesCasing={filterValuesCasing}
|
|
31
|
+
showCounter={showCounter}
|
|
32
|
+
/>
|
|
25
33
|
</FilterGroup>
|
|
26
34
|
);
|
|
27
35
|
}
|
|
@@ -13,7 +13,11 @@ import { CheckboxIcon } from '@redocly/theme/icons/CheckboxIcon/CheckboxIcon';
|
|
|
13
13
|
import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
|
|
14
14
|
import { changeTextCasing } from '@redocly/theme/core/utils';
|
|
15
15
|
|
|
16
|
-
export function FilterCheckboxes({
|
|
16
|
+
export function FilterCheckboxes({
|
|
17
|
+
filter,
|
|
18
|
+
filterValuesCasing,
|
|
19
|
+
showCounter = true,
|
|
20
|
+
}: FilterProps): JSX.Element {
|
|
17
21
|
const { useTranslate, useTelemetry } = useThemeHooks();
|
|
18
22
|
const { translate } = useTranslate();
|
|
19
23
|
const telemetry = useTelemetry();
|
|
@@ -24,7 +28,7 @@ export function FilterCheckboxes({ filter, filterValuesCasing }: FilterProps): J
|
|
|
24
28
|
{translate(filter.titleTranslationKey, filter.title)}
|
|
25
29
|
</FilterTitle>
|
|
26
30
|
<FilterOptions>
|
|
27
|
-
{filter.
|
|
31
|
+
{filter.options.map(({ value, count }) => {
|
|
28
32
|
const id = 'filter--' + filter.property + '--' + value;
|
|
29
33
|
return (
|
|
30
34
|
<FilterCheckboxOption
|
|
@@ -35,11 +39,11 @@ export function FilterCheckboxes({ filter, filterValuesCasing }: FilterProps): J
|
|
|
35
39
|
telemetry.send({ type: 'filter_checkbox.toggled', payload: { id } });
|
|
36
40
|
}}
|
|
37
41
|
>
|
|
38
|
-
<CheckboxIcon checked={filter.selectedOptions.has(value)} />
|
|
42
|
+
<CheckboxIcon checked={filter.selectedOptions.has(value?.toLowerCase())} />
|
|
39
43
|
<FilterOptionLabel data-translation-key={value}>
|
|
40
44
|
{changeTextCasing(translate(value), filterValuesCasing)}
|
|
41
45
|
</FilterOptionLabel>
|
|
42
|
-
<CounterTag borderless>{count}</CounterTag>
|
|
46
|
+
{showCounter && <CounterTag borderless>{count}</CounterTag>}
|
|
43
47
|
</FilterCheckboxOption>
|
|
44
48
|
);
|
|
45
49
|
})}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { JSX } from 'react';
|
|
5
5
|
import type { ResolvedFilter } from '@redocly/theme/core/types';
|
|
@@ -16,6 +16,8 @@ export type FilterContentProps = {
|
|
|
16
16
|
filters: ResolvedFilter[];
|
|
17
17
|
filterTerm: string;
|
|
18
18
|
filterValuesCasing?: NonNullable<RedoclyConfig['catalog']>[string]['filterValuesCasing'];
|
|
19
|
+
hideSearch?: boolean;
|
|
20
|
+
showCounter?: boolean;
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
export function FilterContent({
|
|
@@ -23,7 +25,9 @@ export function FilterContent({
|
|
|
23
25
|
filters,
|
|
24
26
|
filterTerm,
|
|
25
27
|
filterValuesCasing,
|
|
26
|
-
|
|
28
|
+
hideSearch,
|
|
29
|
+
showCounter = true,
|
|
30
|
+
}: FilterContentProps): JSX.Element | null {
|
|
27
31
|
const { useTranslate } = useThemeHooks();
|
|
28
32
|
const { translate } = useTranslate();
|
|
29
33
|
|
|
@@ -45,6 +49,10 @@ export function FilterContent({
|
|
|
45
49
|
setFilterTerm('');
|
|
46
50
|
};
|
|
47
51
|
|
|
52
|
+
if (!filters.length) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
return (
|
|
49
57
|
<FilterContentWrapper data-component-name="Filter/FilterContent">
|
|
50
58
|
<FiltersHeader>
|
|
@@ -57,13 +65,16 @@ export function FilterContent({
|
|
|
57
65
|
</Button>
|
|
58
66
|
) : null}
|
|
59
67
|
</FiltersHeader>
|
|
60
|
-
|
|
61
|
-
|
|
68
|
+
{!hideSearch && (
|
|
69
|
+
<FilterInput value={filterTerm} onChange={(updatedTerm) => setFilterTerm(updatedTerm)} />
|
|
70
|
+
)}
|
|
71
|
+
<FilterItems hideSearch={hideSearch}>
|
|
62
72
|
{filters.map((filter, idx) => (
|
|
63
73
|
<Filter
|
|
64
74
|
filter={filter}
|
|
65
75
|
key={filter.property + '-' + idx}
|
|
66
76
|
filterValuesCasing={filterValuesCasing}
|
|
77
|
+
showCounter={showCounter}
|
|
67
78
|
/>
|
|
68
79
|
))}
|
|
69
80
|
</FilterItems>
|
|
@@ -91,11 +102,16 @@ const FiltersTitle = styled.div`
|
|
|
91
102
|
line-height: var(--filter-content-title-line-height);
|
|
92
103
|
`;
|
|
93
104
|
|
|
94
|
-
const FilterItems = styled.div
|
|
105
|
+
const FilterItems = styled.div<{ hideSearch?: boolean }>`
|
|
95
106
|
padding: var(--filter-content-items-padding);
|
|
96
107
|
height: 100%;
|
|
97
108
|
display: flex;
|
|
98
109
|
flex-direction: column;
|
|
99
110
|
gap: var(--spacing-base);
|
|
100
111
|
border-top: 1px solid var(--border-color-secondary);
|
|
112
|
+
${({ hideSearch }) =>
|
|
113
|
+
hideSearch &&
|
|
114
|
+
css`
|
|
115
|
+
border-top: none;
|
|
116
|
+
`}
|
|
101
117
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { JSX } from 'react';
|
|
@@ -12,7 +12,19 @@ export type FilterInputProps = {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export function FilterInput(props: FilterInputProps): JSX.Element {
|
|
15
|
-
const { value, onChange } = props;
|
|
15
|
+
const { value: initialValue, onChange } = props;
|
|
16
|
+
|
|
17
|
+
const [value, setValue] = useState(initialValue);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setValue(initialValue);
|
|
21
|
+
}, [initialValue]);
|
|
22
|
+
|
|
23
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
24
|
+
const newValue = e.target.value;
|
|
25
|
+
setValue(newValue);
|
|
26
|
+
onChange(newValue);
|
|
27
|
+
};
|
|
16
28
|
|
|
17
29
|
const { useTranslate } = useThemeHooks();
|
|
18
30
|
const { translate } = useTranslate();
|
|
@@ -22,8 +34,8 @@ export function FilterInput(props: FilterInputProps): JSX.Element {
|
|
|
22
34
|
<InputIcon />
|
|
23
35
|
<Input
|
|
24
36
|
value={value}
|
|
25
|
-
onChange={
|
|
26
|
-
placeholder={translate('catalog.filters.placeholder', '
|
|
37
|
+
onChange={handleChange}
|
|
38
|
+
placeholder={translate('catalog.filters.placeholder', 'Search')}
|
|
27
39
|
/>
|
|
28
40
|
</InputWrapper>
|
|
29
41
|
);
|
|
@@ -12,13 +12,17 @@ import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
|
|
|
12
12
|
import { changeTextCasing } from '@redocly/theme/core/utils';
|
|
13
13
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
14
14
|
|
|
15
|
-
export function FilterSelect({
|
|
15
|
+
export function FilterSelect({
|
|
16
|
+
filter,
|
|
17
|
+
filterValuesCasing,
|
|
18
|
+
showCounter = true,
|
|
19
|
+
}: FilterProps): JSX.Element {
|
|
16
20
|
const { useTranslate } = useThemeHooks();
|
|
17
21
|
const { translate } = useTranslate();
|
|
18
22
|
|
|
19
23
|
let selectOptions: SelectOption<string>[] = [];
|
|
20
24
|
|
|
21
|
-
const defaultOptionCount = filter.
|
|
25
|
+
const defaultOptionCount = filter.options.reduce((acc, option) => acc + option.count, 0);
|
|
22
26
|
|
|
23
27
|
selectOptions = [
|
|
24
28
|
{
|
|
@@ -32,14 +36,14 @@ export function FilterSelect({ filter, filterValuesCasing }: FilterProps): JSX.E
|
|
|
32
36
|
</FilterOption>
|
|
33
37
|
),
|
|
34
38
|
},
|
|
35
|
-
...filter.
|
|
39
|
+
...filter.options.map((option) => ({
|
|
36
40
|
value: option.value,
|
|
37
41
|
element: (
|
|
38
42
|
<FilterOption key={option.value}>
|
|
39
43
|
<FilterOptionLabel data-translation-key={option.value}>
|
|
40
44
|
{changeTextCasing(translate(option.value), filterValuesCasing)}
|
|
41
45
|
</FilterOptionLabel>
|
|
42
|
-
<CounterTag borderless>{option.count}</CounterTag>
|
|
46
|
+
{showCounter && <CounterTag borderless>{option.count}</CounterTag>}
|
|
43
47
|
</FilterOption>
|
|
44
48
|
),
|
|
45
49
|
})),
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
5
|
+
|
|
6
|
+
export function LoadMore({
|
|
7
|
+
icon,
|
|
8
|
+
onClick,
|
|
9
|
+
disabled,
|
|
10
|
+
blinking,
|
|
11
|
+
label,
|
|
12
|
+
}: {
|
|
13
|
+
icon: JSX.Element;
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
blinking: boolean;
|
|
17
|
+
label: string;
|
|
18
|
+
}) {
|
|
19
|
+
return (
|
|
20
|
+
<LoadMoreWrapper data-component-name="LoadMore/LoadMore">
|
|
21
|
+
<Button
|
|
22
|
+
variant="secondary"
|
|
23
|
+
icon={icon}
|
|
24
|
+
iconPosition="left"
|
|
25
|
+
onClick={onClick}
|
|
26
|
+
disabled={disabled}
|
|
27
|
+
blinking={blinking}
|
|
28
|
+
>
|
|
29
|
+
{label}
|
|
30
|
+
</Button>
|
|
31
|
+
</LoadMoreWrapper>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const LoadMoreWrapper = styled.div`
|
|
36
|
+
display: flex;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
`;
|