@redocly/theme 0.56.0-rc.2 → 0.56.0
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.js +1 -1
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.js +3 -1
- package/lib/components/Button/ButtonGroup.d.ts +12 -0
- package/lib/components/Button/ButtonGroup.js +38 -0
- package/lib/components/Button/variables.js +32 -5
- package/lib/components/Catalog/Catalog.d.ts +1 -1
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +11 -6
- package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +5 -1
- package/lib/components/Catalog/CatalogEntitiesEmptyState.js +25 -4
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +1 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +17 -13
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.d.ts +4 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +15 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +6 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +18 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +47 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.js +8 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +7 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +12 -5
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +7 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.js +19 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +4 -10
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +3 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +2 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +3 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +5 -5
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +55 -0
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityIcon.js +22 -29
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +11 -23
- package/lib/components/Catalog/CatalogEntityTypeTag.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntityTypeTag.js +40 -0
- package/lib/components/Catalog/CatalogPageDescription.js +3 -3
- package/lib/components/Catalog/CatalogSelector.d.ts +1 -1
- package/lib/components/Catalog/CatalogSelector.js +4 -3
- package/lib/components/Catalog/CatalogSortButton.js +6 -6
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +1 -0
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +3 -15
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +1 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +1 -1
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +1 -5
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +3 -3
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +5 -32
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +0 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +12 -37
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +1 -0
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +8 -4
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +1 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +4 -4
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
- package/lib/components/Catalog/variables.js +42 -8
- package/lib/components/CodeBlock/CodeBlock.d.ts +16 -6
- package/lib/components/CodeBlock/CodeBlock.js +3 -2
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +4 -3
- package/lib/components/CodeBlock/CodeBlockControls.js +35 -8
- package/lib/components/CodeBlock/CodeBlockDropdown.d.ts +3 -0
- package/lib/components/CodeBlock/CodeBlockDropdown.js +35 -0
- package/lib/components/CodeBlock/CodeBlockTabs.d.ts +2 -2
- package/lib/components/CodeBlock/CodeBlockTabs.js +18 -9
- package/lib/components/CodeBlock/variables.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +1 -0
- package/lib/components/Dropdown/DropdownMenu.js +4 -0
- package/lib/components/Dropdown/variables.js +1 -0
- package/lib/components/Feedback/Feedback.js +1 -1
- package/lib/components/Filter/FilterCheckboxes.js +5 -2
- package/lib/components/Footer/FooterItem.js +4 -7
- package/lib/components/Footer/variables.js +2 -2
- package/lib/components/Image/Image.js +2 -0
- package/lib/components/Markdown/Markdown.js +9 -9
- package/lib/components/Markdown/styles/headingAnchor.js +0 -1
- package/lib/components/Menu/MenuItem.js +5 -5
- package/lib/components/Menu/variables.js +3 -1
- package/lib/components/Navbar/NavbarItem.js +8 -39
- package/lib/components/Navbar/variables.js +2 -2
- package/lib/components/PageActions/PageActions.d.ts +6 -0
- package/lib/components/PageActions/PageActions.js +104 -0
- package/lib/components/PageActions/PageActionsMenuItem.d.ts +7 -0
- package/lib/components/PageActions/PageActionsMenuItem.js +58 -0
- package/lib/components/PageActions/variables.d.ts +1 -0
- package/lib/components/PageActions/variables.dark.d.ts +1 -0
- package/lib/components/PageActions/variables.dark.js +9 -0
- package/lib/components/PageActions/variables.js +37 -0
- package/lib/components/Search/SearchDialog.js +2 -2
- package/lib/components/Select/variables.js +2 -2
- package/lib/components/TableOfContent/TableOfContent.js +15 -12
- package/lib/components/Tag/Tag.d.ts +2 -1
- package/lib/components/Tag/Tag.js +3 -3
- package/lib/components/Tag/variables.js +14 -0
- package/lib/core/constants/catalog.d.ts +1 -1
- package/lib/core/constants/common.d.ts +4 -0
- package/lib/core/constants/common.js +5 -1
- package/lib/core/contexts/CodeSnippetContext.d.ts +7 -0
- package/lib/core/contexts/CodeSnippetContext.js +23 -0
- package/lib/core/contexts/index.d.ts +1 -0
- package/lib/core/contexts/index.js +1 -0
- 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/code-walkthrough/use-renderable-files.d.ts +1 -2
- package/lib/core/hooks/code-walkthrough/use-renderable-files.js +2 -2
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/use-active-heading.d.ts +7 -2
- package/lib/core/hooks/use-active-heading.js +160 -23
- package/lib/core/hooks/use-active-section-id.d.ts +1 -1
- package/lib/core/hooks/use-active-section-id.js +2 -2
- package/lib/core/hooks/use-codeblock-tabs-controls.d.ts +2 -2
- package/lib/core/hooks/use-codeblock-tabs-controls.js +6 -6
- package/lib/core/hooks/use-local-state.d.ts +1 -0
- package/lib/core/hooks/use-local-state.js +32 -0
- package/lib/core/hooks/use-page-actions.d.ts +2 -0
- package/lib/core/hooks/use-page-actions.js +101 -0
- package/lib/core/hooks/use-theme-hooks.js +2 -0
- package/lib/core/styles/dark.js +2 -0
- package/lib/core/styles/global.js +2 -0
- package/lib/core/types/catalog.d.ts +5 -1
- package/lib/core/types/hooks.d.ts +2 -1
- 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/page-actions.d.ts +15 -0
- package/lib/core/types/page-actions.js +3 -0
- package/lib/core/types/sidebar.d.ts +1 -0
- package/lib/core/types/telemetry.d.ts +5 -20
- package/lib/core/utils/download-code-walkthrough.js +27 -7
- package/lib/core/utils/enhanced-smoothstep.d.ts +5 -0
- package/lib/core/utils/enhanced-smoothstep.js +15 -0
- package/lib/core/utils/get-file-icon.d.ts +3 -2
- package/lib/core/utils/get-file-icon.js +109 -29
- package/lib/core/utils/icon-resolver.d.ts +28 -0
- package/lib/core/utils/icon-resolver.js +52 -0
- package/lib/core/utils/index.d.ts +4 -1
- package/lib/core/utils/index.js +4 -1
- package/lib/core/utils/lang-to-name.d.ts +1 -0
- package/lib/core/utils/lang-to-name.js +37 -0
- package/lib/core/utils/{text-transform.js → string.js} +1 -1
- package/lib/ext/configure.d.ts +1 -1
- package/lib/icons/CDNIcon/CDNIcon.d.ts +14 -0
- package/lib/icons/CDNIcon/CDNIcon.js +48 -0
- package/lib/icons/ChatGptIcon/ChatGptIcon.d.ts +9 -0
- package/lib/icons/ChatGptIcon/ChatGptIcon.js +22 -0
- package/lib/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon.d.ts +9 -0
- package/lib/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon.js +23 -0
- package/lib/icons/ClaudeIcon/ClaudeIcon.d.ts +9 -0
- package/lib/icons/ClaudeIcon/ClaudeIcon.js +22 -0
- package/lib/icons/GenericIcon/GenericIcon.d.ts +11 -0
- package/lib/icons/GenericIcon/GenericIcon.js +61 -0
- package/lib/icons/GraphqlIcon/GraphqlIcon.d.ts +9 -0
- package/lib/icons/GraphqlIcon/GraphqlIcon.js +36 -0
- package/lib/icons/GraphqlIcon/index.d.ts +1 -0
- package/lib/icons/GraphqlIcon/index.js +6 -0
- package/lib/icons/HexagonIcon/HexagonIcon.d.ts +9 -0
- package/lib/icons/HexagonIcon/HexagonIcon.js +22 -0
- package/lib/icons/MarkdownFullIcon/MarkdownFullIcon.d.ts +9 -0
- package/lib/icons/MarkdownFullIcon/MarkdownFullIcon.js +23 -0
- package/lib/icons/MoleculesIcon/MoleculesIcon.d.ts +9 -0
- package/lib/icons/MoleculesIcon/MoleculesIcon.js +22 -0
- package/lib/icons/NetworkIcon/NetworkIcon.d.ts +9 -0
- package/lib/icons/NetworkIcon/NetworkIcon.js +23 -0
- package/lib/icons/NoneIcon/NoneIcon.d.ts +9 -0
- package/lib/icons/NoneIcon/NoneIcon.js +17 -0
- package/lib/icons/NotesIcon/NotesIcon.d.ts +9 -0
- package/lib/icons/NotesIcon/NotesIcon.js +26 -0
- package/lib/icons/types.d.ts +6 -0
- package/lib/index.d.ts +7 -1
- package/lib/index.js +7 -1
- package/lib/layouts/CodeWalkthroughLayout.js +2 -2
- package/lib/layouts/DocumentationLayout.js +14 -10
- package/lib/markdoc/components/Cards/CardIcon.js +7 -19
- package/lib/markdoc/components/CodeGroup/CodeGroup.d.ts +4 -0
- package/lib/markdoc/components/CodeGroup/CodeGroup.js +72 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +7 -4
- package/lib/markdoc/components/Heading/Heading.d.ts +2 -1
- package/lib/markdoc/components/Heading/Heading.js +21 -3
- package/lib/markdoc/components/Icon/Icon.d.ts +3 -0
- package/lib/markdoc/components/Icon/Icon.js +29 -0
- package/lib/markdoc/components/Tabs/Tab.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tab.js +5 -2
- package/lib/markdoc/components/Tabs/Tabs.d.ts +1 -1
- package/lib/markdoc/components/Tabs/variables.js +2 -0
- package/lib/markdoc/components/default.d.ts +2 -0
- package/lib/markdoc/components/default.js +2 -0
- package/lib/markdoc/default.js +4 -0
- package/lib/markdoc/tags/card.js +1 -1
- package/lib/markdoc/tags/code-group.d.ts +2 -0
- package/lib/markdoc/tags/code-group.js +23 -0
- package/lib/markdoc/tags/code-snippet.js +1 -1
- package/lib/markdoc/tags/icon.d.ts +2 -0
- package/lib/markdoc/tags/icon.js +16 -0
- package/lib/markdoc/tags/tab.js +1 -0
- package/package.json +4 -4
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Button/Button.tsx +4 -2
- package/src/components/Button/ButtonGroup.tsx +53 -0
- package/src/components/Button/variables.ts +32 -5
- package/src/components/Catalog/Catalog.tsx +1 -1
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +12 -6
- package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +38 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +25 -17
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +25 -9
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +12 -15
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +39 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +61 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +12 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +7 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +15 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +2 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +11 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +37 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +2 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +7 -23
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +5 -6
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +21 -13
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +9 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +52 -0
- package/src/components/Catalog/CatalogEntityIcon.tsx +33 -33
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +23 -28
- package/src/components/Catalog/CatalogEntityTypeTag.tsx +49 -0
- package/src/components/Catalog/CatalogPageDescription.tsx +5 -4
- package/src/components/Catalog/CatalogSelector.tsx +3 -1
- package/src/components/Catalog/CatalogSortButton.tsx +19 -20
- package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +1 -0
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +3 -17
- package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +1 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +5 -8
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +6 -36
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +18 -46
- package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +1 -0
- package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +9 -4
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +9 -5
- package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
- package/src/components/Catalog/variables.ts +42 -8
- package/src/components/CodeBlock/CodeBlock.tsx +15 -5
- package/src/components/CodeBlock/CodeBlockControls.tsx +67 -26
- package/src/components/CodeBlock/CodeBlockDropdown.tsx +53 -0
- package/src/components/CodeBlock/CodeBlockTabs.tsx +29 -20
- package/src/components/CodeBlock/variables.ts +1 -1
- package/src/components/Dropdown/Dropdown.tsx +1 -0
- package/src/components/Dropdown/DropdownMenu.tsx +4 -0
- package/src/components/Dropdown/variables.ts +1 -0
- package/src/components/Feedback/Feedback.tsx +1 -1
- package/src/components/Filter/FilterCheckboxes.tsx +9 -2
- package/src/components/Footer/FooterItem.tsx +5 -12
- package/src/components/Footer/variables.ts +2 -2
- package/src/components/Image/Image.tsx +2 -0
- package/src/components/Markdown/Markdown.tsx +3 -3
- package/src/components/Markdown/styles/headingAnchor.ts +0 -1
- package/src/components/Menu/MenuItem.tsx +5 -5
- package/src/components/Menu/variables.ts +3 -1
- package/src/components/Navbar/NavbarItem.tsx +8 -17
- package/src/components/Navbar/variables.ts +2 -2
- package/src/components/PageActions/PageActions.tsx +110 -0
- package/src/components/PageActions/PageActionsMenuItem.tsx +73 -0
- package/src/components/PageActions/variables.dark.ts +6 -0
- package/src/components/PageActions/variables.ts +34 -0
- package/src/components/Search/SearchDialog.tsx +2 -2
- package/src/components/Select/variables.ts +2 -2
- package/src/components/TableOfContent/TableOfContent.tsx +33 -36
- package/src/components/Tag/Tag.tsx +11 -2
- package/src/components/Tag/variables.ts +14 -0
- package/src/core/constants/catalog.ts +1 -1
- package/src/core/constants/common.ts +4 -0
- package/src/core/contexts/CodeSnippetContext.tsx +31 -0
- package/src/core/contexts/index.ts +1 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/code-walkthrough/use-renderable-files.ts +3 -4
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/use-active-heading.ts +199 -28
- package/src/core/hooks/use-active-section-id.ts +2 -1
- package/src/core/hooks/use-codeblock-tabs-controls.ts +8 -8
- package/src/core/hooks/use-local-state.ts +30 -0
- package/src/core/hooks/use-page-actions.ts +115 -0
- package/src/core/hooks/use-theme-hooks.ts +2 -0
- package/src/core/styles/dark.ts +2 -1
- package/src/core/styles/global.ts +2 -0
- package/src/core/types/catalog.ts +5 -1
- package/src/core/types/hooks.ts +2 -0
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +21 -0
- package/src/core/types/page-actions.ts +18 -0
- package/src/core/types/sidebar.ts +1 -0
- package/src/core/types/telemetry.ts +5 -13
- package/src/core/utils/download-code-walkthrough.ts +5 -4
- package/src/core/utils/enhanced-smoothstep.ts +14 -0
- package/src/core/utils/get-file-icon.tsx +94 -0
- package/src/core/utils/icon-resolver.ts +57 -0
- package/src/core/utils/index.ts +4 -1
- package/src/core/utils/lang-to-name.ts +35 -0
- package/src/ext/configure.ts +1 -1
- package/src/icons/CDNIcon/CDNIcon.tsx +47 -0
- package/src/icons/ChatGptIcon/ChatGptIcon.tsx +23 -0
- package/src/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon.tsx +24 -0
- package/src/icons/ClaudeIcon/ClaudeIcon.tsx +23 -0
- package/src/icons/GenericIcon/GenericIcon.tsx +69 -0
- package/src/icons/GraphqlIcon/GraphqlIcon.tsx +81 -0
- package/src/icons/GraphqlIcon/index.ts +1 -0
- package/src/icons/HexagonIcon/HexagonIcon.tsx +23 -0
- package/src/icons/MarkdownFullIcon/MarkdownFullIcon.tsx +24 -0
- package/src/icons/MoleculesIcon/MoleculesIcon.tsx +23 -0
- package/src/icons/NetworkIcon/NetworkIcon.tsx +31 -0
- package/src/icons/NoneIcon/NoneIcon.tsx +17 -0
- package/src/icons/NotesIcon/NotesIcon.tsx +43 -0
- package/src/icons/types.ts +7 -0
- package/src/index.ts +7 -1
- package/src/layouts/CodeWalkthroughLayout.tsx +1 -1
- package/src/layouts/DocumentationLayout.tsx +23 -13
- package/src/markdoc/components/Cards/CardIcon.tsx +6 -21
- package/src/markdoc/components/CodeGroup/CodeGroup.tsx +78 -0
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +7 -4
- package/src/markdoc/components/Heading/Heading.tsx +22 -3
- package/src/markdoc/components/Icon/Icon.tsx +16 -0
- package/src/markdoc/components/Tabs/Tab.tsx +6 -1
- package/src/markdoc/components/Tabs/Tabs.tsx +1 -1
- package/src/markdoc/components/Tabs/variables.ts +2 -0
- package/src/markdoc/components/default.ts +2 -0
- package/src/markdoc/default.ts +4 -0
- package/src/markdoc/tags/card.ts +1 -1
- package/src/markdoc/tags/code-group.ts +21 -0
- package/src/markdoc/tags/code-snippet.ts +1 -1
- package/src/markdoc/tags/icon.ts +14 -0
- package/src/markdoc/tags/tab.ts +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +0 -1
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +0 -5
- package/lib/ext/process-scorecard.d.ts +0 -5
- package/lib/ext/process-scorecard.js +0 -11
- package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +0 -1
- package/src/core/utils/get-file-icon.ts +0 -42
- package/src/ext/process-scorecard.ts +0 -13
- /package/lib/core/utils/{text-transform.d.ts → string.d.ts} +0 -0
- /package/src/core/utils/{text-transform.ts → string.ts} +0 -0
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
12
12
|
import { CatalogActionsRow } from '@redocly/theme/components/Catalog/CatalogActionsRow';
|
|
13
13
|
import { HighlightContext } from '@redocly/theme/components/Catalog/CatalogHighlight';
|
|
14
|
+
import { CatalogEntitiesEmptyState } from '@redocly/theme/components/Catalog/CatalogEntitiesEmptyState';
|
|
14
15
|
|
|
15
16
|
export type CatalogEntityRelationsTableProps = {
|
|
16
17
|
entity: BffCatalogEntity;
|
|
@@ -23,13 +24,14 @@ export type CatalogEntityRelationsTableProps = {
|
|
|
23
24
|
};
|
|
24
25
|
searchQuery: string;
|
|
25
26
|
setSearchQuery: (query: string) => void;
|
|
26
|
-
heading
|
|
27
|
+
heading?: string;
|
|
27
28
|
columns: CatalogColumn<BffCatalogRelatedEntity>[];
|
|
28
29
|
sortOption: SortOption | null;
|
|
29
30
|
setSortOption: (sortOption: SortOption | null) => void;
|
|
30
31
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
31
32
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
32
33
|
shouldShowLoadMore: boolean;
|
|
34
|
+
listType?: 'default' | 'team';
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
export function CatalogEntityRelationsTable({
|
|
@@ -46,19 +48,22 @@ export function CatalogEntityRelationsTable({
|
|
|
46
48
|
handleSortClick,
|
|
47
49
|
isColumnSorted,
|
|
48
50
|
shouldShowLoadMore,
|
|
51
|
+
listType,
|
|
49
52
|
}: CatalogEntityRelationsTableProps): JSX.Element {
|
|
50
53
|
return (
|
|
51
54
|
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable">
|
|
52
|
-
<Heading>{heading}</Heading>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
{heading && <Heading>{heading}</Heading>}
|
|
56
|
+
{(searchQuery || relations.length > 0) && (
|
|
57
|
+
<CatalogActionsRow
|
|
58
|
+
searchQuery={searchQuery}
|
|
59
|
+
setSearchQuery={setSearchQuery}
|
|
60
|
+
sortOption={sortOption}
|
|
61
|
+
setSortOption={setSortOption}
|
|
62
|
+
style={{ marginBottom: '12px' }}
|
|
63
|
+
/>
|
|
64
|
+
)}
|
|
65
|
+
<HighlightContext.Provider value={[searchQuery]}>
|
|
66
|
+
{relations.length > 0 ? (
|
|
62
67
|
<CatalogTableView
|
|
63
68
|
entities={relations}
|
|
64
69
|
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
@@ -68,9 +73,12 @@ export function CatalogEntityRelationsTable({
|
|
|
68
73
|
currentSortOption={sortOption}
|
|
69
74
|
handleSortClick={handleSortClick}
|
|
70
75
|
isColumnSorted={isColumnSorted}
|
|
76
|
+
style={{ marginTop: 0 }}
|
|
71
77
|
/>
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
) : (
|
|
79
|
+
<CatalogEntitiesEmptyState listType={listType} />
|
|
80
|
+
)}
|
|
81
|
+
</HighlightContext.Provider>
|
|
74
82
|
{shouldShowLoadMore && (
|
|
75
83
|
<LoadMore
|
|
76
84
|
icon={<ArrowDownIcon size="var(--catalog-load-more-icon-size)" />}
|
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx
CHANGED
|
@@ -88,6 +88,7 @@ export function CatalogEntityTeamRelations({
|
|
|
88
88
|
<Tabs forceReady={relations.length > 0} size={TabsSize.MEDIUM}>
|
|
89
89
|
<TabItem label="Members" icon={<PeopleIcon />} onClick={() => setFilter('type:user')}>
|
|
90
90
|
<CatalogEntityRelationsTable
|
|
91
|
+
key={`members-${relations.length}-${relations.map((r) => r.id).join(',')}`}
|
|
91
92
|
entity={entity}
|
|
92
93
|
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
93
94
|
catalogConfig={catalogConfig}
|
|
@@ -95,17 +96,22 @@ export function CatalogEntityTeamRelations({
|
|
|
95
96
|
query={query}
|
|
96
97
|
searchQuery={searchQuery}
|
|
97
98
|
setSearchQuery={setSearchQuery}
|
|
98
|
-
heading="Members"
|
|
99
99
|
columns={teamColumns}
|
|
100
100
|
sortOption={sortOption}
|
|
101
101
|
setSortOption={setSortOption}
|
|
102
102
|
handleSortClick={handleSortClick}
|
|
103
103
|
isColumnSorted={isColumnSorted}
|
|
104
104
|
shouldShowLoadMore={shouldShowLoadMore}
|
|
105
|
+
listType="team"
|
|
105
106
|
/>
|
|
106
107
|
</TabItem>
|
|
107
|
-
<TabItem
|
|
108
|
+
<TabItem
|
|
109
|
+
label="Related entities"
|
|
110
|
+
icon={<EntityTypeIcon />}
|
|
111
|
+
onClick={() => setFilter('-type:user')}
|
|
112
|
+
>
|
|
108
113
|
<CatalogEntityDefaultRelations
|
|
114
|
+
key={`related-${relations.length}-${relations.map((r) => r.id).join(',')}`}
|
|
109
115
|
entity={entity}
|
|
110
116
|
relations={relations}
|
|
111
117
|
query={query}
|
|
@@ -119,6 +125,7 @@ export function CatalogEntityTeamRelations({
|
|
|
119
125
|
handleSortClick={handleSortClick}
|
|
120
126
|
isColumnSorted={isColumnSorted}
|
|
121
127
|
shouldShowLoadMore={shouldShowLoadMore}
|
|
128
|
+
shouldShowHeading={false}
|
|
122
129
|
/>
|
|
123
130
|
</TabItem>
|
|
124
131
|
</Tabs>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
6
|
+
import { JsonViewer } from '@redocly/theme/components/JsonViewer/JsonViewer';
|
|
7
|
+
|
|
8
|
+
export type CatalogEntitySchemaProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function CatalogEntitySchema({ entity }: CatalogEntitySchemaProps) {
|
|
13
|
+
const { useTranslate } = useThemeHooks();
|
|
14
|
+
const { translate } = useTranslate();
|
|
15
|
+
const { schema, ...metadataToShow } = entity.metadata || {};
|
|
16
|
+
const metadata = Object.entries(metadataToShow);
|
|
17
|
+
|
|
18
|
+
if (!metadata.length) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let parsedSchema;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
parsedSchema = JSON.parse(schema);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<MetadataWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityMetadata">
|
|
32
|
+
<Heading>{translate('catalog.entity.metadata.title')}</Heading>
|
|
33
|
+
<JsonViewer data={parsedSchema} expandLevel={3} title="JSON" />
|
|
34
|
+
</MetadataWrapper>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const MetadataWrapper = styled.div`
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: var(--spacing-xs);
|
|
42
|
+
border-radius: var(--border-radius);
|
|
43
|
+
background-color: var(--catalog-metadata-bg-color);
|
|
44
|
+
transition: all 0.2s ease-in-out;
|
|
45
|
+
margin: var(--spacing-lg) 0;
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const Heading = styled.h2`
|
|
49
|
+
margin-bottom: var(--spacing-base);
|
|
50
|
+
margin-top: 0;
|
|
51
|
+
font-size: var(--catalog-metadata-heading-size);
|
|
52
|
+
`;
|
|
@@ -5,43 +5,43 @@ import { CodeIcon } from '@redocly/theme/icons/CodeIcon/CodeIcon';
|
|
|
5
5
|
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
6
6
|
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
7
7
|
import { UserIcon } from '@redocly/theme/icons/UserIcon/UserIcon';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const entityIconMap: Record<EntityType, JSX.Element> = {
|
|
12
|
-
service: <CodeIcon color={iconColor} />,
|
|
13
|
-
domain: <GraphIcon color={iconColor} />,
|
|
14
|
-
team: <PeopleIcon color={iconColor} />,
|
|
15
|
-
user: <UserIcon color={iconColor} />,
|
|
16
|
-
'api-description': <CodeIcon color={iconColor} />,
|
|
17
|
-
'data-schema': <CodeIcon color={iconColor} />,
|
|
18
|
-
'api-operation': <CodeIcon color={iconColor} />,
|
|
19
|
-
};
|
|
8
|
+
import { NetworkIcon } from '@redocly/theme/icons/NetworkIcon/NetworkIcon';
|
|
9
|
+
import { MoleculesIcon } from '@redocly/theme/icons/MoleculesIcon/MoleculesIcon';
|
|
20
10
|
|
|
21
11
|
export type CatalogEntityIconProps = {
|
|
22
12
|
entityType: string;
|
|
13
|
+
defaultColor?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getIconColor = (entityType: EntityType) => `var(--catalog-entity-icon-color-${entityType})`;
|
|
17
|
+
|
|
18
|
+
const getEntityIcon = ({ entityType, defaultColor }: CatalogEntityIconProps) => {
|
|
19
|
+
const iconColor = defaultColor
|
|
20
|
+
? `var(--catalog-entity-icon-color)`
|
|
21
|
+
: getIconColor(entityType as EntityType);
|
|
22
|
+
|
|
23
|
+
const entityIconMap: Record<EntityType, JSX.Element> = {
|
|
24
|
+
service: <CodeIcon color={iconColor} />,
|
|
25
|
+
domain: <GraphIcon color={iconColor} />,
|
|
26
|
+
team: <PeopleIcon color={iconColor} />,
|
|
27
|
+
user: <UserIcon color={iconColor} />,
|
|
28
|
+
'api-description': <CodeIcon color={iconColor} />,
|
|
29
|
+
'data-schema': <NetworkIcon color={iconColor} />,
|
|
30
|
+
'api-operation': <MoleculesIcon color={iconColor} />,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return entityIconMap[entityType as EntityType];
|
|
23
34
|
};
|
|
24
35
|
|
|
25
|
-
export function CatalogEntityIcon({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
case 'team':
|
|
34
|
-
return entityIconMap.team;
|
|
35
|
-
case 'user':
|
|
36
|
-
return entityIconMap.user;
|
|
37
|
-
case 'api-description':
|
|
38
|
-
return entityIconMap['api-description'];
|
|
39
|
-
case 'data-schema':
|
|
40
|
-
return entityIconMap.service;
|
|
41
|
-
case 'api-operation':
|
|
42
|
-
return entityIconMap.service;
|
|
43
|
-
default:
|
|
44
|
-
const exhaustiveCheck: never = key;
|
|
45
|
-
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
36
|
+
export function CatalogEntityIcon({
|
|
37
|
+
entityType,
|
|
38
|
+
defaultColor = false,
|
|
39
|
+
}: CatalogEntityIconProps): JSX.Element {
|
|
40
|
+
const icon = getEntityIcon({ entityType, defaultColor });
|
|
41
|
+
|
|
42
|
+
if (!icon) {
|
|
43
|
+
throw new Error(`Unhandled entity type: ${entityType}`);
|
|
46
44
|
}
|
|
45
|
+
|
|
46
|
+
return icon;
|
|
47
47
|
}
|
|
@@ -1,48 +1,43 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
6
|
-
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
7
|
-
import { UserIcon } from '@redocly/theme/icons/UserIcon/UserIcon';
|
|
8
|
-
|
|
9
|
-
const getEntityIcon = (entityType: string): ReactNode => {
|
|
10
|
-
const iconColor = 'var(--catalog-entity-icon-color)';
|
|
11
|
-
|
|
12
|
-
switch (entityType.toLowerCase()) {
|
|
13
|
-
case 'service':
|
|
14
|
-
return <CodeIcon color={iconColor} />;
|
|
15
|
-
case 'domain':
|
|
16
|
-
return <GraphIcon color={iconColor} />;
|
|
17
|
-
case 'team':
|
|
18
|
-
return <PeopleIcon color={iconColor} />;
|
|
19
|
-
case 'user':
|
|
20
|
-
return <UserIcon color={iconColor} />;
|
|
21
|
-
default:
|
|
22
|
-
return <CodeIcon color={iconColor} />;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
4
|
+
import { CatalogEntityIcon } from '@redocly/theme/components/Catalog/CatalogEntityIcon';
|
|
25
5
|
|
|
26
6
|
export type CatalogEntityTypeIconProps = {
|
|
27
7
|
entityType: string;
|
|
8
|
+
defaultColor?: boolean;
|
|
28
9
|
};
|
|
29
10
|
|
|
30
|
-
export function CatalogEntityTypeIcon({
|
|
11
|
+
export function CatalogEntityTypeIcon({
|
|
12
|
+
entityType,
|
|
13
|
+
defaultColor = false,
|
|
14
|
+
}: CatalogEntityTypeIconProps) {
|
|
31
15
|
return (
|
|
32
|
-
<IconContainer
|
|
33
|
-
|
|
16
|
+
<IconContainer
|
|
17
|
+
data-component-name="Catalog/CatalogEntityTypeIcon"
|
|
18
|
+
entityType={entityType}
|
|
19
|
+
defaultColor={defaultColor}
|
|
20
|
+
>
|
|
21
|
+
<CatalogEntityIcon entityType={entityType} defaultColor={defaultColor} />
|
|
34
22
|
</IconContainer>
|
|
35
23
|
);
|
|
36
24
|
}
|
|
37
25
|
|
|
38
|
-
const IconContainer = styled.div
|
|
26
|
+
const IconContainer = styled.div<{ entityType: string; defaultColor: boolean }>`
|
|
39
27
|
display: flex;
|
|
40
28
|
align-items: center;
|
|
41
29
|
justify-content: center;
|
|
42
30
|
width: var(--catalog-table-icon-width);
|
|
43
31
|
height: var(--catalog-table-icon-height);
|
|
44
32
|
border-radius: var(--catalog-table-icon-border-radius);
|
|
45
|
-
background-color:
|
|
33
|
+
background-color: ${({ defaultColor, entityType }) =>
|
|
34
|
+
defaultColor
|
|
35
|
+
? 'var(--catalog-entity-bg-color)'
|
|
36
|
+
: `var(--catalog-entity-bg-color-${entityType})`};
|
|
46
37
|
flex-shrink: 0;
|
|
47
|
-
border:
|
|
38
|
+
border: 1px solid
|
|
39
|
+
${({ defaultColor, entityType }) =>
|
|
40
|
+
defaultColor
|
|
41
|
+
? 'var(--catalog-entity-border-color)'
|
|
42
|
+
: `var(--catalog-entity-border-color-${entityType})`};
|
|
48
43
|
`;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { EntityType } from '@redocly/theme/core/types';
|
|
5
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
|
|
7
|
+
|
|
8
|
+
export type CatalogEntityTypeTagProps = {
|
|
9
|
+
entityType: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const entityTagColorMap: Record<EntityType, string> = {
|
|
13
|
+
service: 'blue',
|
|
14
|
+
domain: 'grass',
|
|
15
|
+
team: 'purple',
|
|
16
|
+
user: 'yellow',
|
|
17
|
+
'api-description': 'sky',
|
|
18
|
+
'data-schema': 'carrot',
|
|
19
|
+
'api-operation': 'raspberry',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const getEntityTagColor = (type: EntityType): string => {
|
|
23
|
+
const color = entityTagColorMap[type];
|
|
24
|
+
|
|
25
|
+
if (!color) {
|
|
26
|
+
throw new Error(`Unhandled entity type: ${type}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return color;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export function CatalogEntityTypeTag({ entityType }: CatalogEntityTypeTagProps): JSX.Element {
|
|
33
|
+
return (
|
|
34
|
+
<EntityTypeTagWrapper
|
|
35
|
+
entityType={entityType as EntityType}
|
|
36
|
+
data-component-name="Catalog/CatalogEntityTypeTag"
|
|
37
|
+
>
|
|
38
|
+
<CatalogHighlight>{entityType}</CatalogHighlight>
|
|
39
|
+
</EntityTypeTagWrapper>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const EntityTypeTagWrapper = styled(Tag)<{ entityType: EntityType }>`
|
|
44
|
+
font-size: var(--font-size-base);
|
|
45
|
+
background-color: transparent;
|
|
46
|
+
text-transform: lowercase;
|
|
47
|
+
border: 1px solid ${({ entityType }) => `var(--catalog-entity-border-color-${entityType})`};
|
|
48
|
+
color: ${({ entityType }) => `var(--catalog-entity-icon-color-${entityType})`};
|
|
49
|
+
`;
|
|
@@ -3,8 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { breakpoints } from '@redocly/theme/core/utils';
|
|
5
5
|
import { H3 } from '@redocly/theme/components/Typography/H3';
|
|
6
|
-
|
|
7
|
-
import { CounterTag } from '../Tags/CounterTag';
|
|
6
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
8
7
|
|
|
9
8
|
export type CatalogPageDescriptionProps = {
|
|
10
9
|
title: string;
|
|
@@ -23,9 +22,11 @@ export function CatalogPageDescription({
|
|
|
23
22
|
}: CatalogPageDescriptionProps) {
|
|
24
23
|
return (
|
|
25
24
|
<CatalogPageDescriptionWrapper>
|
|
26
|
-
<CatalogTitleWrapper>
|
|
25
|
+
<CatalogTitleWrapper data-component-name="Catalog/CatalogEntityTitle">
|
|
27
26
|
<CatalogTitle data-translation-key={titleTranslationKey}>{title}</CatalogTitle>
|
|
28
|
-
<
|
|
27
|
+
<Tag borderless textTransform="none">
|
|
28
|
+
{tag}
|
|
29
|
+
</Tag>
|
|
29
30
|
</CatalogTitleWrapper>
|
|
30
31
|
<CatalogDescription data-translation-key={descriptionTranslationKey}>
|
|
31
32
|
{description}
|
|
@@ -3,7 +3,9 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { useNavigate } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
import { Select } from '@redocly/theme/components/Select/Select';
|
|
6
|
-
import { CatalogSwitcherItem,
|
|
6
|
+
import { CatalogSwitcherItem, SortOption } from '@redocly/theme/core/types/catalog';
|
|
7
|
+
import { getPathPrefix } from '@redocly/theme/core/utils';
|
|
8
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
7
9
|
import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
|
|
8
10
|
|
|
9
11
|
export type CatalogSelectorProps = {
|
|
@@ -29,29 +29,28 @@ export function CatalogSortButton({
|
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
<div data-component-name="Catalog/CatalogSortButton">
|
|
33
|
+
<Dropdown
|
|
34
|
+
trigger={
|
|
35
|
+
<SortTrigger>
|
|
36
|
+
<SortIconWrapper>
|
|
37
|
+
{currentSort === '-title' ? <DescSortIcon /> : <AscSortIcon />}
|
|
38
|
+
</SortIconWrapper>
|
|
39
|
+
<SortText>Sort</SortText>
|
|
40
|
+
</SortTrigger>
|
|
41
|
+
}
|
|
42
|
+
alignment="end"
|
|
43
|
+
>
|
|
44
|
+
<DropdownMenu>
|
|
45
|
+
<DropdownMenuItem onAction={() => toggleSort('title')}>
|
|
46
|
+
{currentSort === '-title' ? 'Title | A → Z' : 'Title | Z → A'}
|
|
47
|
+
</DropdownMenuItem>
|
|
48
|
+
</DropdownMenu>
|
|
49
|
+
</Dropdown>
|
|
50
|
+
</div>
|
|
50
51
|
);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
const CatalogSortButtonWrapper = styled(Dropdown)``;
|
|
54
|
-
|
|
55
54
|
const SortTrigger = styled.div`
|
|
56
55
|
display: flex;
|
|
57
56
|
align-items: center;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
|
|
5
|
-
import {
|
|
5
|
+
import { CatalogEntityTypeIcon } from '@redocly/theme/components/Catalog/CatalogEntityTypeIcon';
|
|
6
6
|
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
7
7
|
|
|
8
8
|
type Entity = Pick<BffCatalogEntity, 'type' | 'title' | 'summary'>;
|
|
@@ -13,11 +13,9 @@ export type CatalogEntityCellProps<T extends Entity> = {
|
|
|
13
13
|
export function CatalogEntityCell<T extends Entity>({ entity }: CatalogEntityCellProps<T>) {
|
|
14
14
|
return (
|
|
15
15
|
<EntityTitleCellWrapper data-component-name="Catalog/CatalogTableView/CatalogEntityCell">
|
|
16
|
-
<
|
|
17
|
-
<CatalogEntityIcon entityType={entity.type} />
|
|
18
|
-
</IconContainer>
|
|
16
|
+
<CatalogEntityTypeIcon entityType={entity.type} defaultColor={true} />
|
|
19
17
|
<EntityTitleContent>
|
|
20
|
-
<EntityTitle>
|
|
18
|
+
<EntityTitle data-component-name="Catalog/CatalogTableView/CatalogEntityTitle">
|
|
21
19
|
<CatalogHighlight>{entity.title}</CatalogHighlight>
|
|
22
20
|
</EntityTitle>
|
|
23
21
|
{entity.summary && (
|
|
@@ -37,18 +35,6 @@ const EntityTitleCellWrapper = styled.div`
|
|
|
37
35
|
max-width: 100%;
|
|
38
36
|
`;
|
|
39
37
|
|
|
40
|
-
const IconContainer = styled.div`
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
width: var(--catalog-table-icon-width);
|
|
45
|
-
height: var(--catalog-table-icon-height);
|
|
46
|
-
border-radius: var(--catalog-table-icon-border-radius);
|
|
47
|
-
background-color: var(--catalog-table-icon-bg-color);
|
|
48
|
-
flex-shrink: 0;
|
|
49
|
-
border: var(--catalog-table-icon-border-width) solid var(--catalog-table-icon-border-color);
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
38
|
const EntityTitleContent = styled.div`
|
|
53
39
|
display: flex;
|
|
54
40
|
flex-direction: column;
|
|
@@ -5,8 +5,10 @@ import { SortOption } from '@redocly/theme/core/types';
|
|
|
5
5
|
import { CaretDownIcon } from '@redocly/theme/icons/CaretDownIcon/CaretDownIcon';
|
|
6
6
|
import { CaretUpIcon } from '@redocly/theme/icons/CaretUpIcon/CaretUpIcon';
|
|
7
7
|
import { useCatalogTableHeaderCellActions } from '@redocly/theme/core/hooks/catalog/useCatalogTableHeaderCellActions';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
BaseEntity,
|
|
10
|
+
CatalogColumn,
|
|
11
|
+
} from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
10
12
|
|
|
11
13
|
export type CatalogTableHeaderCellProps<T extends BaseEntity> = {
|
|
12
14
|
column: CatalogColumn<T>;
|
|
@@ -37,7 +39,7 @@ export const CatalogTableHeaderCell = <T extends BaseEntity>({
|
|
|
37
39
|
$sortable={Boolean(column.sortable && sortKey)}
|
|
38
40
|
>
|
|
39
41
|
<HeaderContent>
|
|
40
|
-
<
|
|
42
|
+
<span>{column.title}</span>
|
|
41
43
|
{column.sortable && sortKey && (
|
|
42
44
|
<SortIndicator>
|
|
43
45
|
<SortArrow $isActive={isUpActive}>
|
|
@@ -81,14 +83,9 @@ const TableHeaderCellWrapper = styled.div<{ $sortable: boolean }>`
|
|
|
81
83
|
const HeaderContent = styled.div`
|
|
82
84
|
display: flex;
|
|
83
85
|
align-items: center;
|
|
84
|
-
justify-content: space-between;
|
|
85
86
|
width: 100%;
|
|
86
87
|
`;
|
|
87
88
|
|
|
88
|
-
const HeaderTitle = styled.span`
|
|
89
|
-
flex: 1;
|
|
90
|
-
`;
|
|
91
|
-
|
|
92
89
|
const SortIndicator = styled.div`
|
|
93
90
|
display: flex;
|
|
94
91
|
flex-direction: column;
|
|
@@ -2,14 +2,14 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
5
|
+
import { SortOption, BffCatalogEntity } from '@redocly/theme/core/types';
|
|
7
6
|
import { CatalogOwnersCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogOwnersCell';
|
|
8
7
|
import { CatalogDomainsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogDomainsCell';
|
|
9
8
|
import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
|
|
10
9
|
import { CatalogTableHeaderCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableHeaderCell';
|
|
11
10
|
import { CatalogTagsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTagsCell';
|
|
12
11
|
import { CatalogTableViewRow } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableViewRow';
|
|
12
|
+
import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
|
|
13
13
|
|
|
14
14
|
export type BaseEntity = {
|
|
15
15
|
id: string;
|
|
@@ -28,6 +28,7 @@ export type CatalogTableViewProps<T extends BaseEntity> = {
|
|
|
28
28
|
currentSortOption?: SortOption | null;
|
|
29
29
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
30
30
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
31
|
+
style?: React.CSSProperties;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
export type CatalogColumn<T> = {
|
|
@@ -40,28 +41,6 @@ export type CatalogColumn<T> = {
|
|
|
40
41
|
sortKey?: string;
|
|
41
42
|
};
|
|
42
43
|
|
|
43
|
-
export const getEntityTagColor = (type: EntityType): string => {
|
|
44
|
-
switch (type) {
|
|
45
|
-
case 'service':
|
|
46
|
-
return 'blue';
|
|
47
|
-
case 'domain':
|
|
48
|
-
return 'grass';
|
|
49
|
-
case 'team':
|
|
50
|
-
return 'purple';
|
|
51
|
-
case 'user':
|
|
52
|
-
return 'yellow';
|
|
53
|
-
case 'api-description':
|
|
54
|
-
return 'sky';
|
|
55
|
-
case 'data-schema':
|
|
56
|
-
return 'sky';
|
|
57
|
-
case 'api-operation':
|
|
58
|
-
return 'sky';
|
|
59
|
-
default:
|
|
60
|
-
const exhaustiveCheck: never = type;
|
|
61
|
-
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
44
|
const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
66
45
|
{
|
|
67
46
|
key: 'entity',
|
|
@@ -75,11 +54,7 @@ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
|
75
54
|
{
|
|
76
55
|
key: 'type',
|
|
77
56
|
title: 'Type',
|
|
78
|
-
render: (entity) =>
|
|
79
|
-
<EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
|
|
80
|
-
{entity.type}
|
|
81
|
-
</EntityTypeTag>
|
|
82
|
-
),
|
|
57
|
+
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
83
58
|
width: '2fr',
|
|
84
59
|
minWidth: '120px',
|
|
85
60
|
sortable: true,
|
|
@@ -121,9 +96,10 @@ export const CatalogTableView = <T extends BaseEntity>({
|
|
|
121
96
|
currentSortOption,
|
|
122
97
|
handleSortClick,
|
|
123
98
|
isColumnSorted,
|
|
99
|
+
style,
|
|
124
100
|
}: CatalogTableViewProps<T>) => {
|
|
125
101
|
return (
|
|
126
|
-
<CatalogTableWrapper data-component-name="Catalog/CatalogTableView">
|
|
102
|
+
<CatalogTableWrapper data-component-name="Catalog/CatalogTableView" style={style}>
|
|
127
103
|
<CatalogTableHeader
|
|
128
104
|
columnsWidths={columns.map((column) => column.width || '1fr')}
|
|
129
105
|
columnsMinWidths={columns.map((column) => column.minWidth || 'auto')}
|
|
@@ -154,12 +130,6 @@ export const CatalogTableView = <T extends BaseEntity>({
|
|
|
154
130
|
);
|
|
155
131
|
};
|
|
156
132
|
|
|
157
|
-
const EntityTypeTag = styled(Tag)`
|
|
158
|
-
font-size: var(--font-size-base);
|
|
159
|
-
background-color: transparent;
|
|
160
|
-
text-transform: lowercase;
|
|
161
|
-
`;
|
|
162
|
-
|
|
163
133
|
const CatalogTableWrapper = styled.div`
|
|
164
134
|
width: 100%;
|
|
165
135
|
border-bottom: 1px solid var(--catalog-table-border-color);
|