@redocly/theme 0.58.1 → 0.59.0-next.1

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.
Files changed (104) hide show
  1. package/lib/components/Accordion/Accordion.d.ts +12 -0
  2. package/lib/components/Accordion/Accordion.js +75 -0
  3. package/lib/components/Accordion/AccordionBody.d.ts +8 -0
  4. package/lib/components/Accordion/AccordionBody.js +63 -0
  5. package/lib/components/Accordion/AccordionHeader.d.ts +10 -0
  6. package/lib/components/Accordion/AccordionHeader.js +37 -0
  7. package/lib/components/Accordion/AccordionTitle.d.ts +6 -0
  8. package/lib/components/Accordion/AccordionTitle.js +20 -0
  9. package/lib/components/Accordion/variables.d.ts +1 -0
  10. package/lib/components/Accordion/variables.js +59 -0
  11. package/lib/components/Buttons/AIAssistantButton.d.ts +2 -0
  12. package/lib/components/Buttons/AIAssistantButton.js +125 -0
  13. package/lib/components/Buttons/variables.d.ts +1 -0
  14. package/lib/components/Buttons/variables.dark.d.ts +1 -0
  15. package/lib/components/Buttons/variables.dark.js +10 -0
  16. package/lib/components/Buttons/variables.js +51 -0
  17. package/lib/components/Catalog/Catalog.js +3 -3
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
  20. package/lib/components/Catalog/CatalogFilter/CatalogFilter.d.ts +6 -0
  21. package/lib/components/Catalog/CatalogFilter/CatalogFilter.js +35 -0
  22. package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.d.ts +6 -0
  23. package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +142 -0
  24. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.d.ts +13 -0
  25. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +92 -0
  26. package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.d.ts +6 -0
  27. package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +111 -0
  28. package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.d.ts +6 -0
  29. package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.js +116 -0
  30. package/lib/components/Catalog/CatalogSelector.js +0 -1
  31. package/lib/components/Catalog/variables.js +0 -1
  32. package/lib/components/Filter/FilterInput.d.ts +1 -0
  33. package/lib/components/Filter/FilterInput.js +2 -2
  34. package/lib/components/Filter/FilterOptions.js +2 -0
  35. package/lib/components/Filter/variables.js +7 -4
  36. package/lib/components/Search/SearchAiDialog.js +2 -3
  37. package/lib/components/Search/SearchAiResponse.js +2 -3
  38. package/lib/components/Search/SearchDialog.d.ts +2 -1
  39. package/lib/components/Search/SearchDialog.js +2 -2
  40. package/lib/components/Tag/Tag.d.ts +3 -2
  41. package/lib/components/Tag/Tag.js +21 -5
  42. package/lib/components/Tag/variables.dark.js +135 -0
  43. package/lib/components/Tag/variables.js +120 -58
  44. package/lib/core/hooks/use-tabs.d.ts +11 -6
  45. package/lib/core/hooks/use-tabs.js +117 -207
  46. package/lib/core/styles/dark.js +29 -26
  47. package/lib/core/styles/global.js +64 -59
  48. package/lib/core/types/l10n.d.ts +1 -1
  49. package/lib/core/utils/index.d.ts +1 -0
  50. package/lib/core/utils/index.js +1 -0
  51. package/lib/core/utils/tabs.d.ts +1 -0
  52. package/lib/core/utils/tabs.js +8 -0
  53. package/lib/icons/RedoclyIcon/RedoclyIcon.d.ts +9 -0
  54. package/lib/icons/RedoclyIcon/RedoclyIcon.js +27 -0
  55. package/lib/index.d.ts +2 -0
  56. package/lib/index.js +2 -0
  57. package/lib/layouts/RootLayout.js +6 -1
  58. package/lib/markdoc/components/Tabs/Tab.js +1 -1
  59. package/lib/markdoc/components/Tabs/TabList.d.ts +2 -14
  60. package/lib/markdoc/components/Tabs/TabList.js +63 -16
  61. package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -2
  62. package/lib/markdoc/components/Tabs/Tabs.js +11 -87
  63. package/lib/markdoc/tags/tabs.js +5 -0
  64. package/package.json +2 -2
  65. package/src/components/Accordion/Accordion.tsx +100 -0
  66. package/src/components/Accordion/AccordionBody.tsx +65 -0
  67. package/src/components/Accordion/AccordionHeader.tsx +68 -0
  68. package/src/components/Accordion/AccordionTitle.tsx +26 -0
  69. package/src/components/Accordion/variables.ts +56 -0
  70. package/src/components/Buttons/AIAssistantButton.tsx +141 -0
  71. package/src/components/Buttons/variables.dark.ts +7 -0
  72. package/src/components/Buttons/variables.ts +48 -0
  73. package/src/components/Catalog/Catalog.tsx +3 -2
  74. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
  75. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
  76. package/src/components/Catalog/CatalogFilter/CatalogFilter.tsx +56 -0
  77. package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +169 -0
  78. package/src/components/Catalog/CatalogFilter/CatalogFilterContent.tsx +121 -0
  79. package/src/components/Catalog/CatalogFilter/CatalogFilterDateRange.tsx +147 -0
  80. package/src/components/Catalog/CatalogFilter/CatalogFilterSelect.tsx +136 -0
  81. package/src/components/Catalog/CatalogSelector.tsx +0 -1
  82. package/src/components/Catalog/variables.ts +0 -1
  83. package/src/components/Filter/FilterInput.tsx +3 -2
  84. package/src/components/Filter/FilterOptions.tsx +2 -0
  85. package/src/components/Filter/variables.ts +7 -4
  86. package/src/components/Search/SearchAiDialog.tsx +2 -2
  87. package/src/components/Search/SearchAiResponse.tsx +2 -2
  88. package/src/components/Search/SearchDialog.tsx +7 -2
  89. package/src/components/Tag/Tag.tsx +33 -8
  90. package/src/components/Tag/variables.dark.ts +135 -0
  91. package/src/components/Tag/variables.ts +120 -58
  92. package/src/core/hooks/use-tabs.ts +160 -238
  93. package/src/core/styles/dark.ts +11 -8
  94. package/src/core/styles/global.ts +7 -2
  95. package/src/core/types/l10n.ts +1 -0
  96. package/src/core/utils/index.ts +1 -0
  97. package/src/core/utils/tabs.ts +4 -0
  98. package/src/icons/RedoclyIcon/RedoclyIcon.tsx +44 -0
  99. package/src/index.ts +2 -0
  100. package/src/layouts/RootLayout.tsx +6 -0
  101. package/src/markdoc/components/Tabs/Tab.tsx +1 -0
  102. package/src/markdoc/components/Tabs/TabList.tsx +84 -30
  103. package/src/markdoc/components/Tabs/Tabs.tsx +12 -125
  104. package/src/markdoc/tags/tabs.ts +5 -0
@@ -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' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | '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' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | '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' | 'aiAssistant.trigger' | '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' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | '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' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | '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;
@@ -37,3 +37,4 @@ export * from './lang-to-name';
37
37
  export * from './enhanced-smoothstep';
38
38
  export * from './icon-resolver';
39
39
  export * from './dynamic';
40
+ export * from './tabs';
@@ -53,4 +53,5 @@ __exportStar(require("./lang-to-name"), exports);
53
53
  __exportStar(require("./enhanced-smoothstep"), exports);
54
54
  __exportStar(require("./icon-resolver"), exports);
55
55
  __exportStar(require("./dynamic"), exports);
56
+ __exportStar(require("./tabs"), exports);
56
57
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export declare function getTabId(label: string, index: number): string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTabId = getTabId;
4
+ function getTabId(label, index) {
5
+ const cleanLabel = label.replace(/\s+/g, '-').toLowerCase();
6
+ return `${cleanLabel}-${index}`;
7
+ }
8
+ //# sourceMappingURL=tabs.js.map
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { IconProps } from '../../icons/types';
3
+ export declare const RedoclyIcon: 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,27 @@
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.RedoclyIcon = 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({ width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
11
+ react_1.default.createElement("g", { clipPath: "url(#clip0_4053_1165)" },
12
+ react_1.default.createElement("path", { d: "M14.625 6.19973C14.625 8.69176 12.6173 10.712 10.1406 10.712H2.8125V10.2717C5.04753 10.2717 6.85938 8.44864 6.85938 6.19973C6.85938 3.95082 5.04753 2.12772 2.8125 2.12772V1.6875H10.1406C12.6173 1.6875 14.625 3.70769 14.625 6.19973Z", fill: "#2467F2" }),
13
+ react_1.default.createElement("path", { d: "M14.625 16.875C14.625 14.383 12.6173 12.3628 10.1406 12.3628H2.8125V12.803C5.04753 12.803 6.85938 14.6261 6.85938 16.875H14.625Z", fill: "#2467F2" })),
14
+ react_1.default.createElement("defs", null,
15
+ react_1.default.createElement("clipPath", { id: "clip0_4053_1165" },
16
+ react_1.default.createElement("rect", { width: "18", height: "18", fill: "white" })))));
17
+ exports.RedoclyIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
18
+ 'data-component-name': 'icons/RedoclyIcon/RedoclyIcon',
19
+ })) `
20
+ path {
21
+ fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
22
+ }
23
+
24
+ height: ${({ size }) => size || '16px'};
25
+ width: ${({ size }) => size || '16px'};
26
+ `;
27
+ //# sourceMappingURL=RedoclyIcon.js.map
package/lib/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export * from './components/Buttons/CopyButton';
29
29
  export * from './components/Buttons/EditPageButton';
30
30
  export * from './components/Buttons/EmailButton';
31
31
  export * from './components/Buttons/NewTabButton';
32
+ export * from './components/Buttons/AIAssistantButton';
32
33
  export * from './components/Markdown/Markdown';
33
34
  export * from './components/Markdown/styles/baseTable';
34
35
  export * from './components/Markdown/styles/headingAnchor';
@@ -256,6 +257,7 @@ export * from './icons/RabbitMQIcon/RabbitMQIcon';
256
257
  export * from './icons/CurveAutoColonIcon/CurveAutoColonIcon';
257
258
  export * from './icons/AiStarsIcon/AiStarsIcon';
258
259
  export * from './icons/AiStarsGradientIcon/AiStarsGradientIcon';
260
+ export * from './icons/RedoclyIcon/RedoclyIcon';
259
261
  export * from './icons/WorkflowHierarchyIcon/WorkflowHierarchyIcon';
260
262
  export * from './icons/GenericIcon/GenericIcon';
261
263
  export * from './icons/ShareIcon/ShareIcon';
package/lib/index.js CHANGED
@@ -60,6 +60,7 @@ __exportStar(require("./components/Buttons/CopyButton"), exports);
60
60
  __exportStar(require("./components/Buttons/EditPageButton"), exports);
61
61
  __exportStar(require("./components/Buttons/EmailButton"), exports);
62
62
  __exportStar(require("./components/Buttons/NewTabButton"), exports);
63
+ __exportStar(require("./components/Buttons/AIAssistantButton"), exports);
63
64
  /* Markdown */
64
65
  __exportStar(require("./components/Markdown/Markdown"), exports);
65
66
  __exportStar(require("./components/Markdown/styles/baseTable"), exports);
@@ -309,6 +310,7 @@ __exportStar(require("./icons/RabbitMQIcon/RabbitMQIcon"), exports);
309
310
  __exportStar(require("./icons/CurveAutoColonIcon/CurveAutoColonIcon"), exports);
310
311
  __exportStar(require("./icons/AiStarsIcon/AiStarsIcon"), exports);
311
312
  __exportStar(require("./icons/AiStarsGradientIcon/AiStarsGradientIcon"), exports);
313
+ __exportStar(require("./icons/RedoclyIcon/RedoclyIcon"), exports);
312
314
  __exportStar(require("./icons/WorkflowHierarchyIcon/WorkflowHierarchyIcon"), exports);
313
315
  __exportStar(require("./icons/GenericIcon/GenericIcon"), exports);
314
316
  __exportStar(require("./icons/ShareIcon/ShareIcon"), exports);
@@ -8,11 +8,16 @@ const react_1 = __importDefault(require("react"));
8
8
  const Navbar_1 = require("../components/Navbar/Navbar");
9
9
  const Footer_1 = require("../components/Footer/Footer");
10
10
  const SkipContent_1 = require("../components/SkipContent/SkipContent");
11
+ const AIAssistantButton_1 = require("../components/Buttons/AIAssistantButton");
12
+ const hooks_1 = require("../core/hooks");
11
13
  function RootLayout({ children }) {
14
+ const { useSearch } = (0, hooks_1.useThemeHooks)();
15
+ const { askAi } = useSearch();
12
16
  return (react_1.default.createElement("div", { "data-component-name": "layouts/RootLayout" },
13
17
  react_1.default.createElement(SkipContent_1.SkipContent, null),
14
18
  react_1.default.createElement(Navbar_1.Navbar, null),
15
19
  children,
16
- react_1.default.createElement(Footer_1.Footer, null)));
20
+ react_1.default.createElement(Footer_1.Footer, null),
21
+ askAi && react_1.default.createElement(AIAssistantButton_1.AIAssistantButton, null)));
17
22
  }
18
23
  //# sourceMappingURL=RootLayout.js.map
@@ -11,7 +11,7 @@ const TabList_1 = require("../../../markdoc/components/Tabs/TabList");
11
11
  const GenericIcon_1 = require("../../../icons/GenericIcon/GenericIcon");
12
12
  function TabComponent({ tabId, label, size, disabled, setRef, onKeyDown, onClick, icon, iconRawContent, }) {
13
13
  return (react_1.default.createElement(TabList_1.TabItem, { "data-component-name": "Markdoc/Tabs/Tab", size: size, tabIndex: 0 },
14
- react_1.default.createElement(TabList_1.TabButtonLink, { id: `tab-${tabId}`, role: "tab", "aria-selected": "false", "aria-controls": `panel-${tabId}`, tabIndex: -1, size: size, disabled: disabled, ref: setRef, onKeyDown: onKeyDown, onClick: onClick },
14
+ react_1.default.createElement(TabList_1.TabButtonLink, { id: `tab-${tabId}`, "data-label": label, role: "tab", "aria-selected": "false", "aria-controls": `panel-${tabId}`, tabIndex: -1, size: size, disabled: disabled, ref: setRef, onKeyDown: onKeyDown, onClick: onClick },
15
15
  react_1.default.createElement(LabelWrapper, null,
16
16
  react_1.default.createElement(GenericIcon_1.GenericIcon, { icon: icon, rawContent: iconRawContent }),
17
17
  label))));
@@ -4,22 +4,10 @@ import { TabItemProps, TabsSize } from '../../../markdoc/components/Tabs/Tabs';
4
4
  type TabListProps = {
5
5
  childrenArray: React.ReactElement<TabItemProps>[];
6
6
  size: TabsSize;
7
- overflowTabs: number[];
8
- visibleTabs: number[];
9
- setTabRef: (element: HTMLButtonElement | null, index: number) => void;
10
- onTabClick: (labelOrIndex: string | number) => void;
11
- handleKeyboard: (event: React.KeyboardEvent<HTMLButtonElement>, index: number) => void;
12
- getTabId: (label: string, index: number) => string;
13
7
  activeTab: string;
14
- isAnimating: boolean;
15
- highlightStyle: {
16
- left: number;
17
- width: number;
18
- };
19
- allTabsHidden: boolean;
20
- tabsContainerRef: React.RefObject<HTMLUListElement | null>;
8
+ onTabChange: (tab: string) => void;
21
9
  };
22
- export declare function TabList({ childrenArray, size, overflowTabs, visibleTabs, setTabRef, onTabClick, handleKeyboard, getTabId, activeTab, isAnimating, highlightStyle, allTabsHidden, tabsContainerRef, }: TabListProps): JSX.Element;
10
+ export declare function TabList({ childrenArray, size, activeTab, onTabChange, }: TabListProps): JSX.Element;
23
11
  export declare const TabListContainer: import("styled-components").StyledComponent<"ul", any, {}, never>;
24
12
  export declare const TabItem: import("styled-components").StyledComponent<"li", any, {
25
13
  active?: boolean;
@@ -22,35 +22,42 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  exports.TabButtonLink = exports.TabItem = exports.TabListContainer = void 0;
30
27
  exports.TabList = TabList;
31
- const react_1 = __importDefault(require("react"));
28
+ const react_1 = __importStar(require("react"));
32
29
  const styled_components_1 = __importStar(require("styled-components"));
33
30
  const Tab_1 = require("../../../markdoc/components/Tabs/Tab");
34
31
  const Dropdown_1 = require("../../../components/Dropdown/Dropdown");
35
32
  const DropdownMenu_1 = require("../../../components/Dropdown/DropdownMenu");
36
33
  const DropdownMenuItem_1 = require("../../../components/Dropdown/DropdownMenuItem");
37
34
  const Button_1 = require("../../../components/Button/Button");
38
- function TabList({ childrenArray, size, overflowTabs, visibleTabs, setTabRef, onTabClick, handleKeyboard, getTabId, activeTab, isAnimating, highlightStyle, allTabsHidden, tabsContainerRef, }) {
39
- return (react_1.default.createElement(exports.TabListContainer, { role: "tablist", ref: tabsContainerRef, "data-animating": isAnimating },
40
- react_1.default.createElement(HighlightBar, { size: size, style: { left: highlightStyle.left, width: highlightStyle.width } },
35
+ const hooks_1 = require("../../../core/hooks");
36
+ const utils_1 = require("../../../core/utils");
37
+ function TabList({ childrenArray, size, activeTab, onTabChange, }) {
38
+ const tabsContainerRef = (0, react_1.useRef)(null);
39
+ const { allTabsHidden, overflowTabs, visibleTabs, handleKeyboard, onTabClick, setTabRef } = (0, hooks_1.useTabs)({
40
+ activeTab,
41
+ onTabChange,
42
+ containerRef: tabsContainerRef,
43
+ totalTabs: childrenArray.length,
44
+ });
45
+ const { highlightStyle } = useHighlightBarAnimation({
46
+ activeTab,
47
+ childrenArray,
48
+ overflowTabs,
49
+ tabsContainerRef,
50
+ visibleTabs,
51
+ });
52
+ return (react_1.default.createElement(exports.TabListContainer, { role: "tablist", ref: tabsContainerRef },
53
+ react_1.default.createElement(HighlightBar, { size: size, style: highlightStyle },
41
54
  react_1.default.createElement("div", null)),
42
55
  childrenArray.map((child, index) => {
43
56
  if (!visibleTabs.includes(index))
44
57
  return null;
45
58
  const { label, icon } = child.props;
46
- const tabId = getTabId(label, index);
47
- return (react_1.default.createElement(Tab_1.Tab, { key: `key-${tabId}`, tabId: tabId, label: label, icon: icon, size: size, disabled: child.props.disable, setRef: (el) => {
48
- setTabRef(el, index);
49
- if (el) {
50
- el.setAttribute('data-label', label);
51
- el.setAttribute('data-animating', isAnimating.toString());
52
- }
53
- }, onKeyDown: (event) => handleKeyboard(event, index), onClick: () => {
59
+ const tabId = (0, utils_1.getTabId)(label, index);
60
+ return (react_1.default.createElement(Tab_1.Tab, { key: `key-${tabId}`, tabId: tabId, label: label, icon: icon, size: size, disabled: child.props.disable, setRef: (el) => setTabRef(el, index), onKeyDown: (event) => handleKeyboard(event, index), onClick: () => {
54
61
  var _a, _b;
55
62
  (_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
56
63
  onTabClick(label);
@@ -61,7 +68,7 @@ function TabList({ childrenArray, size, overflowTabs, visibleTabs, setTabRef, on
61
68
  : undefined }, allTabsHidden ? activeTab : 'More'), alignment: "start", withArrow: true },
62
69
  react_1.default.createElement(DropdownMenu_1.DropdownMenu, null, overflowTabs.map((index) => {
63
70
  const { label } = childrenArray[index].props;
64
- const tabId = getTabId(label, index);
71
+ const tabId = (0, utils_1.getTabId)(label, index);
65
72
  return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: `more-${tabId}`, active: activeTab === label, onAction: () => {
66
73
  var _a, _b;
67
74
  (_b = (_a = childrenArray[index].props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
@@ -69,6 +76,46 @@ function TabList({ childrenArray, size, overflowTabs, visibleTabs, setTabRef, on
69
76
  }, disabled: childrenArray[index].props.disable }, label));
70
77
  })))))));
71
78
  }
79
+ const useHighlightBarAnimation = (props) => {
80
+ const { childrenArray, activeTab, tabsContainerRef, visibleTabs, overflowTabs } = props;
81
+ const [highlightStyle, setHighlightStyle] = react_1.default.useState({
82
+ left: 0,
83
+ width: 0,
84
+ });
85
+ (0, react_1.useEffect)(() => {
86
+ const activeIndex = childrenArray.findIndex((child) => child.props.label === activeTab);
87
+ const container = tabsContainerRef.current;
88
+ if (!container || activeIndex === -1) {
89
+ setHighlightStyle({ left: 0, width: 0 });
90
+ return;
91
+ }
92
+ const activeTabElement = container.querySelector(`[data-label="${activeTab}"]`);
93
+ if (!activeTabElement)
94
+ return;
95
+ container.querySelectorAll('[data-label]').forEach((el) => {
96
+ el.classList.remove('active');
97
+ });
98
+ const { offsetLeft, offsetWidth } = activeTabElement;
99
+ if (visibleTabs.includes(activeIndex)) {
100
+ activeTabElement.classList.add('active');
101
+ setHighlightStyle({ left: offsetLeft, width: offsetWidth });
102
+ return;
103
+ }
104
+ if (overflowTabs.includes(activeIndex)) {
105
+ const moreButton = container.querySelector('button');
106
+ if (!moreButton)
107
+ return;
108
+ const moreButtonRect = moreButton.getBoundingClientRect();
109
+ const containerRect = container.getBoundingClientRect();
110
+ setHighlightStyle({
111
+ left: moreButtonRect.left - containerRect.left,
112
+ width: moreButtonRect.width,
113
+ });
114
+ return;
115
+ }
116
+ }, [activeTab, childrenArray, visibleTabs, overflowTabs, tabsContainerRef]);
117
+ return { highlightStyle };
118
+ };
72
119
  exports.TabListContainer = styled_components_1.default.ul `
73
120
  position: relative;
74
121
  display: flex;
@@ -12,12 +12,12 @@ export type TabItemProps = {
12
12
  icon?: React.ReactNode | string;
13
13
  };
14
14
  type TabsProps = {
15
+ id?: string;
15
16
  children: React.ReactElement<TabItemProps>[];
16
17
  className?: string;
17
18
  size: TabsSize;
18
- forceReady?: boolean;
19
19
  initialTab?: string;
20
20
  };
21
- export declare function Tabs({ children, className, size, forceReady, initialTab: propInitialTab, }: TabsProps): JSX.Element;
21
+ export declare function Tabs({ id, children, className, size, initialTab: propInitialTab, }: TabsProps): JSX.Element;
22
22
  export declare const TabContent: import("styled-components").StyledComponent<"div", any, {}, never>;
23
23
  export {};
@@ -22,101 +22,35 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.TabContent = exports.TabsSize = void 0;
27
30
  exports.Tabs = Tabs;
28
31
  const react_1 = __importStar(require("react"));
29
- const styled_components_1 = __importStar(require("styled-components"));
32
+ const styled_components_1 = __importDefault(require("styled-components"));
30
33
  const hooks_1 = require("../../../core/hooks");
31
34
  const TabList_1 = require("../../../markdoc/components/Tabs/TabList");
35
+ const utils_1 = require("../../../core/utils");
32
36
  var TabsSize;
33
37
  (function (TabsSize) {
34
38
  TabsSize["SMALL"] = "small";
35
39
  TabsSize["MEDIUM"] = "medium";
36
40
  })(TabsSize || (exports.TabsSize = TabsSize = {}));
37
- function Tabs({ children, className, size, forceReady = false, initialTab: propInitialTab, }) {
41
+ function Tabs({ id, children, className, size, initialTab: propInitialTab, }) {
38
42
  var _a, _b;
39
43
  const [childrenArray, setChildrenArray] = (0, react_1.useState)(react_1.default.Children.toArray(children));
44
+ const initialTab = (_b = propInitialTab !== null && propInitialTab !== void 0 ? propInitialTab : (_a = childrenArray[0]) === null || _a === void 0 ? void 0 : _a.props.label) !== null && _b !== void 0 ? _b : '';
45
+ const { activeTab, setActiveTab } = (0, hooks_1.useActiveTab)({ tabsId: id, initialTab });
40
46
  (0, react_1.useEffect)(() => {
41
47
  setChildrenArray(react_1.default.Children.toArray(children));
42
48
  }, [children]);
43
- const tabsContainerRef = (0, react_1.useRef)(null);
44
- const [isAnimating, setIsAnimating] = (0, react_1.useState)(false);
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;
47
- const { activeTab, setTabRef, onTabClick, handleKeyboard, getTabId, visibleTabs, overflowTabs, ready, allTabsHidden, } = (0, hooks_1.useTabs)({
48
- initialTab,
49
- totalTabs: childrenArray.length,
50
- containerRef: tabsContainerRef,
51
- });
52
- const [prevTab, setPrevTab] = react_1.default.useState(initialTab);
53
- const [highlightStyle, setHighlightStyle] = react_1.default.useState({
54
- left: 0,
55
- width: 0,
56
- });
57
- (0, react_1.useEffect)(() => {
58
- setPrevTab(activeTab);
59
- setIsAnimating(true);
60
- const activeIndex = childrenArray.findIndex((child) => child.props.label === activeTab);
61
- const container = tabsContainerRef.current;
62
- if (container) {
63
- container.querySelectorAll('[data-label]').forEach((el) => {
64
- el.classList.remove('active');
65
- });
66
- container.getBoundingClientRect();
67
- requestAnimationFrame(() => {
68
- if (activeIndex >= 0) {
69
- let activeTabElement = null;
70
- let startPosition = { left: 0, width: 0 };
71
- if (visibleTabs.includes(activeIndex)) {
72
- activeTabElement = container.querySelector(`[data-label="${activeTab}"]`);
73
- }
74
- else if (overflowTabs.includes(activeIndex)) {
75
- const moreButton = container.querySelector('button');
76
- if (moreButton) {
77
- const moreButtonRect = moreButton.getBoundingClientRect();
78
- const containerRect = container.getBoundingClientRect();
79
- startPosition = {
80
- left: moreButtonRect.left - containerRect.left,
81
- width: moreButtonRect.width,
82
- };
83
- }
84
- }
85
- if (activeTabElement) {
86
- const { offsetLeft, offsetWidth } = activeTabElement;
87
- if (overflowTabs.includes(activeIndex)) {
88
- setHighlightStyle(startPosition);
89
- requestAnimationFrame(() => {
90
- setHighlightStyle({ left: offsetLeft, width: offsetWidth });
91
- });
92
- }
93
- else {
94
- setHighlightStyle({ left: offsetLeft, width: offsetWidth });
95
- }
96
- if (visibleTabs.includes(activeIndex)) {
97
- activeTabElement === null || activeTabElement === void 0 ? void 0 : activeTabElement.classList.add('active');
98
- }
99
- return () => {
100
- container.querySelectorAll('[data-label]').forEach((el) => {
101
- el.classList.remove('active');
102
- });
103
- };
104
- }
105
- }
106
- setHighlightStyle({ left: 0, width: 0 });
107
- setIsAnimating(false);
108
- });
109
- }
110
- else {
111
- setHighlightStyle({ left: 0, width: 0 });
112
- setIsAnimating(false);
113
- }
114
- }, [activeTab, prevTab, childrenArray, visibleTabs, overflowTabs]);
115
- return (react_1.default.createElement(TabsContainer, { "data-component-name": "Markdoc/Tabs/Tabs", className: className, isReady: ready || forceReady },
116
- react_1.default.createElement(TabList_1.TabList, { size: size, childrenArray: childrenArray, overflowTabs: overflowTabs, setTabRef: setTabRef, onTabClick: onTabClick, handleKeyboard: handleKeyboard, getTabId: getTabId, activeTab: activeTab, isAnimating: isAnimating, highlightStyle: highlightStyle, visibleTabs: visibleTabs, allTabsHidden: allTabsHidden, tabsContainerRef: tabsContainerRef }),
49
+ return (react_1.default.createElement(TabsContainer, { "data-component-name": "Markdoc/Tabs/Tabs", className: className, key: id },
50
+ react_1.default.createElement(TabList_1.TabList, { size: size, childrenArray: childrenArray, activeTab: activeTab, onTabChange: setActiveTab }),
117
51
  childrenArray.map((child, index) => {
118
52
  const { label } = child.props;
119
- const tabId = getTabId(label, index);
53
+ const tabId = (0, utils_1.getTabId)(label, index);
120
54
  return label === activeTab ? (react_1.default.createElement(exports.TabContent, { key: `content-${tabId}`, id: `panel-${tabId}`, "aria-labelledby": `tab-${tabId}`, tabIndex: 0, role: "tabpanel" }, child.props.children)) : null;
121
55
  })));
122
56
  }
@@ -132,16 +66,6 @@ const TabsContainer = styled_components_1.default.div `
132
66
  padding: var(--md-tabs-container-padding);
133
67
  border: var(--md-tabs-container-border);
134
68
 
135
- ${({ isReady }) => !isReady
136
- ? (0, styled_components_1.css) `
137
- visibility: hidden;
138
- overflow: hidden;
139
- `
140
- : (0, styled_components_1.css) `
141
- visibility: visible;
142
- overflow: visible;
143
- `}
144
-
145
69
  ol[class^='Tabs__TabList'] {
146
70
  margin: 0;
147
71
  padding: 0;
@@ -22,6 +22,11 @@ exports.tabs = {
22
22
  return new markdoc_1.default.Tag('Tabs', attributes, tabsContent);
23
23
  },
24
24
  attributes: {
25
+ /*
26
+ A unique persistent identifier assigned to a component.
27
+ This value is used as a key for the query parameter that stores the active tab to enable deep linking.
28
+ */
29
+ id: { type: String },
25
30
  size: { type: String, matches: ['small', 'medium'], default: 'medium' },
26
31
  },
27
32
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.58.1",
3
+ "version": "0.59.0-next.1",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -88,7 +88,7 @@
88
88
  "react-calendar": "5.1.0",
89
89
  "react-date-picker": "11.0.0",
90
90
  "@redocly/config": "0.35.1",
91
- "@redocly/realm-asyncapi-sdk": "0.4.1"
91
+ "@redocly/realm-asyncapi-sdk": "0.5.0-next.0"
92
92
  },
93
93
  "scripts": {
94
94
  "watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
@@ -0,0 +1,100 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { BaseSyntheticEvent, PropsWithChildren, ReactNode, JSX } from 'react';
5
+ import type { AccordionHeaderProps } from '@redocly/theme/components/Accordion/AccordionHeader';
6
+
7
+ import { AccordionBody } from '@redocly/theme/components/Accordion/AccordionBody';
8
+ import { AccordionHeader } from '@redocly/theme/components/Accordion/AccordionHeader';
9
+ import { AccordionTitle } from '@redocly/theme/components/Accordion/AccordionTitle';
10
+ import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
11
+ import { ChevronRightIcon } from '@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon';
12
+
13
+ export type AccordionProps = {
14
+ expanded?: boolean;
15
+ isExpandable?: boolean;
16
+ className?: string;
17
+ renderChildrenHidden?: boolean;
18
+ header?: ReactNode | ((props: AccordionHeaderProps) => ReactNode);
19
+ onToggle?: (expanded: boolean) => void;
20
+ dataTestId?: string;
21
+ };
22
+
23
+ export function Accordion({
24
+ expanded = true,
25
+ isExpandable = true,
26
+ renderChildrenHidden = false,
27
+ header,
28
+ className,
29
+ children,
30
+ onToggle,
31
+ dataTestId,
32
+ }: PropsWithChildren<AccordionProps>): JSX.Element {
33
+ const [isExpanded, setExpanded] = useState(expanded);
34
+ const [animate, setAnimate] = useState(false);
35
+
36
+ const toggle = ({ target }: BaseSyntheticEvent): void => {
37
+ if (target instanceof HTMLAnchorElement || !isExpandable) return;
38
+ setAnimate(true);
39
+ setExpanded(!isExpanded);
40
+ onToggle?.(!isExpanded);
41
+ };
42
+
43
+ useEffect(() => setExpanded(expanded), [expanded]);
44
+
45
+ return (
46
+ <AccordionWrapper
47
+ className={className}
48
+ data-testid={dataTestId}
49
+ data-component-name="Accordion/Accordion"
50
+ >
51
+ {header &&
52
+ (typeof header === 'function' ? (
53
+ header({ expanded: isExpanded })
54
+ ) : (
55
+ <AccordionHeader
56
+ data-testid="accordion-header"
57
+ onClick={toggle}
58
+ expanded={isExpanded}
59
+ isExpandable={isExpandable}
60
+ >
61
+ <HeaderContent>
62
+ <AccordionTitle data-testid="title">{header}</AccordionTitle>
63
+ {isExpandable &&
64
+ (isExpanded ? (
65
+ <ChevronDownIcon color="--accordion-chevron-icon-color" />
66
+ ) : (
67
+ <ChevronRightIcon color="--accordion-chevron-icon-color" />
68
+ ))}
69
+ </HeaderContent>
70
+ </AccordionHeader>
71
+ ))}
72
+
73
+ {(isExpanded || renderChildrenHidden) && (
74
+ <AccordionBody data-testid="accordion-body" hidden={!isExpanded} animate={animate}>
75
+ {children}
76
+ </AccordionBody>
77
+ )}
78
+ </AccordionWrapper>
79
+ );
80
+ }
81
+
82
+ const AccordionWrapper = styled.div`
83
+ background-color: transparent;
84
+ font-family: var(--accordion-font-family);
85
+ font-size: var(--accordion-font-size);
86
+ font-weight: var(--accordion-font-weight);
87
+ border-radius: var(--accordion-border-radius);
88
+ border: var(--accordion-border);
89
+
90
+ &:not(:last-child) {
91
+ margin-bottom: var(--accordion-gap);
92
+ }
93
+ `;
94
+
95
+ const HeaderContent = styled.div`
96
+ display: flex;
97
+ align-items: center;
98
+ width: 100%;
99
+ gap: var(--spacing-xs);
100
+ `;