@redocly/theme 0.59.0-next.0 → 0.59.0-next.10
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/LICENSE +7 -1
- package/lib/components/Accordion/Accordion.d.ts +12 -0
- package/lib/components/Accordion/Accordion.js +85 -0
- package/lib/components/Accordion/AccordionBody.d.ts +8 -0
- package/lib/components/Accordion/AccordionBody.js +73 -0
- package/lib/components/Accordion/AccordionHeader.d.ts +10 -0
- package/lib/components/Accordion/AccordionHeader.js +37 -0
- package/lib/components/Accordion/AccordionTitle.d.ts +6 -0
- package/lib/components/Accordion/AccordionTitle.js +20 -0
- package/lib/components/Accordion/variables.d.ts +1 -0
- package/lib/components/Accordion/variables.js +59 -0
- package/lib/components/Admonition/Admonition.js +17 -7
- package/lib/components/Badge/Badge.js +17 -7
- package/lib/components/Breadcrumbs/Breadcrumb.js +17 -7
- package/lib/components/Breadcrumbs/BreadcrumbDropdown.js +17 -7
- package/lib/components/Button/Button.js +17 -7
- package/lib/components/Buttons/AIAssistantButton.d.ts +2 -0
- package/lib/components/Buttons/AIAssistantButton.js +139 -0
- package/lib/components/Buttons/CopyButton.js +17 -7
- package/lib/components/Buttons/variables.d.ts +1 -0
- package/lib/components/Buttons/variables.dark.d.ts +1 -0
- package/lib/components/Buttons/variables.dark.js +10 -0
- package/lib/components/Buttons/variables.js +51 -0
- package/lib/components/Catalog/Catalog.d.ts +6 -0
- package/lib/components/Catalog/Catalog.js +9 -8
- package/lib/components/Catalog/CatalogEntities.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +17 -7
- package/lib/components/Catalog/CatalogEntityIcon.js +2 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilter.d.ts +6 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilter.js +39 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.d.ts +6 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +152 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.d.ts +13 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +102 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.d.ts +6 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +121 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.d.ts +6 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.js +126 -0
- package/lib/components/Catalog/CatalogSelector.js +0 -1
- package/lib/components/Catalog/CatalogSortButton.js +17 -7
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +17 -7
- package/lib/components/Catalog/CatalogViewModeToggle.js +17 -7
- package/lib/components/Catalog/variables.js +1 -2
- package/lib/components/CatalogClassic/CatalogClassicActions.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicCard.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicHighlight.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.js +17 -7
- package/lib/components/CodeBlock/CodeBlock.js +17 -7
- package/lib/components/CodeBlock/CodeBlockContainer.js +17 -7
- package/lib/components/CodeBlock/CodeBlockTabs.js +17 -7
- package/lib/components/Dropdown/Dropdown.d.ts +16 -2
- package/lib/components/Dropdown/Dropdown.js +22 -12
- package/lib/components/Dropdown/DropdownMenuItem.js +17 -7
- package/lib/components/Feedback/Comment.js +17 -7
- package/lib/components/Feedback/Feedback.js +17 -7
- package/lib/components/Feedback/Mood.js +17 -7
- package/lib/components/Feedback/Rating.js +17 -7
- package/lib/components/Feedback/Reasons.js +17 -7
- package/lib/components/Feedback/Scale.js +17 -7
- package/lib/components/Feedback/Sentiment.js +17 -7
- package/lib/components/Feedback/Stars.js +17 -7
- package/lib/components/Filter/FilterContent.js +17 -7
- package/lib/components/Filter/FilterInput.d.ts +1 -0
- package/lib/components/Filter/FilterInput.js +19 -9
- package/lib/components/Filter/FilterOptions.js +2 -0
- package/lib/components/Filter/variables.js +7 -4
- package/lib/components/Image/Image.js +17 -7
- package/lib/components/JsonViewer/JsonViewer.js +17 -7
- package/lib/components/JsonViewer/helpers.js +17 -7
- package/lib/components/LastUpdated/LastUpdated.js +17 -7
- package/lib/components/Link/Link.js +17 -7
- package/lib/components/Markdown/Markdown.js +17 -7
- package/lib/components/Marker/Marker.js +17 -7
- package/lib/components/Menu/MenuContainer.js +17 -7
- package/lib/components/Menu/MenuItem.js +18 -8
- package/lib/components/Menu/MenuMobile.js +17 -7
- package/lib/components/Navbar/NavbarItem.js +3 -3
- package/lib/components/PageActions/PageActions.js +17 -7
- package/lib/components/PageNavigation/NextButton.js +17 -7
- package/lib/components/Panel/Panel.js +17 -7
- package/lib/components/Panel/PanelBody.js +17 -7
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +17 -7
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +1 -2
- package/lib/components/Search/SearchAiActionButtons.d.ts +10 -0
- package/lib/components/Search/SearchAiActionButtons.js +43 -0
- package/lib/components/Search/SearchAiConversationInput.d.ts +3 -1
- package/lib/components/Search/SearchAiConversationInput.js +56 -14
- package/lib/components/Search/SearchAiDialog.d.ts +3 -6
- package/lib/components/Search/SearchAiDialog.js +39 -19
- package/lib/components/Search/SearchAiMessage.d.ts +9 -5
- package/lib/components/Search/SearchAiMessage.js +146 -22
- package/lib/components/Search/SearchAiNegativeFeedbackForm.d.ts +8 -0
- package/lib/components/Search/SearchAiNegativeFeedbackForm.js +169 -0
- package/lib/components/Search/SearchAiResponse.js +2 -3
- package/lib/components/Search/SearchDialog.d.ts +2 -1
- package/lib/components/Search/SearchDialog.js +55 -14
- package/lib/components/Search/SearchFilter.js +17 -7
- package/lib/components/Search/SearchGroups.js +19 -9
- package/lib/components/Search/SearchHighlight.js +17 -7
- package/lib/components/Search/SearchItem.js +17 -7
- package/lib/components/Search/SearchRecent.js +17 -7
- package/lib/components/Search/SearchShortcut.js +17 -7
- package/lib/components/Search/SearchSuggestedPages.js +17 -7
- package/lib/components/Search/SearchTrigger.js +17 -7
- package/lib/components/Search/variables.js +36 -64
- package/lib/components/Segmented/Segmented.js +17 -7
- package/lib/components/Select/Select.js +17 -7
- package/lib/components/Select/SelectInput.js +18 -8
- package/lib/components/Sidebar/Sidebar.js +17 -7
- package/lib/components/SidebarActions/styled.js +17 -7
- package/lib/components/SkipContent/SkipContent.js +17 -7
- package/lib/components/Switch/Switch.js +17 -7
- package/lib/components/TableOfContent/TableOfContent.js +17 -7
- package/lib/components/Tag/Tag.d.ts +2 -1
- package/lib/components/Tag/Tag.js +67 -18
- package/lib/components/Tag/variables.dark.js +137 -38
- package/lib/components/Tag/variables.js +78 -61
- package/lib/components/Tooltip/Tooltip.js +17 -7
- package/lib/components/VersionPicker/VersionPicker.js +17 -7
- package/lib/core/constants/search.d.ts +5 -4
- package/lib/core/constants/search.js +4 -5
- package/lib/core/contexts/CodeSnippetContext.js +17 -7
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/menu/use-nested-menu.js +1 -1
- package/lib/core/hooks/search/use-feedback-tooltip.d.ts +6 -0
- package/lib/core/hooks/search/use-feedback-tooltip.js +26 -0
- package/lib/core/hooks/use-product-picker.js +2 -1
- package/lib/core/hooks/use-tabs.d.ts +3 -2
- package/lib/core/hooks/use-tabs.js +115 -57
- package/lib/core/hooks/use-telemetry-fallback.d.ts +10 -8
- package/lib/core/hooks/use-telemetry-fallback.js +10 -8
- package/lib/core/styles/dark.js +33 -26
- package/lib/core/styles/global.js +68 -59
- package/lib/core/templates/Markdown.js +17 -7
- package/lib/core/types/hooks.d.ts +6 -3
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +11 -4
- package/lib/core/types/search.js +6 -0
- package/lib/core/utils/download-code-walkthrough.js +17 -7
- package/lib/core/utils/frontmatter-translate.d.ts +6 -0
- package/lib/core/utils/frontmatter-translate.js +14 -0
- package/lib/core/utils/get-file-icon.js +17 -7
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +44 -4
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +11 -2
- package/lib/icons/CubeIcon/CubeIcon.d.ts +9 -0
- package/lib/icons/CubeIcon/CubeIcon.js +17 -0
- package/lib/icons/GenericIcon/GenericIcon.js +17 -7
- package/lib/icons/HashtagIcon/HashtagIcon.d.ts +9 -0
- package/lib/icons/HashtagIcon/HashtagIcon.js +22 -0
- package/lib/icons/RedoclyIcon/RedoclyIcon.d.ts +9 -0
- package/lib/icons/RedoclyIcon/RedoclyIcon.js +24 -0
- package/lib/icons/Spinner/Spinner.js +17 -7
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.js +34 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.js +34 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +20 -7
- package/lib/layouts/OIDCForbidden.js +17 -7
- package/lib/layouts/RootLayout.js +6 -1
- package/lib/layouts/ThreePanelLayout.js +17 -7
- package/lib/markdoc/components/Cards/Card.js +1 -28
- package/lib/markdoc/components/Cards/Cards.js +17 -7
- package/lib/markdoc/components/CodeGroup/CodeGroup.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/Input.js +17 -7
- package/lib/markdoc/components/Heading/Heading.js +17 -7
- package/lib/markdoc/components/HtmlBlock/HtmlBlock.js +17 -7
- package/lib/markdoc/components/InlineSvg/InlineSvg.js +17 -7
- package/lib/markdoc/components/MarkdocExample/MarkdocExample.js +17 -7
- package/lib/markdoc/components/Tabs/TabList.d.ts +3 -1
- package/lib/markdoc/components/Tabs/TabList.js +214 -54
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tabs.js +74 -19
- package/lib/markdoc/default.d.ts +104 -1
- package/lib/markdoc/default.js +17 -7
- package/lib/markdoc/tags/card.js +0 -1
- package/package.json +8 -8
- package/src/components/Accordion/Accordion.tsx +100 -0
- package/src/components/Accordion/AccordionBody.tsx +65 -0
- package/src/components/Accordion/AccordionHeader.tsx +68 -0
- package/src/components/Accordion/AccordionTitle.tsx +26 -0
- package/src/components/Accordion/variables.ts +56 -0
- package/src/components/Buttons/AIAssistantButton.tsx +145 -0
- package/src/components/Buttons/variables.dark.ts +7 -0
- package/src/components/Buttons/variables.ts +48 -0
- package/src/components/Catalog/Catalog.tsx +18 -6
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntityIcon.tsx +2 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilter.tsx +61 -0
- package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +169 -0
- package/src/components/Catalog/CatalogFilter/CatalogFilterContent.tsx +121 -0
- package/src/components/Catalog/CatalogFilter/CatalogFilterDateRange.tsx +147 -0
- package/src/components/Catalog/CatalogFilter/CatalogFilterSelect.tsx +136 -0
- package/src/components/Catalog/CatalogSelector.tsx +0 -1
- package/src/components/Catalog/variables.ts +1 -2
- package/src/components/Dropdown/Dropdown.tsx +84 -79
- package/src/components/Filter/FilterInput.tsx +3 -2
- package/src/components/Filter/FilterOptions.tsx +2 -0
- package/src/components/Filter/variables.ts +7 -4
- package/src/components/Menu/MenuItem.tsx +1 -0
- package/src/components/Navbar/NavbarItem.tsx +6 -5
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +3 -3
- package/src/components/Search/SearchAiActionButtons.tsx +76 -0
- package/src/components/Search/SearchAiConversationInput.tsx +61 -18
- package/src/components/Search/SearchAiDialog.tsx +54 -25
- package/src/components/Search/SearchAiMessage.tsx +172 -43
- package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +210 -0
- package/src/components/Search/SearchAiResponse.tsx +2 -2
- package/src/components/Search/SearchDialog.tsx +56 -15
- package/src/components/Search/SearchGroups.tsx +2 -0
- package/src/components/Search/variables.ts +36 -64
- package/src/components/Select/SelectInput.tsx +1 -0
- package/src/components/Tag/Tag.tsx +36 -20
- package/src/components/Tag/variables.dark.ts +137 -38
- package/src/components/Tag/variables.ts +78 -61
- package/src/core/constants/search.ts +8 -4
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/menu/use-nested-menu.ts +2 -2
- package/src/core/hooks/search/use-feedback-tooltip.ts +32 -0
- package/src/core/hooks/use-product-picker.ts +2 -1
- package/src/core/hooks/use-tabs.ts +168 -86
- package/src/core/hooks/use-telemetry-fallback.ts +10 -8
- package/src/core/styles/dark.ts +15 -8
- package/src/core/styles/global.ts +11 -2
- package/src/core/types/hooks.ts +6 -1
- package/src/core/types/l10n.ts +6 -0
- package/src/core/types/search.ts +13 -4
- package/src/core/utils/frontmatter-translate.ts +9 -0
- package/src/core/utils/index.ts +1 -0
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +13 -4
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +11 -2
- package/src/icons/CubeIcon/CubeIcon.tsx +27 -0
- package/src/icons/HashtagIcon/HashtagIcon.tsx +23 -0
- package/src/icons/RedoclyIcon/RedoclyIcon.tsx +26 -0
- package/src/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.tsx +38 -0
- package/src/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.tsx +35 -0
- package/src/index.ts +3 -0
- package/src/layouts/RootLayout.tsx +6 -0
- package/src/markdoc/components/Cards/Card.tsx +1 -28
- package/src/markdoc/components/Tabs/TabList.tsx +312 -105
- package/src/markdoc/components/Tabs/Tabs.tsx +136 -11
- package/src/markdoc/tags/card.ts +0 -1
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.CopyButton = void 0;
|
|
27
37
|
const react_1 = __importStar(require("react"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const aiAssistantButton: import("styled-components").FlattenSimpleInterpolation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const aiAssistantButtonDarkMode: import("styled-components").FlattenSimpleInterpolation;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.aiAssistantButtonDarkMode = void 0;
|
|
4
|
+
const styled_components_1 = require("styled-components");
|
|
5
|
+
exports.aiAssistantButtonDarkMode = (0, styled_components_1.css) `
|
|
6
|
+
|
|
7
|
+
/* Background color */
|
|
8
|
+
--ai-assistant-button-bg-color: var(--color-warm-grey-4);
|
|
9
|
+
`;
|
|
10
|
+
//# sourceMappingURL=variables.dark.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.aiAssistantButton = void 0;
|
|
4
|
+
const styled_components_1 = require("styled-components");
|
|
5
|
+
exports.aiAssistantButton = (0, styled_components_1.css) `
|
|
6
|
+
/**
|
|
7
|
+
* @tokens AI Assistant Button
|
|
8
|
+
* @presenter Color
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* Button sizing */
|
|
12
|
+
--ai-assistant-button-icon-size: 40px;
|
|
13
|
+
--ai-assistant-button-text-height: 40px;
|
|
14
|
+
--ai-assistant-button-text-padding: var(--spacing-sm) var(--spacing-md);
|
|
15
|
+
--ai-assistant-button-border-radius-icon: 50%;
|
|
16
|
+
--ai-assistant-button-border-radius-text: 1.75rem;
|
|
17
|
+
--ai-assistant-button-min-width: auto;
|
|
18
|
+
|
|
19
|
+
/* Icon sizing */
|
|
20
|
+
--ai-assistant-button-icon-icon-size: 18px;
|
|
21
|
+
--ai-assistant-button-text-icon-size: 20px;
|
|
22
|
+
|
|
23
|
+
/* Positioning */
|
|
24
|
+
--ai-assistant-button-bottom: var(--spacing-xl);
|
|
25
|
+
--ai-assistant-button-right: var(--spacing-xl);
|
|
26
|
+
--ai-assistant-button-z-index: 50
|
|
27
|
+
|
|
28
|
+
/* Typography */
|
|
29
|
+
--ai-assistant-button-font-size: var(--font-size-base);
|
|
30
|
+
--ai-assistant-button-font-weight: var(--font-weight-medium);
|
|
31
|
+
--ai-assistant-button-gap: var(--spacing-xs);
|
|
32
|
+
|
|
33
|
+
/* Background color */
|
|
34
|
+
--ai-assistant-button-bg-color: var(--color-static-white);
|
|
35
|
+
|
|
36
|
+
/* Icon colors */
|
|
37
|
+
--ai-assistant-button-redocly-icon-color: #297AFE;
|
|
38
|
+
|
|
39
|
+
/* Transform */
|
|
40
|
+
--ai-assistant-button-transform-hover: none;
|
|
41
|
+
--ai-assistant-button-transform-active: translateY(0);
|
|
42
|
+
|
|
43
|
+
/* Shadow */
|
|
44
|
+
--ai-assistant-button-shadow-hover:
|
|
45
|
+
2px 1px 12px 4px rgba(143, 98, 254, 0.2),
|
|
46
|
+
-3px -2px 24px 0px rgba(41, 122, 254, 0.2);
|
|
47
|
+
|
|
48
|
+
/* Transition */
|
|
49
|
+
--ai-assistant-button-transition: box-shadow 0.3s ease, transform 0.2s ease;
|
|
50
|
+
`;
|
|
51
|
+
//# sourceMappingURL=variables.js.map
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { CatalogEntityConfig } from '@redocly/config';
|
|
3
3
|
import { BffCatalogEntityList, CatalogSwitcherItem, CatalogViewMode } from '../../core/types';
|
|
4
|
+
type CatalogFiltersWithCounts = Record<string, {
|
|
5
|
+
value: string;
|
|
6
|
+
count: number;
|
|
7
|
+
}[]>;
|
|
4
8
|
export type CatalogProps = {
|
|
5
9
|
catalogConfig: CatalogEntityConfig;
|
|
10
|
+
filters?: CatalogFiltersWithCounts;
|
|
6
11
|
entitiesTypes: string[];
|
|
7
12
|
initialEntitiesList?: BffCatalogEntityList;
|
|
8
13
|
catalogSwitcherItems: CatalogSwitcherItem[];
|
|
9
14
|
initialViewMode?: CatalogViewMode;
|
|
10
15
|
};
|
|
11
16
|
export declare function Catalog(props: CatalogProps): JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -9,7 +9,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
9
9
|
const utils_1 = require("../../core/utils");
|
|
10
10
|
const hooks_1 = require("../../core/hooks");
|
|
11
11
|
const H3_1 = require("../../components/Typography/H3");
|
|
12
|
-
const
|
|
12
|
+
const CatalogFilterContent_1 = require("../../components/Catalog/CatalogFilter/CatalogFilterContent");
|
|
13
13
|
const Sidebar_1 = require("../../components/Sidebar/Sidebar");
|
|
14
14
|
const CatalogSelector_1 = require("../../components/Catalog/CatalogSelector");
|
|
15
15
|
const SidebarActions_1 = require("../../components/SidebarActions/SidebarActions");
|
|
@@ -19,9 +19,10 @@ const CatalogViewModeToggle_1 = require("../../components/Catalog/CatalogViewMod
|
|
|
19
19
|
const CatalogSortButton_1 = require("../../components/Catalog/CatalogSortButton");
|
|
20
20
|
const CatalogEntities_1 = require("../../components/Catalog/CatalogEntities");
|
|
21
21
|
const customCatalogOptionsCasing = (str) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const trimmedStr = str.trim();
|
|
23
|
+
if (!trimmedStr)
|
|
24
|
+
return trimmedStr;
|
|
25
|
+
const words = trimmedStr.split(/[\s-_]+/);
|
|
25
26
|
return words
|
|
26
27
|
.map((word, index) => {
|
|
27
28
|
if (index === 0 && word.toLowerCase() === 'api') {
|
|
@@ -32,13 +33,13 @@ const customCatalogOptionsCasing = (str) => {
|
|
|
32
33
|
.join(' ');
|
|
33
34
|
};
|
|
34
35
|
function Catalog(props) {
|
|
35
|
-
const { catalogConfig, entitiesTypes, initialEntitiesList, catalogSwitcherItems, initialViewMode, } = props;
|
|
36
|
+
const { catalogConfig, filters: serverFilters, entitiesTypes, initialEntitiesList, catalogSwitcherItems, initialViewMode, } = props;
|
|
36
37
|
const { useTranslate, useCatalog } = (0, hooks_1.useThemeHooks)();
|
|
37
38
|
const { translate } = useTranslate();
|
|
38
|
-
const { filters, searchQuery, setSearchQuery, filterQuery, sortOption, setSortOption, handleSortClick, isColumnSorted, viewMode, setViewMode, entitiesCounter, setEntitiesCounter, onChangeViewClick, onChangeCollapseSidebarClick, layout, collapsedSidebar, } = useCatalog(catalogConfig, (initialEntitiesList === null || initialEntitiesList === void 0 ? void 0 : initialEntitiesList.page.total) || 0, initialViewMode);
|
|
39
|
+
const { filters, searchQuery, setSearchQuery, filterQuery, sortOption, setSortOption, handleSortClick, isColumnSorted, viewMode, setViewMode, entitiesCounter, setEntitiesCounter, onChangeViewClick, onChangeCollapseSidebarClick, layout, collapsedSidebar, } = useCatalog(catalogConfig, serverFilters, (initialEntitiesList === null || initialEntitiesList === void 0 ? void 0 : initialEntitiesList.page.total) || 0, initialViewMode);
|
|
39
40
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
40
41
|
react_1.default.createElement(CatalogPageWrapper, { "data-component-name": "Catalog/Catalog" },
|
|
41
|
-
react_1.default.createElement(FiltersSidebar, { collapsed: collapsedSidebar, header: collapsedSidebar ? null : (react_1.default.createElement(CatalogSelector_1.CatalogSelector, { catalogSwitcherItems: catalogSwitcherItems, setSearchQuery: setSearchQuery, setSortOption: setSortOption })), menu: react_1.default.createElement(
|
|
42
|
+
react_1.default.createElement(FiltersSidebar, { collapsed: collapsedSidebar, header: collapsedSidebar ? null : (react_1.default.createElement(CatalogSelector_1.CatalogSelector, { catalogSwitcherItems: catalogSwitcherItems, setSearchQuery: setSearchQuery, setSortOption: setSortOption })), menu: react_1.default.createElement(CatalogFilterContent_1.CatalogFilterContent, { setFilterTerm: setSearchQuery, filters: filters, filterTerm: searchQuery, hideSearch: true, showCounter: true, filterValuesCasing: customCatalogOptionsCasing }), footer: react_1.default.createElement(SidebarActions_1.SidebarActions, { layout: layout, collapsedSidebar: collapsedSidebar, isApiDocs: false, onChangeViewClick: onChangeViewClick, onChangeCollapseSidebarClick: onChangeCollapseSidebarClick }) }),
|
|
42
43
|
react_1.default.createElement(CatalogPageContent, null,
|
|
43
44
|
react_1.default.createElement(CatalogPageDescription, null,
|
|
44
45
|
react_1.default.createElement(CatalogTitleWrapper, null,
|
|
@@ -51,7 +52,7 @@ function Catalog(props) {
|
|
|
51
52
|
react_1.default.createElement(CatalogDescription, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey }, translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey))),
|
|
52
53
|
react_1.default.createElement(CatalogActionsRow, null,
|
|
53
54
|
react_1.default.createElement(CatalogSearchInputWrapper, null,
|
|
54
|
-
react_1.default.createElement(FilterInput_1.FilterInput, { value: searchQuery, onChange: (updatedTerm) => setSearchQuery(updatedTerm) })),
|
|
55
|
+
react_1.default.createElement(FilterInput_1.FilterInput, { value: searchQuery, onChange: (updatedTerm) => setSearchQuery(updatedTerm), dataTestId: "catalog-search-input" })),
|
|
55
56
|
react_1.default.createElement(CatalogControlsWrapper, null,
|
|
56
57
|
react_1.default.createElement(CatalogSortButton_1.CatalogSortButton, { onSortChange: setSortOption, currentSort: sortOption }),
|
|
57
58
|
react_1.default.createElement(CatalogViewModeToggle_1.CatalogViewModeToggle, { viewMode: viewMode, onViewModeChange: setViewMode }))),
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.CatalogEntities = CatalogEntities;
|
|
27
37
|
const react_1 = __importStar(require("react"));
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.CatalogEntityRelationsGraph = void 0;
|
|
27
37
|
const utils_1 = require("../../../../core/utils");
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
36
|
var t = {};
|
|
27
37
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -13,7 +13,7 @@ const MoleculesIcon_1 = require("../../../../icons/MoleculesIcon/MoleculesIcon")
|
|
|
13
13
|
const NetworkIcon_1 = require("../../../../icons/NetworkIcon/NetworkIcon");
|
|
14
14
|
function CatalogEntityApiDescriptionRelations({ entity, relations, query, searchQuery, setSearchQuery, setFilter, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, }) {
|
|
15
15
|
return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations" },
|
|
16
|
-
react_1.default.createElement(Tabs_1.Tabs, { key: entity.id, size: Tabs_1.TabsSize.MEDIUM },
|
|
16
|
+
react_1.default.createElement(Tabs_1.Tabs, { key: entity.id, forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
|
|
17
17
|
react_1.default.createElement(TabItem, { label: "Operations", icon: react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, null), onClick: () => setFilter('type:api-operation') },
|
|
18
18
|
react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key: "operations-table", entity: entity, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, shouldShowHeading: false, listType: "api-operation" })),
|
|
19
19
|
react_1.default.createElement(TabItem, { label: "Schemas", icon: react_1.default.createElement(NetworkIcon_1.NetworkIcon, null), onClick: () => setFilter('type:data-schema') },
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.CatalogEntityRelations = CatalogEntityRelations;
|
|
27
37
|
const react_1 = __importStar(require("react"));
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js
CHANGED
|
@@ -40,7 +40,7 @@ const teamColumns = [
|
|
|
40
40
|
];
|
|
41
41
|
function CatalogEntityTeamRelations({ entity, relations, query, searchQuery, setSearchQuery, setFilter, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, }) {
|
|
42
42
|
return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations" },
|
|
43
|
-
react_1.default.createElement(Tabs_1.Tabs, { size: Tabs_1.TabsSize.MEDIUM },
|
|
43
|
+
react_1.default.createElement(Tabs_1.Tabs, { forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
|
|
44
44
|
react_1.default.createElement(TabItem, { label: "Members", icon: react_1.default.createElement(PeopleIcon_1.PeopleIcon, null), onClick: () => setFilter('type:user') },
|
|
45
45
|
react_1.default.createElement(CatalogEntityRelationsTable_1.CatalogEntityRelationsTable, { key: "members-table", entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, columns: teamColumns, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, listType: "team" })),
|
|
46
46
|
react_1.default.createElement(TabItem, { label: "Related entities", icon: react_1.default.createElement(EntityTypeIcon_1.EntityTypeIcon, null), onClick: () => setFilter('-type:user') },
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -14,6 +14,7 @@ const HierarchyIcon_1 = require("../../icons/HierarchyIcon/HierarchyIcon");
|
|
|
14
14
|
const Image_1 = require("../../components/Image/Image");
|
|
15
15
|
const core_1 = require("../../core");
|
|
16
16
|
const NoteIcon_1 = require("../../icons/NoteIcon/NoteIcon");
|
|
17
|
+
const CubeIcon_1 = require("../../icons/CubeIcon/CubeIcon");
|
|
17
18
|
const getIconColor = (entityType) => `var(--catalog-entity-icon-color-${entityType})`;
|
|
18
19
|
const getEntityIcon = ({ entityType, defaultColor, forceColor, entitiesCatalogConfig, }) => {
|
|
19
20
|
var _a, _b;
|
|
@@ -34,7 +35,7 @@ const getEntityIcon = ({ entityType, defaultColor, forceColor, entitiesCatalogCo
|
|
|
34
35
|
if ((iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.src) || (iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.srcSet)) {
|
|
35
36
|
return (react_1.default.createElement(Image_1.Image, { src: iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.src, srcSet: iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.srcSet, alt: `${entityType} icon`, width: "16", height: "16" }));
|
|
36
37
|
}
|
|
37
|
-
return react_1.default.createElement(
|
|
38
|
+
return react_1.default.createElement(CubeIcon_1.CubeIcon, { color: "var(--catalog-entity-icon-color)" });
|
|
38
39
|
};
|
|
39
40
|
function CatalogEntityIcon({ entityType, defaultColor = false, forceColor, }) {
|
|
40
41
|
const themeConfig = (0, core_1.useThemeConfig)();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { FilterProps } from '../../../core/types';
|
|
3
|
+
export type CatalogFilterProps = FilterProps & {
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function CatalogFilter({ filter, filterValuesCasing, showCounter, className, }: CatalogFilterProps): JSX.Element | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
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.CatalogFilter = CatalogFilter;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const CatalogFilterSelect_1 = require("../../../components/Catalog/CatalogFilter/CatalogFilterSelect");
|
|
10
|
+
const CatalogFilterCheckboxes_1 = require("../../../components/Catalog/CatalogFilter/CatalogFilterCheckboxes");
|
|
11
|
+
const CatalogFilterDateRange_1 = require("../../../components/Catalog/CatalogFilter/CatalogFilterDateRange");
|
|
12
|
+
const filterComponents = {
|
|
13
|
+
select: CatalogFilterSelect_1.CatalogFilterSelect,
|
|
14
|
+
'date-range': CatalogFilterDateRange_1.CatalogFilterDateRange,
|
|
15
|
+
checkboxes: CatalogFilterCheckboxes_1.CatalogFilterCheckboxes,
|
|
16
|
+
};
|
|
17
|
+
function CatalogFilter({ filter, filterValuesCasing, showCounter = true, className, }) {
|
|
18
|
+
if (!filter.parentUsed)
|
|
19
|
+
return null;
|
|
20
|
+
const filteredOptions = filter.filteredOptions || filter.options;
|
|
21
|
+
if (!filteredOptions || filteredOptions.length === 0) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const FilterComponent = filterComponents[(filter.type || 'checkboxes')];
|
|
25
|
+
return (react_1.default.createElement(CatalogFilterGroup, { className: className, "data-component-name": "Catalog/CatalogFilter", key: filter.property + filter.title },
|
|
26
|
+
react_1.default.createElement(FilterComponent, { filter: filter, filterValuesCasing: filterValuesCasing, showCounter: showCounter })));
|
|
27
|
+
}
|
|
28
|
+
const CatalogFilterGroup = styled_components_1.default.div `
|
|
29
|
+
padding: var(--filter-group-padding);
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
gap: var(--filter-group-gap);
|
|
33
|
+
border-bottom: 1px solid var(--catalog-table-border-color);
|
|
34
|
+
|
|
35
|
+
&:first-child {
|
|
36
|
+
border-top: 1px solid var(--catalog-table-border-color);
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
//# sourceMappingURL=CatalogFilter.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { FilterProps } from '../../../core/types';
|
|
3
|
+
export type CatalogFilterCheckboxesProps = FilterProps & {
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function CatalogFilterCheckboxes({ filter, filterValuesCasing, showCounter, className, }: CatalogFilterCheckboxesProps): JSX.Element;
|
|
@@ -0,0 +1,152 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.CatalogFilterCheckboxes = CatalogFilterCheckboxes;
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
|
+
const highlight_words_core_1 = require("highlight-words-core");
|
|
43
|
+
const FilterOptions_1 = require("../../../components/Filter/FilterOptions");
|
|
44
|
+
const FilterOption_1 = require("../../../components/Filter/FilterOption");
|
|
45
|
+
const FilterOptionLabel_1 = require("../../../components/Filter/FilterOptionLabel");
|
|
46
|
+
const FilterInput_1 = require("../../../components/Filter/FilterInput");
|
|
47
|
+
const hooks_1 = require("../../../core/hooks");
|
|
48
|
+
const CheckboxIcon_1 = require("../../../icons/CheckboxIcon/CheckboxIcon");
|
|
49
|
+
const CounterTag_1 = require("../../../components/Tags/CounterTag");
|
|
50
|
+
const utils_1 = require("../../../core/utils");
|
|
51
|
+
const Accordion_1 = require("../../../components/Accordion/Accordion");
|
|
52
|
+
function CatalogFilterCheckboxes({ filter, filterValuesCasing, showCounter = true, className, }) {
|
|
53
|
+
const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
54
|
+
const { translate } = useTranslate();
|
|
55
|
+
const telemetry = useTelemetry();
|
|
56
|
+
const [searchTerm, setSearchTerm] = (0, react_1.useState)('');
|
|
57
|
+
const [isExpanded, setIsExpanded] = (0, react_1.useState)(false);
|
|
58
|
+
const filteredOptions = (0, react_1.useMemo)(() => {
|
|
59
|
+
const options = filter.filteredOptions || filter.options;
|
|
60
|
+
if (!searchTerm.trim())
|
|
61
|
+
return options;
|
|
62
|
+
const lowerSearchTerm = searchTerm.toLowerCase();
|
|
63
|
+
return options.filter(({ value }) => {
|
|
64
|
+
const translatedValue = (0, utils_1.changeTextCasing)(translate(value), filterValuesCasing);
|
|
65
|
+
if (!translatedValue)
|
|
66
|
+
return false;
|
|
67
|
+
return translatedValue.toLowerCase().includes(lowerSearchTerm);
|
|
68
|
+
});
|
|
69
|
+
}, [searchTerm, filter.filteredOptions, filter.options, translate, filterValuesCasing]);
|
|
70
|
+
const selectedCount = (0, react_1.useMemo)(() => {
|
|
71
|
+
if (filter.selectedOptions instanceof Set) {
|
|
72
|
+
return filter.selectedOptions.size;
|
|
73
|
+
}
|
|
74
|
+
return 0;
|
|
75
|
+
}, [filter.selectedOptions]);
|
|
76
|
+
const highlightText = (text) => {
|
|
77
|
+
if (!searchTerm.trim()) {
|
|
78
|
+
return react_1.default.createElement(react_1.default.Fragment, null, text);
|
|
79
|
+
}
|
|
80
|
+
const chunks = (0, highlight_words_core_1.findAll)({
|
|
81
|
+
searchWords: [searchTerm],
|
|
82
|
+
textToHighlight: text,
|
|
83
|
+
});
|
|
84
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, chunks.map((chunk, idx) => {
|
|
85
|
+
const { end, highlight, start } = chunk;
|
|
86
|
+
const chunkText = text.substr(start, end - start);
|
|
87
|
+
if (highlight) {
|
|
88
|
+
return react_1.default.createElement(HighlightedText, { key: idx }, chunkText);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return react_1.default.createElement("span", { key: idx }, chunkText);
|
|
92
|
+
}
|
|
93
|
+
})));
|
|
94
|
+
};
|
|
95
|
+
const headerContent = (react_1.default.createElement(AccordionHeaderContent, null,
|
|
96
|
+
react_1.default.createElement("span", null, translate(filter.titleTranslationKey, filter.title)),
|
|
97
|
+
selectedCount > 0 && react_1.default.createElement(CounterTag_1.CounterTag, { borderless: true }, selectedCount)));
|
|
98
|
+
return (react_1.default.createElement(AccordionWrapper, { className: className, "$hasSelection": selectedCount > 0 && !isExpanded, "data-component-name": "Catalog/CatalogFilterCheckboxes" },
|
|
99
|
+
react_1.default.createElement(Accordion_1.Accordion, { expanded: isExpanded, header: headerContent, onToggle: setIsExpanded },
|
|
100
|
+
react_1.default.createElement(FilterSearchWrapper, null,
|
|
101
|
+
react_1.default.createElement(FilterInput_1.FilterInput, { value: searchTerm, onChange: setSearchTerm })),
|
|
102
|
+
react_1.default.createElement(FilterOptions_1.FilterOptions, null, filteredOptions.map(({ value, count }) => {
|
|
103
|
+
const id = 'filter--' + filter.property + '--' + value;
|
|
104
|
+
return (react_1.default.createElement(FilterCheckboxOption, { key: id, role: "link", onClick: () => {
|
|
105
|
+
filter.toggleOption(value);
|
|
106
|
+
telemetry.sendFilterCheckboxToggledMessage({ id });
|
|
107
|
+
} },
|
|
108
|
+
react_1.default.createElement(CheckboxIcon_1.CheckboxIcon, { checked: filter.selectedOptions instanceof Set
|
|
109
|
+
? filter.selectedOptions.has(value) ||
|
|
110
|
+
filter.selectedOptions.has(value === null || value === void 0 ? void 0 : value.toLowerCase())
|
|
111
|
+
: false }),
|
|
112
|
+
react_1.default.createElement(FilterOptionLabel_1.FilterOptionLabel, { "data-translation-key": value }, highlightText((0, utils_1.changeTextCasing)(translate(value), filterValuesCasing) || '')),
|
|
113
|
+
showCounter && react_1.default.createElement(CounterTag_1.CounterTag, { borderless: true }, count)));
|
|
114
|
+
})))));
|
|
115
|
+
}
|
|
116
|
+
const AccordionWrapper = styled_components_1.default.div `
|
|
117
|
+
position: relative;
|
|
118
|
+
border-right: 4px solid transparent;
|
|
119
|
+
|
|
120
|
+
${({ $hasSelection }) => $hasSelection &&
|
|
121
|
+
`
|
|
122
|
+
border-right-color: var(--color-blueberry-6);
|
|
123
|
+
|
|
124
|
+
&::after {
|
|
125
|
+
content: '';
|
|
126
|
+
position: absolute;
|
|
127
|
+
bottom: -1px;
|
|
128
|
+
right: -4px;
|
|
129
|
+
width: 4px;
|
|
130
|
+
height: 1px;
|
|
131
|
+
background-color: var(--color-blueberry-6);
|
|
132
|
+
z-index: 1;
|
|
133
|
+
}
|
|
134
|
+
`}
|
|
135
|
+
`;
|
|
136
|
+
const AccordionHeaderContent = styled_components_1.default.div `
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
gap: var(--spacing-xs);
|
|
140
|
+
width: 100%;
|
|
141
|
+
`;
|
|
142
|
+
const HighlightedText = styled_components_1.default.span `
|
|
143
|
+
background-color: var(--catalog-highlight-bg-color);
|
|
144
|
+
color: var(--catalog-highlight-text-color);
|
|
145
|
+
`;
|
|
146
|
+
const FilterCheckboxOption = (0, styled_components_1.default)(FilterOption_1.FilterOption) `
|
|
147
|
+
padding-left: var(--filter-option-checkbox-padding-left);
|
|
148
|
+
`;
|
|
149
|
+
const FilterSearchWrapper = styled_components_1.default.div `
|
|
150
|
+
padding: var(--filter-content-search-padding);
|
|
151
|
+
`;
|
|
152
|
+
//# sourceMappingURL=CatalogFilterCheckboxes.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { ResolvedFilter } from '../../../core/types';
|
|
3
|
+
import type { RedoclyConfig } from '../../../config';
|
|
4
|
+
export type CatalogFilterContentProps = {
|
|
5
|
+
setFilterTerm: (value: string) => void;
|
|
6
|
+
filters: ResolvedFilter[];
|
|
7
|
+
filterTerm: string;
|
|
8
|
+
filterValuesCasing?: NonNullable<RedoclyConfig['catalog']>[string]['filterValuesCasing'] | ((str: string) => string);
|
|
9
|
+
hideSearch?: boolean;
|
|
10
|
+
showCounter?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function CatalogFilterContent({ setFilterTerm, filters, filterTerm, filterValuesCasing, hideSearch, showCounter, className, }: CatalogFilterContentProps): JSX.Element | null;
|