@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,19 +1,29 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import { breakpoints } from '@redocly/theme/core/openapi';
|
|
3
|
+
import { typography } from '../../../utils/index.js';
|
|
4
|
+
import { deprecatedCss } from '../mixins.js';
|
|
5
|
+
import { styled } from '../../../styled-components.js';
|
|
6
|
+
export const getCssVariable = (variable) => typeof document !== 'undefined'
|
|
7
|
+
? getComputedStyle(document.documentElement).getPropertyValue(variable).trim()
|
|
8
|
+
: '';
|
|
9
|
+
export const PropertiesTableCaption = styled.caption `
|
|
2
10
|
text-align: right;
|
|
3
11
|
font-size: 0.9em;
|
|
4
12
|
font-weight: normal;
|
|
5
13
|
color: var(--text-color-secondary);
|
|
6
|
-
|
|
14
|
+
`;
|
|
15
|
+
const repeatingGradient = css `
|
|
7
16
|
repeating-linear-gradient(0deg,
|
|
8
17
|
var(--schemas-lines-color),
|
|
9
18
|
var(--schemas-lines-color) 3px,
|
|
10
19
|
transparent 3px,
|
|
11
20
|
transparent 5px,
|
|
12
21
|
var(--schemas-lines-color) 5px);
|
|
13
|
-
|
|
22
|
+
`;
|
|
23
|
+
export const PropertyCell = styled.td `
|
|
14
24
|
box-sizing: border-box;
|
|
15
25
|
position: relative;
|
|
16
|
-
background-image: ${
|
|
26
|
+
background-image: ${repeatingGradient};
|
|
17
27
|
background-repeat: no-repeat;
|
|
18
28
|
background-size: 1px 100%;
|
|
19
29
|
display: block;
|
|
@@ -21,7 +31,7 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
21
31
|
padding: 0 20px;
|
|
22
32
|
margin-bottom: 2px;
|
|
23
33
|
|
|
24
|
-
@media screen and (min-width: ${
|
|
34
|
+
@media screen and (min-width: ${breakpoints.small}) {
|
|
25
35
|
display: table-cell;
|
|
26
36
|
overflow: initial;
|
|
27
37
|
padding: 10px;
|
|
@@ -29,17 +39,17 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
tr:first-of-type > & {
|
|
32
|
-
background-image: ${
|
|
42
|
+
background-image: ${repeatingGradient};
|
|
33
43
|
background-position: 0 10px;
|
|
34
44
|
padding-top: 0;
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
tr.last > & {
|
|
38
|
-
background-image: ${
|
|
48
|
+
background-image: ${repeatingGradient};
|
|
39
49
|
padding-bottom: 0;
|
|
40
50
|
background-size: 0.9px 100%;
|
|
41
51
|
|
|
42
|
-
@media screen and (min-width: ${
|
|
52
|
+
@media screen and (min-width: ${breakpoints.small}) {
|
|
43
53
|
background-size: 0.9px 22px;
|
|
44
54
|
}
|
|
45
55
|
}
|
|
@@ -49,18 +59,20 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
tr.last:first-child > & {
|
|
52
|
-
background-image: ${
|
|
62
|
+
background-image: ${repeatingGradient};
|
|
53
63
|
background-size: 0.9px 100%;
|
|
54
64
|
background-position: 0 20px;
|
|
55
65
|
|
|
56
|
-
@media screen and (min-width: ${
|
|
66
|
+
@media screen and (min-width: ${breakpoints.small}) {
|
|
57
67
|
background-size: 0.9px 22px;
|
|
58
68
|
background-position: 0 0;
|
|
59
69
|
}
|
|
60
70
|
}
|
|
61
|
-
|
|
71
|
+
`;
|
|
72
|
+
export const PropertyCellWithInner = styled(PropertyCell) `
|
|
62
73
|
padding: 0;
|
|
63
|
-
|
|
74
|
+
`;
|
|
75
|
+
export const PropertyNameCell = styled(PropertyCell) `
|
|
64
76
|
vertical-align: top;
|
|
65
77
|
line-height: 23px;
|
|
66
78
|
white-space: nowrap;
|
|
@@ -68,10 +80,11 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
68
80
|
font-family: var(--field-name-font-family);
|
|
69
81
|
|
|
70
82
|
&.deprecated {
|
|
71
|
-
${
|
|
83
|
+
${deprecatedCss};
|
|
72
84
|
}
|
|
73
85
|
|
|
74
|
-
${({kind
|
|
86
|
+
${({ kind }) => kind === 'patternProperties' &&
|
|
87
|
+
css `
|
|
75
88
|
span.field-name {
|
|
76
89
|
white-space: break-spaces;
|
|
77
90
|
text-align: left;
|
|
@@ -80,24 +93,32 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
80
93
|
}
|
|
81
94
|
`}
|
|
82
95
|
|
|
83
|
-
${()=>
|
|
96
|
+
${() => {
|
|
97
|
+
const breakFieldNames = getCssVariable('--schema-field-name-word-break');
|
|
98
|
+
if (['break-all', 'break-word'].includes(breakFieldNames)) {
|
|
99
|
+
const wordBreakCSS = `
|
|
84
100
|
&& span:last-child {
|
|
85
101
|
white-space: normal;
|
|
86
|
-
word-break: ${
|
|
102
|
+
word-break: ${breakFieldNames};
|
|
87
103
|
vertical-align: top;
|
|
88
104
|
max-width: calc(100% - 21px);
|
|
89
105
|
display: inline-flex;
|
|
90
106
|
}
|
|
91
|
-
`;
|
|
92
|
-
|
|
93
|
-
${
|
|
94
|
-
|
|
107
|
+
`;
|
|
108
|
+
return css `
|
|
109
|
+
${typography('schemas-property-name')}
|
|
110
|
+
${wordBreakCSS}
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
return typography('schemas-property-name');
|
|
114
|
+
}};
|
|
95
115
|
|
|
96
116
|
.field-name {
|
|
97
117
|
display: inline-flex;
|
|
98
118
|
align-items: center;
|
|
99
119
|
}
|
|
100
|
-
|
|
120
|
+
`;
|
|
121
|
+
export const PropertyDetailsCell = styled.td `
|
|
101
122
|
box-sizing: border-box;
|
|
102
123
|
vertical-align: top;
|
|
103
124
|
|
|
@@ -129,12 +150,13 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
129
150
|
width: var(--schema-default-details-width);
|
|
130
151
|
min-width: 200px;
|
|
131
152
|
|
|
132
|
-
@media screen and (min-width: ${
|
|
153
|
+
@media screen and (min-width: ${breakpoints.small}) {
|
|
133
154
|
border-bottom: 1px solid var(--border-color-primary);
|
|
134
155
|
border-left: none;
|
|
135
156
|
padding: 10px 0;
|
|
136
157
|
}
|
|
137
|
-
|
|
158
|
+
`;
|
|
159
|
+
export const PropertyBullet = styled.span `
|
|
138
160
|
margin-right: 10px;
|
|
139
161
|
color: var(--schemas-lines-color);
|
|
140
162
|
font-family: var(--code-font-family);
|
|
@@ -142,7 +164,7 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
142
164
|
border-left: 1px dashed var(--schemas-lines-color);
|
|
143
165
|
padding: 5px 10px;
|
|
144
166
|
|
|
145
|
-
@media screen and (min-width: ${
|
|
167
|
+
@media screen and (min-width: ${breakpoints.small}) {
|
|
146
168
|
border-left: none;
|
|
147
169
|
padding: 10px;
|
|
148
170
|
}
|
|
@@ -155,16 +177,18 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
155
177
|
height: 1px;
|
|
156
178
|
background: var(--schemas-lines-color);
|
|
157
179
|
}
|
|
158
|
-
|
|
180
|
+
`;
|
|
181
|
+
export const InnerPropertiesWrap = styled.div `
|
|
159
182
|
padding: var(--schema-nested-offset);
|
|
160
|
-
|
|
183
|
+
`;
|
|
184
|
+
export const PropertiesTable = styled.table `
|
|
161
185
|
border-collapse: separate;
|
|
162
186
|
border-radius: var(--border-radius);
|
|
163
187
|
width: 100%;
|
|
164
188
|
font-size: var(--font-size-base);
|
|
165
189
|
display: block;
|
|
166
190
|
|
|
167
|
-
@media screen and (min-width: ${
|
|
191
|
+
@media screen and (min-width: ${breakpoints.small}) {
|
|
168
192
|
display: table;
|
|
169
193
|
}
|
|
170
194
|
|
|
@@ -174,7 +198,7 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
174
198
|
margin-bottom: 10px;
|
|
175
199
|
border-spacing: 0;
|
|
176
200
|
|
|
177
|
-
@media screen and (min-width: ${
|
|
201
|
+
@media screen and (min-width: ${breakpoints.small}) {
|
|
178
202
|
display: table-row;
|
|
179
203
|
margin-bottom: 0;
|
|
180
204
|
border-spacing: 0 2px;
|
|
@@ -185,7 +209,7 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
185
209
|
vertical-align: middle;
|
|
186
210
|
}
|
|
187
211
|
|
|
188
|
-
@media screen and (max-width: ${
|
|
212
|
+
@media screen and (max-width: ${breakpoints.small}) and (-ms-high-contrast: none) {
|
|
189
213
|
td {
|
|
190
214
|
float: left;
|
|
191
215
|
width: 100%;
|
|
@@ -193,17 +217,17 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
193
217
|
}
|
|
194
218
|
|
|
195
219
|
&
|
|
196
|
-
${
|
|
220
|
+
${InnerPropertiesWrap},
|
|
197
221
|
&
|
|
198
|
-
${
|
|
199
|
-
${
|
|
200
|
-
${
|
|
222
|
+
${InnerPropertiesWrap}
|
|
223
|
+
${InnerPropertiesWrap}
|
|
224
|
+
${InnerPropertiesWrap},
|
|
201
225
|
&
|
|
202
|
-
${
|
|
203
|
-
${
|
|
204
|
-
${
|
|
205
|
-
${
|
|
206
|
-
${
|
|
226
|
+
${InnerPropertiesWrap}
|
|
227
|
+
${InnerPropertiesWrap}
|
|
228
|
+
${InnerPropertiesWrap}
|
|
229
|
+
${InnerPropertiesWrap}
|
|
230
|
+
${InnerPropertiesWrap} {
|
|
207
231
|
margin-left: var(--schema-nested-offset);
|
|
208
232
|
margin-bottom: var(--schema-nested-offset);
|
|
209
233
|
background: var(--schema-nested-background-color);
|
|
@@ -211,20 +235,21 @@ import{css as i}from"styled-components";import{breakpoints as r}from"@redocly/th
|
|
|
211
235
|
}
|
|
212
236
|
|
|
213
237
|
&
|
|
214
|
-
${
|
|
215
|
-
${
|
|
238
|
+
${InnerPropertiesWrap}
|
|
239
|
+
${InnerPropertiesWrap},
|
|
216
240
|
&
|
|
217
|
-
${
|
|
218
|
-
${
|
|
219
|
-
${
|
|
220
|
-
${
|
|
241
|
+
${InnerPropertiesWrap}
|
|
242
|
+
${InnerPropertiesWrap}
|
|
243
|
+
${InnerPropertiesWrap}
|
|
244
|
+
${InnerPropertiesWrap},
|
|
221
245
|
&
|
|
222
|
-
${
|
|
223
|
-
${
|
|
224
|
-
${
|
|
225
|
-
${
|
|
226
|
-
${
|
|
227
|
-
${
|
|
246
|
+
${InnerPropertiesWrap}
|
|
247
|
+
${InnerPropertiesWrap}
|
|
248
|
+
${InnerPropertiesWrap}
|
|
249
|
+
${InnerPropertiesWrap}
|
|
250
|
+
${InnerPropertiesWrap}
|
|
251
|
+
${InnerPropertiesWrap} {
|
|
228
252
|
background: var(--panel-bg-color, #fff);
|
|
229
253
|
}
|
|
230
|
-
`;
|
|
254
|
+
`;
|
|
255
|
+
//# sourceMappingURL=fields-layout.js.map
|
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
import{Button
|
|
1
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
2
|
+
import { styled } from '../../../styled-components.js';
|
|
3
|
+
export const FieldLabel = styled.span `
|
|
2
4
|
vertical-align: middle;
|
|
3
5
|
line-height: var(--schema-labels-line-height);
|
|
4
6
|
font-size: var(--schema-property-labels-font-size);
|
|
5
7
|
color: var(--schema-labels--text-color);
|
|
6
|
-
|
|
8
|
+
`;
|
|
9
|
+
export const TypePrefix = styled(FieldLabel) `
|
|
7
10
|
color: var(--schema-type-text-color);
|
|
8
|
-
|
|
11
|
+
`;
|
|
12
|
+
export const TypeName = styled(FieldLabel) `
|
|
9
13
|
color: var(--schema-type-text-color);
|
|
10
|
-
|
|
14
|
+
`;
|
|
15
|
+
export const TypeTitle = styled(FieldLabel) `
|
|
11
16
|
color: var(--schema-type-title-text-color);
|
|
12
17
|
word-break: break-word;
|
|
13
|
-
|
|
18
|
+
`;
|
|
19
|
+
export const PropertyLabel = styled(FieldLabel).attrs({ as: 'div' }) `
|
|
14
20
|
color: var(--text-color-secondary);
|
|
15
21
|
font-size: var(--schema-labels-font-size);
|
|
16
22
|
line-height: var(--schema-labels-line-height);
|
|
17
23
|
font-weight: normal;
|
|
18
24
|
display: block;
|
|
19
|
-
|
|
25
|
+
`;
|
|
26
|
+
export const RequiredLabel = styled(FieldLabel) `
|
|
20
27
|
color: var(--schema-property-required-label-text-color);
|
|
21
28
|
font-size: var(--font-size-base);
|
|
22
29
|
line-height: var(--line-height-base);
|
|
23
|
-
|
|
30
|
+
`;
|
|
31
|
+
export const AdditionalPropertiesLabel = styled(PropertyLabel) `
|
|
24
32
|
color: var(--schema-property-additional-label-text-color);
|
|
25
|
-
|
|
33
|
+
`;
|
|
34
|
+
export const Tag = styled.span.attrs(() => ({ className: 'tag-grey' })) `
|
|
26
35
|
background: var(--tag-bg-color);
|
|
27
36
|
padding: 0 var(--spacing-xxs);
|
|
28
37
|
font-family: var(--font-family-monospaced);
|
|
@@ -32,30 +41,36 @@ import{Button as t}from"@redocly/theme/components/Button/Button";import{styled a
|
|
|
32
41
|
color: var(--text-color-secondary);
|
|
33
42
|
display: inline-flex;
|
|
34
43
|
word-break: var(--code-word-break);
|
|
35
|
-
|
|
44
|
+
`;
|
|
45
|
+
export const AccessLabel = styled(Tag) `
|
|
36
46
|
color: var(--schema-property-access-label-text-color);
|
|
37
47
|
background-color: var(--bg-color);
|
|
38
48
|
border: 1px solid var(--border-color-secondary);
|
|
39
|
-
|
|
49
|
+
`;
|
|
50
|
+
export const FieldValueLabel = styled(Tag) `
|
|
40
51
|
background-color: var(--schema-inline-bg-color);
|
|
41
52
|
border-radius: var(--border-radius);
|
|
42
53
|
border: var(--schema-inline-border);
|
|
43
54
|
padding: 0 var(--spacing-unit);
|
|
44
55
|
width: fit-content;
|
|
45
|
-
|
|
56
|
+
`;
|
|
57
|
+
export const RecursiveLabel = styled(Tag) `
|
|
46
58
|
background-color: var(--schema-recursive-bg-color);
|
|
47
59
|
border-color: var(--schema-recursive-border-color);
|
|
48
60
|
color: var(--schema-recursive-text-color);
|
|
49
61
|
padding: 0 var(--spacing-xs);
|
|
50
|
-
|
|
62
|
+
`;
|
|
63
|
+
export const EnumValue = styled(FieldValueLabel) `
|
|
51
64
|
background-color: var(--schema-enum-bg-color);
|
|
52
65
|
border-color: var(--schema-enum-border-color);
|
|
53
66
|
color: var(--schema-enum-text-color);
|
|
54
|
-
|
|
67
|
+
`;
|
|
68
|
+
export const DefaultValue = styled(Tag) `
|
|
55
69
|
background-color: var(--schema-default-bg-color);
|
|
56
70
|
border-color: var(--schema-default-border-color);
|
|
57
71
|
color: var(--schema-default-text-color);
|
|
58
|
-
|
|
72
|
+
`;
|
|
73
|
+
export const ExampleValue = styled(Tag) `
|
|
59
74
|
background-color: var(--schema-example-bg-color);
|
|
60
75
|
border-color: var(--schema-example-border-color);
|
|
61
76
|
color: var(--schema-example-text-color);
|
|
@@ -75,7 +90,9 @@ import{Button as t}from"@redocly/theme/components/Button/Button";import{styled a
|
|
|
75
90
|
font-family: var(--schema-inline-code-font-family);
|
|
76
91
|
margin: 0;
|
|
77
92
|
}
|
|
78
|
-
|
|
93
|
+
`;
|
|
94
|
+
export const ExtensionValue = styled(ExampleValue) ``;
|
|
95
|
+
export const ConstraintItem = styled(FieldValueLabel) `
|
|
79
96
|
background-color: var(--schema-constraint-bg-color);
|
|
80
97
|
border-color: var(--schema-constraint-border-color);
|
|
81
98
|
color: var(--schema-constraint-text-color);
|
|
@@ -85,8 +102,13 @@ import{Button as t}from"@redocly/theme/components/Button/Button";import{styled a
|
|
|
85
102
|
& + & {
|
|
86
103
|
margin-left: 0;
|
|
87
104
|
}
|
|
88
|
-
|
|
105
|
+
`;
|
|
106
|
+
export const ToggleButton = styled(Button).attrs(() => ({
|
|
107
|
+
variant: 'link',
|
|
108
|
+
size: 'small',
|
|
109
|
+
})) `
|
|
89
110
|
padding: 0;
|
|
90
111
|
font-size: var(--font-size-sm);
|
|
91
112
|
line-height: var(--line-height-sm);
|
|
92
|
-
`;
|
|
113
|
+
`;
|
|
114
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -1,19 +1,46 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { css } from 'styled-components';
|
|
3
|
+
import { useLocation } from 'react-router-dom';
|
|
4
|
+
import { LinkIcon } from '@redocly/theme/icons/LinkIcon/LinkIcon';
|
|
5
|
+
import { encodeBackSlashes } from '../../utils/string.js';
|
|
6
|
+
import { constructFieldDeepFragment, joinWithSeparator } from '../../services/history/helpers.js';
|
|
7
|
+
import { ShareLink } from './linkify.js';
|
|
8
|
+
import { styled } from '../../styled-components.js';
|
|
9
|
+
export function generateDeepLink(field, activeMimeName) {
|
|
10
|
+
const operation = field.deps.operation;
|
|
11
|
+
const fieldFragment = constructFieldDeepFragment(field, activeMimeName);
|
|
12
|
+
//Models doesnt have operation.id
|
|
13
|
+
if (!operation?.id && !operation.isCallback) {
|
|
14
|
+
return '#' + fieldFragment.toLowerCase();
|
|
15
|
+
}
|
|
16
|
+
const deepLink = joinWithSeparator(operation.href, joinWithSeparator(operation.id, fieldFragment), '#');
|
|
17
|
+
return encodeBackSlashes(deepLink.toLowerCase());
|
|
18
|
+
}
|
|
19
|
+
export const LinkToField = ({ to, className, }) => {
|
|
20
|
+
const deepLink = to;
|
|
21
|
+
const location = useLocation();
|
|
22
|
+
const hash = deepLink?.split('#')[1];
|
|
23
|
+
const isActive = location ? location.hash === `#${hash}` : false;
|
|
24
|
+
return (_jsx(ShareLinkToField, { ariaLabel: `link to ${deepLink}`, className: className, isActive: isActive, to: deepLink, id: hash }));
|
|
25
|
+
};
|
|
26
|
+
export const ShareLinkToField = styled(ShareLink) `
|
|
2
27
|
display: flex;
|
|
3
|
-
${
|
|
28
|
+
${LinkIcon} {
|
|
4
29
|
visibility: hidden;
|
|
5
30
|
cursor: pointer;
|
|
6
31
|
background-color: var(--bg-color);
|
|
7
32
|
}
|
|
8
33
|
|
|
9
|
-
${({isActive
|
|
10
|
-
|
|
34
|
+
${({ isActive }) => isActive &&
|
|
35
|
+
css `
|
|
36
|
+
${LinkIcon} {
|
|
11
37
|
visibility: visible;
|
|
12
38
|
opacity: 1;
|
|
13
39
|
}
|
|
14
40
|
`}
|
|
15
|
-
:hover ${
|
|
41
|
+
:hover ${LinkIcon}, :focus ${LinkIcon} {
|
|
16
42
|
visibility: visible;
|
|
17
43
|
opacity: 1;
|
|
18
44
|
}
|
|
19
|
-
`;
|
|
45
|
+
`;
|
|
46
|
+
//# sourceMappingURL=LinkToField.js.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import{LinkIcon
|
|
1
|
+
import { LinkIcon } from '@redocly/theme/icons/LinkIcon/LinkIcon';
|
|
2
|
+
import { H2 } from '@redocly/theme/components/Typography/H2';
|
|
3
|
+
import { styled } from '../../styled-components.js';
|
|
4
|
+
export const Title = styled.h4 `
|
|
2
5
|
font-size: var(--h4-font-size);
|
|
3
6
|
font-weight: var(--h4-font-weight);
|
|
4
7
|
line-height: var(--h4-line-height);
|
|
@@ -11,12 +14,13 @@ import{LinkIcon as t}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{H2 as e
|
|
|
11
14
|
position: relative;
|
|
12
15
|
|
|
13
16
|
:hover {
|
|
14
|
-
${
|
|
17
|
+
${LinkIcon} {
|
|
15
18
|
opacity: 1;
|
|
16
19
|
visibility: visible;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
`;
|
|
23
|
+
export const Heading = styled(H2) `
|
|
20
24
|
position: relative;
|
|
21
25
|
display: flex;
|
|
22
26
|
align-items: center;
|
|
@@ -25,13 +29,15 @@ import{LinkIcon as t}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{H2 as e
|
|
|
25
29
|
margin: 0;
|
|
26
30
|
|
|
27
31
|
:hover {
|
|
28
|
-
${
|
|
32
|
+
${LinkIcon} {
|
|
29
33
|
opacity: 1;
|
|
30
34
|
visibility: visible;
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
|
-
|
|
37
|
+
`;
|
|
38
|
+
export const HeadingWrapper = styled.div `
|
|
34
39
|
display: flex;
|
|
35
40
|
align-items: flex-start;
|
|
36
41
|
margin: var(--h2-margin-top) 0 var(--h2-margin-bottom);
|
|
37
|
-
`;
|
|
42
|
+
`;
|
|
43
|
+
//# sourceMappingURL=OperationItemTitle.js.map
|
|
@@ -1 +1,51 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useAtom } from 'jotai';
|
|
4
|
+
import { Segmented } from '@redocly/theme/components/Segmented/Segmented';
|
|
5
|
+
import { isUndefined } from '@redocly/theme/core/openapi';
|
|
6
|
+
import { Dropdown } from '../Dropdown/index.js';
|
|
7
|
+
import { operationStore } from '../../../jotai/operation.js';
|
|
8
|
+
const LIMIT_FOR_SEGMENTED = 5;
|
|
9
|
+
function SchemaSelectionComponent({ options, onChange, pointer, schema, defaultOneOfIdx, }) {
|
|
10
|
+
const [store, setOperationStore] = useAtom(operationStore(pointer));
|
|
11
|
+
const activeOneOfIdx = store.activeOneOf[schema.pointer] ?? defaultOneOfIdx;
|
|
12
|
+
const activeValue = options[activeOneOfIdx]?.value;
|
|
13
|
+
const [isAnyItemTruncated, setIsAnyItemTruncated] = useState(false);
|
|
14
|
+
const segmentedRef = useRef(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!segmentedRef.current)
|
|
17
|
+
return;
|
|
18
|
+
const checkTruncation = () => {
|
|
19
|
+
const items = segmentedRef.current?.querySelectorAll('button[role="tab"]');
|
|
20
|
+
const isTruncated = Array.from(items || []).some((item) => {
|
|
21
|
+
return item.offsetWidth < item.scrollWidth;
|
|
22
|
+
});
|
|
23
|
+
if (isTruncated !== isAnyItemTruncated) {
|
|
24
|
+
setIsAnyItemTruncated(isTruncated);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
checkTruncation();
|
|
28
|
+
window.addEventListener('resize', checkTruncation);
|
|
29
|
+
return () => window.removeEventListener('resize', checkTruncation);
|
|
30
|
+
}, [isAnyItemTruncated, options]);
|
|
31
|
+
const handleSelectedChange = useCallback(({ value }) => {
|
|
32
|
+
if (value !== undefined) {
|
|
33
|
+
if (onChange) {
|
|
34
|
+
onChange(value);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setOperationStore({
|
|
38
|
+
activeExampleName: schema.oneOf?.[value]?.title,
|
|
39
|
+
activeOneOf: { [schema.pointer]: value },
|
|
40
|
+
requestValues: { body: null },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, [onChange, schema.oneOf, schema.pointer, setOperationStore]);
|
|
45
|
+
if (isUndefined(activeValue)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return options.length > LIMIT_FOR_SEGMENTED || isAnyItemTruncated ? (_jsx(Dropdown, { options: options, value: activeValue, onChange: handleSelectedChange })) : (_jsx(Segmented, { ref: segmentedRef, value: activeValue, onChange: handleSelectedChange, options: options, size: "small", "data-testid": "segmented-schema" }));
|
|
49
|
+
}
|
|
50
|
+
export const SchemaSelection = SchemaSelectionComponent;
|
|
51
|
+
//# sourceMappingURL=SchemaSelection.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { SchemaSelection } from './SchemaSelection.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
import { ClearButton } from '../ClearButton/index.js';
|
|
4
|
+
import { normalizeText } from '../../../utils/index.js';
|
|
5
|
+
import { Arrow } from './styled.js';
|
|
6
|
+
function SelectComponent({ options, onChange, handleClear, clearable, placeholder, value = '', className, }) {
|
|
7
|
+
const handleChange = (event) => {
|
|
8
|
+
const { selectedIndex } = event.target;
|
|
9
|
+
const index = placeholder || !value ? selectedIndex - 1 : selectedIndex;
|
|
10
|
+
onChange(options[index]);
|
|
11
|
+
};
|
|
12
|
+
const renderOptions = useMemo(() => options.map(({ idx, value, title }, index) => {
|
|
13
|
+
const normalizedValue = normalizeText(value);
|
|
14
|
+
return (_jsx("option", { value: normalizedValue, className: "dropdown-option", children: title || normalizedValue }, idx || normalizedValue + index));
|
|
15
|
+
}), [options]);
|
|
16
|
+
const normalizedValue = normalizeText(value);
|
|
17
|
+
const title = options.find((option) => option.value === value)?.title || normalizedValue;
|
|
18
|
+
return (_jsxs("div", { className: className + ' dropdown-wrapper', children: [_jsx(Arrow, {}), clearable && normalizedValue?.length > 0 && _jsx(ClearButton, { handleClear: handleClear }), _jsxs("select", { onChange: handleChange, value: normalizedValue, className: "dropdown-select", "aria-label": "dropdown select", children: [placeholder && (_jsx("option", { disabled: true, hidden: true, value: placeholder, children: placeholder })), !normalizedValue && !placeholder && _jsx("option", { disabled: true }), renderOptions] }), _jsx("label", { children: title })] }));
|
|
19
|
+
}
|
|
20
|
+
export const Select = memo(SelectComponent);
|
|
21
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
|
|
3
|
+
import { Select as SelectComponent } from './Select.js';
|
|
4
|
+
import { styled } from '../../../styled-components.js';
|
|
5
|
+
const darkSelectStyle = css `
|
|
2
6
|
background-color: var(--panel-samples-dropdown-bg-color);
|
|
3
7
|
border: var(--panel-samples-dropdown-border);
|
|
4
8
|
color: var(--panel-samples-dropdown-color);
|
|
@@ -8,13 +12,14 @@ import{css as n}from"styled-components";import{ChevronDownIcon as t}from"@redocl
|
|
|
8
12
|
&:focus-within {
|
|
9
13
|
box-shadow: none;
|
|
10
14
|
}
|
|
11
|
-
|
|
15
|
+
`;
|
|
16
|
+
export const Select = styled(SelectComponent) `
|
|
12
17
|
box-sizing: border-box;
|
|
13
18
|
outline: none;
|
|
14
19
|
display: inline-block;
|
|
15
20
|
vertical-align: bottom;
|
|
16
21
|
position: relative;
|
|
17
|
-
width: ${({fullWidth
|
|
22
|
+
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
18
23
|
cursor: pointer;
|
|
19
24
|
text-transform: none;
|
|
20
25
|
|
|
@@ -28,7 +33,7 @@ import{css as n}from"styled-components";import{ChevronDownIcon as t}from"@redocl
|
|
|
28
33
|
border-radius: var(--border-radius-md);
|
|
29
34
|
padding: var(--docs-dropdown-padding);
|
|
30
35
|
vertical-align: bottom;
|
|
31
|
-
width: ${({fullWidth
|
|
36
|
+
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
32
37
|
text-transform: none;
|
|
33
38
|
line-height: inherit;
|
|
34
39
|
font-size: var(--docs-dropdown-font-size);
|
|
@@ -43,7 +48,7 @@ import{css as n}from"styled-components";import{ChevronDownIcon as t}from"@redocl
|
|
|
43
48
|
box-shadow: none;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
${({variant
|
|
51
|
+
${({ variant }) => (variant === 'dark' ? darkSelectStyle : '')};
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
.dropdown-select {
|
|
@@ -62,9 +67,10 @@ import{css as n}from"styled-components";import{ChevronDownIcon as t}from"@redocl
|
|
|
62
67
|
font-size: var(--font-size-base);
|
|
63
68
|
font-family: inherit;
|
|
64
69
|
padding: var(--docs-dropdown-padding);
|
|
65
|
-
${({variant
|
|
70
|
+
${({ variant }) => (variant === 'dark' ? darkSelectStyle : '')};
|
|
66
71
|
}
|
|
67
|
-
|
|
72
|
+
`;
|
|
73
|
+
export const SimpleSelect = styled(Select) `
|
|
68
74
|
svg {
|
|
69
75
|
top: 60%;
|
|
70
76
|
transform: translateY(-60%);
|
|
@@ -82,8 +88,10 @@ import{css as n}from"styled-components";import{ChevronDownIcon as t}from"@redocl
|
|
|
82
88
|
box-shadow: none;
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
|
-
|
|
91
|
+
`;
|
|
92
|
+
export const Arrow = styled(ChevronDownIcon) `
|
|
86
93
|
position: absolute;
|
|
87
94
|
right: 10px;
|
|
88
95
|
top: 10px;
|
|
89
|
-
`;
|
|
96
|
+
`;
|
|
97
|
+
//# sourceMappingURL=styled.js.map
|