@redocly/theme 0.58.0-next.0 → 0.58.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Buttons/CopyButton.d.ts +1 -0
- package/lib/components/Buttons/CopyButton.js +3 -3
- package/lib/components/Catalog/Catalog.d.ts +2 -2
- package/lib/components/Catalog/Catalog.js +19 -5
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +15 -14
- package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntitiesEmptyState.js +32 -11
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +7 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +13 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +0 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +6 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +0 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +6 -10
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +5 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.d.ts +23 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +27 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +3 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +11 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +2 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +9 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +66 -30
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -0
- package/lib/components/Catalog/CatalogEntityIcon.js +31 -14
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +19 -6
- package/lib/components/Catalog/CatalogEntityTypeTag.js +9 -3
- package/lib/components/Catalog/CatalogSelector.d.ts +1 -1
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +1 -1
- package/lib/components/Catalog/CatalogTableView/CatalogEntityRelationCell.d.ts +1 -1
- package/lib/components/Catalog/CatalogTableView/CatalogEntityRelationCell.js +2 -2
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
- package/lib/components/Catalog/variables.js +10 -7
- package/lib/components/CatalogClassic/CatalogClassic.js +9 -2
- package/lib/components/CodeBlock/CodeBlock.d.ts +5 -12
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +3 -3
- package/lib/components/CodeBlock/CodeBlockDropdown.d.ts +2 -2
- package/lib/components/CodeBlock/CodeBlockDropdown.js +4 -13
- package/lib/components/CodeBlock/CodeBlockTabs.d.ts +2 -2
- package/lib/components/CodeBlock/CodeBlockTabs.js +4 -3
- package/lib/components/Filter/FilterContent.d.ts +1 -1
- package/lib/components/Search/SearchDialog.js +12 -6
- package/lib/components/Search/SearchFilter.js +2 -1
- package/lib/components/Tooltip/Tooltip.js +7 -9
- package/lib/components/Tooltip/TooltipWrapper.js +1 -1
- package/lib/core/constants/catalog.d.ts +2 -1
- package/lib/core/constants/catalog.js +40 -27
- package/lib/core/contexts/CodeSnippetContext.d.ts +14 -6
- package/lib/core/contexts/CodeSnippetContext.js +57 -14
- package/lib/core/hooks/catalog/useCatalogEntitySchema.d.ts +11 -0
- package/lib/core/hooks/catalog/useCatalogEntitySchema.js +39 -0
- package/lib/core/hooks/catalog/useCatalogTableViewRow.js +1 -1
- package/lib/core/hooks/use-active-section-id.js +4 -0
- package/lib/core/hooks/use-codeblock-tabs-controls.d.ts +2 -2
- package/lib/core/hooks/use-control.js +17 -2
- package/lib/core/hooks/use-local-state.js +22 -18
- package/lib/core/hooks/use-telemetry-fallback.d.ts +5 -0
- package/lib/core/hooks/use-telemetry-fallback.js +5 -0
- package/lib/core/openapi/index.d.ts +8 -4
- package/lib/core/openapi/index.js +9 -9
- package/lib/core/styles/global.js +19 -0
- package/lib/core/types/catalog.d.ts +8 -1
- package/lib/core/types/filter.d.ts +1 -1
- package/lib/core/types/hooks.d.ts +2 -2
- 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/open-api-info.d.ts +34 -0
- package/lib/core/types/open-api-info.js +3 -0
- package/lib/core/types/open-api-server.d.ts +1 -0
- package/lib/core/types/search.d.ts +2 -3
- package/lib/core/utils/change-text-casing.d.ts +1 -1
- package/lib/core/utils/change-text-casing.js +3 -0
- package/lib/core/utils/urls.js +1 -1
- package/lib/ext/configure.d.ts +1 -0
- package/lib/ext/configure.js +4 -1
- package/lib/ext/useConfigureReplay.d.ts +19 -0
- package/lib/ext/useConfigureReplay.js +64 -0
- package/lib/icons/HierarchyIcon/HierarchyIcon.d.ts +9 -0
- package/lib/icons/HierarchyIcon/HierarchyIcon.js +23 -0
- package/lib/icons/NoteIcon/NoteIcon.d.ts +9 -0
- package/lib/icons/NoteIcon/NoteIcon.js +24 -0
- package/lib/icons/ShareIcon/ShareIcon.d.ts +9 -0
- package/lib/icons/ShareIcon/ShareIcon.js +22 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/layouts/DocumentationLayout.js +1 -3
- package/lib/markdoc/components/CodeGroup/CodeGroup.js +49 -27
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tabs.js +3 -2
- package/package.json +5 -4
- package/src/components/Buttons/CopyButton.tsx +4 -1
- package/src/components/Catalog/Catalog.tsx +32 -7
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +20 -19
- package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +39 -16
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +53 -12
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +0 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +8 -7
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +0 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +15 -14
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +6 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +125 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +30 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +4 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +3 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -13
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +84 -23
- package/src/components/Catalog/CatalogEntityIcon.tsx +53 -18
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +19 -8
- package/src/components/Catalog/CatalogEntityTypeTag.tsx +11 -3
- package/src/components/Catalog/CatalogSelector.tsx +1 -1
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +1 -1
- package/src/components/Catalog/CatalogTableView/CatalogEntityRelationCell.tsx +3 -3
- package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
- package/src/components/Catalog/variables.ts +10 -7
- package/src/components/CatalogClassic/CatalogClassic.tsx +26 -10
- package/src/components/CodeBlock/CodeBlock.tsx +5 -11
- package/src/components/CodeBlock/CodeBlockControls.tsx +3 -6
- package/src/components/CodeBlock/CodeBlockDropdown.tsx +11 -20
- package/src/components/CodeBlock/CodeBlockTabs.tsx +8 -8
- package/src/components/Filter/FilterContent.tsx +3 -1
- package/src/components/Search/SearchDialog.tsx +14 -5
- package/src/components/Search/SearchFilter.tsx +2 -1
- package/src/components/Tooltip/Tooltip.tsx +6 -8
- package/src/components/Tooltip/TooltipWrapper.tsx +1 -1
- package/src/core/constants/catalog.ts +41 -27
- package/src/core/contexts/CodeSnippetContext.tsx +54 -18
- package/src/core/hooks/catalog/useCatalogEntitySchema.ts +46 -0
- package/src/core/hooks/catalog/useCatalogTableViewRow.ts +1 -1
- package/src/core/hooks/use-active-section-id.ts +6 -0
- package/src/core/hooks/use-codeblock-tabs-controls.ts +2 -2
- package/src/core/hooks/use-control.ts +21 -3
- package/src/core/hooks/use-local-state.ts +28 -19
- package/src/core/hooks/use-telemetry-fallback.ts +5 -0
- package/src/core/openapi/index.ts +8 -4
- package/src/core/styles/global.ts +19 -0
- package/src/core/types/catalog.ts +10 -2
- package/src/core/types/filter.ts +3 -1
- package/src/core/types/hooks.ts +6 -1
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +3 -0
- package/src/core/types/open-api-info.ts +34 -0
- package/src/core/types/open-api-server.ts +1 -0
- package/src/core/types/search.ts +3 -3
- package/src/core/utils/change-text-casing.ts +8 -1
- package/src/core/utils/urls.ts +2 -1
- package/src/ext/configure.ts +5 -1
- package/src/ext/useConfigureReplay.ts +84 -0
- package/src/icons/HierarchyIcon/HierarchyIcon.tsx +32 -0
- package/src/icons/NoteIcon/NoteIcon.tsx +35 -0
- package/src/icons/ShareIcon/ShareIcon.tsx +23 -0
- package/src/index.ts +2 -0
- package/src/layouts/DocumentationLayout.tsx +3 -10
- package/src/markdoc/components/CodeGroup/CodeGroup.tsx +81 -52
- package/src/markdoc/components/Tabs/Tabs.tsx +10 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.d.ts +0 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.js +0 -32
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +0 -46
|
@@ -4,7 +4,7 @@ import type { ShikiTransformer } from '@shikijs/types';
|
|
|
4
4
|
import type { Callback, TFunction as TFunc } from 'i18next';
|
|
5
5
|
import type { To, Location, NavigateFunction } from 'react-router-dom';
|
|
6
6
|
import type { CatalogConfig, ProductUiConfig } from '../../config';
|
|
7
|
-
import type { UseCatalogResponse, CatalogApiResults, CatalogApiParams, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse } from './catalog';
|
|
7
|
+
import type { UseCatalogResponse, CatalogApiResults, CatalogApiParams, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, CatalogViewMode } from './catalog';
|
|
8
8
|
import type { UserMenuData } from './user-menu';
|
|
9
9
|
import type { ItemState } from './sidebar';
|
|
10
10
|
import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem } from './search';
|
|
@@ -112,7 +112,7 @@ export type ThemeHooks = {
|
|
|
112
112
|
prevPage?: ResolvedNavItemWithLink;
|
|
113
113
|
nextPage?: ResolvedNavItemWithLink;
|
|
114
114
|
} | undefined;
|
|
115
|
-
useCatalog: (config?: CatalogEntityConfig, entitiesCounterInitial?: number) => UseCatalogResponse;
|
|
115
|
+
useCatalog: (config?: CatalogEntityConfig, entitiesCounterInitial?: number, initialViewMode?: CatalogViewMode) => UseCatalogResponse;
|
|
116
116
|
useCatalogSort: () => UseCatalogSortResponse;
|
|
117
117
|
useCatalogSearch: () => UseCatalogSearchResponse;
|
|
118
118
|
useFetchCatalogEntities: (params: CatalogApiParams, initialData?: BffCatalogEntityList) => CatalogApiResults<BffCatalogEntity, BffCatalogEntityList>;
|
package/lib/core/types/index.js
CHANGED
|
@@ -32,4 +32,5 @@ __exportStar(require("./open-api-server"), exports);
|
|
|
32
32
|
__exportStar(require("./marker"), exports);
|
|
33
33
|
__exportStar(require("./code-walkthrough"), exports);
|
|
34
34
|
__exportStar(require("./page-actions"), exports);
|
|
35
|
+
__exportStar(require("./open-api-info"), exports);
|
|
35
36
|
//# sourceMappingURL=index.js.map
|
package/lib/core/types/l10n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TOptions } from 'i18next';
|
|
2
|
-
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label';
|
|
2
|
+
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type OpenAPIInfo = {
|
|
2
|
+
title: string;
|
|
3
|
+
version: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
summary?: string;
|
|
6
|
+
termsOfService?: string;
|
|
7
|
+
contact?: {
|
|
8
|
+
name?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
email?: string;
|
|
11
|
+
};
|
|
12
|
+
license?: {
|
|
13
|
+
name: string;
|
|
14
|
+
url?: string;
|
|
15
|
+
identifier?: string;
|
|
16
|
+
};
|
|
17
|
+
externalDocs?: {
|
|
18
|
+
description?: string;
|
|
19
|
+
url: string;
|
|
20
|
+
};
|
|
21
|
+
'x-logo'?: {
|
|
22
|
+
url?: string;
|
|
23
|
+
backgroundColor?: string;
|
|
24
|
+
altText?: string;
|
|
25
|
+
href?: string;
|
|
26
|
+
};
|
|
27
|
+
'x-metadata'?: {
|
|
28
|
+
apiId?: string;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
'x-seo'?: {
|
|
32
|
+
title?: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -13,7 +13,7 @@ export type OperationParameter = {
|
|
|
13
13
|
example: string | undefined;
|
|
14
14
|
enum: string[] | undefined;
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
16
|
+
export type SearchHit = {
|
|
17
17
|
id: string;
|
|
18
18
|
url: string;
|
|
19
19
|
title: string | string[];
|
|
@@ -24,7 +24,6 @@ export type SearchDocument = {
|
|
|
24
24
|
deprecated?: boolean;
|
|
25
25
|
security?: string[];
|
|
26
26
|
parameters?: OperationParameter[];
|
|
27
|
-
metadata?: Record<string, any>;
|
|
28
27
|
version?: string;
|
|
29
28
|
versionFolderId?: string;
|
|
30
29
|
isDefaultVersion?: boolean;
|
|
@@ -48,7 +47,7 @@ export type ParameterHighlight = {
|
|
|
48
47
|
path: string[];
|
|
49
48
|
};
|
|
50
49
|
export type SearchItemData = {
|
|
51
|
-
document:
|
|
50
|
+
document: SearchHit;
|
|
52
51
|
highlight: Record<string, string> & {
|
|
53
52
|
parameters?: ParameterHighlight[];
|
|
54
53
|
path?: string[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
type Casing = 'original' | 'lowercase' | 'uppercase' | 'sentence';
|
|
2
|
-
export declare function changeTextCasing(str: string, casing?: Casing): string | undefined;
|
|
2
|
+
export declare function changeTextCasing(str: string, casing?: Casing | ((str: string) => string)): string | undefined;
|
|
3
3
|
export {};
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.changeTextCasing = changeTextCasing;
|
|
4
4
|
function changeTextCasing(str, casing = 'original') {
|
|
5
|
+
if (casing instanceof Function) {
|
|
6
|
+
return casing(str);
|
|
7
|
+
}
|
|
5
8
|
if (casing === 'original' || !str)
|
|
6
9
|
return str;
|
|
7
10
|
if (casing === 'lowercase') {
|
package/lib/core/utils/urls.js
CHANGED
|
@@ -56,7 +56,7 @@ function addLeadingSlash(url) {
|
|
|
56
56
|
return url.startsWith('/') ? url : `/${url}`;
|
|
57
57
|
}
|
|
58
58
|
function removeTrailingSlash(url) {
|
|
59
|
-
return url.endsWith('/') ? url.substring(0, url.length - 1) : url;
|
|
59
|
+
return url.endsWith('/') && url !== '/' ? url.substring(0, url.length - 1) : url;
|
|
60
60
|
}
|
|
61
61
|
function removeLeadingSlash(url) {
|
|
62
62
|
return url.startsWith('/') ? url.substring(1) : url;
|
package/lib/ext/configure.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export type ConfigureRequestValues = {
|
|
|
18
18
|
cookie?: Record<string, string>;
|
|
19
19
|
security?: SecurityDetails;
|
|
20
20
|
envVariables?: Record<string, string>;
|
|
21
|
+
serverVariables?: Record<string, string>;
|
|
21
22
|
};
|
|
22
23
|
export type ConfigureServerRequestValues = {
|
|
23
24
|
[serverUrl: string]: ConfigureRequestValues;
|
package/lib/ext/configure.js
CHANGED
|
@@ -37,13 +37,16 @@ function configure(_context) {
|
|
|
37
37
|
// envVariables: {
|
|
38
38
|
// customLocation: 'prod'
|
|
39
39
|
// },
|
|
40
|
+
// serverVariables: {
|
|
41
|
+
// version: 'v1',
|
|
42
|
+
// },
|
|
40
43
|
// };
|
|
41
44
|
// const { servers } = _context;
|
|
42
45
|
// const serverRequestValues: ConfigureServerRequestValues = {};
|
|
43
46
|
// for (const server of servers) {
|
|
44
47
|
// if (server.url === 'https://dev.api.fake-museum-example.com') {
|
|
45
48
|
// serverRequestValues[server.url] = exampleDevRequestValues;
|
|
46
|
-
// } else if (server.url === 'https://api.fake-museum-example.com') {
|
|
49
|
+
// } else if (server.url === 'https://api.fake-museum-example.com/{version}') {
|
|
47
50
|
// serverRequestValues[server.url] = exampleProdRequestValues;
|
|
48
51
|
// } else {
|
|
49
52
|
// serverRequestValues[server.url] = exampleDefaultRequestValues;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConfigureRequestValues, ConfigureServerRequestValues } from '../ext/configure';
|
|
2
|
+
import type { UserClaims, OpenAPIServer, OpenAPIInfo } from '../core/types';
|
|
3
|
+
type ContextProps = {
|
|
4
|
+
operation: {
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
operationId: string;
|
|
8
|
+
href: string;
|
|
9
|
+
method: string;
|
|
10
|
+
};
|
|
11
|
+
info: OpenAPIInfo;
|
|
12
|
+
servers: OpenAPIServer[];
|
|
13
|
+
userClaims: UserClaims;
|
|
14
|
+
};
|
|
15
|
+
export declare function useConfigureReplay(context: ContextProps, isOpened: boolean): {
|
|
16
|
+
config: ConfigureRequestValues | ConfigureServerRequestValues | null | undefined;
|
|
17
|
+
refresh: () => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.useConfigureReplay = useConfigureReplay;
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
function getReplayConfiguration(_context) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
// Customize this function to fetch replay configuration from your API endpoint
|
|
17
|
+
// STEP 1: Uncomment the fetch code below and update the URL to your API endpoint
|
|
18
|
+
// try {
|
|
19
|
+
// const response = await fetch(`/api/replay-config/${_context.operation.operationId}`, {
|
|
20
|
+
// method: 'GET',
|
|
21
|
+
// headers: {
|
|
22
|
+
// 'Content-Type': 'application/json',
|
|
23
|
+
// },
|
|
24
|
+
// });
|
|
25
|
+
// if (!response.ok) {
|
|
26
|
+
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
27
|
+
// }
|
|
28
|
+
// const { token } = await response.json();
|
|
29
|
+
//
|
|
30
|
+
// return {
|
|
31
|
+
// security: {
|
|
32
|
+
// token: {
|
|
33
|
+
// access_token: token,
|
|
34
|
+
// }
|
|
35
|
+
// }
|
|
36
|
+
// };
|
|
37
|
+
// } catch (error) {
|
|
38
|
+
// console.warn('Failed to fetch replay configuration:', error);
|
|
39
|
+
// throw error;
|
|
40
|
+
// }
|
|
41
|
+
// STEP 2: Remove this return null statement once you've implemented the fetch above
|
|
42
|
+
return null;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function useConfigureReplay(context, isOpened) {
|
|
46
|
+
const [config, setConfig] = (0, react_1.useState)();
|
|
47
|
+
const refresh = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
try {
|
|
49
|
+
const result = yield getReplayConfiguration(context);
|
|
50
|
+
setConfig(result);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.warn('Failed to configure replay for operation:', context.operation.operationId, error);
|
|
54
|
+
}
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
}), []);
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
if (isOpened) {
|
|
59
|
+
refresh();
|
|
60
|
+
}
|
|
61
|
+
}, [isOpened, refresh]);
|
|
62
|
+
return { config, refresh };
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=useConfigureReplay.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const HierarchyIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,23 @@
|
|
|
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.HierarchyIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const utils_1 = require("../../core/utils");
|
|
10
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18" }, props),
|
|
11
|
+
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.0625 7.3125H15.1875C15.4858 7.31216 15.7717 7.19352 15.9826 6.98262C16.1935 6.77171 16.3122 6.48576 16.3125 6.1875V2.8125C16.3122 2.51424 16.1935 2.22829 15.9826 2.01738C15.7717 1.80648 15.4858 1.68784 15.1875 1.6875H2.8125C2.51424 1.68784 2.22829 1.80648 2.01738 2.01738C1.80648 2.22829 1.68784 2.51424 1.6875 2.8125V6.1875C1.68784 6.48576 1.80648 6.77171 2.01738 6.98262C2.22829 7.19352 2.51424 7.31216 2.8125 7.3125H3.9375H5.0625ZM15.1875 2.8125H2.8125V6.1875H15.1875V2.8125Z" }),
|
|
12
|
+
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.1875 10.6875H9.5625C9.26424 10.6878 8.97829 10.8065 8.76738 11.0174C8.55648 11.2283 8.43784 11.5142 8.4375 11.8125V12.9375H5.0625V10.4546V9.5625V7.3125H3.9375V10.4546V12.9375C3.93784 13.2358 4.05648 13.5217 4.26738 13.7326C4.47829 13.9435 4.76424 14.0622 5.0625 14.0625H8.4375V15.1875C8.43784 15.4858 8.55648 15.7717 8.76738 15.9826C8.97829 16.1935 9.26424 16.3122 9.5625 16.3125H15.1875C15.4858 16.3122 15.7717 16.1935 15.9826 15.9826C16.1935 15.7717 16.3122 15.4858 16.3125 15.1875V11.8125C16.3122 11.5142 16.1935 11.2283 15.9826 11.0174C15.7717 10.8065 15.4858 10.6878 15.1875 10.6875ZM9.5625 11.8125V15.1875H15.1875V11.8125H9.5625Z" })));
|
|
13
|
+
exports.HierarchyIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
14
|
+
'data-component-name': 'icons/HierarchyIcon/HierarchyIcon',
|
|
15
|
+
})) `
|
|
16
|
+
path {
|
|
17
|
+
fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
height: ${({ size }) => size || '16px'};
|
|
21
|
+
width: ${({ size }) => size || '16px'};
|
|
22
|
+
`;
|
|
23
|
+
//# sourceMappingURL=HierarchyIcon.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const NoteIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,24 @@
|
|
|
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.NoteIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const utils_1 = require("../../core/utils");
|
|
10
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "8", height: "12", viewBox: "0 0 8 12", fill: "none" }, props),
|
|
11
|
+
react_1.default.createElement("path", { d: "M7.6375 3.4875L5.0125 0.8625C4.9375 0.7875 4.8625 0.75 4.75 0.75H1C0.5875 0.75 0.25 1.0875 0.25 1.5V10.5C0.25 10.9125 0.5875 11.25 1 11.25H7C7.4125 11.25 7.75 10.9125 7.75 10.5V3.75C7.75 3.6375 7.7125 3.5625 7.6375 3.4875ZM4.75 1.65L6.85 3.75H4.75V1.65ZM7 10.5H1V1.5H4V3.75C4 4.1625 4.3375 4.5 4.75 4.5H7V10.5Z", fill: "currentColor" }),
|
|
12
|
+
react_1.default.createElement("path", { d: "M6.25 8.25H1.75V9H6.25V8.25Z", fill: "currentColor" }),
|
|
13
|
+
react_1.default.createElement("path", { d: "M6.25 6H1.75V6.75H6.25V6Z", fill: "currentColor" })));
|
|
14
|
+
exports.NoteIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
15
|
+
'data-component-name': 'icons/NoteIcon/NoteIcon',
|
|
16
|
+
})) `
|
|
17
|
+
path {
|
|
18
|
+
fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
height: ${({ size }) => size || '16px'};
|
|
22
|
+
width: ${({ size }) => size || '16px'};
|
|
23
|
+
`;
|
|
24
|
+
//# sourceMappingURL=NoteIcon.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const ShareIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,22 @@
|
|
|
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.ShareIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const utils_1 = require("../../core/utils");
|
|
10
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
11
|
+
react_1.default.createElement("path", { d: "M11.5 10.0001C11.1257 10.002 10.7566 10.0879 10.42 10.2514C10.0834 10.415 9.78776 10.652 9.55497 10.9451L5.89997 8.6601C6.03318 8.23018 6.03318 7.77002 5.89997 7.3401L9.55497 5.0551C9.92594 5.51446 10.4475 5.82769 11.0273 5.93931C11.6071 6.05092 12.2077 5.95372 12.7227 5.66491C13.2377 5.37611 13.6339 4.91435 13.841 4.36143C14.0482 3.8085 14.0529 3.20011 13.8544 2.64402C13.656 2.08793 13.2671 1.62003 12.7567 1.32322C12.2462 1.0264 11.6472 0.919827 11.0657 1.02237C10.4843 1.12491 9.95785 1.42996 9.57975 1.88346C9.20164 2.33697 8.99626 2.90966 8.99997 3.5001C9.00233 3.72369 9.03599 3.94585 9.09997 4.1601L5.44497 6.4451C5.12229 6.03889 4.68124 5.74313 4.18295 5.5988C3.68465 5.45447 3.1538 5.46873 2.66398 5.63961C2.17415 5.81048 1.74961 6.1295 1.44921 6.55245C1.14881 6.9754 0.987427 7.48133 0.987427 8.0001C0.987427 8.51888 1.14881 9.0248 1.44921 9.44775C1.74961 9.8707 2.17415 10.1897 2.66398 10.3606C3.1538 10.5315 3.68465 10.5457 4.18295 10.4014C4.68124 10.2571 5.12229 9.96131 5.44497 9.5551L9.09997 11.8401C9.03599 12.0544 9.00233 12.2765 8.99997 12.5001C8.99997 12.9946 9.14659 13.4779 9.4213 13.889C9.696 14.3002 10.0864 14.6206 10.5433 14.8098C11.0001 14.999 11.5027 15.0485 11.9877 14.9521C12.4726 14.8556 12.9181 14.6175 13.2677 14.2679C13.6174 13.9182 13.8555 13.4728 13.9519 12.9878C14.0484 12.5029 13.9989 12.0002 13.8097 11.5434C13.6204 11.0866 13.3 10.6961 12.8889 10.4214C12.4778 10.1467 11.9944 10.0001 11.5 10.0001ZM11.5 2.0001C11.7966 2.0001 12.0867 2.08808 12.3333 2.2529C12.58 2.41772 12.7723 2.65199 12.8858 2.92608C12.9993 3.20017 13.029 3.50177 12.9711 3.79274C12.9133 4.08371 12.7704 4.35098 12.5606 4.56076C12.3509 4.77054 12.0836 4.9134 11.7926 4.97128C11.5016 5.02916 11.2 4.99945 10.9259 4.88592C10.6519 4.77239 10.4176 4.58013 10.2528 4.33346C10.0879 4.08678 9.99997 3.79677 9.99997 3.5001C9.99997 3.10228 10.158 2.72075 10.4393 2.43944C10.7206 2.15814 11.1021 2.0001 11.5 2.0001ZM3.49997 9.5001C3.2033 9.5001 2.91329 9.41213 2.66661 9.24731C2.41994 9.08248 2.22768 8.84822 2.11415 8.57413C2.00062 8.30004 1.97091 7.99844 2.02879 7.70747C2.08667 7.4165 2.22953 7.14922 2.43931 6.93944C2.64909 6.72966 2.91636 6.5868 3.20733 6.52892C3.49831 6.47105 3.79991 6.50075 4.074 6.61428C4.34808 6.72781 4.58235 6.92007 4.74717 7.16675C4.912 7.41342 4.99997 7.70343 4.99997 8.0001C4.99997 8.39793 4.84193 8.77946 4.56063 9.06076C4.27933 9.34207 3.89779 9.5001 3.49997 9.5001ZM11.5 14.0001C11.2033 14.0001 10.9133 13.9121 10.6666 13.7473C10.4199 13.5825 10.2277 13.3482 10.1142 13.0741C10.0006 12.8 9.97091 12.4984 10.0288 12.2075C10.0867 11.9165 10.2295 11.6492 10.4393 11.4394C10.6491 11.2297 10.9164 11.0868 11.2073 11.0289C11.4983 10.971 11.7999 11.0008 12.074 11.1143C12.3481 11.2278 12.5824 11.4201 12.7472 11.6667C12.912 11.9134 13 12.2034 13 12.5001C13 12.8979 12.8419 13.2795 12.5606 13.5608C12.2793 13.8421 11.8978 14.0001 11.5 14.0001Z" })));
|
|
12
|
+
exports.ShareIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
13
|
+
'data-component-name': 'icons/ShareIcon/ShareIcon',
|
|
14
|
+
})) `
|
|
15
|
+
path {
|
|
16
|
+
fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
height: ${({ size }) => size || '16px'};
|
|
20
|
+
width: ${({ size }) => size || '16px'};
|
|
21
|
+
`;
|
|
22
|
+
//# sourceMappingURL=ShareIcon.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -219,6 +219,7 @@ export * from './icons/MarkdownFullIcon/MarkdownFullIcon';
|
|
|
219
219
|
export * from './icons/DocumentBlankIcon/DocumentBlankIcon';
|
|
220
220
|
export * from './icons/WarningSquareIcon/WarningSquareIcon';
|
|
221
221
|
export * from './icons/MenuIcon/MenuIcon';
|
|
222
|
+
export * from './icons/NoteIcon/NoteIcon';
|
|
222
223
|
export * from './icons/GlobalOutlinedIcon/GlobalOutlinedIcon';
|
|
223
224
|
export * from './icons/FaceDissatisfiedIcon/FaceDissatisfiedIcon';
|
|
224
225
|
export * from './icons/FaceNeutralIcon/FaceNeutralIcon';
|
|
@@ -257,6 +258,7 @@ export * from './icons/AiStarsIcon/AiStarsIcon';
|
|
|
257
258
|
export * from './icons/AiStarsGradientIcon/AiStarsGradientIcon';
|
|
258
259
|
export * from './icons/WorkflowHierarchyIcon/WorkflowHierarchyIcon';
|
|
259
260
|
export * from './icons/GenericIcon/GenericIcon';
|
|
261
|
+
export * from './icons/ShareIcon/ShareIcon';
|
|
260
262
|
export * from './layouts/RootLayout';
|
|
261
263
|
export * from './layouts/PageLayout';
|
|
262
264
|
export * from './layouts/NotFound';
|
package/lib/index.js
CHANGED
|
@@ -272,6 +272,7 @@ __exportStar(require("./icons/MarkdownFullIcon/MarkdownFullIcon"), exports);
|
|
|
272
272
|
__exportStar(require("./icons/DocumentBlankIcon/DocumentBlankIcon"), exports);
|
|
273
273
|
__exportStar(require("./icons/WarningSquareIcon/WarningSquareIcon"), exports);
|
|
274
274
|
__exportStar(require("./icons/MenuIcon/MenuIcon"), exports);
|
|
275
|
+
__exportStar(require("./icons/NoteIcon/NoteIcon"), exports);
|
|
275
276
|
__exportStar(require("./icons/GlobalOutlinedIcon/GlobalOutlinedIcon"), exports);
|
|
276
277
|
__exportStar(require("./icons/FaceDissatisfiedIcon/FaceDissatisfiedIcon"), exports);
|
|
277
278
|
__exportStar(require("./icons/FaceNeutralIcon/FaceNeutralIcon"), exports);
|
|
@@ -310,6 +311,7 @@ __exportStar(require("./icons/AiStarsIcon/AiStarsIcon"), exports);
|
|
|
310
311
|
__exportStar(require("./icons/AiStarsGradientIcon/AiStarsGradientIcon"), exports);
|
|
311
312
|
__exportStar(require("./icons/WorkflowHierarchyIcon/WorkflowHierarchyIcon"), exports);
|
|
312
313
|
__exportStar(require("./icons/GenericIcon/GenericIcon"), exports);
|
|
314
|
+
__exportStar(require("./icons/ShareIcon/ShareIcon"), exports);
|
|
313
315
|
/* Layouts */
|
|
314
316
|
__exportStar(require("./layouts/RootLayout"), exports);
|
|
315
317
|
__exportStar(require("./layouts/PageLayout"), exports);
|
|
@@ -12,13 +12,11 @@ const PageNavigation_1 = require("../components/PageNavigation/PageNavigation");
|
|
|
12
12
|
const LastUpdated_1 = require("../components/LastUpdated/LastUpdated");
|
|
13
13
|
const Breadcrumbs_1 = require("../components/Breadcrumbs/Breadcrumbs");
|
|
14
14
|
const CodeSnippetContext_1 = require("../core/contexts/CodeSnippetContext");
|
|
15
|
-
const use_local_state_1 = require("../core/hooks/use-local-state");
|
|
16
15
|
function DocumentationLayout({ tableOfContent, feedback, config, editPage, lastModified, nextPage, prevPage, className, children, }) {
|
|
17
16
|
var _a;
|
|
18
17
|
const { editPage: themeEditPage } = config || {};
|
|
19
18
|
const mergedConf = editPage ? Object.assign(Object.assign({}, themeEditPage), editPage) : undefined;
|
|
20
|
-
|
|
21
|
-
return (react_1.default.createElement(CodeSnippetContext_1.CodeSnippetContext.Provider, { value: { activeSnippetName, setActiveSnippetName } },
|
|
19
|
+
return (react_1.default.createElement(CodeSnippetContext_1.CodeSnippetProvider, null,
|
|
22
20
|
react_1.default.createElement(LayoutWrapper, { "data-component-name": "Layout/DocumentationLayout", className: className },
|
|
23
21
|
react_1.default.createElement(ContentWrapper, { withToc: !((_a = config === null || config === void 0 ? void 0 : config.toc) === null || _a === void 0 ? void 0 : _a.hide) },
|
|
24
22
|
react_1.default.createElement(Breadcrumbs, null),
|
|
@@ -31,42 +31,64 @@ const contexts_1 = require("../../../core/contexts");
|
|
|
31
31
|
function CodeGroup(props) {
|
|
32
32
|
const mode = props.mode || 'tabs';
|
|
33
33
|
const isTabsMode = mode === 'tabs';
|
|
34
|
-
const rawSnippets = React.useMemo(() =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
lang: childProps.props.lang || '',
|
|
40
|
-
props: childProps.props,
|
|
41
|
-
};
|
|
42
|
-
}), [props.children]);
|
|
43
|
-
const [activeSnippetName, setActiveSnippetName] = (0, contexts_1.useActiveCodeSnippetName)(mode);
|
|
44
|
-
const snippets = React.useMemo(() => Object.fromEntries(rawSnippets.map((snippet) => {
|
|
45
|
-
const getItemName = (snippet) => isTabsMode ? snippet === null || snippet === void 0 ? void 0 : snippet.name : (snippet === null || snippet === void 0 ? void 0 : snippet.languageName) || '';
|
|
46
|
-
const name = getItemName(snippet);
|
|
47
|
-
const items = rawSnippets.map((item) => ({
|
|
48
|
-
name: getItemName(item),
|
|
49
|
-
lang: item.lang,
|
|
50
|
-
}));
|
|
34
|
+
const rawSnippets = React.useMemo(() => parseSnippetsFromChildren(props.children), [props.children]);
|
|
35
|
+
const groupId = React.useMemo(() => generateGroupId(rawSnippets, mode), [rawSnippets, mode]);
|
|
36
|
+
const [activeSnippetId, setActiveSnippetId] = (0, contexts_1.useActiveCodeSnippetId)(groupId, rawSnippets);
|
|
37
|
+
const snippets = React.useMemo(() => {
|
|
38
|
+
const items = createItemsFromSnippets(rawSnippets, isTabsMode);
|
|
51
39
|
const itemsProps = {
|
|
52
40
|
items,
|
|
53
|
-
onChange: (
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
value: activeSnippetName || getItemName(rawSnippets[0]),
|
|
41
|
+
onChange: (id) => setActiveSnippetId(id),
|
|
42
|
+
value: activeSnippetId,
|
|
57
43
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
return Object.fromEntries(rawSnippets.map((snippet) => {
|
|
45
|
+
const snippetProps = Object.assign(Object.assign(Object.assign({}, snippet.props), { header: Object.assign(Object.assign({}, snippet.props.header), { title: isTabsMode ? undefined : snippet.name }) }), (isTabsMode ? { tabs: itemsProps } : { dropdown: itemsProps }));
|
|
46
|
+
return [snippet.id, snippetProps];
|
|
47
|
+
}));
|
|
48
|
+
}, [rawSnippets, activeSnippetId, isTabsMode, setActiveSnippetId]);
|
|
49
|
+
const activeSnippet = snippets[activeSnippetId];
|
|
63
50
|
if (!activeSnippet) {
|
|
64
51
|
return null;
|
|
65
52
|
}
|
|
66
53
|
return React.createElement(CodeBlock_1.CodeBlock, Object.assign({}, activeSnippet));
|
|
67
54
|
}
|
|
55
|
+
function generateContentHash(content) {
|
|
56
|
+
let hash = 0;
|
|
57
|
+
for (let i = 0; i < content.length; i++) {
|
|
58
|
+
hash = content.charCodeAt(i) + ((hash << 5) - hash);
|
|
59
|
+
}
|
|
60
|
+
return Math.abs(hash);
|
|
61
|
+
}
|
|
62
|
+
// Generate unique group ID for CodeGroup instance
|
|
63
|
+
// Examples: "dropdown-8901234", "tabs-1234567"
|
|
64
|
+
function generateGroupId(rawSnippets, mode) {
|
|
65
|
+
const content = rawSnippets.map((s) => s.id + (s.props.source || '')).join('|') + `|${mode}`;
|
|
66
|
+
const hash = generateContentHash(content);
|
|
67
|
+
return `${mode}-${hash}`;
|
|
68
|
+
}
|
|
68
69
|
function getTabName(props, idx) {
|
|
69
70
|
var _a;
|
|
70
|
-
|
|
71
|
+
const fallbackName = `Tab ${idx + 1}`;
|
|
72
|
+
return String(((_a = props.header) === null || _a === void 0 ? void 0 : _a.title) || props.file || (0, utils_1.langToName)(props.lang || '') || fallbackName);
|
|
73
|
+
}
|
|
74
|
+
function parseSnippetsFromChildren(children) {
|
|
75
|
+
return React.Children.toArray(children).map((child, idx) => {
|
|
76
|
+
const childProps = child;
|
|
77
|
+
const props = childProps.props;
|
|
78
|
+
return {
|
|
79
|
+
name: getTabName(props, idx),
|
|
80
|
+
languageName: String((0, utils_1.langToName)(props.lang || 'Default') || ''),
|
|
81
|
+
lang: props.lang || '',
|
|
82
|
+
props,
|
|
83
|
+
id: `${props.lang || ''}-${idx}`,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function createItemsFromSnippets(snippets, isTabsMode) {
|
|
88
|
+
return snippets.map((snippet) => ({
|
|
89
|
+
name: isTabsMode ? snippet.name : snippet.languageName || '',
|
|
90
|
+
lang: snippet.lang,
|
|
91
|
+
id: snippet.id,
|
|
92
|
+
}));
|
|
71
93
|
}
|
|
72
94
|
//# sourceMappingURL=CodeGroup.js.map
|
|
@@ -16,7 +16,8 @@ type TabsProps = {
|
|
|
16
16
|
className?: string;
|
|
17
17
|
size: TabsSize;
|
|
18
18
|
forceReady?: boolean;
|
|
19
|
+
initialTab?: string;
|
|
19
20
|
};
|
|
20
|
-
export declare function Tabs({ children, className, size, forceReady }: TabsProps): JSX.Element;
|
|
21
|
+
export declare function Tabs({ children, className, size, forceReady, initialTab: propInitialTab, }: TabsProps): JSX.Element;
|
|
21
22
|
export declare const TabContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
23
|
export {};
|
|
@@ -34,7 +34,7 @@ var TabsSize;
|
|
|
34
34
|
TabsSize["SMALL"] = "small";
|
|
35
35
|
TabsSize["MEDIUM"] = "medium";
|
|
36
36
|
})(TabsSize || (exports.TabsSize = TabsSize = {}));
|
|
37
|
-
function Tabs({ children, className, size, forceReady = false }) {
|
|
37
|
+
function Tabs({ children, className, size, forceReady = false, initialTab: propInitialTab, }) {
|
|
38
38
|
var _a, _b;
|
|
39
39
|
const [childrenArray, setChildrenArray] = (0, react_1.useState)(react_1.default.Children.toArray(children));
|
|
40
40
|
(0, react_1.useEffect)(() => {
|
|
@@ -42,7 +42,8 @@ function Tabs({ children, className, size, forceReady = false }) {
|
|
|
42
42
|
}, [children]);
|
|
43
43
|
const tabsContainerRef = (0, react_1.useRef)(null);
|
|
44
44
|
const [isAnimating, setIsAnimating] = (0, react_1.useState)(false);
|
|
45
|
-
const
|
|
45
|
+
const defaultInitialTab = (_b = (_a = childrenArray[0]) === null || _a === void 0 ? void 0 : _a.props.label) !== null && _b !== void 0 ? _b : '';
|
|
46
|
+
const initialTab = propInitialTab !== null && propInitialTab !== void 0 ? propInitialTab : defaultInitialTab;
|
|
46
47
|
const { activeTab, setTabRef, onTabClick, handleKeyboard, getTabId, visibleTabs, overflowTabs, ready, allTabsHidden, } = (0, hooks_1.useTabs)({
|
|
47
48
|
initialTab,
|
|
48
49
|
totalTabs: childrenArray.length,
|