@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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CodeBlockDropdown = CodeBlockDropdown;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
10
|
+
const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
|
|
11
|
+
const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
|
|
12
|
+
const Button_1 = require("../../components/Button/Button");
|
|
13
|
+
const ChevronSortIcon_1 = require("../../icons/ChevronSortIcon/ChevronSortIcon");
|
|
14
|
+
const NoneIcon_1 = require("../../icons/NoneIcon/NoneIcon");
|
|
15
|
+
const utils_1 = require("../../core/utils");
|
|
16
|
+
function CodeBlockDropdown({ items, onChange, value }) {
|
|
17
|
+
const activeItem = items.find((item) => item.name === value) || items[0];
|
|
18
|
+
const icon = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.lang) ? (0, utils_1.getFileIconByLanguage)(activeItem === null || activeItem === void 0 ? void 0 : activeItem.lang) : null;
|
|
19
|
+
return (react_1.default.createElement(StyledDropdown, { alignment: "end", trigger: react_1.default.createElement(Button_1.Button, { icon: react_1.default.createElement(ChevronSortIcon_1.ChevronSortIcon, null), iconPosition: "right", variant: "text", size: "small" },
|
|
20
|
+
icon,
|
|
21
|
+
activeItem.name) },
|
|
22
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, null, items.map((item) => {
|
|
23
|
+
const icon = (0, utils_1.getFileIconByLanguage)(item.lang || '');
|
|
24
|
+
return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: item.lang, onAction: () => onChange(item.name), active: item.name === activeItem.name, prefix: item.lang ? icon : react_1.default.createElement(NoneIcon_1.NoneIcon, { size: "var(--icon-size)" }) }, item.name));
|
|
25
|
+
}))));
|
|
26
|
+
}
|
|
27
|
+
const StyledDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown) `
|
|
28
|
+
margin-left: auto;
|
|
29
|
+
--icon-size: 18px;
|
|
30
|
+
--button-color: var(--text-color-secondary);
|
|
31
|
+
button.button-size-small {
|
|
32
|
+
--button-icon-size: 18px;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
//# sourceMappingURL=CodeBlockDropdown.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JSX } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CodeBlockTabItems } from '../../components/CodeBlock/CodeBlock';
|
|
3
3
|
export type CodeBlockTabsProps = {
|
|
4
|
-
tabs:
|
|
4
|
+
tabs: CodeBlockTabItems;
|
|
5
5
|
};
|
|
6
6
|
export declare function CodeBlockTabs({ tabs }: CodeBlockTabsProps): JSX.Element;
|
|
@@ -28,9 +28,9 @@ const react_1 = __importStar(require("react"));
|
|
|
28
28
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
29
29
|
const hooks_1 = require("../../core/hooks");
|
|
30
30
|
const Button_1 = require("../../components/Button/Button");
|
|
31
|
-
const DocumentBlankIcon_1 = require("../../icons/DocumentBlankIcon/DocumentBlankIcon");
|
|
32
31
|
const ChevronLeftIcon_1 = require("../../icons/ChevronLeftIcon/ChevronLeftIcon");
|
|
33
32
|
const ChevronRightIcon_1 = require("../../icons/ChevronRightIcon/ChevronRightIcon");
|
|
33
|
+
const get_file_icon_1 = require("../../core/utils/get-file-icon");
|
|
34
34
|
function CodeBlockTabs({ tabs }) {
|
|
35
35
|
const containerRef = (0, react_1.useRef)(null);
|
|
36
36
|
const tabRefs = (0, react_1.useRef)([]);
|
|
@@ -40,18 +40,27 @@ function CodeBlockTabs({ tabs }) {
|
|
|
40
40
|
tabRefs,
|
|
41
41
|
});
|
|
42
42
|
(0, react_1.useEffect)(() => {
|
|
43
|
-
const activeTab = tabRefs.current.find((tab) => (tab === null || tab === void 0 ? void 0 : tab.dataset.name) === tabs.
|
|
43
|
+
const activeTab = tabRefs.current.find((tab) => (tab === null || tab === void 0 ? void 0 : tab.dataset.name) === tabs.value);
|
|
44
44
|
if (activeTab) {
|
|
45
45
|
activeTab.scrollIntoView({ block: 'nearest', inline: 'center' });
|
|
46
46
|
}
|
|
47
|
-
}, [tabs.
|
|
47
|
+
}, [tabs.value]);
|
|
48
48
|
return (react_1.default.createElement(CodeBlockTabsWrapper, { ref: containerRef, "data-component-name": "CodeBlock/CodeBlockTabs" },
|
|
49
49
|
react_1.default.createElement(ShadowWrapper, null,
|
|
50
|
-
react_1.default.createElement(Tabs, null, tabs.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
react_1.default.createElement(Tabs, null, tabs.items.map(({ name, lang }, i) => {
|
|
51
|
+
var _a;
|
|
52
|
+
const ext = (_a = name.match(/\.([^.]+)$/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
53
|
+
const fileIcon = lang
|
|
54
|
+
? (0, get_file_icon_1.getFileIconByLanguage)(lang)
|
|
55
|
+
: ext
|
|
56
|
+
? (0, get_file_icon_1.getFileIconByExt)(ext)
|
|
57
|
+
: null;
|
|
58
|
+
return (react_1.default.createElement(Tab, { ref: (el) => {
|
|
59
|
+
tabRefs.current[i] = el;
|
|
60
|
+
}, "data-name": name, active: name === tabs.value, key: name + i, onClick: () => tabs.onChange(name) },
|
|
61
|
+
fileIcon,
|
|
62
|
+
name));
|
|
63
|
+
}))),
|
|
55
64
|
showControls && (react_1.default.createElement(Controls, null,
|
|
56
65
|
react_1.default.createElement(ControlButton, { size: "small", onClick: handlePrevTab, "data-testid": "prev-button" },
|
|
57
66
|
react_1.default.createElement(ChevronLeftIcon_1.ChevronLeftIcon, null)),
|
|
@@ -61,7 +70,6 @@ function CodeBlockTabs({ tabs }) {
|
|
|
61
70
|
const CodeBlockTabsWrapper = styled_components_1.default.div `
|
|
62
71
|
display: flex;
|
|
63
72
|
overflow: hidden;
|
|
64
|
-
padding: var(--spacing-xxs) 0;
|
|
65
73
|
`;
|
|
66
74
|
const Controls = styled_components_1.default.div `
|
|
67
75
|
display: flex;
|
|
@@ -98,6 +106,7 @@ const Tabs = styled_components_1.default.div `
|
|
|
98
106
|
}
|
|
99
107
|
`;
|
|
100
108
|
const Tab = styled_components_1.default.button `
|
|
109
|
+
--icon-size: 18px;
|
|
101
110
|
display: inline-flex;
|
|
102
111
|
align-items: center;
|
|
103
112
|
|
|
@@ -75,7 +75,7 @@ exports.code = (0, styled_components_1.css) `
|
|
|
75
75
|
--code-block-controls-border: 1px solid var(--border-color-secondary); // @presenter Border
|
|
76
76
|
--code-block-icon-controls-bg-color: var(--code-block-controls-bg-color);
|
|
77
77
|
--code-block-text-controls-bg-color: var(--code-block-controls-bg-color);
|
|
78
|
-
--code-block-controls-padding: var(--spacing-
|
|
78
|
+
--code-block-controls-padding: var(--spacing-xxs);
|
|
79
79
|
--code-block-controls-height: 20px;
|
|
80
80
|
--code-block-controls-width: 20px;
|
|
81
81
|
|
|
@@ -78,6 +78,7 @@ const DropdownWrapper = styled_components_1.default.div `
|
|
|
78
78
|
text-decoration: none;
|
|
79
79
|
`;
|
|
80
80
|
const ChildrenWrapper = styled_components_1.default.div `
|
|
81
|
+
padding-top: var(--dropdown-menu-margin-top);
|
|
81
82
|
position: absolute;
|
|
82
83
|
top: ${({ placement }) => (placement === 'top' ? 'auto' : '100%')};
|
|
83
84
|
bottom: ${({ placement }) => (placement === 'top' ? '100%' : 'auto')};
|
|
@@ -25,6 +25,10 @@ const DropdownMenuWrapper = styled_components_1.default.ul `
|
|
|
25
25
|
line-height: var(--dropdown-menu-line-height);
|
|
26
26
|
color: var(--dropdown-menu-text-color);
|
|
27
27
|
|
|
28
|
+
/* Make sure the spacing is not overriden by the markdown list styles */
|
|
29
|
+
--md-list-margin: 0;
|
|
30
|
+
--md-list-left-padding: var(--dropdown-menu-padding);
|
|
31
|
+
|
|
28
32
|
margin: 0;
|
|
29
33
|
min-width: var(--dropdown-menu-min-width);
|
|
30
34
|
max-width: var(--dropdown-menu-max-width);
|
|
@@ -11,6 +11,7 @@ exports.dropdown = (0, styled_components_1.css) `
|
|
|
11
11
|
--dropdown-menu-line-height: var(--line-height-base); // @presenter LineHeight
|
|
12
12
|
--dropdown-menu-text-color: var(--text-color-secondary); // @presenter Color
|
|
13
13
|
|
|
14
|
+
--dropdown-menu-margin-top: var(--spacing-xxs);
|
|
14
15
|
--dropdown-menu-min-width: 100px;
|
|
15
16
|
--dropdown-menu-max-width: 424px;
|
|
16
17
|
--dropdown-menu-max-height: 300px;
|
|
@@ -64,7 +64,7 @@ function Feedback(props) {
|
|
|
64
64
|
return (React.createElement(FeedbackWrapper, { "data-component-name": "Feedback/Feedback" },
|
|
65
65
|
React.createElement(FeedbackComponent, { settings: settings, onSubmit: (values) => {
|
|
66
66
|
submitFeedback({ type, values, path });
|
|
67
|
-
telemetry.send({ type: 'feedback.sent', payload: {
|
|
67
|
+
telemetry.send({ type: 'feedback.sent', payload: { feedbackType: type } });
|
|
68
68
|
} })));
|
|
69
69
|
};
|
|
70
70
|
return React.createElement(React.Fragment, { key: pathname }, renderFeedbackComponent());
|
|
@@ -20,13 +20,16 @@ function FilterCheckboxes({ filter, filterValuesCasing, showCounter = true, }) {
|
|
|
20
20
|
const telemetry = useTelemetry();
|
|
21
21
|
return (react_1.default.createElement(FilterCheckboxesWrapper, { "data-component-name": "Filter/FilterCheckboxes" },
|
|
22
22
|
react_1.default.createElement(FilterTitle_1.FilterTitle, { "data-translation-key": filter.titleTranslationKey }, translate(filter.titleTranslationKey, filter.title)),
|
|
23
|
-
react_1.default.createElement(FilterOptions_1.FilterOptions, null, filter.options.map(({ value, count }) => {
|
|
23
|
+
react_1.default.createElement(FilterOptions_1.FilterOptions, null, (filter.filteredOptions || filter.options).map(({ value, count }) => {
|
|
24
24
|
const id = 'filter--' + filter.property + '--' + value;
|
|
25
25
|
return (react_1.default.createElement(FilterCheckboxOption, { key: id, role: "link", onClick: () => {
|
|
26
26
|
filter.toggleOption(value);
|
|
27
27
|
telemetry.send({ type: 'filter_checkbox.toggled', payload: { id } });
|
|
28
28
|
} },
|
|
29
|
-
react_1.default.createElement(CheckboxIcon_1.CheckboxIcon, { checked: filter.selectedOptions
|
|
29
|
+
react_1.default.createElement(CheckboxIcon_1.CheckboxIcon, { checked: filter.selectedOptions instanceof Set
|
|
30
|
+
? filter.selectedOptions.has(value) ||
|
|
31
|
+
filter.selectedOptions.has(value === null || value === void 0 ? void 0 : value.toLowerCase())
|
|
32
|
+
: false }),
|
|
30
33
|
react_1.default.createElement(FilterOptionLabel_1.FilterOptionLabel, { "data-translation-key": value }, (0, utils_1.changeTextCasing)(translate(value), filterValuesCasing)),
|
|
31
34
|
showCounter && react_1.default.createElement(CounterTag_1.CounterTag, { borderless: true }, count)));
|
|
32
35
|
}))));
|
|
@@ -9,10 +9,9 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
9
9
|
const hooks_1 = require("../../core/hooks");
|
|
10
10
|
const LaunchIcon_1 = require("../../icons/LaunchIcon/LaunchIcon");
|
|
11
11
|
const Link_1 = require("../../components/Link/Link");
|
|
12
|
-
const Image_1 = require("../../components/Image/Image");
|
|
13
12
|
const utils_1 = require("../../core/utils");
|
|
13
|
+
const GenericIcon_1 = require("../../icons/GenericIcon/GenericIcon");
|
|
14
14
|
function FooterItem({ item, iconsOnly, className }) {
|
|
15
|
-
var _a, _b;
|
|
16
15
|
const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
17
16
|
const telemetry = useTelemetry();
|
|
18
17
|
const { translate } = useTranslate();
|
|
@@ -23,9 +22,7 @@ function FooterItem({ item, iconsOnly, className }) {
|
|
|
23
22
|
const iconWithoutLabel = Boolean(item.label === item.link && hasIcon);
|
|
24
23
|
return (react_1.default.createElement(FooterItemWrapper, { className: className, "data-component-name": "Footer/FooterItem", iconsOnly: iconsOnly, item: item }, item.type === 'separator' ? (react_1.default.createElement(FooterSeparator, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label))) : (react_1.default.createElement(FooterLink, { to: item.link, external: item.external, target: item.target, "data-testid": item.label, onClick: () => telemetry.send({ type: 'footer_item.clicked' }), "data-translation-key": item.labelTranslationKey },
|
|
25
24
|
hasIcon ? (react_1.default.createElement(FooterLinkIcon, { iconsOnly: iconsOnly },
|
|
26
|
-
react_1.default.createElement(
|
|
27
|
-
? `${item.label} icon`
|
|
28
|
-
: `${(_b = (_a = (item.icon || item.srcSet)) === null || _a === void 0 ? void 0 : _a.split('/').pop()) === null || _b === void 0 ? void 0 : _b.split('.')[0]} icon` }))) : null,
|
|
25
|
+
react_1.default.createElement(GenericIcon_1.GenericIcon, { icon: item.icon, srcSet: item.srcSet }))) : null,
|
|
29
26
|
!iconWithoutLabel ? translate(item.labelTranslationKey, item.label) : null,
|
|
30
27
|
item.external ? react_1.default.createElement(LaunchIcon_1.LaunchIcon, { size: "10px" }) : null))));
|
|
31
28
|
}
|
|
@@ -36,9 +33,9 @@ const FooterSeparator = styled_components_1.default.div `
|
|
|
36
33
|
opacity: var(--footer-separator-item-opacity);
|
|
37
34
|
`;
|
|
38
35
|
const FooterLinkIcon = styled_components_1.default.div `
|
|
36
|
+
--icon-width: var(--footer-item-icon-width);
|
|
37
|
+
--icon-height: var(--footer-item-icon-height);
|
|
39
38
|
display: inline-flex;
|
|
40
|
-
width: var(--footer-item-icon-width);
|
|
41
|
-
height: var(--footer-item-icon-height);
|
|
42
39
|
margin-right: ${({ iconsOnly }) => (iconsOnly ? '0' : 'var(--footer-item-icon-margin-right)')};
|
|
43
40
|
vertical-align: middle;
|
|
44
41
|
border: 1px solid var(--footer-item-icon-border-color);
|
|
@@ -28,8 +28,8 @@ exports.footer = (0, styled_components_1.css) `
|
|
|
28
28
|
--footer-link-padding-vertical: var(--spacing-xs); // @presenter Spacing
|
|
29
29
|
--footer-link-padding-horizontal: 0;
|
|
30
30
|
|
|
31
|
-
--footer-item-icon-width: var(--spacing-
|
|
32
|
-
--footer-item-icon-height: var(--spacing-
|
|
31
|
+
--footer-item-icon-width: var(--spacing-base); // @presenter Spacing
|
|
32
|
+
--footer-item-icon-height: var(--spacing-base); // @presenter Spacing
|
|
33
33
|
--footer-item-icon-margin-right: var(--spacing-sm); // @presenter Spacing
|
|
34
34
|
--footer-item-icon-border-color: var(--border-color-primary); // @presenter Color
|
|
35
35
|
--footer-item-icon-border-radius: 12px; // @presenter BorderRadius
|
|
@@ -30,6 +30,7 @@ exports.Image = Image;
|
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const utils_1 = require("../../core/utils");
|
|
33
|
+
const hooks_1 = require("../../core/hooks");
|
|
33
34
|
function Image(props) {
|
|
34
35
|
const { src, srcSet, alt, className, width, height, border, style, withLightbox, lightboxStyle } = props;
|
|
35
36
|
const lightboxContainerRef = (0, react_1.useRef)(null);
|
|
@@ -52,6 +53,7 @@ function Image(props) {
|
|
|
52
53
|
const handleCloseLightbox = (0, react_1.useCallback)(() => {
|
|
53
54
|
setLightboxImage(undefined);
|
|
54
55
|
}, []);
|
|
56
|
+
(0, hooks_1.useModalScrollLock)(!!lightboxImage);
|
|
55
57
|
(0, react_1.useEffect)(() => {
|
|
56
58
|
var _a;
|
|
57
59
|
if (lightboxImage) {
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Markdown = void 0;
|
|
27
27
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
28
|
-
const
|
|
28
|
+
const utils_1 = require("../../core/utils");
|
|
29
29
|
const baseTable_1 = require("../../components/Markdown/styles/baseTable");
|
|
30
30
|
const links_1 = require("../../components/Markdown/styles/links");
|
|
31
31
|
const headingAnchor_1 = require("../../components/Markdown/styles/headingAnchor");
|
|
@@ -130,37 +130,37 @@ exports.Markdown = styled_components_1.default.main.attrs(({ className }) => ({
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
h1.md {
|
|
133
|
-
${(0,
|
|
133
|
+
${(0, utils_1.typography)('h1')};
|
|
134
134
|
margin: var(--h1-margin-top) 0 var(--h1-margin-bottom) 0;
|
|
135
135
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
h2.md {
|
|
139
|
-
${(0,
|
|
139
|
+
${(0, utils_1.typography)('h2')};
|
|
140
140
|
margin: var(--h2-margin-top) 0 var(--h2-margin-bottom) 0;
|
|
141
141
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
h3.md {
|
|
145
|
-
${(0,
|
|
145
|
+
${(0, utils_1.typography)('h3')};
|
|
146
146
|
margin: var(--h3-margin-top) 0 var(--h3-margin-bottom) 0;
|
|
147
147
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
h4.md {
|
|
151
|
-
${(0,
|
|
151
|
+
${(0, utils_1.typography)('h4')};
|
|
152
152
|
margin: var(--h4-margin-top) 0 var(--h4-margin-bottom) 0;
|
|
153
153
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
h5.md {
|
|
157
|
-
${(0,
|
|
157
|
+
${(0, utils_1.typography)('h5')};
|
|
158
158
|
margin: var(--h5-margin-top) 0 var(--h5-margin-bottom) 0;
|
|
159
159
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
h6.md {
|
|
163
|
-
${(0,
|
|
163
|
+
${(0, utils_1.typography)('h6')};
|
|
164
164
|
margin: var(--h6-margin-top) 0 var(--h6-margin-bottom) 0;
|
|
165
165
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
166
166
|
}
|
|
@@ -257,8 +257,8 @@ exports.Markdown = styled_components_1.default.main.attrs(({ className }) => ({
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
ul,
|
|
261
|
-
ol {
|
|
260
|
+
ul.md,
|
|
261
|
+
ol.md {
|
|
262
262
|
padding-left: var(--md-list-left-padding);
|
|
263
263
|
margin: var(--md-list-margin);
|
|
264
264
|
|
|
@@ -36,6 +36,7 @@ const constants_1 = require("../../core/constants");
|
|
|
36
36
|
const utils_1 = require("../../core/utils");
|
|
37
37
|
const ArrowRightIcon_1 = require("../../icons/ArrowRightIcon/ArrowRightIcon");
|
|
38
38
|
const Badge_1 = require("../../components/Badge/Badge");
|
|
39
|
+
const GenericIcon_1 = require("../../icons/GenericIcon/GenericIcon");
|
|
39
40
|
function MenuItem(props) {
|
|
40
41
|
var _a;
|
|
41
42
|
const { item, depth, className, onClick } = props;
|
|
@@ -75,7 +76,7 @@ function MenuItem(props) {
|
|
|
75
76
|
const httpColor = item.deprecated ? 'http-deprecated' : item.httpVerb;
|
|
76
77
|
const label = item.label && (react_1.default.createElement(MenuItemLabelWrapper, { active: item.active, deprecated: item.deprecated, depth: depth, withChevron: hasChevron, isSeparator: isSeparator, onClick: handleOnClick, onKeyDown: handleExpandOnEnter, ref: labelRef, role: item.link ? 'none' : 'link', tabIndex: !item.link ? 0 : undefined, "data-testid": "menu-item-label" },
|
|
77
78
|
hasChevron ? react_1.default.createElement(ChevronWrapper, null, chevron) : null,
|
|
78
|
-
|
|
79
|
+
react_1.default.createElement(MenuItemIcon, { icon: item.icon, srcSet: item.srcSet }),
|
|
79
80
|
react_1.default.createElement(MenuItemLabelTextWrapper, null,
|
|
80
81
|
react_1.default.createElement(MenuItemLabel, null,
|
|
81
82
|
react_1.default.createElement("span", null, translate(item.labelTranslationKey, item.label)), (_a = item.badges) === null || _a === void 0 ? void 0 :
|
|
@@ -240,11 +241,10 @@ const MenuItemSubLabel = styled_components_1.default.div `
|
|
|
240
241
|
font-size: var(--menu-item-sublabel-font-size);
|
|
241
242
|
font-family: var(--menu-item-sublabel-font-family);
|
|
242
243
|
`;
|
|
243
|
-
const MenuItemIcon = styled_components_1.default.
|
|
244
|
-
width: var(--menu-item-icon-size);
|
|
245
|
-
height: var(--menu-item-icon-size);
|
|
244
|
+
const MenuItemIcon = (0, styled_components_1.default)(GenericIcon_1.GenericIcon) `
|
|
245
|
+
--icon-width: var(--menu-item-icon-size);
|
|
246
|
+
--icon-height: var(--menu-item-icon-size);
|
|
246
247
|
margin: var(--menu-item-icon-margin);
|
|
247
|
-
border-radius: var(--menu-item-icon-border-radius);
|
|
248
248
|
flex-shrink: 0;
|
|
249
249
|
overflow: hidden;
|
|
250
250
|
`;
|
|
@@ -71,7 +71,7 @@ exports.menu = (0, styled_components_1.css) `
|
|
|
71
71
|
* @tokens Menu item icons
|
|
72
72
|
*/
|
|
73
73
|
--menu-item-icon-size: var(--spacing-base);
|
|
74
|
-
--menu-item-icon-margin:
|
|
74
|
+
--menu-item-icon-margin: 0 var(--spacing-xxs) 0 0;
|
|
75
75
|
--menu-item-icon-border-radius: 100%;
|
|
76
76
|
|
|
77
77
|
--menu-item-external-icon-size: 10px;
|
|
@@ -129,7 +129,9 @@ exports.mobileMenu = (0, styled_components_1.css) `
|
|
|
129
129
|
/**
|
|
130
130
|
* @tokens Mobile Menu
|
|
131
131
|
* */
|
|
132
|
+
/* Fallback for older browsers. dvh accounts for dynamic UI elements like mobile address bars */
|
|
132
133
|
--menu-mobile-height: calc(100vh - var(--navbar-height));
|
|
134
|
+
--menu-mobile-height: calc(100dvh - var(--navbar-height));
|
|
133
135
|
--menu-mobile-width: 100%;
|
|
134
136
|
--menu-mobile-z-index: var(--z-index-raised);
|
|
135
137
|
--menu-mobile-left: 0;
|
|
@@ -1,34 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.NavbarItem = NavbarItem;
|
|
30
7
|
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const styled_components_1 =
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
9
|
const react_router_dom_1 = require("react-router-dom");
|
|
33
10
|
const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
|
|
34
11
|
const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
|
|
@@ -37,6 +14,7 @@ const hooks_1 = require("../../core/hooks");
|
|
|
37
14
|
const LaunchIcon_1 = require("../../icons/LaunchIcon/LaunchIcon");
|
|
38
15
|
const Link_1 = require("../../components/Link/Link");
|
|
39
16
|
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
17
|
+
const GenericIcon_1 = require("../../icons/GenericIcon/GenericIcon");
|
|
40
18
|
function NavbarItem({ navItem, className }) {
|
|
41
19
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
42
20
|
const { useTranslate, useL10nConfig, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
@@ -50,7 +28,7 @@ function NavbarItem({ navItem, className }) {
|
|
|
50
28
|
const isActive = pathname ===
|
|
51
29
|
(0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(normalizedPath, defaultLocale, currentLocale, locales));
|
|
52
30
|
const itemContent = (react_1.default.createElement(NavbarMenuItem, { as: item.link ? Link_1.Link : undefined, active: isActive, className: className, onClick: () => telemetry.send({ type: 'navbar.menu_item_clicked', payload: { type: item.type } }), external: item.external, target: item.target, to: item.link },
|
|
53
|
-
react_1.default.createElement(NavbarIcon, {
|
|
31
|
+
react_1.default.createElement(NavbarIcon, { icon: item.icon, srcSet: item.srcSet }),
|
|
54
32
|
react_1.default.createElement(NavbarLabel, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label)),
|
|
55
33
|
item.external ? react_1.default.createElement(ExternalLinkIcon, { size: "10px" }) : null));
|
|
56
34
|
if (navItem.items) {
|
|
@@ -60,7 +38,7 @@ function NavbarItem({ navItem, className }) {
|
|
|
60
38
|
if (item.type !== 'link' && item.type !== 'separator')
|
|
61
39
|
return null;
|
|
62
40
|
return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: `${item.label}_${index}`, to: item.link, separator: item.type === 'separator', separatorLine: item.separatorLine, "data-translation-key": item.labelTranslationKey, external: item.external },
|
|
63
|
-
react_1.default.createElement(NavbarIcon, {
|
|
41
|
+
react_1.default.createElement(NavbarIcon, { icon: item.icon, srcSet: item.srcSet }),
|
|
64
42
|
react_1.default.createElement(NavbarLabel, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label)),
|
|
65
43
|
item.external ? react_1.default.createElement(ExternalLinkIcon, { size: "10px" }) : null));
|
|
66
44
|
});
|
|
@@ -100,19 +78,10 @@ const NavbarLabel = styled_components_1.default.span `
|
|
|
100
78
|
cursor: pointer;
|
|
101
79
|
vertical-align: middle;
|
|
102
80
|
`;
|
|
103
|
-
const NavbarIcon = styled_components_1.default.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
width: var(--navbar-item-icon-width);
|
|
108
|
-
height: var(--navbar-item-icon-height);
|
|
109
|
-
display: inline-block;
|
|
110
|
-
background-size: contain;
|
|
111
|
-
margin-right: var(--navbar-item-icon-margin-right);
|
|
112
|
-
vertical-align: middle;
|
|
113
|
-
background-position: center;
|
|
114
|
-
background-repeat: no-repeat;
|
|
115
|
-
`}
|
|
81
|
+
const NavbarIcon = (0, styled_components_1.default)(GenericIcon_1.GenericIcon) `
|
|
82
|
+
--icon-width: var(--navbar-item-icon-width);
|
|
83
|
+
--icon-height: var(--navbar-item-icon-height);
|
|
84
|
+
margin-right: var(--navbar-item-icon-margin-right);
|
|
116
85
|
`;
|
|
117
86
|
const ExternalLinkIcon = (0, styled_components_1.default)(LaunchIcon_1.LaunchIcon) `
|
|
118
87
|
margin-left: 5px;
|
|
@@ -37,8 +37,8 @@ exports.navbar = (0, styled_components_1.css) `
|
|
|
37
37
|
--navbar-item-bg-color-hover: var(--bg-color);
|
|
38
38
|
--navbar-item-bottom-border-hover: none;
|
|
39
39
|
|
|
40
|
-
--navbar-item-icon-width: 1.
|
|
41
|
-
--navbar-item-icon-height: 1.
|
|
40
|
+
--navbar-item-icon-width: 1.25em; // @presenter Spacing
|
|
41
|
+
--navbar-item-icon-height: 1.25em; // @presenter Spacing
|
|
42
42
|
--navbar-item-icon-margin-right: 0.5em; // @presenter Spacing
|
|
43
43
|
|
|
44
44
|
--navbar-logo-height: var(--logo-height);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.PageActions = PageActions;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
41
|
+
const PageActionsMenuItem_1 = require("../../components/PageActions/PageActionsMenuItem");
|
|
42
|
+
const Link_1 = require("../../components/Link/Link");
|
|
43
|
+
const ButtonGroup_1 = require("../../components/Button/ButtonGroup");
|
|
44
|
+
const Button_1 = require("../../components/Button/Button");
|
|
45
|
+
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
46
|
+
const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
|
|
47
|
+
const Spinner_1 = require("../../icons/Spinner/Spinner");
|
|
48
|
+
const CheckmarkFilledIcon_1 = require("../../icons/CheckmarkFilledIcon/CheckmarkFilledIcon");
|
|
49
|
+
const hooks_1 = require("../../core/hooks");
|
|
50
|
+
const ACTION_DONE_DISPLAY_DURATION = 1000;
|
|
51
|
+
function PageActions(props) {
|
|
52
|
+
const { pageSlug } = props;
|
|
53
|
+
const actions = (0, hooks_1.usePageActions)(pageSlug || '/');
|
|
54
|
+
const [actionState, setActionState] = (0, react_1.useState)('idle');
|
|
55
|
+
if (!actions.length) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const buttonAction = actions[0];
|
|
59
|
+
const handleActionClick = (action) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
if (!('onClick' in action)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
setActionState('processing');
|
|
64
|
+
yield action.onClick();
|
|
65
|
+
setActionState('done');
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
setActionState('idle');
|
|
68
|
+
}, ACTION_DONE_DISPLAY_DURATION);
|
|
69
|
+
});
|
|
70
|
+
const menuItems = actions.map((action) => ({
|
|
71
|
+
content: 'link' in action ? (react_1.default.createElement(LinkMenuItem, { to: action.link, external: true },
|
|
72
|
+
react_1.default.createElement(PageActionsMenuItem_1.PageActionsMenuItem, { pageAction: action }))) : (react_1.default.createElement(PageActionsMenuItem_1.PageActionsMenuItem, { pageAction: action })),
|
|
73
|
+
onAction: 'onClick' in action ? () => handleActionClick(action) : undefined,
|
|
74
|
+
}));
|
|
75
|
+
return (react_1.default.createElement(PageActionsWrapper, null,
|
|
76
|
+
react_1.default.createElement(ButtonGroup_1.ButtonGroup, { variant: "outlined", size: "medium" },
|
|
77
|
+
react_1.default.createElement(Button_1.Button, { icon: renderIcon(buttonAction, actionState), to: 'link' in buttonAction ? buttonAction.link : undefined, external: true, onClick: () => handleActionClick(buttonAction) }, buttonAction.buttonText),
|
|
78
|
+
actions.length > 1 ? (react_1.default.createElement(Dropdown_1.Dropdown, { withArrow: true, trigger: react_1.default.createElement(Button_1.Button, null), placement: "bottom", alignment: "end" },
|
|
79
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { items: menuItems }))) : null)));
|
|
80
|
+
}
|
|
81
|
+
function renderIcon(buttonAction, actionState) {
|
|
82
|
+
switch (actionState) {
|
|
83
|
+
case 'processing':
|
|
84
|
+
return react_1.default.createElement(Spinner_1.Spinner, { color: "var(--page-actions-processing-icon-color)" });
|
|
85
|
+
case 'done':
|
|
86
|
+
return react_1.default.createElement(CheckmarkFilledIcon_1.CheckmarkFilledIcon, { color: "var(--page-actions-done-icon-color)" });
|
|
87
|
+
default:
|
|
88
|
+
return react_1.default.createElement(buttonAction.iconComponent, null);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const PageActionsWrapper = styled_components_1.default.div `
|
|
92
|
+
margin-left: auto;
|
|
93
|
+
padding-left: var(--page-actions-padding-left);
|
|
94
|
+
--button-color: var(--page-actions-button-text-color);
|
|
95
|
+
|
|
96
|
+
.button-group-size-medium .button.button-size-medium {
|
|
97
|
+
--button-icon-left-padding: var(--page-actions-button-padding);
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
const LinkMenuItem = (0, styled_components_1.default)(Link_1.Link) `
|
|
101
|
+
text-decoration: none;
|
|
102
|
+
--link-decoration-hover: none;
|
|
103
|
+
`;
|
|
104
|
+
//# sourceMappingURL=PageActions.js.map
|