@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
|
@@ -3,31 +3,38 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
export type CatalogEntityInfoBarProps = {
|
|
5
5
|
leftContent: ReactNode;
|
|
6
|
-
rightContent
|
|
6
|
+
rightContent?: ReactNode;
|
|
7
7
|
withSeparator?: boolean;
|
|
8
|
+
hoverEffect?: boolean;
|
|
9
|
+
isCodeBlock?: boolean;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
export function CatalogEntityInfoBar({
|
|
11
13
|
leftContent,
|
|
12
14
|
rightContent,
|
|
13
15
|
withSeparator = true,
|
|
16
|
+
hoverEffect = true,
|
|
17
|
+
isCodeBlock = false,
|
|
14
18
|
}: CatalogEntityInfoBarProps): JSX.Element {
|
|
15
19
|
return (
|
|
16
|
-
<InfoBarWrapper
|
|
20
|
+
<InfoBarWrapper
|
|
21
|
+
data-component-name="Catalog/CatalogEntity/CatalogEntityInfoBar"
|
|
22
|
+
hoverEffect={hoverEffect}
|
|
23
|
+
>
|
|
17
24
|
<LeftColumn withSeparator={withSeparator}>{leftContent}</LeftColumn>
|
|
18
|
-
<RightColumn>{rightContent}</RightColumn>
|
|
25
|
+
{rightContent && <RightColumn isCodeBlock={isCodeBlock}>{rightContent}</RightColumn>}
|
|
19
26
|
</InfoBarWrapper>
|
|
20
27
|
);
|
|
21
28
|
}
|
|
22
29
|
|
|
23
|
-
const InfoBarWrapper = styled.div
|
|
30
|
+
const InfoBarWrapper = styled.div<{ hoverEffect: boolean }>`
|
|
24
31
|
display: grid;
|
|
25
32
|
grid-template-columns: 1fr 1fr;
|
|
26
33
|
grid-template-areas: 'left right';
|
|
27
34
|
align-items: center;
|
|
28
35
|
|
|
29
36
|
color: var(--catalog-card-text-color, inherit);
|
|
30
|
-
background-color: var(--catalog-card-bg-color
|
|
37
|
+
background-color: var(--catalog-card-bg-color);
|
|
31
38
|
border: var(--catalog-card-border-width, 1px) var(--catalog-card-border-style)
|
|
32
39
|
var(--catalog-card-border-color);
|
|
33
40
|
border-radius: var(--catalog-card-border-radius);
|
|
@@ -35,9 +42,14 @@ const InfoBarWrapper = styled.div`
|
|
|
35
42
|
height: 100%;
|
|
36
43
|
padding: var(--catalog-card-gap);
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
${({ hoverEffect }) =>
|
|
46
|
+
hoverEffect &&
|
|
47
|
+
`
|
|
48
|
+
&:hover {
|
|
49
|
+
border-color: var(--catalog-card-border-color-hover);
|
|
50
|
+
background-color: var(--bg-color-active);
|
|
51
|
+
}
|
|
52
|
+
`}
|
|
41
53
|
`;
|
|
42
54
|
|
|
43
55
|
const LeftColumn = styled.div<{ withSeparator?: boolean }>`
|
|
@@ -49,12 +61,16 @@ const LeftColumn = styled.div<{ withSeparator?: boolean }>`
|
|
|
49
61
|
text-align: left;
|
|
50
62
|
border-right: ${({ withSeparator }) =>
|
|
51
63
|
withSeparator ? '1px solid var(--border-color-primary)' : 'none'};
|
|
64
|
+
height: 100%;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
52
67
|
`;
|
|
53
68
|
|
|
54
|
-
const RightColumn = styled.div
|
|
69
|
+
const RightColumn = styled.div<{ isCodeBlock?: boolean }>`
|
|
55
70
|
color: var(--catalog-metadata-value-color);
|
|
56
71
|
font-weight: var(--font-weight-medium);
|
|
57
72
|
grid-area: right;
|
|
58
73
|
justify-self: end;
|
|
59
74
|
text-align: right;
|
|
75
|
+
width: ${({ isCodeBlock }) => (isCodeBlock ? '100%' : 'auto')};
|
|
60
76
|
`;
|
|
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
5
|
import { LaunchIcon } from '@redocly/theme/icons/LaunchIcon/LaunchIcon';
|
|
6
|
-
import {
|
|
6
|
+
import { LinkIcon } from '@redocly/theme/icons/LinkIcon/LinkIcon';
|
|
7
7
|
import { CatalogEntityInfoBar } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityInfoBar';
|
|
8
8
|
import { Link } from '@redocly/theme/components/Link/Link';
|
|
9
9
|
|
|
@@ -22,20 +22,17 @@ export function CatalogEntityLinks({ entity }: CatalogEntityLinksProps) {
|
|
|
22
22
|
<LinksWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityLinks">
|
|
23
23
|
<Heading>Links</Heading>
|
|
24
24
|
{links.map(([key, value]) => (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
withSeparator={false}
|
|
38
|
-
/>
|
|
25
|
+
<Link key={key} color="var(--catalog-metadata-link-color)" to={value.url} target="_blank">
|
|
26
|
+
<CatalogEntityInfoBar
|
|
27
|
+
leftContent={
|
|
28
|
+
<Label>
|
|
29
|
+
<LinkIcon /> {value.label}
|
|
30
|
+
</Label>
|
|
31
|
+
}
|
|
32
|
+
rightContent={<LaunchIcon />}
|
|
33
|
+
withSeparator={false}
|
|
34
|
+
/>
|
|
35
|
+
</Link>
|
|
39
36
|
))}
|
|
40
37
|
</LinksWrapper>
|
|
41
38
|
);
|
|
@@ -3,7 +3,8 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
5
|
import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
|
|
6
|
-
import {
|
|
6
|
+
import { JsonViewer } from '@redocly/theme/components/JsonViewer/JsonViewer';
|
|
7
|
+
import { capitalize, isPlainObject } from '@redocly/theme/core/utils';
|
|
7
8
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
8
9
|
import { CatalogEntityInfoBar } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityInfoBar';
|
|
9
10
|
|
|
@@ -13,6 +14,30 @@ export type CatalogEntityMetadataProps = {
|
|
|
13
14
|
entity: BffCatalogEntity;
|
|
14
15
|
};
|
|
15
16
|
|
|
17
|
+
function renderMetadataValue(value: any): React.JSX.Element {
|
|
18
|
+
if (isPlainObject(value)) {
|
|
19
|
+
return <JsonViewerWrapper data={value} expandLevel={3} hideHeader={true} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
return (
|
|
24
|
+
<ArrayWrapper>
|
|
25
|
+
{value.map((item, index) => (
|
|
26
|
+
<div key={index}>
|
|
27
|
+
{isPlainObject(item) ? (
|
|
28
|
+
<JsonViewerWrapper data={item} expandLevel={3} hideHeader={true} />
|
|
29
|
+
) : (
|
|
30
|
+
<span>{String(item)}</span>
|
|
31
|
+
)}
|
|
32
|
+
</div>
|
|
33
|
+
))}
|
|
34
|
+
</ArrayWrapper>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return <span>{String(value)}</span>;
|
|
39
|
+
}
|
|
40
|
+
|
|
16
41
|
export function CatalogEntityMetadata({ entity }: CatalogEntityMetadataProps) {
|
|
17
42
|
const { useTranslate } = useThemeHooks();
|
|
18
43
|
const { translate } = useTranslate();
|
|
@@ -25,6 +50,7 @@ export function CatalogEntityMetadata({ entity }: CatalogEntityMetadataProps) {
|
|
|
25
50
|
if (!metadata.length) {
|
|
26
51
|
return null;
|
|
27
52
|
}
|
|
53
|
+
|
|
28
54
|
return (
|
|
29
55
|
<MetadataWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityMetadata">
|
|
30
56
|
<Heading>{translate('catalog.entity.metadata.title')}</Heading>
|
|
@@ -32,7 +58,9 @@ export function CatalogEntityMetadata({ entity }: CatalogEntityMetadataProps) {
|
|
|
32
58
|
<CatalogEntityInfoBar
|
|
33
59
|
key={key}
|
|
34
60
|
leftContent={<Label>{capitalize(key)}:</Label>}
|
|
35
|
-
rightContent={<Value>{value}</Value>}
|
|
61
|
+
rightContent={<Value>{renderMetadataValue(value)}</Value>}
|
|
62
|
+
hoverEffect={false}
|
|
63
|
+
isCodeBlock={isPlainObject(value) || Array.isArray(value)}
|
|
36
64
|
/>
|
|
37
65
|
))}
|
|
38
66
|
{hasMoreItems && (
|
|
@@ -44,6 +72,10 @@ export function CatalogEntityMetadata({ entity }: CatalogEntityMetadataProps) {
|
|
|
44
72
|
);
|
|
45
73
|
}
|
|
46
74
|
|
|
75
|
+
const JsonViewerWrapper = styled(JsonViewer)`
|
|
76
|
+
text-align: left;
|
|
77
|
+
`;
|
|
78
|
+
|
|
47
79
|
const MetadataWrapper = styled.div`
|
|
48
80
|
display: flex;
|
|
49
81
|
flex-direction: column;
|
|
@@ -64,6 +96,11 @@ const Value = styled.span`
|
|
|
64
96
|
font-weight: var(--font-weight-medium);
|
|
65
97
|
`;
|
|
66
98
|
|
|
99
|
+
const ArrayWrapper = styled.div`
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
`;
|
|
103
|
+
|
|
67
104
|
const Heading = styled.h2`
|
|
68
105
|
margin-bottom: var(--spacing-base);
|
|
69
106
|
margin-top: 0;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
|
+
import { CatalogEntityInfoBar } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityInfoBar';
|
|
6
|
+
import { HttpTag } from '@redocly/theme/components/Tags/HttpTag';
|
|
7
|
+
|
|
8
|
+
export type CatalogEntityMethodAndPathProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function CatalogEntityMethodAndPath({ entity }: CatalogEntityMethodAndPathProps) {
|
|
13
|
+
const method = entity.metadata?.method;
|
|
14
|
+
const path = entity.metadata?.path;
|
|
15
|
+
|
|
16
|
+
if (!method || !path) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<LinksWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityMethodAndPath">
|
|
22
|
+
<Heading>Method & Path</Heading>
|
|
23
|
+
<CatalogEntityInfoBar
|
|
24
|
+
leftContent={
|
|
25
|
+
<Label>
|
|
26
|
+
<MethodTag color={method.toLowerCase()}>{method}</MethodTag>
|
|
27
|
+
{path}
|
|
28
|
+
</Label>
|
|
29
|
+
}
|
|
30
|
+
withSeparator={false}
|
|
31
|
+
/>
|
|
32
|
+
</LinksWrapper>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const MethodTag = styled(HttpTag)`
|
|
37
|
+
width: auto;
|
|
38
|
+
justify-content: start;
|
|
39
|
+
margin-right: var(--spacing-xxs);
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const LinksWrapper = styled.div`
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: var(--spacing-xs);
|
|
46
|
+
border-radius: var(--border-radius);
|
|
47
|
+
background-color: var(--catalog-metadata-bg-color);
|
|
48
|
+
transition: all 0.2s ease-in-out;
|
|
49
|
+
margin: var(--spacing-lg) 0;
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
const Label = styled.div`
|
|
53
|
+
display: flex;
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const Heading = styled.h2`
|
|
57
|
+
margin-bottom: var(--spacing-sm);
|
|
58
|
+
margin-top: 0;
|
|
59
|
+
font-size: var(--font-size-md);
|
|
60
|
+
color: var(--catalog-metadata-heading-color);
|
|
61
|
+
`;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
2
|
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import styled from 'styled-components';
|
|
3
4
|
|
|
4
5
|
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
6
|
import { DocumentIcon, getPathPrefix, Tag, useThemeHooks } from '@redocly/theme';
|
|
@@ -25,7 +26,11 @@ export function ApiDescriptionProperty({ entity }: ApiDescriptionPropertyProps):
|
|
|
25
26
|
{translate('catalog.entity.properties.apiDescription.title')}
|
|
26
27
|
</>
|
|
27
28
|
}
|
|
28
|
-
content={
|
|
29
|
+
content={
|
|
30
|
+
<Tag textTransform="none">
|
|
31
|
+
<DescriptionFile>{descriptionFile}</DescriptionFile>
|
|
32
|
+
</Tag>
|
|
33
|
+
}
|
|
29
34
|
onClick={() => {
|
|
30
35
|
navigate(`${pathPrefix}/${descriptionFile}`);
|
|
31
36
|
}}
|
|
@@ -33,3 +38,9 @@ export function ApiDescriptionProperty({ entity }: ApiDescriptionPropertyProps):
|
|
|
33
38
|
</div>
|
|
34
39
|
);
|
|
35
40
|
}
|
|
41
|
+
|
|
42
|
+
const DescriptionFile = styled.span`
|
|
43
|
+
word-break: break-all;
|
|
44
|
+
overflow-wrap: break-word;
|
|
45
|
+
white-space: normal;
|
|
46
|
+
`;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import { UserEmailProperty } from '@redocly/theme/components/Catalog/CatalogEnti
|
|
|
10
10
|
import { DomainsProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty';
|
|
11
11
|
import { OwnersProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty';
|
|
12
12
|
import { ContactProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty';
|
|
13
|
+
import { FormatProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty';
|
|
13
14
|
|
|
14
15
|
type PropertyRenderer = {
|
|
15
16
|
key: string;
|
|
@@ -23,6 +24,11 @@ const propertyRenderers: PropertyRenderer[] = [
|
|
|
23
24
|
condition: (entity) => !!entity.type,
|
|
24
25
|
component: EntityTypeProperty,
|
|
25
26
|
},
|
|
27
|
+
{
|
|
28
|
+
key: 'format',
|
|
29
|
+
condition: (entity) => entity.type === 'data-schema' && !!entity.metadata?.specType,
|
|
30
|
+
component: FormatProperty,
|
|
31
|
+
},
|
|
26
32
|
{
|
|
27
33
|
key: 'contact',
|
|
28
34
|
condition: (entity) => !!entity.contact?.slack?.channels,
|
|
@@ -35,7 +41,7 @@ const propertyRenderers: PropertyRenderer[] = [
|
|
|
35
41
|
},
|
|
36
42
|
{
|
|
37
43
|
key: 'tags',
|
|
38
|
-
condition: (entity) => !!entity.tags,
|
|
44
|
+
condition: (entity) => !!entity.tags?.length,
|
|
39
45
|
component: TagsProperty,
|
|
40
46
|
},
|
|
41
47
|
{
|
package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx
CHANGED
|
@@ -5,17 +5,20 @@ export type CatalogEntityPropertyCardProps = {
|
|
|
5
5
|
header: ReactNode;
|
|
6
6
|
content: ReactNode;
|
|
7
7
|
onClick?: () => void;
|
|
8
|
+
hoverEffect?: boolean;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
export function CatalogEntityPropertyCard({
|
|
11
12
|
header,
|
|
12
13
|
content,
|
|
13
14
|
onClick,
|
|
15
|
+
hoverEffect = true,
|
|
14
16
|
}: CatalogEntityPropertyCardProps): JSX.Element {
|
|
15
17
|
return (
|
|
16
18
|
<CatalogEntityPropertyWrapper
|
|
17
19
|
data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard"
|
|
18
20
|
onClick={onClick}
|
|
21
|
+
hoverEffect={hoverEffect}
|
|
19
22
|
>
|
|
20
23
|
<CardHeader>{header}</CardHeader>
|
|
21
24
|
<CardContent>{content}</CardContent>
|
|
@@ -23,7 +26,7 @@ export function CatalogEntityPropertyCard({
|
|
|
23
26
|
);
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
const CatalogEntityPropertyWrapper = styled.div
|
|
29
|
+
const CatalogEntityPropertyWrapper = styled.div<{ hoverEffect: boolean }>`
|
|
27
30
|
display: flex;
|
|
28
31
|
flex-direction: column;
|
|
29
32
|
color: var(--catalog-card-text-color);
|
|
@@ -36,9 +39,13 @@ const CatalogEntityPropertyWrapper = styled.div`
|
|
|
36
39
|
padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
|
|
37
40
|
gap: var(--catalog-card-content-gap-vertical);
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
${({ hoverEffect }) =>
|
|
43
|
+
hoverEffect &&
|
|
44
|
+
`
|
|
45
|
+
&:hover {
|
|
46
|
+
border-color: var(--catalog-card-border-color-hover);
|
|
47
|
+
}
|
|
48
|
+
`}
|
|
42
49
|
|
|
43
50
|
${(props) =>
|
|
44
51
|
props.onClick &&
|
|
@@ -51,6 +58,7 @@ const CardHeader = styled.div`
|
|
|
51
58
|
display: flex;
|
|
52
59
|
align-items: center;
|
|
53
60
|
gap: var(--catalog-card-content-gap);
|
|
61
|
+
font-weight: var(--font-weight-medium);
|
|
54
62
|
`;
|
|
55
63
|
|
|
56
64
|
const CardContent = styled.div`
|
|
@@ -59,4 +67,7 @@ const CardContent = styled.div`
|
|
|
59
67
|
align-items: center;
|
|
60
68
|
gap: var(--catalog-card-content-gap);
|
|
61
69
|
flex-wrap: wrap;
|
|
70
|
+
color: var(--text-color-primary);
|
|
71
|
+
font-size: var(--font-size-lg);
|
|
72
|
+
line-height: var(--line-height-lg);
|
|
62
73
|
`;
|
|
@@ -24,7 +24,11 @@ export function ContactProperty({ entity }: ContactPropertyProps): JSX.Element {
|
|
|
24
24
|
content={
|
|
25
25
|
<>
|
|
26
26
|
{channels?.map((channel) => (
|
|
27
|
-
<Tag
|
|
27
|
+
<Tag
|
|
28
|
+
key={channel.name}
|
|
29
|
+
textTransform="none"
|
|
30
|
+
style={{ backgroundColor: 'var(--bg-color)' }}
|
|
31
|
+
>
|
|
28
32
|
{channel.name}
|
|
29
33
|
</Tag>
|
|
30
34
|
))}
|
|
@@ -2,9 +2,8 @@ import React, { JSX } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
4
|
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
5
|
-
import { Tag } from '@redocly/theme';
|
|
6
|
-
|
|
7
|
-
import { CatalogEntityPropertyCard } from './CatalogEntityPropertyCard';
|
|
5
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
8
7
|
|
|
9
8
|
export type DomainsPropertyProps = {
|
|
10
9
|
entity: BffCatalogEntity;
|
|
@@ -4,13 +4,20 @@ import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
|
4
4
|
import { EntityTypeIcon } from '@redocly/theme/icons/EntityTypeIcon/EntityTypeIcon';
|
|
5
5
|
import { capitalize } from '@redocly/theme/core/utils';
|
|
6
6
|
import { CatalogEntityTypeIcon } from '@redocly/theme/components/Catalog/CatalogEntityTypeIcon';
|
|
7
|
-
|
|
8
|
-
import { CatalogEntityPropertyCard } from './CatalogEntityPropertyCard';
|
|
7
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
9
8
|
|
|
10
9
|
export type EntityTypePropertyProps = {
|
|
11
10
|
entity: BffCatalogEntity;
|
|
12
11
|
};
|
|
13
12
|
|
|
13
|
+
const formatEntityType = (entityType: string) => {
|
|
14
|
+
return capitalize(
|
|
15
|
+
entityType.startsWith('api-')
|
|
16
|
+
? entityType.replace('api-', 'API-').replace(/-/g, ' ')
|
|
17
|
+
: entityType.replace(/-/g, ' '),
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
14
21
|
export function EntityTypeProperty({ entity }: EntityTypePropertyProps): JSX.Element {
|
|
15
22
|
return (
|
|
16
23
|
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty">
|
|
@@ -24,9 +31,10 @@ export function EntityTypeProperty({ entity }: EntityTypePropertyProps): JSX.Ele
|
|
|
24
31
|
content={
|
|
25
32
|
<>
|
|
26
33
|
<CatalogEntityTypeIcon entityType={entity.type} />
|
|
27
|
-
|
|
34
|
+
{formatEntityType(entity.type)}
|
|
28
35
|
</>
|
|
29
36
|
}
|
|
37
|
+
hoverEffect={false}
|
|
30
38
|
/>
|
|
31
39
|
</div>
|
|
32
40
|
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
+
import { NotesIcon } from '@redocly/theme/icons/NotesIcon/NotesIcon';
|
|
5
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
7
|
+
|
|
8
|
+
export type FormatPropertyProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function FormatProperty({ entity }: FormatPropertyProps): JSX.Element {
|
|
13
|
+
return (
|
|
14
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty">
|
|
15
|
+
<CatalogEntityPropertyCard
|
|
16
|
+
header={
|
|
17
|
+
<>
|
|
18
|
+
<NotesIcon />
|
|
19
|
+
Format
|
|
20
|
+
</>
|
|
21
|
+
}
|
|
22
|
+
content={
|
|
23
|
+
<>
|
|
24
|
+
<Tag
|
|
25
|
+
textTransform="none"
|
|
26
|
+
key={entity.metadata?.specType}
|
|
27
|
+
style={{ backgroundColor: 'var(--bg-color)' }}
|
|
28
|
+
>
|
|
29
|
+
{entity.metadata?.specType}
|
|
30
|
+
</Tag>
|
|
31
|
+
</>
|
|
32
|
+
}
|
|
33
|
+
hoverEffect={false}
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -28,7 +28,7 @@ export function GitProperty({ entity }: GitPropertyProps): JSX.Element {
|
|
|
28
28
|
const url = new URL(repo);
|
|
29
29
|
const repoName = removeLeadingSlash(url.pathname);
|
|
30
30
|
return (
|
|
31
|
-
<Tag key={repo} style={{ backgroundColor: 'var(--bg-color)' }}>
|
|
31
|
+
<Tag key={repo} textTransform="none" style={{ backgroundColor: 'var(--bg-color)' }}>
|
|
32
32
|
{repoName}
|
|
33
33
|
</Tag>
|
|
34
34
|
);
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
2
|
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
3
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
BffCatalogRelatedEntity,
|
|
8
|
-
EntityType,
|
|
9
|
-
SortOption,
|
|
10
|
-
} from '@redocly/theme/core/types';
|
|
11
|
-
import {
|
|
12
|
-
CatalogColumn,
|
|
13
|
-
getEntityTagColor,
|
|
14
|
-
} from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
4
|
+
import { BffCatalogEntity, BffCatalogRelatedEntity, SortOption } from '@redocly/theme/core/types';
|
|
5
|
+
import { CatalogColumn } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
15
6
|
import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
|
|
16
|
-
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
17
7
|
import { CatalogEntityRelationsTable } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable';
|
|
8
|
+
import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
|
|
18
9
|
import { CatalogEntityRelationCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityRelationCell';
|
|
19
10
|
|
|
20
11
|
const columns: CatalogColumn<BffCatalogRelatedEntity>[] = [
|
|
@@ -29,11 +20,7 @@ const columns: CatalogColumn<BffCatalogRelatedEntity>[] = [
|
|
|
29
20
|
{
|
|
30
21
|
key: 'type',
|
|
31
22
|
title: 'Type',
|
|
32
|
-
render: (entity) =>
|
|
33
|
-
<EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
|
|
34
|
-
{entity.type}
|
|
35
|
-
</EntityTypeTag>
|
|
36
|
-
),
|
|
23
|
+
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
37
24
|
sortable: true,
|
|
38
25
|
sortKey: 'type',
|
|
39
26
|
width: '1fr',
|
|
@@ -68,6 +55,7 @@ export type CatalogEntityDefaultRelationsProps = {
|
|
|
68
55
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
69
56
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
70
57
|
shouldShowLoadMore: boolean;
|
|
58
|
+
shouldShowHeading?: boolean;
|
|
71
59
|
};
|
|
72
60
|
|
|
73
61
|
export function CatalogEntityDefaultRelations({
|
|
@@ -83,6 +71,7 @@ export function CatalogEntityDefaultRelations({
|
|
|
83
71
|
handleSortClick,
|
|
84
72
|
isColumnSorted,
|
|
85
73
|
shouldShowLoadMore,
|
|
74
|
+
shouldShowHeading = true,
|
|
86
75
|
}: CatalogEntityDefaultRelationsProps): JSX.Element {
|
|
87
76
|
return (
|
|
88
77
|
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations">
|
|
@@ -94,7 +83,7 @@ export function CatalogEntityDefaultRelations({
|
|
|
94
83
|
query={query}
|
|
95
84
|
searchQuery={searchQuery}
|
|
96
85
|
setSearchQuery={setSearchQuery}
|
|
97
|
-
heading=
|
|
86
|
+
heading={shouldShowHeading ? 'Related entities' : undefined}
|
|
98
87
|
columns={columns}
|
|
99
88
|
sortOption={sortOption}
|
|
100
89
|
setSortOption={setSortOption}
|
|
@@ -105,8 +94,3 @@ export function CatalogEntityDefaultRelations({
|
|
|
105
94
|
</div>
|
|
106
95
|
);
|
|
107
96
|
}
|
|
108
|
-
|
|
109
|
-
const EntityTypeTag = styled(Tag)`
|
|
110
|
-
font-size: var(--font-size-base);
|
|
111
|
-
background-color: transparent;
|
|
112
|
-
`;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx
CHANGED
|
@@ -11,6 +11,8 @@ export type CatalogEntityRelationsProps = {
|
|
|
11
11
|
entitiesCatalogConfig: EntitiesCatalogConfig;
|
|
12
12
|
catalogConfig: CatalogEntityConfig;
|
|
13
13
|
initialRelations: BffCatalogRelatedEntityList;
|
|
14
|
+
searchQuery: string;
|
|
15
|
+
setSearchQuery: (query: string) => void;
|
|
14
16
|
};
|
|
15
17
|
const LOAD_MORE_THRESHOLD = 10;
|
|
16
18
|
const ENTITY_DEFAULT_FILTERS: Record<string, string> = {
|
|
@@ -22,10 +24,11 @@ export function CatalogEntityRelations({
|
|
|
22
24
|
entitiesCatalogConfig,
|
|
23
25
|
initialRelations,
|
|
24
26
|
catalogConfig,
|
|
27
|
+
searchQuery,
|
|
28
|
+
setSearchQuery,
|
|
25
29
|
}: CatalogEntityRelationsProps): JSX.Element | null {
|
|
26
|
-
const { useCatalogSort,
|
|
30
|
+
const { useCatalogSort, useFetchCatalogEntitiesRelations } = useThemeHooks();
|
|
27
31
|
const { sortOption, setSortOption, handleSortClick, isColumnSorted } = useCatalogSort();
|
|
28
|
-
const { searchQuery, setSearchQuery } = useCatalogSearch();
|
|
29
32
|
const [filter, setFilter] = useState<string>(ENTITY_DEFAULT_FILTERS[entity.type] ?? '');
|
|
30
33
|
|
|
31
34
|
const { items: relations, query } = useFetchCatalogEntitiesRelations(
|
|
@@ -33,10 +36,6 @@ export function CatalogEntityRelations({
|
|
|
33
36
|
initialRelations,
|
|
34
37
|
);
|
|
35
38
|
|
|
36
|
-
if (relations.length === 0) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
39
|
const shouldShowLoadMore =
|
|
41
40
|
query.hasNextPage ||
|
|
42
41
|
(query.isPlaceholderData && relations && relations.length >= LOAD_MORE_THRESHOLD);
|