@redocly/openapi-docs 3.12.0 → 3.12.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.
- package/dist/redocly-openapi-docs.min.js +753 -750
- package/lib/components/ApiInfo/ApiInfo.js +29 -1
- package/lib/components/ApiInfo/Metadata.js +29 -1
- package/lib/components/ApiInfo/index.js +2 -1
- package/lib/components/ApiInfo/styled.js +16 -8
- package/lib/components/CallbackSamples/CallbackSamples.js +25 -4
- package/lib/components/CallbackSamples/index.js +2 -1
- package/lib/components/Callbacks/CallbackDetails.js +17 -3
- package/lib/components/Callbacks/CallbackOperation.js +24 -3
- package/lib/components/Callbacks/CallbackSummary.js +19 -3
- package/lib/components/Callbacks/CallbacksList.js +16 -1
- package/lib/components/Callbacks/index.js +4 -1
- package/lib/components/Callbacks/styled.js +6 -3
- package/lib/components/Content/Content.js +10 -1
- package/lib/components/Content/index.js +2 -1
- package/lib/components/Content/useAutoScroll.js +50 -1
- package/lib/components/ContentItem/ContentItem.js +31 -1
- package/lib/components/ContentItem/index.js +2 -1
- package/lib/components/ContentItem/useIsExpanded.js +33 -1
- package/lib/components/ContentItems/ContentItems.js +19 -1
- package/lib/components/ContentItems/Items.js +13 -1
- package/lib/components/ContentItems/VirtualList.js +35 -1
- package/lib/components/ContentItems/helpers.js +49 -1
- package/lib/components/ContentItems/index.js +2 -1
- package/lib/components/ContentItems/useScrollOnRender.js +26 -1
- package/lib/components/Discriminator/Discriminator.js +27 -2
- package/lib/components/Discriminator/index.js +2 -1
- package/lib/components/Download/DownloadSpecification.js +46 -4
- package/lib/components/Download/index.js +2 -1
- package/lib/components/Download/types.js +2 -0
- package/lib/components/Download/useDownloadInfo.js +42 -1
- package/lib/components/ErrorBoundary/ErrorBoundary.js +22 -2
- package/lib/components/ErrorBoundary/index.js +2 -1
- package/lib/components/ExpandAllButton/ExpandAllButton.js +31 -2
- package/lib/components/ExpandAllButton/index.js +2 -1
- package/lib/components/ExternalDocumentation/ExternalDocumentation.js +18 -4
- package/lib/components/ExternalDocumentation/index.js +2 -1
- package/lib/components/Language/LanguageDropdown.js +21 -1
- package/lib/components/Language/LanguageItem.js +33 -1
- package/lib/components/Language/LanguageList.js +93 -1
- package/lib/components/Language/_tests_/LanguageDropdown.test.js +23 -1
- package/lib/components/Language/constants.js +3 -1
- package/lib/components/Language/index.js +4 -1
- package/lib/components/Language/styled.js +29 -15
- package/lib/components/Markdown/Markdown.js +64 -1
- package/lib/components/Markdown/index.js +3 -1
- package/lib/components/Markdown/types.js +2 -0
- package/lib/components/MediaTypeSwitch/MediaTypesSwitch.js +51 -1
- package/lib/components/MediaTypeSwitch/index.js +2 -1
- package/lib/components/OperationItem/Description.js +9 -1
- package/lib/components/OperationItem/OperationItem.js +70 -5
- package/lib/components/OperationItem/_tests_/OperationItem.test.js +70 -1
- package/lib/components/OperationItem/_tests_/__mocks__/mock-intersection-observer.js +40 -1
- package/lib/components/OperationItem/index.js +2 -1
- package/lib/components/OperationItem/types.js +2 -0
- package/lib/components/Overlay.js +48 -3
- package/lib/components/Overview/Overview.js +20 -1
- package/lib/components/Overview/index.js +2 -1
- package/lib/components/PageFooter/PageFooter.js +19 -1
- package/lib/components/PageFooter/index.js +2 -1
- package/lib/components/Panel/ResponsePanel.js +12 -6
- package/lib/components/Panel/Trigger.js +4 -2
- package/lib/components/Panel/index.js +3 -1
- package/lib/components/PanelItem/PanelItem.js +6 -1
- package/lib/components/PanelItem/index.js +3 -1
- package/lib/components/PanelItem/styled.js +20 -10
- package/lib/components/PayloadSamples/Example.js +6 -1
- package/lib/components/PayloadSamples/ExampleValue.js +30 -1
- package/lib/components/PayloadSamples/MediaTypeSamples.js +36 -2
- package/lib/components/PayloadSamples/PayloadSamples.js +26 -1
- package/lib/components/PayloadSamples/index.js +7 -1
- package/lib/components/PayloadSamples/styled.js +9 -4
- package/lib/components/PayloadSamples/types.js +2 -0
- package/lib/components/PropertyDetails/DescriptionEnums.js +19 -3
- package/lib/components/PropertyDetails/EnumValues.js +37 -1
- package/lib/components/PropertyDetails/Examples.js +26 -1
- package/lib/components/PropertyDetails/Extensions.js +17 -2
- package/lib/components/PropertyDetails/FieldDetail.js +15 -2
- package/lib/components/PropertyDetails/FieldDetails.js +51 -6
- package/lib/components/PropertyDetails/Pattern.js +21 -1
- package/lib/components/PropertyDetails/PlusCircleIcon.js +10 -4
- package/lib/components/PropertyDetails/PropertyDetails.js +22 -5
- package/lib/components/PropertyDetails/SchemaTypeInfo.js +10 -2
- package/lib/components/PropertyDetails/SimpleEnums.js +13 -2
- package/lib/components/PropertyDetails/cycleColorsByLevel.js +18 -1
- package/lib/components/PropertyDetails/index.js +4 -1
- package/lib/components/PropertyDetails/styled.js +15 -7
- package/lib/components/PropertyDetails/types.js +2 -0
- package/lib/components/RedoclyOpenAPIDocs/Providers.js +114 -1
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +57 -1
- package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +86 -1
- package/lib/components/RedoclyOpenAPIDocs/index.js +5 -1
- package/lib/components/RedoclyOpenAPIDocs/styled.js +4 -2
- package/lib/components/RedoclyOpenAPIDocs/types.js +2 -0
- package/lib/components/RedoclyOpenAPIDocs/utils.js +33 -1
- package/lib/components/RenderHook/RenderHook.js +17 -1
- package/lib/components/RenderHook/index.js +2 -1
- package/lib/components/Replay/EmbeddedReplay.js +41 -3
- package/lib/components/Replay/Replay.js +99 -1
- package/lib/components/Replay/index.js +3 -1
- package/lib/components/Replay/utils.js +208 -1
- package/lib/components/Request/RequestDetails.js +33 -2
- package/lib/components/Request/types.js +2 -0
- package/lib/components/RequestParameters/Body.js +8 -1
- package/lib/components/RequestParameters/ParametersGroup.js +19 -4
- package/lib/components/RequestParameters/RequestParameters.js +40 -1
- package/lib/components/RequestParameters/index.js +4 -1
- package/lib/components/RequestSamples/CodeSample.js +55 -2
- package/lib/components/RequestSamples/Example.js +37 -1
- package/lib/components/RequestSamples/RequestSamples.js +89 -5
- package/lib/components/RequestSamples/index.js +3 -1
- package/lib/components/RequestSamples/useCodeSamples.js +92 -1
- package/lib/components/ResponseSamples/ResponseSamples.js +47 -1
- package/lib/components/ResponseSamples/Summary.js +9 -1
- package/lib/components/ResponseSamples/index.js +2 -1
- package/lib/components/Responses/OperationResponseList.js +42 -2
- package/lib/components/Responses/ResponseDetails.js +18 -1
- package/lib/components/Responses/ResponseHeaders.js +15 -1
- package/lib/components/Responses/index.js +6 -1
- package/lib/components/Responses/styled.js +14 -6
- package/lib/components/Responses/types.js +2 -0
- package/lib/components/RightPanel/RightPanel.js +21 -1
- package/lib/components/RightPanel/index.js +2 -1
- package/lib/components/Samples/ExampleSwitch.js +33 -1
- package/lib/components/Samples/index.js +3 -1
- package/lib/components/Samples/use-example-key.js +12 -1
- package/lib/components/Schema/ArraySchema.js +45 -1
- package/lib/components/Schema/ObjectSchema.js +29 -1
- package/lib/components/Schema/OneOfSchema.js +47 -3
- package/lib/components/Schema/RecursiveSchema.js +10 -1
- package/lib/components/Schema/Schema.js +63 -2
- package/lib/components/Schema/SubSchema.js +20 -1
- package/lib/components/Schema/helpers.js +16 -1
- package/lib/components/Schema/index.js +5 -1
- package/lib/components/Schema/types.js +2 -0
- package/lib/components/Schema/useOneOfLocationIdx.js +11 -1
- package/lib/components/SchemaDefinition/SchemaDefinition.js +65 -2
- package/lib/components/SchemaDefinition/index.js +2 -1
- package/lib/components/SectionContent/SectionContent.js +49 -6
- package/lib/components/SectionContent/index.js +2 -1
- package/lib/components/SectionItem/SectionItem.js +14 -1
- package/lib/components/SectionItem/index.js +2 -1
- package/lib/components/Security/Divider.js +9 -2
- package/lib/components/Security/OAuthFlow.js +11 -1
- package/lib/components/Security/OAuthScopes.js +59 -9
- package/lib/components/Security/Security.js +15 -1
- package/lib/components/Security/SecurityButton.js +31 -7
- package/lib/components/Security/SecurityFlow.js +28 -4
- package/lib/components/Security/SecurityModal.js +34 -5
- package/lib/components/Security/SecuritySchemeItem.js +15 -4
- package/lib/components/Security/helper.js +16 -1
- package/lib/components/Security/index.js +11 -1
- package/lib/components/Security/styled.js +6 -3
- package/lib/components/SelectOrLabel/SelectOrLabel.js +12 -2
- package/lib/components/SelectOrLabel/index.js +2 -1
- package/lib/components/ServerList/ServerList.js +36 -10
- package/lib/components/ServerList/index.js +2 -1
- package/lib/components/ServerList/types.js +2 -0
- package/lib/components/ServerListDropdown/ServerListDropdown.js +54 -1
- package/lib/components/ServerListDropdown/index.js +2 -1
- package/lib/components/ServerListDropdown/styled.js +15 -6
- package/lib/components/SideMenu/SideMenu.js +13 -2
- package/lib/components/SideMenu/hooks/useMenuItems.js +110 -1
- package/lib/components/SideMenu/index.js +2 -1
- package/lib/components/SideMenu/types.js +2 -0
- package/lib/components/StickySidebar/SidebarActions.js +14 -2
- package/lib/components/StickySidebar/StickyResponsiveSidebar.js +37 -7
- package/lib/components/StickySidebar/index.js +2 -1
- package/lib/components/Tabs/Tabs.js +16 -5
- package/lib/components/Tabs/index.js +3 -1
- package/lib/components/Tabs/useTabsState.js +22 -1
- package/lib/components/TagItem/OperationNavigationItems.js +18 -4
- package/lib/components/TagItem/OperationsNavigation.js +46 -2
- package/lib/components/TagItem/TagItem.js +40 -7
- package/lib/components/TagItem/index.js +2 -1
- package/lib/components/TagItem/styled.js +5 -2
- package/lib/components/TagItem/types.js +2 -0
- package/lib/components/ViewNested/ViewNested.js +42 -9
- package/lib/components/ViewNested/index.js +2 -1
- package/lib/components/common/Badges.js +21 -5
- package/lib/components/common/BodyContent/BodyContent.js +31 -4
- package/lib/components/common/BodyContent/index.js +2 -1
- package/lib/components/common/ClearButton/ClearButton.js +5 -1
- package/lib/components/common/ClearButton/index.js +3 -1
- package/lib/components/common/ClearButton/styled.js +5 -2
- package/lib/components/common/ClearButton/types.js +2 -0
- package/lib/components/common/CodeBlockPanel.js +7 -3
- package/lib/components/common/ConstraintsView.js +14 -2
- package/lib/components/common/Dropdown/Dropdown.js +22 -4
- package/lib/components/common/Dropdown/index.js +2 -1
- package/lib/components/common/ExpandableExample/ExpandableExample.js +24 -3
- package/lib/components/common/ExpandableExample/index.js +2 -1
- package/lib/components/common/Extensions.js +17 -2
- package/lib/components/common/Fields/fields-layout.js +76 -51
- package/lib/components/common/Fields/fields.js +39 -17
- package/lib/components/common/Fields/index.js +3 -1
- package/lib/components/common/LinkToField.js +33 -6
- package/lib/components/common/OperationItemTitle.js +12 -6
- package/lib/components/common/SchemaSelection/SchemaSelection.js +51 -1
- package/lib/components/common/SchemaSelection/index.js +2 -1
- package/lib/components/common/Select/Select.js +21 -1
- package/lib/components/common/Select/index.js +3 -1
- package/lib/components/common/Select/styled.js +17 -9
- package/lib/components/common/Select/types.js +2 -0
- package/lib/components/common/Skeleton/LanguageListSkeleton.js +16 -6
- package/lib/components/common/Skeleton/Skeleton.js +15 -5
- package/lib/components/common/Skeleton/index.js +3 -1
- package/lib/components/common/headers.js +4 -2
- package/lib/components/common/index.js +14 -1
- package/lib/components/common/linkify.js +28 -4
- package/lib/components/common/mixins.js +4 -2
- package/lib/components/common/panels.js +52 -29
- package/lib/components/common/schema.js +16 -8
- package/lib/components/common/styled.js +15 -7
- package/lib/components/index.js +25 -1
- package/lib/components/pluggable/RedocExample.js +20 -1
- package/lib/components/pluggable/RedocSchema.js +22 -1
- package/lib/components/pluggable/index.js +3 -1
- package/lib/components/pluggable/styled.components.js +9 -4
- package/lib/constants.js +30 -1
- package/lib/empty.js +7 -1
- package/lib/events/codeSampleCopy.js +19 -1
- package/lib/events/creator.js +5 -1
- package/lib/events/index.js +8 -1
- package/lib/events/languageSwitch.js +18 -1
- package/lib/events/panelToggle.js +16 -1
- package/lib/events/serverSwitch.js +13 -1
- package/lib/events/tryItOpen.js +12 -1
- package/lib/events/tryItSent.js +12 -1
- package/lib/events/types.js +11 -1
- package/lib/hoc/types.js +2 -0
- package/lib/hoc/utils.js +4 -1
- package/lib/hoc/withRouter.js +17 -1
- package/lib/hoc/withStore.js +28 -1
- package/lib/hooks/index.js +9 -1
- package/lib/hooks/useActivateExample.js +35 -1
- package/lib/hooks/useActiveWithFallback.js +12 -1
- package/lib/hooks/useContentItems.js +10 -1
- package/lib/hooks/useLicense.js +17 -1
- package/lib/hooks/usePerformanceMetrics.js +26 -1
- package/lib/hooks/useRouter.js +17 -1
- package/lib/hooks/useTelemetry.js +5 -1
- package/lib/hooks/useTranslate.js +6 -1
- package/lib/hooks/useUppercase2LowercaseRedirect.js +12 -1
- package/lib/icons/CSharpIcon/CSharpIcon.js +7 -1
- package/lib/icons/CSharpIcon/index.js +2 -1
- package/lib/icons/CurlIcon/CurlIcon.js +8 -2
- package/lib/icons/CurlIcon/index.js +2 -1
- package/lib/icons/GOIcon/GOIcon.js +7 -1
- package/lib/icons/GOIcon/index.js +2 -1
- package/lib/icons/JavaIcon/JavaIcon.js +7 -1
- package/lib/icons/JavaIcon/index.js +2 -1
- package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +7 -1
- package/lib/icons/JavaScriptIcon/index.js +2 -1
- package/lib/icons/NodeJSIcon/NodeJSIcon.js +7 -1
- package/lib/icons/NodeJSIcon/index.js +2 -1
- package/lib/icons/PHPIcon/PHPIcon.js +7 -1
- package/lib/icons/PHPIcon/index.js +2 -1
- package/lib/icons/PayloadIcon/PayloadIcon.js +7 -1
- package/lib/icons/PayloadIcon/index.js +2 -1
- package/lib/icons/PythonIcon/PythonIcon.js +7 -1
- package/lib/icons/PythonIcon/index.js +2 -1
- package/lib/icons/RIcon/RIcon.js +7 -1
- package/lib/icons/RIcon/index.js +2 -1
- package/lib/icons/RubyIcon/RubyIcon.js +7 -1
- package/lib/icons/RubyIcon/index.js +2 -1
- package/lib/index.js +49 -1
- package/lib/jotai/app.js +113 -1
- package/lib/jotai/operation.js +28 -1
- package/lib/jotai/replay.js +5 -1
- package/lib/jotai/store.js +8 -1
- package/lib/jotai/use-write-atom.js +9 -1
- package/lib/models/callback.js +28 -1
- package/lib/models/code-sample-options.js +2 -0
- package/lib/models/example.js +17 -1
- package/lib/models/field.js +109 -1
- package/lib/models/group.js +38 -1
- package/lib/models/index.js +14 -1
- package/lib/models/mediaContent.js +26 -1
- package/lib/models/mediaType.js +153 -1
- package/lib/models/operation.js +166 -1
- package/lib/models/request.js +25 -1
- package/lib/models/response.js +46 -1
- package/lib/models/schema.js +474 -2
- package/lib/models/security.js +84 -1
- package/lib/models/tab.js +2 -0
- package/lib/models/types.js +2 -0
- package/lib/services/OpenAPIParser.js +321 -1
- package/lib/services/check.js +104 -1
- package/lib/services/code-samples/constants.js +16 -1
- package/lib/services/code-samples/generator.js +540 -1
- package/lib/services/code-samples/httpsnippet/helpers/code-builder.js +252 -3
- package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +90 -2
- package/lib/services/code-samples/httpsnippet/helpers/constants.js +28 -1
- package/lib/services/code-samples/httpsnippet/helpers/lodash-int.js +173 -1
- package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +76 -37
- package/lib/services/code-samples/httpsnippet/helpers/reducer.js +16 -1
- package/lib/services/code-samples/httpsnippet/helpers/shell.js +20 -1
- package/lib/services/code-samples/httpsnippet/helpers/string-utility.js +19 -1
- package/lib/services/code-samples/httpsnippet/index.js +166 -1
- package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +2340 -146
- package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +227 -2
- package/lib/services/code-samples/httpsnippet/targets/csharp/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +185 -2
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/go/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/go/native.js +222 -3
- package/lib/services/code-samples/httpsnippet/targets/index.js +28 -1
- package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +184 -3
- package/lib/services/code-samples/httpsnippet/targets/java/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +223 -2
- package/lib/services/code-samples/httpsnippet/targets/java8/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +147 -1
- package/lib/services/code-samples/httpsnippet/targets/javascript/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +199 -1
- package/lib/services/code-samples/httpsnippet/targets/node/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/php/curl.js +203 -5
- package/lib/services/code-samples/httpsnippet/targets/php/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
- package/lib/services/code-samples/httpsnippet/targets/php/utils.js +106 -5
- package/lib/services/code-samples/httpsnippet/targets/python/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/python/requests.js +185 -6
- package/lib/services/code-samples/httpsnippet/targets/r/httr.js +111 -1
- package/lib/services/code-samples/httpsnippet/targets/r/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/r/utils.js +18 -6
- package/lib/services/code-samples/httpsnippet/targets/ruby/index.js +11 -1
- package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +169 -1
- package/lib/services/code-samples/httpsnippet/targets/shell/curl.js +94 -6
- package/lib/services/code-samples/httpsnippet/targets/shell/index.js +11 -1
- package/lib/services/code-samples/index.js +3 -1
- package/lib/services/code-samples/types.js +2 -0
- package/lib/services/config-options/helpers.js +49 -1
- package/lib/services/config-options/index.js +3 -1
- package/lib/services/config-options/normalizeOptions.js +83 -1
- package/lib/services/config-options/types.js +2 -0
- package/lib/services/history/helpers.js +63 -1
- package/lib/services/history/index.js +2 -1
- package/lib/services/index.js +9 -1
- package/lib/services/menu/builder.js +47 -1
- package/lib/services/menu/index.js +2 -1
- package/lib/services/menu/markdown.js +93 -1
- package/lib/services/menu/operation.js +50 -1
- package/lib/services/menu/tags.js +166 -1
- package/lib/services/types.js +2 -0
- package/lib/services/utils.js +83 -1
- package/lib/standalone.js +68 -1
- package/lib/styled-components.js +6 -1
- package/lib/types/app.js +2 -0
- package/lib/types/index.js +4 -1
- package/lib/types/open-api.js +2 -0
- package/lib/types/security.js +2 -0
- package/lib/utils/JsonPointer.js +84 -1
- package/lib/utils/areArraysEqual.js +4 -1
- package/lib/utils/argValuesHelpers.js +35 -1
- package/lib/utils/compose.js +2 -1
- package/lib/utils/configure-helpers.js +223 -1
- package/lib/utils/convertSwagger2OpenAPI.js +14 -1
- package/lib/utils/cookies.js +73 -1
- package/lib/utils/debounce.js +22 -1
- package/lib/utils/debug.js +11 -1
- package/lib/utils/dom.js +65 -1
- package/lib/utils/environments.js +13 -1
- package/lib/utils/helpers.js +222 -12
- package/lib/utils/index.js +25 -1
- package/lib/utils/isMobile.js +13 -1
- package/lib/utils/loadAndBundleSpec.js +32 -1
- package/lib/utils/local-storage.js +12 -1
- package/lib/utils/object.js +31 -1
- package/lib/utils/openapi.js +592 -1
- package/lib/utils/parameters.js +13 -1
- package/lib/utils/path.js +22 -1
- package/lib/utils/queryString.js +60 -1
- package/lib/utils/replaceVariables.js +14 -1
- package/lib/utils/saveTextBeforeHeading.js +35 -1
- package/lib/utils/security-details.js +49 -1
- package/lib/utils/session-storage.js +12 -1
- package/lib/utils/simplifyAstStructure.js +22 -1
- package/lib/utils/sort.js +21 -1
- package/lib/utils/string.js +65 -1
- package/lib/utils/telemetry.js +7 -1
- package/lib/utils/test-utils.js +26 -1
- package/lib/utils/theme-helpers.js +24 -3
- package/lib/utils/url.js +38 -1
- package/package.json +3 -3
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { css } from 'styled-components';
|
|
3
|
+
import { StatusCode } from '@redocly/theme/components/StatusCode/StatusCode';
|
|
4
|
+
import { styled } from '../../styled-components.js';
|
|
5
|
+
export function Tabs({ tabs, onChange, activeTab }) {
|
|
6
|
+
return (_jsx(TabList, { children: tabs.map((tab) => (_jsx(Tab, { "$active": tab.key === activeTab?.key, onClick: () => onChange(tab), children: _jsx(StatusCode, { status: tab.key, children: tab.title }) }, tab.key))) }));
|
|
7
|
+
}
|
|
8
|
+
const TabList = styled.ol `
|
|
2
9
|
display: flex;
|
|
3
10
|
flex-wrap: wrap;
|
|
4
11
|
list-style: none;
|
|
5
12
|
margin: 0;
|
|
6
13
|
padding: 0;
|
|
7
|
-
|
|
14
|
+
`;
|
|
15
|
+
const Tab = styled.li `
|
|
8
16
|
display: inline-flex;
|
|
9
17
|
align-items: center;
|
|
10
18
|
list-style: none;
|
|
@@ -22,13 +30,16 @@ import{jsx as e}from"react/jsx-runtime";import{css as t}from"styled-components";
|
|
|
22
30
|
button {
|
|
23
31
|
color: var(--text-color-secondary);
|
|
24
32
|
|
|
25
|
-
${({$active
|
|
33
|
+
${({ $active }) => $active
|
|
34
|
+
? css `
|
|
26
35
|
color: var(--text-color-primary);
|
|
27
36
|
background-color: var(--tab-bg-color-filled);
|
|
28
|
-
|
|
37
|
+
`
|
|
38
|
+
: css `
|
|
29
39
|
&:hover {
|
|
30
40
|
color: var(--text-color-primary);
|
|
31
41
|
}
|
|
32
42
|
`}
|
|
33
43
|
}
|
|
34
|
-
`;
|
|
44
|
+
`;
|
|
45
|
+
//# sourceMappingURL=Tabs.js.map
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
import{useCallback
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import { useMount } from '@redocly/theme/core/openapi';
|
|
3
|
+
export function useTabsState({ tabs, defaultTab, onChange }) {
|
|
4
|
+
const [activeTab, setActiveTab] = useState(defaultTab || tabs[0].key);
|
|
5
|
+
useMount(() => {
|
|
6
|
+
if (defaultTab) {
|
|
7
|
+
setActiveTab(defaultTab);
|
|
8
|
+
onChange?.(defaultTab);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const handleTabChange = useCallback((tab) => {
|
|
12
|
+
if (activeTab !== tab.key) {
|
|
13
|
+
setActiveTab(tab.key);
|
|
14
|
+
}
|
|
15
|
+
onChange?.(tab.key);
|
|
16
|
+
}, [activeTab, onChange]);
|
|
17
|
+
return {
|
|
18
|
+
activeTab,
|
|
19
|
+
handleTabChange,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=useTabsState.js.map
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { joinWithSeparator } from '../../services/index.js';
|
|
4
|
+
import { encodeBackSlashes } from '../../utils/index.js';
|
|
5
|
+
import { HttpVerb, NavigationBadge } from '../common/index.js';
|
|
6
|
+
import { styled } from '../../styled-components.js';
|
|
7
|
+
import { StyledButton } from './styled.js';
|
|
8
|
+
function OperationNavigationItemsComponent({ title, items, onClick, routingBasePath, translate, }) {
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(Heading, { children: title }), items.map(({ id, href, httpVerb, path, deprecated, badges }) => (_jsx(Item, { variant: "outlined", size: "large", onClick: () => onClick(joinWithSeparator(routingBasePath, encodeBackSlashes(href))), children: _jsxs("span", { children: [_jsx(HttpVerb, { color: deprecated ? 'http-deprecated' : httpVerb, children: httpVerb }), _jsx(Path, { children: path }), deprecated && (_jsx(NavigationBadge, { deprecated: true, children: translate('openapi.badges.deprecated', 'Deprecated') })), badges?.map(({ name, color }) => (_jsx(NavigationBadge, { color: color, children: name }, name)))] }) }, id)))] }));
|
|
10
|
+
}
|
|
11
|
+
export const OperationNavigationItems = memo(OperationNavigationItemsComponent);
|
|
12
|
+
const Heading = styled.span `
|
|
2
13
|
font-size: var(--font-size-base);
|
|
3
14
|
line-height: var(--line-height-base);
|
|
4
15
|
font-weight: var(--font-weight-bold);
|
|
5
16
|
color: var(--text-color-primary);
|
|
6
17
|
margin: var(--spacing-sm) 0 var(--spacing-xxs) 0;
|
|
7
|
-
|
|
18
|
+
`;
|
|
19
|
+
const Item = styled(StyledButton) `
|
|
8
20
|
border-radius: var(--border-radius);
|
|
9
21
|
background: var(--bg-color);
|
|
10
22
|
justify-content: space-between;
|
|
@@ -24,7 +36,8 @@ import{jsx as e,jsxs as i,Fragment as b}from"react/jsx-runtime";import{memo as x
|
|
|
24
36
|
content: '→';
|
|
25
37
|
line-height: var(--line-height-base);
|
|
26
38
|
}
|
|
27
|
-
|
|
39
|
+
`;
|
|
40
|
+
const Path = styled.span `
|
|
28
41
|
font-family: var(--font-family-base);
|
|
29
42
|
font-size: var(--font-size-base);
|
|
30
43
|
line-height: var(--line-height-base);
|
|
@@ -33,4 +46,5 @@ import{jsx as e,jsxs as i,Fragment as b}from"react/jsx-runtime";import{memo as x
|
|
|
33
46
|
white-space: nowrap;
|
|
34
47
|
text-overflow: ellipsis;
|
|
35
48
|
overflow-x: hidden;
|
|
36
|
-
`;
|
|
49
|
+
`;
|
|
50
|
+
//# sourceMappingURL=OperationNavigationItems.js.map
|
|
@@ -1,6 +1,50 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, memo, useState, useCallback } from 'react';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { LayoutVariant } from '@redocly/config';
|
|
5
|
+
import { useAtomValue } from 'jotai/index';
|
|
6
|
+
import { SamplesPanel } from '../common/index.js';
|
|
7
|
+
import { layoutAtom } from '../../jotai/app.js';
|
|
8
|
+
import { OperationNavigationItems } from './OperationNavigationItems.js';
|
|
9
|
+
import { StyledButton } from './styled.js';
|
|
10
|
+
import { useTranslate } from '../../hooks/index.js';
|
|
11
|
+
import { styled } from '../../styled-components.js';
|
|
12
|
+
const MAX_OPERATIONS = 8;
|
|
13
|
+
export function OperationsNavigationComponent({ items, routingBasePath, }) {
|
|
14
|
+
const translate = useTranslate();
|
|
15
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
16
|
+
const navigate = useNavigate();
|
|
17
|
+
const layout = useAtomValue(layoutAtom);
|
|
18
|
+
const isStacked = layout === LayoutVariant.STACKED;
|
|
19
|
+
const { operations, webhooks, count } = useMemo(() => {
|
|
20
|
+
const all = items.filter((item) => item.type === 'operation');
|
|
21
|
+
const list = isExpanded ? all : all.slice(0, MAX_OPERATIONS);
|
|
22
|
+
const { operations, webhooks } = list.reduce((acc, item) => {
|
|
23
|
+
if (item.isWebhook) {
|
|
24
|
+
acc.webhooks.push(item);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
acc.operations.push(item);
|
|
28
|
+
}
|
|
29
|
+
return acc;
|
|
30
|
+
}, { operations: [], webhooks: [] });
|
|
31
|
+
return {
|
|
32
|
+
operations,
|
|
33
|
+
webhooks,
|
|
34
|
+
count: !isExpanded && all.length > MAX_OPERATIONS ? all.length - MAX_OPERATIONS : 0,
|
|
35
|
+
};
|
|
36
|
+
}, [isExpanded, items]);
|
|
37
|
+
const handleOnClick = useCallback((link) => navigate(link), [navigate]);
|
|
38
|
+
if (!operations.length && !webhooks.length) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs(Wrapper, { isStacked: isStacked, "data-testid": "operation-navigation-list", children: [operations.length > 0 && (_jsx(OperationNavigationItems, { items: operations, onClick: handleOnClick, routingBasePath: routingBasePath, translate: translate, title: translate('openapi.operations', 'Operations') })), webhooks.length > 0 && (_jsx(OperationNavigationItems, { items: webhooks, onClick: handleOnClick, routingBasePath: routingBasePath, translate: translate, title: translate('openapi.webhooks', 'Webhooks') })), !isExpanded && Boolean(count) && (_jsxs(StyledButton, { variant: "link", size: "large", "data-testid": "show-more-operations", fullWidth: true, onClick: () => setIsExpanded(true), children: [translate('openapi.actions.show', 'Show'), " ", count, ' ', translate('openapi.actions.more', 'more'), "..."] }))] }));
|
|
42
|
+
}
|
|
43
|
+
export const OperationsNavigation = memo(OperationsNavigationComponent);
|
|
44
|
+
const Wrapper = styled(SamplesPanel) `
|
|
2
45
|
display: flex;
|
|
3
46
|
flex-direction: column;
|
|
4
47
|
gap: var(--spacing-xxs);
|
|
5
48
|
padding-top: var(--spacing-xxl);
|
|
6
|
-
`;
|
|
49
|
+
`;
|
|
50
|
+
//# sourceMappingURL=OperationsNavigation.js.map
|
|
@@ -1,23 +1,56 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback } from 'react';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { useAtomValue } from 'jotai';
|
|
5
|
+
import { LayoutVariant } from '@redocly/config';
|
|
6
|
+
import { breakpoints } from '@redocly/theme/core/openapi';
|
|
7
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
8
|
+
import { PageActions } from '@redocly/theme/components/PageActions/PageActions';
|
|
9
|
+
import { H2 } from '@redocly/theme/components/Typography/H2';
|
|
10
|
+
import { LinkIcon } from '@redocly/theme/icons/LinkIcon/LinkIcon';
|
|
11
|
+
import { Row, SamplesMiddlePanel, ShareLink } from '../common/index.js';
|
|
12
|
+
import { Markdown } from '../Markdown/index.js';
|
|
13
|
+
import { OperationsNavigation } from './OperationsNavigation.js';
|
|
14
|
+
import { layoutAtom } from '../../jotai/app.js';
|
|
15
|
+
import { useTranslate } from '../../hooks/index.js';
|
|
16
|
+
import { styled } from '../../styled-components.js';
|
|
17
|
+
export function TagItemComponent({ item, routingBasePath = '', isExpanded, }) {
|
|
18
|
+
const translate = useTranslate();
|
|
19
|
+
const { description, name, href } = item;
|
|
20
|
+
const navigate = useNavigate();
|
|
21
|
+
const layout = useAtomValue(layoutAtom);
|
|
22
|
+
const tagItemSlug = routingBasePath + item.href;
|
|
23
|
+
const handleClick = useCallback(() => {
|
|
24
|
+
navigate(tagItemSlug);
|
|
25
|
+
}, [navigate, tagItemSlug]);
|
|
26
|
+
const expandable = Boolean(item.items.length);
|
|
27
|
+
const isStacked = layout === LayoutVariant.STACKED;
|
|
28
|
+
return (_jsxs(Wrapper, { expanded: isExpanded, children: [_jsxs(Row, { layout: layout, children: [_jsxs(SamplesMiddlePanel, { fullWidth: !expandable, isStacked: isStacked, children: [_jsxs(Heading, { children: [_jsx(ShareLink, { to: href, "aria-label": `link to ${name}` }), name, _jsx(PageActions, { pageSlug: tagItemSlug })] }), _jsx(Markdown, { source: description })] }), expandable && (_jsx(OperationsNavigation, { items: item.items, routingBasePath: routingBasePath }))] }), expandable && !isExpanded && (_jsxs(ShowButton, { type: "button", variant: "text", size: "medium", onClick: handleClick, children: ["+ ", translate('openapi.actions.show', 'Show')] }))] }));
|
|
29
|
+
}
|
|
30
|
+
export const TagItem = memo(TagItemComponent);
|
|
31
|
+
const Wrapper = styled.div `
|
|
2
32
|
padding-top: var(--spacing-lg);
|
|
3
|
-
padding-bottom: ${({expanded
|
|
4
|
-
|
|
33
|
+
padding-bottom: ${({ expanded }) => (expanded ? 'var(--spacing-xxl)' : '')};
|
|
34
|
+
`;
|
|
35
|
+
const ShowButton = styled(Button) `
|
|
5
36
|
margin: var(--spacing-md) var(--spacing-xl) var(--spacing-xxs);
|
|
6
37
|
width: calc(100% - var(--spacing-xl) * 2);
|
|
7
38
|
|
|
8
|
-
@media screen and (min-width: ${
|
|
39
|
+
@media screen and (min-width: ${breakpoints.medium}) {
|
|
9
40
|
--button-margin-md: calc(var(--spacing-xl) * 2);
|
|
10
41
|
|
|
11
42
|
margin-left: var(--button-margin-md);
|
|
12
43
|
margin-right: var(--button-margin-md);
|
|
13
44
|
width: calc(100% - var(--button-margin-md) * 2);
|
|
14
45
|
}
|
|
15
|
-
|
|
46
|
+
`;
|
|
47
|
+
const Heading = styled(H2) `
|
|
16
48
|
display: flex;
|
|
17
49
|
:hover {
|
|
18
|
-
${
|
|
50
|
+
${LinkIcon} {
|
|
19
51
|
opacity: 1;
|
|
20
52
|
visibility: visible;
|
|
21
53
|
}
|
|
22
54
|
}
|
|
23
|
-
`;
|
|
55
|
+
`;
|
|
56
|
+
//# sourceMappingURL=TagItem.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { TagItem } from './TagItem.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import{Button
|
|
1
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
2
|
+
import { styled } from '../../styled-components.js';
|
|
3
|
+
export const StyledButton = styled(Button) `
|
|
2
4
|
& + & {
|
|
3
5
|
margin-left: 0;
|
|
4
6
|
}
|
|
5
|
-
`;
|
|
7
|
+
`;
|
|
8
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { css } from 'styled-components';
|
|
3
|
+
import { memo, useEffect, useState } from 'react';
|
|
4
|
+
import { isUndefined } from '@redocly/theme/core/openapi';
|
|
5
|
+
import { cycleColorsByLevel } from '../PropertyDetails/cycleColorsByLevel.js';
|
|
6
|
+
import { CircleIcon } from '../PropertyDetails/PlusCircleIcon.js';
|
|
7
|
+
import { LabelValue } from '../common/styled.js';
|
|
8
|
+
import { styled } from '../../styled-components.js';
|
|
9
|
+
function ViewNestedComponent({ expandByDefault, level, expandable = false, expandText, hideText, hideDivider = false, children, expandedAll, isNestedArray, }) {
|
|
10
|
+
const [expanded, setExpanded] = useState((expandByDefault || isNestedArray) ?? false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!isUndefined(expandedAll)) {
|
|
13
|
+
setExpanded(expandedAll);
|
|
14
|
+
}
|
|
15
|
+
}, [expandedAll]);
|
|
16
|
+
const color = expanded ? cycleColorsByLevel(level) : undefined;
|
|
17
|
+
if (!expandable)
|
|
18
|
+
return children;
|
|
19
|
+
const handleToggle = () => {
|
|
20
|
+
setExpanded((prev) => !prev);
|
|
21
|
+
};
|
|
22
|
+
if (isNestedArray) {
|
|
23
|
+
return (_jsxs(_Fragment, { children: [_jsx(LabelValue, { children: "Array [" }), _jsx(Wrapper, { "$isArrayInsideArray": isNestedArray, className: "view-nested-wrapper", children: _jsx(StyledNested, { color: color, children: children }) })] }));
|
|
24
|
+
}
|
|
25
|
+
return (_jsx(_Fragment, { children: _jsxs(Wrapper, { "$divider": !hideDivider && !expanded, className: "view-nested-wrapper", children: [_jsxs(ShowProperty, { onClick: handleToggle, children: [_jsx(CircleIcon, { sign: expanded ? '-' : '+', color: color }), !expanded && expandText, expanded && (hideText || '')] }), expanded && _jsx(StyledNested, { color: color, children: children })] }) }));
|
|
26
|
+
}
|
|
27
|
+
export const ViewNested = memo(ViewNestedComponent);
|
|
28
|
+
const ShowProperty = styled.button `
|
|
2
29
|
background: none;
|
|
3
30
|
border: none;
|
|
4
31
|
cursor: pointer;
|
|
@@ -12,23 +39,29 @@ import{jsx as o,Fragment as l,jsxs as t}from"react/jsx-runtime";import{css as c}
|
|
|
12
39
|
line-height: var(--line-height-base);
|
|
13
40
|
margin: var(--spacing-xxs) 0 var(--spacing-xs);
|
|
14
41
|
width: 100%;
|
|
15
|
-
|
|
42
|
+
`;
|
|
43
|
+
const StyledNested = styled.div `
|
|
16
44
|
padding-left: var(--schema-nested-offset);
|
|
17
|
-
border-left: 1px solid ${({color
|
|
45
|
+
border-left: 1px solid ${({ color }) => color || 'var(--border-color-primary)'};
|
|
18
46
|
margin: -10px 0 0 9px;
|
|
19
|
-
${({color
|
|
47
|
+
${({ color }) => color &&
|
|
48
|
+
css `
|
|
20
49
|
.schema-name {
|
|
21
|
-
color: ${
|
|
50
|
+
color: ${color};
|
|
22
51
|
}
|
|
23
52
|
`}
|
|
24
|
-
|
|
53
|
+
`;
|
|
54
|
+
const Wrapper = styled.div `
|
|
25
55
|
width: 100%;
|
|
26
|
-
${({$isArrayInsideArray
|
|
56
|
+
${({ $isArrayInsideArray }) => $isArrayInsideArray &&
|
|
57
|
+
css `
|
|
27
58
|
padding-top: var(--schema-property-details-spacing);
|
|
28
59
|
`}
|
|
29
60
|
|
|
30
|
-
${({$divider
|
|
61
|
+
${({ $divider }) => $divider &&
|
|
62
|
+
css `
|
|
31
63
|
border-bottom: 1px solid var(--border-color-primary);
|
|
32
64
|
padding-bottom: var(--schema-property-details-spacing);
|
|
33
65
|
`}
|
|
34
|
-
`;
|
|
66
|
+
`;
|
|
67
|
+
//# sourceMappingURL=ViewNested.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { ViewNested } from './ViewNested.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { css } from 'styled-components';
|
|
4
|
+
import { Badge } from '@redocly/theme/components/Badge/Badge';
|
|
5
|
+
import { styled } from '../../styled-components.js';
|
|
6
|
+
function CustomBadgesComponent({ badges, children }) {
|
|
7
|
+
if (!badges)
|
|
8
|
+
return _jsx(_Fragment, { children: children });
|
|
9
|
+
const badgesBefore = badges.filter(({ position }) => position === 'before');
|
|
10
|
+
const badgesAfter = badges.filter(({ position }) => position === 'after');
|
|
11
|
+
return (_jsxs(_Fragment, { children: [badgesBefore.map(({ name, color }) => (_jsx(StyledBadge, { color: color, children: name }, name))), children, badgesAfter.map(({ name, color }) => (_jsx(StyledBadge, { color: color, children: name }, name)))] }));
|
|
12
|
+
}
|
|
13
|
+
export const CustomBadges = memo(CustomBadgesComponent);
|
|
14
|
+
export const StyledBadge = styled(Badge) `
|
|
2
15
|
margin-left: 0;
|
|
3
|
-
background-color: ${({color
|
|
4
|
-
${({deprecated
|
|
16
|
+
background-color: ${({ color }) => color || 'var(--color-info-base)'};
|
|
17
|
+
${({ deprecated }) => deprecated &&
|
|
18
|
+
css `
|
|
5
19
|
color: var(--badge-deprecated-text-color);
|
|
6
20
|
background-color: var(--badge-deprecated-bg-color);
|
|
7
21
|
border-radius: var(--badge-deprecated-border-radius);
|
|
8
22
|
`};
|
|
9
|
-
|
|
23
|
+
`;
|
|
24
|
+
export const NavigationBadge = styled(StyledBadge) `
|
|
10
25
|
margin-left: 0;
|
|
11
26
|
font-size: var(--font-size-sm);
|
|
12
27
|
line-height: var(--line-height-sm);
|
|
@@ -15,4 +30,5 @@ import{Fragment as i,jsx as t,jsxs as l}from"react/jsx-runtime";import{memo as m
|
|
|
15
30
|
text-overflow: ellipsis;
|
|
16
31
|
white-space: nowrap;
|
|
17
32
|
overflow: hidden;
|
|
18
|
-
`;
|
|
33
|
+
`;
|
|
34
|
+
//# sourceMappingURL=Badges.js.map
|
|
@@ -1,6 +1,32 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { useAtom } from 'jotai';
|
|
4
|
+
import { LinkIcon } from '@redocly/theme/icons/LinkIcon/LinkIcon';
|
|
5
|
+
import { Dropdown } from '../Dropdown/index.js';
|
|
6
|
+
import { RequiredLabel } from '../Fields/index.js';
|
|
7
|
+
import { ConstraintsView } from '../ConstraintsView.js';
|
|
8
|
+
import { Schema } from '../../Schema/index.js';
|
|
9
|
+
import { getActiveMediaType } from '../../../models/index.js';
|
|
10
|
+
import { Markdown } from '../../Markdown/index.js';
|
|
11
|
+
import { activeMimeNameAtom } from '../../../jotai/app.js';
|
|
12
|
+
import { LinkToField } from '../LinkToField.js';
|
|
13
|
+
import { useTranslate } from '../../../hooks/index.js';
|
|
14
|
+
import { styled } from '../../../styled-components.js';
|
|
15
|
+
function BodyContentComponent({ required, skipReadOnly, skipWriteOnly, description, content, deepLink, }) {
|
|
16
|
+
const translate = useTranslate();
|
|
17
|
+
const [activeMimeName, setActiveMimeName] = useAtom(activeMimeNameAtom);
|
|
18
|
+
if (!content) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const { schema, examples, operation, name } = getActiveMediaType(content, activeMimeName);
|
|
22
|
+
const mimeTypeOptions = content.mediaTypes.map(({ name }) => ({ label: name, value: name }));
|
|
23
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Title, { children: [deepLink && _jsx(LinkToField, { to: deepLink }), translate('openapi.body', 'Body'), _jsx(Dropdown, { options: mimeTypeOptions, value: name, triggerVariant: "ghost", triggerSize: "large", onChange: ({ value }) => setActiveMimeName(value) })] }), required && (_jsx(RequiredLabel, { children: translate('openapi.badges.required', 'required') })), _jsx(StyledMarkdown, { source: description }), schema?.type === 'object' && schema?.constraints && (_jsx(ConstraintsView, { constraints: schema?.constraints || [] })), _jsx(Schema, { skipReadOnly: skipReadOnly, skipWriteOnly: skipWriteOnly, schema: schema, examples: examples, operation: operation, level: 1, disableDeepLinks: !deepLink }, "schema")] }));
|
|
24
|
+
}
|
|
25
|
+
export const BodyContent = memo(BodyContentComponent);
|
|
26
|
+
const StyledMarkdown = styled(Markdown) `
|
|
2
27
|
margin: var(--spacing-xxs) 0 0;
|
|
3
|
-
|
|
28
|
+
`;
|
|
29
|
+
const Title = styled.span `
|
|
4
30
|
position: relative;
|
|
5
31
|
display: flex;
|
|
6
32
|
align-items: center;
|
|
@@ -13,7 +39,7 @@ import{jsx as e,jsxs as n,Fragment as x}from"react/jsx-runtime";import{memo as u
|
|
|
13
39
|
padding: var(--spacing-xxs) 0;
|
|
14
40
|
|
|
15
41
|
:hover {
|
|
16
|
-
${
|
|
42
|
+
${LinkIcon} {
|
|
17
43
|
opacity: 1;
|
|
18
44
|
visibility: visible;
|
|
19
45
|
}
|
|
@@ -24,4 +50,5 @@ import{jsx as e,jsxs as n,Fragment as x}from"react/jsx-runtime";import{memo as u
|
|
|
24
50
|
font-size: var(--font-size-sm);
|
|
25
51
|
line-height: var(--line-height-lg);
|
|
26
52
|
}
|
|
27
|
-
`;
|
|
53
|
+
`;
|
|
54
|
+
//# sourceMappingURL=BodyContent.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { BodyContent } from './BodyContent.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
const ClearButtonComponent = ({ className, style, handleClear, }) => (_jsx("button", { className: className, style: style, onClick: handleClear, children: "\u2715" }));
|
|
4
|
+
export const ClearButton = memo(ClearButtonComponent);
|
|
5
|
+
//# sourceMappingURL=ClearButton.js.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import{styled
|
|
1
|
+
import { styled } from '../../../styled-components.js';
|
|
2
|
+
import { ClearButton as ClearButtonComponent } from './ClearButton.js';
|
|
3
|
+
export const ClearButton = styled(ClearButtonComponent) `
|
|
2
4
|
z-index: 1;
|
|
3
5
|
position: absolute;
|
|
4
6
|
right: 24px;
|
|
@@ -12,4 +14,5 @@ import{styled as o}from"../../../styled-components.js";import{ClearButton as r}f
|
|
|
12
14
|
&:hover {
|
|
13
15
|
color: #fff;
|
|
14
16
|
}
|
|
15
|
-
`;
|
|
17
|
+
`;
|
|
18
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import{Panel
|
|
2
|
-
|
|
1
|
+
import { Panel } from '@redocly/theme/components/Panel/Panel';
|
|
2
|
+
import { PanelBody } from '@redocly/theme/components/Panel/PanelBody';
|
|
3
|
+
import { styled } from '../../styled-components.js';
|
|
4
|
+
export const CodeBlockPanel = styled(Panel) `
|
|
5
|
+
${PanelBody} {
|
|
3
6
|
padding: var(--spacing-sm) 0 0;
|
|
4
7
|
}
|
|
5
|
-
`;
|
|
8
|
+
`;
|
|
9
|
+
//# sourceMappingURL=CodeBlockPanel.js.map
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { Tag } from './Fields/index.js';
|
|
4
|
+
import { styled } from '../../styled-components.js';
|
|
5
|
+
function ConstraintsViewComponent({ constraints }) {
|
|
6
|
+
if (constraints.length === 0) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return (_jsx(Wrapper, { children: constraints.map((constraint) => (_jsxs(Tag, { children: [" ", constraint, " "] }, constraint))) }));
|
|
10
|
+
}
|
|
11
|
+
export const ConstraintsView = memo(ConstraintsViewComponent);
|
|
12
|
+
const Wrapper = styled.div `
|
|
2
13
|
margin-top: var(--spacing-xxs);
|
|
3
|
-
`;
|
|
14
|
+
`;
|
|
15
|
+
//# sourceMappingURL=ConstraintsView.js.map
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Dropdown as DropdownTheme } from '@redocly/theme/components/Dropdown/Dropdown';
|
|
3
|
+
import { CheckmarkIcon } from '@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon';
|
|
4
|
+
import { DropdownMenu } from '@redocly/theme/components/Dropdown/DropdownMenu';
|
|
5
|
+
import { DropdownMenuItem } from '@redocly/theme/components/Dropdown/DropdownMenuItem';
|
|
6
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
7
|
+
import { typedMemo } from '@redocly/theme/core/openapi';
|
|
8
|
+
import { styled } from '../../../styled-components.js';
|
|
9
|
+
function DropdownComponent({ options, value, onChange, className, triggerVariant = 'outlined', triggerSize = 'small', }) {
|
|
10
|
+
const activeLabel = options.find((opt) => opt.value === value)?.label;
|
|
11
|
+
if (options.length === 1)
|
|
12
|
+
return _jsx(Title, { children: activeLabel });
|
|
13
|
+
return (_jsx(DropdownTheme, { className: className, trigger: _jsx(Button, { variant: triggerVariant, size: triggerSize, type: "button", children: activeLabel }), withArrow: true, children: _jsx(DropdownMenu, { children: options.map((opt) => (_jsx(StyledDropdownMenuItem, { active: opt.value === value, onAction: () => onChange(opt), suffix: opt.value === value && _jsx(StyledCheckmarkIcon, {}), children: opt.label }, opt.label))) }) }));
|
|
14
|
+
}
|
|
15
|
+
export const Dropdown = typedMemo(DropdownComponent);
|
|
16
|
+
const StyledCheckmarkIcon = styled(CheckmarkIcon) `
|
|
2
17
|
width: 16px;
|
|
3
18
|
height: 16px;
|
|
4
19
|
margin-left: auto;
|
|
5
|
-
|
|
20
|
+
`;
|
|
21
|
+
const StyledDropdownMenuItem = styled(DropdownMenuItem) `
|
|
6
22
|
--dropdown-menu-item-justify-content: space-between;
|
|
7
23
|
|
|
8
24
|
width: 100%;
|
|
@@ -12,7 +28,8 @@ import{jsx as n}from"react/jsx-runtime";import{Dropdown as d}from"@redocly/theme
|
|
|
12
28
|
padding: var(--spacing-xxs) var(--spacing-sm);
|
|
13
29
|
font-size: var(--font-size-base);
|
|
14
30
|
line-height: var(--line-height-base);
|
|
15
|
-
|
|
31
|
+
`;
|
|
32
|
+
const Title = styled.span `
|
|
16
33
|
margin-right: var(--spacing-unit);
|
|
17
34
|
cursor: default;
|
|
18
35
|
background: none;
|
|
@@ -23,4 +40,5 @@ import{jsx as n}from"react/jsx-runtime";import{Dropdown as d}from"@redocly/theme
|
|
|
23
40
|
line-height: var(--line-height-lg);
|
|
24
41
|
font-family: var(--font-family-base);
|
|
25
42
|
font-weight: var(--font-weight-regular);
|
|
26
|
-
`;
|
|
43
|
+
`;
|
|
44
|
+
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { Dropdown } from './Dropdown.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
4
|
+
import { Markdown } from '../../Markdown/index.js';
|
|
5
|
+
import { ExampleValue } from '../Fields/index.js';
|
|
6
|
+
import { useTranslate } from '../../../hooks/index.js';
|
|
7
|
+
import { styled } from '../../../styled-components.js';
|
|
8
|
+
const MAX_EXAMPLE_LENGTH = 150;
|
|
9
|
+
export function ExpandableExample({ value }) {
|
|
10
|
+
const translate = useTranslate();
|
|
11
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
12
|
+
const truncatedValue = useMemo(() => value.slice(0, MAX_EXAMPLE_LENGTH), [value]);
|
|
13
|
+
const toggleExpand = () => {
|
|
14
|
+
setIsExpanded(!isExpanded);
|
|
15
|
+
};
|
|
16
|
+
return (_jsxs(Container, { children: [_jsx(Markdown, { source: isExpanded ? value : truncatedValue }), (value !== truncatedValue || isExpanded) && (_jsx(ButtonWrap, { children: _jsx(Button, { variant: "link", size: "small", onClick: toggleExpand, children: isExpanded
|
|
17
|
+
? translate('openapi.hideExample', 'Hide example')
|
|
18
|
+
: translate('openapi.showExample', 'Show example') }) }))] }));
|
|
19
|
+
}
|
|
20
|
+
const Container = styled(ExampleValue) `
|
|
2
21
|
display: inline;
|
|
3
22
|
|
|
4
23
|
& * {
|
|
5
24
|
display: inline;
|
|
6
25
|
}
|
|
7
|
-
|
|
26
|
+
`;
|
|
27
|
+
const ButtonWrap = styled.span `
|
|
8
28
|
margin-left: var(--spacing-xs);
|
|
9
|
-
`;
|
|
29
|
+
`;
|
|
30
|
+
//# sourceMappingURL=ExpandableExample.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { ExpandableExample } from './ExpandableExample.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { useAtomValue } from 'jotai';
|
|
4
|
+
import { Markdown as MarkdownWrapper } from '@redocly/theme/components/Markdown/Markdown';
|
|
5
|
+
import { ExtensionValue, FieldLabel } from './index.js';
|
|
6
|
+
import { globalOptionsAtom } from '../../jotai/store.js';
|
|
7
|
+
import { styled } from '../../styled-components.js';
|
|
8
|
+
const Extension = styled(MarkdownWrapper) `
|
|
2
9
|
margin: 2px 0;
|
|
3
|
-
`;
|
|
10
|
+
`;
|
|
11
|
+
function ExtensionsComponent({ extensions }) {
|
|
12
|
+
const { showExtensions } = useAtomValue(globalOptionsAtom);
|
|
13
|
+
return showExtensions ? (_jsx("div", { children: Object.keys(extensions).map((key) => (_jsxs(Extension, { children: [_jsxs(FieldLabel, { children: [key.substring(2), ": "] }), ' ', _jsx(ExtensionValue, { children: typeof extensions[key] === 'string'
|
|
14
|
+
? extensions[key]
|
|
15
|
+
: JSON.stringify(extensions[key]) })] }, key))) })) : null;
|
|
16
|
+
}
|
|
17
|
+
export const Extensions = memo(ExtensionsComponent);
|
|
18
|
+
//# sourceMappingURL=Extensions.js.map
|