@mintlify/msft-sdk 1.1.22 → 1.1.24
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/api-playground/ApiPlayground/Request/BodySection.js +65 -0
- package/dist/api-playground/ApiPlayground/Request/BodySection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +33 -0
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +201 -0
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +147 -0
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js +31 -0
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/index.js +44 -0
- package/dist/api-playground/ApiPlayground/Request/index.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +94 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +91 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +63 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +34 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +62 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +110 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +88 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +62 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +55 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +68 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +45 -0
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js +7 -0
- package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +45 -0
- package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +54 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js +15 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseError.js +14 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseError.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js +12 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +20 -0
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +21 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +93 -0
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js.map +1 -0
- package/dist/api-playground/ApiPlayground/Response/index.js +80 -0
- package/dist/api-playground/ApiPlayground/Response/index.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js +24 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +45 -0
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ArrayCount.js +18 -0
- package/dist/api-playground/ApiPlayground/components/ArrayCount.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/BasePathSelector.js +40 -0
- package/dist/api-playground/ApiPlayground/components/BasePathSelector.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +44 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +45 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +39 -0
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/InputContainer.js +129 -0
- package/dist/api-playground/ApiPlayground/components/InputContainer.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +60 -0
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ModalHeader.js +16 -0
- package/dist/api-playground/ApiPlayground/components/ModalHeader.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js +29 -0
- package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +20 -0
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/PathHeader.js +163 -0
- package/dist/api-playground/ApiPlayground/components/PathHeader.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +59 -0
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/PrettyPath.js +50 -0
- package/dist/api-playground/ApiPlayground/components/PrettyPath.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/SendPill.js +40 -0
- package/dist/api-playground/ApiPlayground/components/SendPill.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/TrashButton.js +27 -0
- package/dist/api-playground/ApiPlayground/components/TrashButton.js.map +1 -0
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +53 -0
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js.map +1 -0
- package/dist/api-playground/ApiPlayground/index.js +68 -0
- package/dist/api-playground/ApiPlayground/index.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +51 -0
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +20 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +19 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +29 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +6 -0
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js.map +1 -0
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +13 -0
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/Description.js +13 -0
- package/dist/api-playground/EndpointFields/components/Description.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/OneOfDropdown.js +20 -0
- package/dist/api-playground/EndpointFields/components/OneOfDropdown.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js +36 -0
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js.map +1 -0
- package/dist/api-playground/EndpointFields/components/SectionHeading.js +44 -0
- package/dist/api-playground/EndpointFields/components/SectionHeading.js.map +1 -0
- package/dist/api-playground/EndpointFields/index.js +7 -0
- package/dist/api-playground/EndpointFields/index.js.map +1 -0
- package/dist/api-playground-2/Api.js +13 -0
- package/dist/api-playground-2/Api.js.map +1 -0
- package/dist/api-playground-2/ApiExamples.js +27 -18
- package/dist/api-playground-2/ApiExamples.js.map +1 -1
- package/dist/api-playground-2/ApiFields.js +253 -0
- package/dist/api-playground-2/ApiFields.js.map +1 -0
- package/dist/api-playground-2/EndpointHeader.js +52 -0
- package/dist/api-playground-2/EndpointHeader.js.map +1 -0
- package/dist/api-playground-2/OperationPage.js +101 -0
- package/dist/api-playground-2/OperationPage.js.map +1 -0
- package/dist/api-playground-2/Playground.js +136 -0
- package/dist/api-playground-2/Playground.js.map +1 -0
- package/dist/api-playground-2/SchemaPage.js +14 -0
- package/dist/api-playground-2/SchemaPage.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +88 -0
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +16 -0
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js +21 -0
- package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +57 -0
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +90 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +122 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +75 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +253 -0
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js.map +1 -0
- package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js +28 -0
- package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js.map +1 -0
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +113 -118
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -1
- package/dist/api-playground-2/components/Example/RequestExample.js +55 -50
- package/dist/api-playground-2/components/Example/RequestExample.js.map +1 -1
- package/dist/api-playground-2/components/Request/BodySection.js +41 -0
- package/dist/api-playground-2/components/Request/BodySection.js.map +1 -0
- package/dist/api-playground-2/components/Request/InputSectionContainer.js +66 -0
- package/dist/api-playground-2/components/Request/InputSectionContainer.js.map +1 -0
- package/dist/api-playground-2/components/Request/ParameterSection.js +36 -0
- package/dist/api-playground-2/components/Request/ParameterSection.js.map +1 -0
- package/dist/api-playground-2/components/Request/SecuritySection.js +55 -0
- package/dist/api-playground-2/components/Request/SecuritySection.js.map +1 -0
- package/dist/api-playground-2/components/Request/ServerSection.js +33 -0
- package/dist/api-playground-2/components/Request/ServerSection.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +55 -0
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +48 -0
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/FileInput.js +43 -0
- package/dist/api-playground-2/components/Request/inputs/FileInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js +127 -0
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/NullInput.js +15 -0
- package/dist/api-playground-2/components/Request/inputs/NullInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js +46 -0
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +104 -0
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +77 -0
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js +54 -0
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/StringInput.js +44 -0
- package/dist/api-playground-2/components/Request/inputs/StringInput.js.map +1 -0
- package/dist/api-playground-2/components/Request/inputs/TextInput.js +29 -0
- package/dist/api-playground-2/components/Request/inputs/TextInput.js.map +1 -0
- package/dist/api-playground-2/components/TypeDropdown.js +48 -0
- package/dist/api-playground-2/components/TypeDropdown.js.map +1 -0
- package/dist/api-playground-2/constants/index.js +6 -4
- package/dist/api-playground-2/constants/index.js.map +1 -1
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +11 -0
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js.map +1 -0
- package/dist/api-playground-2/generators/createBodyData.js +1 -1
- package/dist/api-playground-2/generators/createBodyData.js.map +1 -1
- package/dist/api-playground-2/generators/createHeaders.js +18 -18
- package/dist/api-playground-2/generators/createHeaders.js.map +1 -1
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +21 -19
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
- package/dist/api-playground-2/generators/generateRequest.js +26 -25
- package/dist/api-playground-2/generators/generateRequest.js.map +1 -1
- package/dist/api-playground-2/generators/generateSnippet.js +187 -36
- package/dist/api-playground-2/generators/generateSnippet.js.map +1 -1
- package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
- package/dist/api-playground-2/generators/generateSnippetMap.js.map +1 -1
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +14 -0
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js.map +1 -0
- package/dist/api-playground-2/hooks/useInitializeInputs.js +101 -0
- package/dist/api-playground-2/hooks/useInitializeInputs.js.map +1 -0
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +24 -13
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js.map +1 -1
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +156 -0
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +57 -0
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/processExamples.js +41 -8
- package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +107 -0
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js.map +1 -0
- package/dist/api-playground-2/schemaGraph/utils.js +195 -43
- package/dist/api-playground-2/schemaGraph/utils.js.map +1 -1
- package/dist/api-playground-2/types/index.js +118 -0
- package/dist/api-playground-2/types/index.js.map +1 -0
- package/dist/common/guards.js +37 -0
- package/dist/common/guards.js.map +1 -0
- package/dist/common/potentiallyParseOpenApiString.js +25 -0
- package/dist/common/potentiallyParseOpenApiString.js.map +1 -0
- package/dist/common/replaceSlashIndex.js +7 -0
- package/dist/common/replaceSlashIndex.js.map +1 -0
- package/dist/common/slugToTitle.js +11 -0
- package/dist/common/slugToTitle.js.map +1 -0
- package/dist/components/Api/Expandable.js +119 -0
- package/dist/components/Api/Expandable.js.map +1 -0
- package/dist/components/Api/Markdown.js +66 -0
- package/dist/components/Api/Markdown.js.map +1 -0
- package/dist/components/Api/Param.js +191 -0
- package/dist/components/Api/Param.js.map +1 -0
- package/dist/components/content-components/code-block.js +68 -61
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/content-components/code-group.js +36 -25
- package/dist/components/content-components/code-group.js.map +1 -1
- package/dist/components/content-components/getNodeText.js +5 -0
- package/dist/components/content-components/getNodeText.js.map +1 -0
- package/dist/components/toc/index.js +4 -4
- package/dist/components/toc/index.js.map +1 -1
- package/dist/constants/index.js +5 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/zIndex.js +7 -0
- package/dist/constants/zIndex.js.map +1 -0
- package/dist/contexts/ApiPlaygroundInputsContext.js +18 -0
- package/dist/contexts/ApiPlaygroundInputsContext.js.map +1 -0
- package/dist/contexts/ConfigContext.js +2 -3
- package/dist/contexts/ConfigContext.js.map +1 -1
- package/dist/contexts/EndpointLocationContext.js +18 -0
- package/dist/contexts/EndpointLocationContext.js.map +1 -0
- package/dist/contexts/MDXContentContext.js +19 -0
- package/dist/contexts/MDXContentContext.js.map +1 -0
- package/dist/env.js +6 -1
- package/dist/env.js.map +1 -1
- package/dist/hooks/useApiPlaygroundInputs.js +7 -0
- package/dist/hooks/useApiPlaygroundInputs.js.map +1 -0
- package/dist/hooks/useApiPlaygroundPrefillExamples.js +40 -0
- package/dist/hooks/useApiPlaygroundPrefillExamples.js.map +1 -0
- package/dist/hooks/useBaseUrlOptions.js +19 -0
- package/dist/hooks/useBaseUrlOptions.js.map +1 -0
- package/dist/hooks/useCheckHash.js +18 -0
- package/dist/hooks/useCheckHash.js.map +1 -0
- package/dist/hooks/useComponentSchemas.js +10 -0
- package/dist/hooks/useComponentSchemas.js.map +1 -0
- package/dist/hooks/useCurrentPath.js +17 -0
- package/dist/hooks/useCurrentPath.js.map +1 -0
- package/dist/hooks/useEndpoint.js +3 -3
- package/dist/hooks/useExpandableMemory.js +46 -0
- package/dist/hooks/useExpandableMemory.js.map +1 -0
- package/dist/hooks/useGenerateNextAdditionalProperties.js +12 -0
- package/dist/hooks/useGenerateNextAdditionalProperties.js.map +1 -0
- package/dist/hooks/useGenerateNextItems.js +12 -0
- package/dist/hooks/useGenerateNextItems.js.map +1 -0
- package/dist/hooks/useGenerateNextProperties.js +12 -0
- package/dist/hooks/useGenerateNextProperties.js.map +1 -0
- package/dist/hooks/useKeyboardShortcut.js +26 -0
- package/dist/hooks/useKeyboardShortcut.js.map +1 -0
- package/dist/hooks/useMDXContent.js +7 -0
- package/dist/hooks/useMDXContent.js.map +1 -0
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +10 -0
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js.map +1 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +16 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js.map +1 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +16 -0
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js.map +1 -0
- package/dist/hooks/usePlaygroundSchemaOptions.js +43 -0
- package/dist/hooks/usePlaygroundSchemaOptions.js.map +1 -0
- package/dist/hooks/usePrefilledInputs/index.js +66 -0
- package/dist/hooks/usePrefilledInputs/index.js.map +1 -0
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js +30 -0
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js.map +1 -0
- package/dist/hooks/useSecurityOption.js +11 -0
- package/dist/hooks/useSecurityOption.js.map +1 -0
- package/dist/hooks/useSendPlaygroundRequest.js +146 -15
- package/dist/hooks/useSendPlaygroundRequest.js.map +1 -1
- package/dist/hooks/useSetDefaultValue.js +64 -0
- package/dist/hooks/useSetDefaultValue.js.map +1 -0
- package/dist/index.d.ts +281 -0
- package/dist/index.js +143 -108
- package/dist/index.js.map +1 -1
- package/dist/openapi/filterEnums.js +21 -0
- package/dist/openapi/filterEnums.js.map +1 -0
- package/dist/openapi/generateNextAdditionalProperties.js +8 -0
- package/dist/openapi/generateNextAdditionalProperties.js.map +1 -0
- package/dist/openapi/generateNextItems.js +8 -0
- package/dist/openapi/generateNextItems.js.map +1 -0
- package/dist/openapi/generateNextProperties.js +24 -0
- package/dist/openapi/generateNextProperties.js.map +1 -0
- package/dist/openapi/generateOptionLabels.js +21 -0
- package/dist/openapi/generateOptionLabels.js.map +1 -0
- package/dist/openapi/generateSimpleLabels.js +5 -0
- package/dist/openapi/generateSimpleLabels.js.map +1 -0
- package/dist/openapi/generateTypeStringFromSchema.js +34 -0
- package/dist/openapi/generateTypeStringFromSchema.js.map +1 -0
- package/dist/openapi/getAuthFilteredSchemaArray.js +19 -0
- package/dist/openapi/getAuthFilteredSchemaArray.js.map +1 -0
- package/dist/paths/isEqualIgnoringLeadingSlash.js +22 -0
- package/dist/paths/isEqualIgnoringLeadingSlash.js.map +1 -0
- package/dist/paths/optionallyRemoveLeadingSlash.js +7 -0
- package/dist/paths/optionallyRemoveLeadingSlash.js.map +1 -0
- package/dist/paths/optionallyRemoveTrailingSlash.js +7 -0
- package/dist/paths/optionallyRemoveTrailingSlash.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/utils/api-playground/defaults.js +16 -0
- package/dist/utils/api-playground/defaults.js.map +1 -0
- package/dist/utils/api-playground/paramFieldDefaults.js +11 -0
- package/dist/utils/api-playground/paramFieldDefaults.js.map +1 -0
- package/dist/utils/api-reference/getFilteredSecurityOptions.js +5 -0
- package/dist/utils/api-reference/getFilteredSecurityOptions.js.map +1 -0
- package/dist/utils/api-reference/getNextPropertiesByType.js +6 -0
- package/dist/utils/api-reference/getNextPropertiesByType.js.map +1 -0
- package/dist/utils/containsMarkdownTable.js +5 -0
- package/dist/utils/containsMarkdownTable.js.map +1 -0
- package/dist/utils/copyToClipboard.js +12 -0
- package/dist/utils/copyToClipboard.js.map +1 -0
- package/dist/utils/decodeSlug.js +8 -0
- package/dist/utils/decodeSlug.js.map +1 -0
- package/dist/utils/flattenObject.js +11 -0
- package/dist/utils/flattenObject.js.map +1 -0
- package/dist/utils/formatJSON.js +39 -0
- package/dist/utils/formatJSON.js.map +1 -0
- package/dist/utils/optionallyAddLeadingSlash.js +7 -0
- package/dist/utils/optionallyAddLeadingSlash.js.map +1 -0
- package/dist/utils/scrollElementIntoView.js +21 -0
- package/dist/utils/scrollElementIntoView.js.map +1 -0
- package/package.json +2 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsxs as x, Fragment as y, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as I } from "react";
|
|
3
|
+
import { usePlaygroundInputsStore as k } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
4
|
+
import { getSchemaPlaceholder as w, getUniqueInputKey as v } from "../../../schemaGraph/utils.js";
|
|
5
|
+
import { useSelectedLocale as F } from "../../../../utils/locales/index.js";
|
|
6
|
+
import { cn as P } from "../../../../utils/cn.js";
|
|
7
|
+
const N = ({ name: c, schema: n, inputKeyPrefix: m, arrayIndex: u }) => {
|
|
8
|
+
const { getInput: d, setInput: p } = k(), s = F(), o = I(null), f = w(n) ?? "Drop a file here or click to upload", i = v(m, n, u), r = d(i), t = typeof window < "u" && r instanceof File ? r : void 0, h = (t == null ? void 0 : t.name) ?? f, g = (e) => {
|
|
9
|
+
var l;
|
|
10
|
+
p(i, (l = e.target.files) == null ? void 0 : l[0]);
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ x(y, { children: [
|
|
13
|
+
/* @__PURE__ */ a(
|
|
14
|
+
"button",
|
|
15
|
+
{
|
|
16
|
+
"aria-label": s["aria.fileUploadButton"],
|
|
17
|
+
className: P(
|
|
18
|
+
"mint:text-left mint:flex mint:text-playground-input mint:overflow-hidden",
|
|
19
|
+
t ? "mint:text-gray-900! mint:dark:text-gray-100!" : "mint:text-gray-400! mint:dark:text-white/30!"
|
|
20
|
+
),
|
|
21
|
+
onClick: () => {
|
|
22
|
+
var e;
|
|
23
|
+
return (e = o.current) == null ? void 0 : e.click();
|
|
24
|
+
},
|
|
25
|
+
children: h
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ a(
|
|
29
|
+
"input",
|
|
30
|
+
{
|
|
31
|
+
type: "file",
|
|
32
|
+
"data-testid": `${c ?? "file"}-input`,
|
|
33
|
+
onChange: g,
|
|
34
|
+
ref: o,
|
|
35
|
+
className: "mint:hidden"
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
] });
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
N as FileInput
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=FileInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/FileInput.tsx"],"sourcesContent":["import { ChangeEvent, useRef } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { cn, getSchemaPlaceholder, getUniqueInputKey } from '@/api-playground-2/schemaGraph/utils';\nimport { useSelectedLocale } from '@/utils/locales';\n\nimport { InputParams } from './DifferentiatedInput';\n\nexport const FileInput = ({ name, schema, inputKeyPrefix, arrayIndex }: InputParams) => {\n const { getInput, setInput } = usePlaygroundInputsStore();\n const locale = useSelectedLocale();\n const hiddenInputRef = useRef<HTMLInputElement>(null);\n\n const schemaPlaceholder = getSchemaPlaceholder(schema) ?? 'Drop a file here or click to upload';\n const uniqueInputKey = getUniqueInputKey(inputKeyPrefix, schema, arrayIndex);\n const value = getInput(uniqueInputKey);\n\n const safeValue = typeof window !== 'undefined' && value instanceof File ? value : undefined;\n\n const placeholder = safeValue?.name ?? schemaPlaceholder;\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n setInput(uniqueInputKey, event.target.files?.[0]);\n };\n\n return (\n <>\n <button\n aria-label={locale['aria.fileUploadButton']}\n className={cn(\n 'mint:text-left mint:flex mint:text-playground-input mint:overflow-hidden',\n safeValue ? 'mint:text-gray-900! mint:dark:text-gray-100!' : 'mint:text-gray-400! mint:dark:text-white/30!'\n )}\n onClick={() => hiddenInputRef.current?.click()}\n >\n {placeholder}\n </button>\n {/* HACK: file inputs are notoriously hard to style, so hide the native input and click it programmatically */}\n <input\n type=\"file\"\n data-testid={`${name ?? 'file'}-input`}\n onChange={onChange}\n ref={hiddenInputRef}\n className=\"mint:hidden\"\n />\n </>\n );\n};\n"],"names":["FileInput","name","schema","inputKeyPrefix","arrayIndex","getInput","setInput","usePlaygroundInputsStore","locale","useSelectedLocale","hiddenInputRef","useRef","schemaPlaceholder","getSchemaPlaceholder","uniqueInputKey","getUniqueInputKey","value","safeValue","placeholder","onChange","event","_a","jsxs","Fragment","jsx","cn"],"mappings":";;;;;;AAQO,MAAMA,IAAY,CAAC,EAAE,MAAAC,GAAM,QAAAC,GAAQ,gBAAAC,GAAgB,YAAAC,QAA8B;AACtF,QAAM,EAAE,UAAAC,GAAU,UAAAC,EAAA,IAAaC,EAAA,GACzBC,IAASC,EAAA,GACTC,IAAiBC,EAAyB,IAAI,GAE9CC,IAAoBC,EAAqBX,CAAM,KAAK,uCACpDY,IAAiBC,EAAkBZ,GAAgBD,GAAQE,CAAU,GACrEY,IAAQX,EAASS,CAAc,GAE/BG,IAAY,OAAO,SAAW,OAAeD,aAAiB,OAAOA,IAAQ,QAE7EE,KAAcD,KAAA,gBAAAA,EAAW,SAAQL,GAEjCO,IAAW,CAACC,MAAyC;;AACzD,IAAAd,EAASQ,IAAgBO,IAAAD,EAAM,OAAO,UAAb,gBAAAC,EAAqB,EAAE;AAAA,EAClD;AAEA,SACE,gBAAAC,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,cAAYhB,EAAO,uBAAuB;AAAA,QAC1C,WAAWiB;AAAA,UACT;AAAA,UACAR,IAAY,iDAAiD;AAAA,QAAA;AAAA,QAE/D,SAAS,MAAA;;AAAM,kBAAAI,IAAAX,EAAe,YAAf,gBAAAW,EAAwB;AAAA;AAAA,QAEtC,UAAAH;AAAA,MAAA;AAAA,IAAA;AAAA,IAGH,gBAAAM;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAa,GAAGvB,KAAQ,MAAM;AAAA,QAC9B,UAAAkB;AAAA,QACA,KAAKT;AAAA,QACL,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GACF;AAEJ;"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { jsxs as e, Fragment as l, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N } from "react";
|
|
3
|
+
import { isEnum as g } from "../../../schemaGraph/utils.js";
|
|
4
|
+
import { ArrayCount as $ } from "../../../../api-playground/ApiPlayground/components/ArrayCount.js";
|
|
5
|
+
import { ObjectExpandButton as O } from "../../../../api-playground/ApiPlayground/components/ObjectExpandButton.js";
|
|
6
|
+
import { TrashButton as P } from "../../../../api-playground/ApiPlayground/components/TrashButton.js";
|
|
7
|
+
import { Description as x } from "../../../../api-playground/EndpointFields/components/Description.js";
|
|
8
|
+
import { InfoPill as T, RequiredPill as q, DeprecatedPill as A } from "../../../../components/Api/Param.js";
|
|
9
|
+
import { containsMarkdownTable as B } from "../../../../utils/containsMarkdownTable.js";
|
|
10
|
+
import { cn as m } from "../../../../utils/cn.js";
|
|
11
|
+
const J = ({
|
|
12
|
+
name: d,
|
|
13
|
+
schema: t,
|
|
14
|
+
defaultExpanded: a = !0,
|
|
15
|
+
typeDropdown: p,
|
|
16
|
+
arrayIndex: o,
|
|
17
|
+
parentNames: n,
|
|
18
|
+
clearValue: y,
|
|
19
|
+
style: b,
|
|
20
|
+
explode: v,
|
|
21
|
+
children: u
|
|
22
|
+
}) => {
|
|
23
|
+
const [s, k] = N(a), f = g(t) && t.description && B(t.description), h = t.format && typeof t.format == "string" ? `${t.type}<${t.format}>` : g(t) ? `enum<${t.type}>` : t.type, c = t.type === "array", r = t.type === "object", w = r ? Object.keys(t.properties ?? {}).length : 0;
|
|
24
|
+
return /* @__PURE__ */ e(l, { children: [
|
|
25
|
+
/* @__PURE__ */ e(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: m(
|
|
29
|
+
"mint:flex mint:space-x-3 mint:items-start",
|
|
30
|
+
o != null && !r && "mint:flex mint:items-center"
|
|
31
|
+
),
|
|
32
|
+
children: [
|
|
33
|
+
o != null && /* @__PURE__ */ i($, { className: m(r && "mint:mt-8"), children: o + 1 }),
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: m(
|
|
38
|
+
"mint:flex-1 mint:lg:grid-cols-2 mint:gap-x-12 mint:gap-y-4 mint:py-5 mint:max-w-full",
|
|
39
|
+
!c && !r && "mint:grid",
|
|
40
|
+
c && "mint:flex mint:flex-col",
|
|
41
|
+
r && "mint:gap-y-0 mint:flex mint:flex-col mint:border mint:border-gray-50 mint:dark:border-white/5 mint:rounded-xl mint:px-4 mint:py-0 mint:my-5",
|
|
42
|
+
o !== void 0 && "mint:py-1 mint:my-2"
|
|
43
|
+
),
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ e(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: m(
|
|
49
|
+
"mint:space-y-2",
|
|
50
|
+
r && "mint:py-5 mint:border-b mint:border-gray-50 mint:dark:border-white/5",
|
|
51
|
+
!s && "mint:border-none",
|
|
52
|
+
o != null && !r && "mint:flex mint:items-center"
|
|
53
|
+
),
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ e("div", { className: "mint:flex mint:items-center mint:justify-between mint:font-mono mint:font-bold", children: [
|
|
56
|
+
/* @__PURE__ */ e(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: "mint:flex mint:flex-wrap mint:items-center mint:gap-2 mint:text-xs mint:truncate",
|
|
60
|
+
title: n && n.length > 0 ? `${n.join(".")}.${d}` : d,
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ i("div", { className: m("mint:text-sm mint:truncate", d == null && "mint:hidden"), children: n && n.length > 0 && b === "deepObject" && v ? /* @__PURE__ */ e(l, { children: [
|
|
63
|
+
/* @__PURE__ */ i("span", { className: "mint:text-gray-500 mint:dark:text-gray-400", children: n.map((j, C) => /* @__PURE__ */ e(l, { children: [
|
|
64
|
+
j,
|
|
65
|
+
C === 0 ? "[" : "]["
|
|
66
|
+
] })) }),
|
|
67
|
+
/* @__PURE__ */ i("span", { className: "mint:font-semibold mint:text-gray-900 mint:dark:text-gray-100", children: d }),
|
|
68
|
+
/* @__PURE__ */ i("span", { className: "mint:text-gray-500 mint:dark:text-gray-400", children: "]" })
|
|
69
|
+
] }) : /* @__PURE__ */ e(l, { children: [
|
|
70
|
+
/* @__PURE__ */ i("span", { className: "mint:text-gray-500 mint:dark:text-gray-400", children: n ? `${n.join(".")}.` : "" }),
|
|
71
|
+
/* @__PURE__ */ i("span", { className: "mint:font-semibold mint:text-gray-900 mint:dark:text-gray-100", children: d })
|
|
72
|
+
] }) }),
|
|
73
|
+
p ?? /* @__PURE__ */ i(T, { children: h }),
|
|
74
|
+
t.isRequired && /* @__PURE__ */ i(q, {}),
|
|
75
|
+
t.deprecated && /* @__PURE__ */ i(A, {})
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
r && /* @__PURE__ */ i(
|
|
80
|
+
O,
|
|
81
|
+
{
|
|
82
|
+
onClick: () => k(!s),
|
|
83
|
+
count: w,
|
|
84
|
+
labeled: a == !1
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] }),
|
|
88
|
+
t.description && !f && /* @__PURE__ */ i(
|
|
89
|
+
x,
|
|
90
|
+
{
|
|
91
|
+
markdown: t.description,
|
|
92
|
+
className: "mint:text-gray-500 mint:dark:text-gray-400"
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
s && /* @__PURE__ */ i(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: m(
|
|
102
|
+
"mint:grid mint:grid-cols-1 mint:w-full mint:items-start mint:divide-y mint:divide-gray-50 mint:dark:divide-white/5",
|
|
103
|
+
c && "mint:divide-y-0"
|
|
104
|
+
),
|
|
105
|
+
children: u
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
(o != null || n) && y && /* @__PURE__ */ i(
|
|
112
|
+
P,
|
|
113
|
+
{
|
|
114
|
+
className: m(r && "mint:mt-8", n && "mint:mt-7"),
|
|
115
|
+
onClick: () => y()
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
t.description && f && /* @__PURE__ */ i(x, { markdown: t.description, className: "mint:text-gray-500 mint:dark:text-gray-400" })
|
|
122
|
+
] });
|
|
123
|
+
};
|
|
124
|
+
export {
|
|
125
|
+
J as InputContainer
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=InputContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputContainer.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/InputContainer.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { isEnum } from '@/api-playground-2/schemaGraph/utils';\nimport { ArrayCount } from '@/api-playground/ApiPlayground/components/ArrayCount';\nimport { ObjectExpandButton } from '@/api-playground/ApiPlayground/components/ObjectExpandButton';\nimport { TrashButton } from '@/api-playground/ApiPlayground/components/TrashButton';\nimport { Description } from '@/api-playground/EndpointFields/components/Description';\nimport { DeprecatedPill, InfoPill, RequiredPill } from '../../../../components/Api/Param';\nimport { containsMarkdownTable } from '../../../../utils/containsMarkdownTable';\n\nimport { InputContainerParams } from './DifferentiatedInput';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const InputContainer = ({\n name,\n schema,\n defaultExpanded = true,\n typeDropdown,\n arrayIndex,\n parentNames,\n clearValue,\n style,\n explode,\n children,\n}: InputContainerParams) => {\n const [showChildren, setShowChildren] = useState(defaultExpanded);\n const descriptionContainsTable =\n isEnum(schema) && schema.description && containsMarkdownTable(schema.description);\n const typeLabel =\n schema.format && typeof schema.format === 'string'\n ? `${schema.type}<${schema.format}>`\n : isEnum(schema)\n ? `enum<${schema.type}>`\n : schema.type;\n const isArray = schema.type === 'array';\n const isObject = schema.type === 'object';\n const propertiesCount = isObject ? Object.keys(schema.properties ?? {}).length : 0;\n return (\n <>\n <div\n className={cn(\n 'mint:flex mint:space-x-3 mint:items-start',\n arrayIndex != undefined && !isObject && 'mint:flex mint:items-center'\n )}\n >\n {arrayIndex != undefined && (\n <ArrayCount className={cn(isObject && 'mint:mt-8')}>{arrayIndex + 1}</ArrayCount>\n )}\n <div\n className={cn(\n 'mint:flex-1 mint:lg:grid-cols-2 mint:gap-x-12 mint:gap-y-4 mint:py-5 mint:max-w-full',\n !isArray && !isObject && \"mint:grid\",\n isArray && 'mint:flex mint:flex-col',\n isObject &&\n 'mint:gap-y-0 mint:flex mint:flex-col mint:border mint:border-gray-50 mint:dark:border-white/5 mint:rounded-xl mint:px-4 mint:py-0 mint:my-5',\n arrayIndex !== undefined && 'mint:py-1 mint:my-2'\n )}\n >\n <div\n className={cn(\n 'mint:space-y-2',\n isObject && 'mint:py-5 mint:border-b mint:border-gray-50 mint:dark:border-white/5',\n !showChildren && 'mint:border-none',\n arrayIndex != undefined && !isObject && 'mint:flex mint:items-center'\n )}\n >\n <div className=\"mint:flex mint:items-center mint:justify-between mint:font-mono mint:font-bold\">\n <div\n className=\"mint:flex mint:flex-wrap mint:items-center mint:gap-2 mint:text-xs mint:truncate\"\n title={\n parentNames && parentNames.length > 0 ? `${parentNames.join('.')}.${name}` : name\n }\n >\n <div className={cn(\"mint:text-sm mint:truncate\", name == undefined && 'mint:hidden')}>\n {parentNames && parentNames.length > 0 && style === 'deepObject' && explode ? (\n <>\n <span className=\"mint:text-gray-500 mint:dark:text-gray-400\">\n {parentNames.map((parentName, index) => (\n <>\n {parentName}\n {index === 0 ? '[' : ']['}\n </>\n ))}\n </span>\n <span className=\"mint:font-semibold mint:text-gray-900 mint:dark:text-gray-100\">{name}</span>\n <span className=\"mint:text-gray-500 mint:dark:text-gray-400\">{']'}</span>\n </>\n ) : (\n <>\n <span className=\"mint:text-gray-500 mint:dark:text-gray-400\">\n {parentNames ? `${parentNames.join('.')}.` : ''}\n </span>\n <span className=\"mint:font-semibold mint:text-gray-900 mint:dark:text-gray-100\">{name}</span>\n </>\n )}\n </div>\n {typeDropdown != undefined ? typeDropdown : <InfoPill>{typeLabel}</InfoPill>}\n {schema.isRequired && <RequiredPill />}\n {schema.deprecated && <DeprecatedPill />}\n </div>\n {isObject && (\n <ObjectExpandButton\n onClick={() => setShowChildren(!showChildren)}\n count={propertiesCount}\n labeled={defaultExpanded == false}\n />\n )}\n </div>\n {schema.description && !descriptionContainsTable && (\n <Description\n markdown={schema.description}\n className=\"mint:text-gray-500 mint:dark:text-gray-400\"\n />\n )}\n </div>\n {showChildren && (\n <div\n className={cn(\n 'mint:grid mint:grid-cols-1 mint:w-full mint:items-start mint:divide-y mint:divide-gray-50 mint:dark:divide-white/5',\n isArray && 'mint:divide-y-0'\n )}\n >\n {children}\n </div>\n )}\n </div>\n {/* // TODO - Api Playground Refactor: make sure clearValue works to delete keys */}\n {(arrayIndex != undefined || parentNames) && clearValue && (\n <TrashButton\n className={cn(isObject && 'mint:mt-8', parentNames && 'mint:mt-7')}\n onClick={() => clearValue()}\n />\n )}\n </div>\n {schema.description && descriptionContainsTable && (\n <Description markdown={schema.description} className=\"mint:text-gray-500 mint:dark:text-gray-400\" />\n )}\n </>\n );\n};\n"],"names":["InputContainer","name","schema","defaultExpanded","typeDropdown","arrayIndex","parentNames","clearValue","style","explode","children","showChildren","setShowChildren","useState","descriptionContainsTable","isEnum","containsMarkdownTable","typeLabel","isArray","isObject","propertiesCount","jsxs","Fragment","cn","ArrayCount","jsx","parentName","index","InfoPill","RequiredPill","DeprecatedPill","ObjectExpandButton","Description","TrashButton"],"mappings":";;;;;;;;;;AAaO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,MAA4B;AAC1B,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAASV,CAAe,GAC1DW,IACJC,EAAOb,CAAM,KAAKA,EAAO,eAAec,EAAsBd,EAAO,WAAW,GAC5Ee,IACJf,EAAO,UAAU,OAAOA,EAAO,UAAW,WACtC,GAAGA,EAAO,IAAI,IAAIA,EAAO,MAAM,MAC/Ba,EAAOb,CAAM,IACX,QAAQA,EAAO,IAAI,MACnBA,EAAO,MACTgB,IAAUhB,EAAO,SAAS,SAC1BiB,IAAWjB,EAAO,SAAS,UAC3BkB,IAAkBD,IAAW,OAAO,KAAKjB,EAAO,cAAc,CAAA,CAAE,EAAE,SAAS;AACjF,SACE,gBAAAmB,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWE;AAAA,UACT;AAAA,UACAlB,KAAc,QAAa,CAACc,KAAY;AAAA,QAAA;AAAA,QAGzC,UAAA;AAAA,UAAAd,KAAc,0BACZmB,GAAA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W;AAAA,cACjE,SAAS,MAAMC,EAAA;AAAA,YAAW;AAAA,UAAA;AAAA,QAC5B;AAAA,MAAA;AAAA,IAAA;AAAA,IAGHL,EAAO,eAAeY,KACrB,gBAAAW,EAACO,KAAY,UAAU9B,EAAO,aAAa,WAAU,6CAAA,CAA6C;AAAA,EAAA,GAEtG;AAEJ;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
const e = () => /* @__PURE__ */ t(
|
|
3
|
+
"input",
|
|
4
|
+
{
|
|
5
|
+
className: "mint:flex-1 mint:min-w-0 mint:outline-0 mint:bg-transparent mint:text-playground-input",
|
|
6
|
+
type: "text",
|
|
7
|
+
placeholder: "--",
|
|
8
|
+
contentEditable: "false",
|
|
9
|
+
disabled: !0
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
export {
|
|
13
|
+
e as NullInput
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=NullInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NullInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/NullInput.tsx"],"sourcesContent":["import { cn } from \"../../../../utils/cn\";\nexport const NullInput = () => {\n return (\n <input\n className=\"mint:flex-1 mint:min-w-0 mint:outline-0 mint:bg-transparent mint:text-playground-input\"\n type=\"text\"\n placeholder=\"--\"\n contentEditable=\"false\"\n disabled\n />\n );\n};\n"],"names":["NullInput","jsx"],"mappings":";AACO,MAAMA,IAAY,MAErB,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,MAAK;AAAA,IACL,aAAY;AAAA,IACZ,iBAAgB;AAAA,IAChB,UAAQ;AAAA,EAAA;AAAA;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { isInteger as b, isNumber as N } from "../../../../common/guards.js";
|
|
3
|
+
import { usePlaygroundInputsStore as h } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
4
|
+
import { getSchemaPlaceholder as P, getUniqueInputKey as S } from "../../../schemaGraph/utils.js";
|
|
5
|
+
import { useSelectedLocale as v } from "../../../../utils/locales/index.js";
|
|
6
|
+
import { Ids as x } from "../../../types/index.js";
|
|
7
|
+
const A = ({
|
|
8
|
+
name: a,
|
|
9
|
+
schema: n,
|
|
10
|
+
inputKeyPrefix: l,
|
|
11
|
+
numberType: s,
|
|
12
|
+
arrayIndex: p
|
|
13
|
+
}) => {
|
|
14
|
+
const m = v(), { getInput: c, setInput: o } = h(), u = P(n), r = S(l, n, p), g = c(r), f = u ?? `enter ${a ?? "value"}`, i = n.type, d = ((e, t) => e === "integer" ? b(t) ? t : void 0 : N(t) ? t : void 0)(s, g), I = (e) => {
|
|
15
|
+
if (e.target.value.length === 0) {
|
|
16
|
+
o(r, void 0);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (i === "integer") {
|
|
20
|
+
const t = parseInt(e.target.value);
|
|
21
|
+
if (isNaN(t))
|
|
22
|
+
return;
|
|
23
|
+
o(r, t);
|
|
24
|
+
} else
|
|
25
|
+
o(r, parseFloat(e.target.value));
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ y(
|
|
28
|
+
"input",
|
|
29
|
+
{
|
|
30
|
+
id: x.APIPlaygroundInput,
|
|
31
|
+
className: "mint:flex-1 mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input",
|
|
32
|
+
placeholder: f,
|
|
33
|
+
"aria-label": u ?? m["aria.enterValue"].replace("{name}", a ?? "value"),
|
|
34
|
+
onKeyDown: (e) => {
|
|
35
|
+
(e.key === "e" || e.key === "." && i === "integer") && e.preventDefault();
|
|
36
|
+
},
|
|
37
|
+
type: "number",
|
|
38
|
+
value: d ?? "",
|
|
39
|
+
onChange: I
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
A as NumberInput
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=NumberInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/NumberInput.tsx"],"sourcesContent":["import { isInteger, isNumber } from '../../../../common/guards';\nimport { ChangeEvent } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { getSchemaPlaceholder, getUniqueInputKey } from '@/api-playground-2/schemaGraph/utils';\nimport { useSelectedLocale } from '@/utils/locales';\n\nimport { InputParams } from './DifferentiatedInput';\nimport { Ids } from '@/api-playground-2/types';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const NumberInput = ({\n name,\n schema,\n inputKeyPrefix,\n numberType,\n arrayIndex,\n}: InputParams & { numberType: string }) => {\n const locale = useSelectedLocale();\n const { getInput, setInput } = usePlaygroundInputsStore();\n const schemaPlaceholder = getSchemaPlaceholder(schema);\n const uniqueInputKey = getUniqueInputKey(inputKeyPrefix, schema, arrayIndex);\n const value = getInput(uniqueInputKey);\n const placeholder = schemaPlaceholder ?? `enter ${name ?? 'value'}`;\n const schemaType = schema.type;\n\n const getSafeNumberValue = (numberType: string, value: unknown) => {\n if (numberType === 'integer') {\n return isInteger(value) ? value : undefined;\n } else {\n return isNumber(value) ? value : undefined;\n }\n };\n const safeValue = getSafeNumberValue(numberType, value);\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (event.target.value.length === 0) {\n setInput(uniqueInputKey, undefined);\n return;\n }\n\n if (schemaType === 'integer') {\n const parsedInteger = parseInt(event.target.value);\n if (isNaN(parsedInteger)) {\n return;\n }\n setInput(uniqueInputKey, parsedInteger);\n } else {\n setInput(uniqueInputKey, parseFloat(event.target.value));\n }\n };\n\n return (\n <input\n id={Ids.APIPlaygroundInput}\n className=\"mint:flex-1 mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input\"\n placeholder={placeholder}\n aria-label={schemaPlaceholder ?? locale['aria.enterValue'].replace('{name}', name ?? 'value')}\n onKeyDown={(event) => {\n // disallow \"e\", and disallow \".\" for integer inputs\n if (event.key === 'e' || (event.key === '.' && schemaType === 'integer')) {\n event.preventDefault();\n }\n }}\n type=\"number\"\n value={safeValue ?? ''}\n onChange={onChange}\n />\n );\n};\n"],"names":["NumberInput","name","schema","inputKeyPrefix","numberType","arrayIndex","locale","useSelectedLocale","getInput","setInput","usePlaygroundInputsStore","schemaPlaceholder","getSchemaPlaceholder","uniqueInputKey","getUniqueInputKey","value","placeholder","schemaType","safeValue","isInteger","isNumber","onChange","event","parsedInteger","jsx","Ids"],"mappings":";;;;;;AAWO,MAAMA,IAAc,CAAC;AAAA,EAC1B,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AACF,MAA4C;AAC1C,QAAMC,IAASC,EAAA,GACT,EAAE,UAAAC,GAAU,UAAAC,EAAA,IAAaC,EAAA,GACzBC,IAAoBC,EAAqBV,CAAM,GAC/CW,IAAiBC,EAAkBX,GAAgBD,GAAQG,CAAU,GACrEU,IAAQP,EAASK,CAAc,GAC/BG,IAAcL,KAAqB,SAASV,KAAQ,OAAO,IAC3DgB,IAAaf,EAAO,MASpBgB,KAPqB,CAACd,GAAoBW,MAC1CX,MAAe,YACVe,EAAUJ,CAAK,IAAIA,IAAQ,SAE3BK,EAASL,CAAK,IAAIA,IAAQ,QAGAX,GAAYW,CAAK,GAEhDM,IAAW,CAACC,MAAyC;AACzD,QAAIA,EAAM,OAAO,MAAM,WAAW,GAAG;AACnC,MAAAb,EAASI,GAAgB,MAAS;AAClC;AAAA,IACF;AAEA,QAAII,MAAe,WAAW;AAC5B,YAAMM,IAAgB,SAASD,EAAM,OAAO,KAAK;AACjD,UAAI,MAAMC,CAAa;AACrB;AAEF,MAAAd,EAASI,GAAgBU,CAAa;AAAA,IACxC;AACE,MAAAd,EAASI,GAAgB,WAAWS,EAAM,OAAO,KAAK,CAAC;AAAA,EAE3D;AAEA,SACE,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAIC,EAAI;AAAA,MACR,WAAU;AAAA,MACV,aAAAT;AAAA,MACA,cAAYL,KAAqBL,EAAO,iBAAiB,EAAE,QAAQ,UAAUL,KAAQ,OAAO;AAAA,MAC5F,WAAW,CAACqB,MAAU;AAEpB,SAAIA,EAAM,QAAQ,OAAQA,EAAM,QAAQ,OAAOL,MAAe,cAC5DK,EAAM,eAAA;AAAA,MAEV;AAAA,MACA,MAAK;AAAA,MACL,OAAOJ,KAAa;AAAA,MACpB,UAAAG;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as r, Fragment as K, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g } from "react";
|
|
3
|
+
import { v4 as q } from "uuid";
|
|
4
|
+
import { isSchemaObject as u, getUniqueInputKey as b, convertAnySchemaToOneOfs as w } from "../../../schemaGraph/utils.js";
|
|
5
|
+
import { AdditionalPropertyButton as B } from "../../../../api-playground/ApiPlayground/components/AdditionalPropertyButton.js";
|
|
6
|
+
import { DifferentiatedInput as f } from "./DifferentiatedInput.js";
|
|
7
|
+
const G = ({
|
|
8
|
+
schema: t,
|
|
9
|
+
depth: s,
|
|
10
|
+
parentNames: m,
|
|
11
|
+
style: a,
|
|
12
|
+
explode: d,
|
|
13
|
+
inputKeyPrefix: e,
|
|
14
|
+
name: l
|
|
15
|
+
}) => {
|
|
16
|
+
const O = [];
|
|
17
|
+
Object.entries(t.properties ?? {}).forEach(([o, n]) => {
|
|
18
|
+
if (u(n)) {
|
|
19
|
+
const i = l ? [l] : void 0;
|
|
20
|
+
O.push(
|
|
21
|
+
/* @__PURE__ */ r(
|
|
22
|
+
f,
|
|
23
|
+
{
|
|
24
|
+
name: o,
|
|
25
|
+
schema: n,
|
|
26
|
+
depth: (s ?? 0) + 1,
|
|
27
|
+
parentNames: i,
|
|
28
|
+
style: a,
|
|
29
|
+
explode: d,
|
|
30
|
+
inputKeyPrefix: e
|
|
31
|
+
},
|
|
32
|
+
o
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const h = t.additionalProperties !== void 0 && t.additionalProperties !== !1, j = q(), [p, v] = g([]), c = [];
|
|
38
|
+
p.forEach((o) => {
|
|
39
|
+
var n;
|
|
40
|
+
if (u(t.additionalProperties)) {
|
|
41
|
+
const i = b(e, t, void 0, o);
|
|
42
|
+
c.push(
|
|
43
|
+
/* @__PURE__ */ r(
|
|
44
|
+
f,
|
|
45
|
+
{
|
|
46
|
+
name: o,
|
|
47
|
+
schema: { ...t.additionalProperties, uniqueKey: i },
|
|
48
|
+
depth: (s ?? 0) + 1,
|
|
49
|
+
parentNames: m,
|
|
50
|
+
style: a,
|
|
51
|
+
explode: d,
|
|
52
|
+
inputKeyPrefix: e
|
|
53
|
+
},
|
|
54
|
+
o
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
} else {
|
|
58
|
+
const i = b(e, t, void 0, o), y = {
|
|
59
|
+
oneOf: (n = w().oneOf) == null ? void 0 : n.map((S) => ({
|
|
60
|
+
...S,
|
|
61
|
+
uniqueKey: i
|
|
62
|
+
}))
|
|
63
|
+
};
|
|
64
|
+
u(y) && c.push(
|
|
65
|
+
/* @__PURE__ */ r(
|
|
66
|
+
f,
|
|
67
|
+
{
|
|
68
|
+
name: o,
|
|
69
|
+
schema: y,
|
|
70
|
+
depth: (s ?? 0) + 1,
|
|
71
|
+
parentNames: m,
|
|
72
|
+
style: a,
|
|
73
|
+
explode: d,
|
|
74
|
+
inputKeyPrefix: e
|
|
75
|
+
},
|
|
76
|
+
o
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const P = [...O, ...c];
|
|
82
|
+
if (s === 0)
|
|
83
|
+
return /* @__PURE__ */ r(K, { children: P });
|
|
84
|
+
const A = (o) => {
|
|
85
|
+
const n = [...p, o];
|
|
86
|
+
v(n);
|
|
87
|
+
}, I = [...Object.keys(t.properties ?? {}), ...p];
|
|
88
|
+
return /* @__PURE__ */ T(K, { children: [
|
|
89
|
+
P,
|
|
90
|
+
h ? /* @__PURE__ */ r(
|
|
91
|
+
B,
|
|
92
|
+
{
|
|
93
|
+
existingKeys: I,
|
|
94
|
+
onAddKey: A,
|
|
95
|
+
dataTestId: ("name" in t && t.name ? t.name : "") + "-additional-property-button"
|
|
96
|
+
},
|
|
97
|
+
"add-property-button" + j
|
|
98
|
+
) : null
|
|
99
|
+
] });
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
G as ObjectInput
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=ObjectInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/ObjectInput.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n convertAnySchemaToOneOfs,\n getUniqueInputKey,\n isSchemaObject,\n} from '@/api-playground-2/schemaGraph/utils';\nimport { AdditionalPropertyButton } from '@/api-playground/ApiPlayground/components/AdditionalPropertyButton';\n\nimport { DifferentiatedInput, InputParams } from './DifferentiatedInput';\n\nexport const ObjectInput = ({\n schema,\n depth,\n parentNames,\n style,\n explode,\n inputKeyPrefix,\n name,\n}: InputParams) => {\n const propertiesInputs: React.ReactNode[] = [];\n\n Object.entries(schema.properties ?? {}).forEach(([propName, propSchema]) => {\n if (isSchemaObject(propSchema)) {\n const newParentNames = name ? [name] : undefined;\n\n propertiesInputs.push(\n <DifferentiatedInput\n key={propName}\n name={propName}\n schema={propSchema}\n depth={(depth ?? 0) + 1}\n parentNames={newParentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n );\n }\n });\n\n const allowsAdditionalProperties =\n schema.additionalProperties !== undefined && schema.additionalProperties !== false;\n const additionalPropButtonKey = uuidv4();\n const [additionalPropKeys, setAdditionalPropKeys] = useState<string[]>([]);\n const additionalPropertiesInputs: React.ReactNode[] = [];\n\n additionalPropKeys.forEach((key) => {\n if (isSchemaObject(schema.additionalProperties)) {\n const uniqueKey = getUniqueInputKey(inputKeyPrefix, schema, undefined, key);\n additionalPropertiesInputs.push(\n <DifferentiatedInput\n key={key}\n name={key}\n schema={{ ...schema.additionalProperties, uniqueKey }}\n depth={(depth ?? 0) + 1}\n parentNames={parentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n );\n } else {\n const uniqueKey = getUniqueInputKey(inputKeyPrefix, schema, undefined, key);\n const anySchemaToOneOfSchema = convertAnySchemaToOneOfs();\n const oneOfWithKeys = {\n oneOf: anySchemaToOneOfSchema.oneOf?.map((schema) => {\n return {\n ...schema,\n uniqueKey,\n };\n }),\n };\n\n if (isSchemaObject(oneOfWithKeys)) {\n additionalPropertiesInputs.push(\n <DifferentiatedInput\n key={key}\n name={key}\n schema={oneOfWithKeys}\n depth={(depth ?? 0) + 1}\n parentNames={parentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n );\n }\n }\n });\n\n const children = [...propertiesInputs, ...additionalPropertiesInputs];\n\n if (depth === 0) {\n return <>{children}</>;\n }\n\n const addKey = (key: string) => {\n const newAdditionalPropKeys = [...additionalPropKeys, key];\n setAdditionalPropKeys(newAdditionalPropKeys);\n };\n\n const existingKeys = [...Object.keys(schema.properties ?? {}), ...additionalPropKeys];\n\n return (\n <>\n {children}\n {allowsAdditionalProperties ? (\n <AdditionalPropertyButton\n key={'add-property-button' + additionalPropButtonKey}\n existingKeys={existingKeys}\n onAddKey={addKey}\n dataTestId={\n ('name' in schema && schema.name ? schema.name : '') + '-additional-property-button'\n }\n />\n ) : null}\n </>\n );\n};\n"],"names":["ObjectInput","schema","depth","parentNames","style","explode","inputKeyPrefix","name","propertiesInputs","propName","propSchema","isSchemaObject","newParentNames","jsx","DifferentiatedInput","allowsAdditionalProperties","additionalPropButtonKey","uuidv4","additionalPropKeys","setAdditionalPropKeys","useState","additionalPropertiesInputs","key","uniqueKey","getUniqueInputKey","oneOfWithKeys","_a","convertAnySchemaToOneOfs","children","addKey","newAdditionalPropKeys","existingKeys","jsxs","Fragment","AdditionalPropertyButton"],"mappings":";;;;;;AAYO,MAAMA,IAAc,CAAC;AAAA,EAC1B,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,MAAAC;AACF,MAAmB;AACjB,QAAMC,IAAsC,CAAA;AAE5C,SAAO,QAAQP,EAAO,cAAc,CAAA,CAAE,EAAE,QAAQ,CAAC,CAACQ,GAAUC,CAAU,MAAM;AAC1E,QAAIC,EAAeD,CAAU,GAAG;AAC9B,YAAME,IAAiBL,IAAO,CAACA,CAAI,IAAI;AAEvC,MAAAC,EAAiB;AAAA,QACf,gBAAAK;AAAA,UAACC;AAAA,UAAA;AAAA,YAEC,MAAML;AAAA,YACN,QAAQC;AAAA,YACR,QAAQR,KAAS,KAAK;AAAA,YACtB,aAAaU;AAAA,YACb,OAAAR;AAAA,YACA,SAAAC;AAAA,YACA,gBAAAC;AAAA,UAAA;AAAA,UAPKG;AAAA,QAAA;AAAA,MAQP;AAAA,IAEJ;AAAA,EACF,CAAC;AAED,QAAMM,IACJd,EAAO,yBAAyB,UAAaA,EAAO,yBAAyB,IACzEe,IAA0BC,EAAA,GAC1B,CAACC,GAAoBC,CAAqB,IAAIC,EAAmB,CAAA,CAAE,GACnEC,IAAgD,CAAA;AAEtD,EAAAH,EAAmB,QAAQ,CAACI,MAAQ;;AAClC,QAAIX,EAAeV,EAAO,oBAAoB,GAAG;AAC/C,YAAMsB,IAAYC,EAAkBlB,GAAgBL,GAAQ,QAAWqB,CAAG;AAC1E,MAAAD,EAA2B;AAAA,QACz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ACqB;AAAA,MAAA;AAAA,QAEC,cAAAH;AAAA,QACA,UAAUF;AAAA,QACV,aACG,UAAU5B,KAAUA,EAAO,OAAOA,EAAO,OAAO,MAAM;AAAA,MAAA;AAAA,MAJpD,wBAAwBe;AAAA,IAAA,IAO7B;AAAA,EAAA,GACN;AAEJ;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g } from "react";
|
|
3
|
+
import { generateSimpleSchemaLabel as T, generateSchemaOptionLabels as w } from "../../EndpointFields/fields/SimpleSchemaField.js";
|
|
4
|
+
import { usePlaygroundInputsStore as D } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
5
|
+
import { isSchemaObject as L } from "../../../schemaGraph/utils.js";
|
|
6
|
+
import { TypeDropdown as j } from "../../TypeDropdown.js";
|
|
7
|
+
import { DifferentiatedInput as b } from "./DifferentiatedInput.js";
|
|
8
|
+
import { Tabs as k } from "../../../../components/content-components/tabs/tabs.js";
|
|
9
|
+
import { Tab as q } from "../../../../components/content-components/tabs/tab.js";
|
|
10
|
+
const G = ({
|
|
11
|
+
name: m,
|
|
12
|
+
schema: r,
|
|
13
|
+
clearValue: l,
|
|
14
|
+
parentNames: c,
|
|
15
|
+
style: p,
|
|
16
|
+
explode: a,
|
|
17
|
+
inputKeyPrefix: s
|
|
18
|
+
}) => {
|
|
19
|
+
const [i, S] = g(0), n = "oneOf" in r && r.oneOf ? r.oneOf.filter(L) : [], y = n.some((e) => e.type === "null"), O = n.map((e) => ({
|
|
20
|
+
label: T(e, y),
|
|
21
|
+
schema: e
|
|
22
|
+
})), t = n[i], { setInput: f } = D(), d = `${s}.${r.uniqueKey}`, u = (e) => {
|
|
23
|
+
t && "type" in t && t.type === "null" ? f(d, null) : f(d, void 0), S(e);
|
|
24
|
+
};
|
|
25
|
+
if (!t) return null;
|
|
26
|
+
if (n.every((e) => e.type === "object")) {
|
|
27
|
+
const e = w(n);
|
|
28
|
+
return /* @__PURE__ */ o(
|
|
29
|
+
k,
|
|
30
|
+
{
|
|
31
|
+
defaultTab: i,
|
|
32
|
+
onChange: u,
|
|
33
|
+
className: "mint:border-gray-100! mint:mb-4! mint:dark:border-white/10!",
|
|
34
|
+
children: e.map((h) => /* @__PURE__ */ o(q, { title: h, children: /* @__PURE__ */ o(
|
|
35
|
+
b,
|
|
36
|
+
{
|
|
37
|
+
skipContainer: !0,
|
|
38
|
+
name: m,
|
|
39
|
+
schema: t,
|
|
40
|
+
clearValue: l,
|
|
41
|
+
parentNames: c,
|
|
42
|
+
style: p,
|
|
43
|
+
explode: a,
|
|
44
|
+
inputKeyPrefix: s
|
|
45
|
+
}
|
|
46
|
+
) }, h))
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const I = O.filter(
|
|
51
|
+
({ schema: e }) => e.type !== "null"
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ o(
|
|
54
|
+
b,
|
|
55
|
+
{
|
|
56
|
+
name: m,
|
|
57
|
+
schema: t,
|
|
58
|
+
typeDropdown: /* @__PURE__ */ o(
|
|
59
|
+
j,
|
|
60
|
+
{
|
|
61
|
+
options: I,
|
|
62
|
+
selectedIndex: i,
|
|
63
|
+
onSelectOption: u
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
clearValue: l,
|
|
67
|
+
parentNames: c,
|
|
68
|
+
style: p,
|
|
69
|
+
explode: a,
|
|
70
|
+
inputKeyPrefix: s
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
G as OneOfInput
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=OneOfInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OneOfInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/OneOfInput.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport {\n generateSchemaOptionLabels,\n generateSimpleSchemaLabel,\n} from '@/api-playground-2/components/EndpointFields/fields/SimpleSchemaField';\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { isSchemaObject } from '@/api-playground-2/schemaGraph/utils';\nimport { Tabs, Tab } from '../../../../components/content-components/tabs';\n\nimport { TypeDropdown } from '../../TypeDropdown';\nimport { DifferentiatedInput, InputParams } from './DifferentiatedInput';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const OneOfInput = ({\n name,\n schema,\n clearValue,\n parentNames,\n style,\n explode,\n inputKeyPrefix,\n}: InputParams & { value?: unknown }) => {\n const [selectedSchemaIndex, setSelectedSchemaIndex] = useState(0);\n const schemas = 'oneOf' in schema && schema.oneOf ? schema.oneOf.filter(isSchemaObject) : [];\n const nullable = schemas.some((schema) => schema.type === 'null');\n // TODO - Api Playground Refactor: equivalent of schemasWithLabelInfo from RecursiveInput\n const schemasWithLabels = schemas.map((schema) => ({\n label: generateSimpleSchemaLabel(schema, nullable),\n schema: schema,\n }));\n const selectedSchema = schemas[selectedSchemaIndex];\n\n const { setInput } = usePlaygroundInputsStore();\n const uniqueKey = `${inputKeyPrefix}.${schema.uniqueKey}`;\n\n const onSelectTypeOption = (index: number) => {\n if (selectedSchema && 'type' in selectedSchema && selectedSchema.type === 'null') {\n setInput(uniqueKey, null);\n } else {\n setInput(uniqueKey, undefined);\n }\n setSelectedSchemaIndex(index);\n };\n\n if (!selectedSchema) return null;\n\n if (schemas.every((schema) => schema.type === 'object')) {\n const oneOfOptions = generateSchemaOptionLabels(schemas);\n return (\n <Tabs\n defaultTab={selectedSchemaIndex}\n onChange={onSelectTypeOption}\n className=\"mint:border-gray-100! mint:mb-4! mint:dark:border-white/10!\"\n >\n {oneOfOptions.map((option) => (\n <Tab title={option} key={option}>\n <DifferentiatedInput\n skipContainer\n name={name}\n schema={selectedSchema}\n clearValue={clearValue}\n parentNames={parentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n </Tab>\n ))}\n </Tabs>\n );\n }\n\n const filteredSchemasWithLabels = schemasWithLabels.filter(\n ({ schema }) => schema.type !== 'null'\n );\n\n const typeDropdown = (\n <TypeDropdown\n options={filteredSchemasWithLabels}\n selectedIndex={selectedSchemaIndex}\n onSelectOption={onSelectTypeOption}\n />\n );\n\n return (\n <DifferentiatedInput\n name={name}\n schema={selectedSchema}\n typeDropdown={typeDropdown}\n clearValue={clearValue}\n parentNames={parentNames}\n style={style}\n explode={explode}\n inputKeyPrefix={inputKeyPrefix}\n />\n );\n};\n"],"names":["OneOfInput","name","schema","clearValue","parentNames","style","explode","inputKeyPrefix","selectedSchemaIndex","setSelectedSchemaIndex","useState","schemas","isSchemaObject","nullable","schemasWithLabels","generateSimpleSchemaLabel","selectedSchema","setInput","usePlaygroundInputsStore","uniqueKey","onSelectTypeOption","index","oneOfOptions","generateSchemaOptionLabels","jsx","Tabs","option","Tab","DifferentiatedInput","filteredSchemasWithLabels","TypeDropdown"],"mappings":";;;;;;;;;AAcO,MAAMA,IAAa,CAAC;AAAA,EACzB,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAAC;AACF,MAAyC;AACvC,QAAM,CAACC,GAAqBC,CAAsB,IAAIC,EAAS,CAAC,GAC1DC,IAAU,WAAWT,KAAUA,EAAO,QAAQA,EAAO,MAAM,OAAOU,CAAc,IAAI,CAAA,GACpFC,IAAWF,EAAQ,KAAK,CAACT,MAAWA,EAAO,SAAS,MAAM,GAE1DY,IAAoBH,EAAQ,IAAI,CAACT,OAAY;AAAA,IACjD,OAAOa,EAA0Bb,GAAQW,CAAQ;AAAA,IACjD,QAAQX;AAAAA,EAAA,EACR,GACIc,IAAiBL,EAAQH,CAAmB,GAE5C,EAAE,UAAAS,EAAA,IAAaC,EAAA,GACfC,IAAY,GAAGZ,CAAc,IAAIL,EAAO,SAAS,IAEjDkB,IAAqB,CAACC,MAA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
+
import { isBoolean as S, isString as b, isNumber as v, isInteger as y } from "../../../../common/guards.js";
|
|
3
|
+
import { ChevronDownIcon as I } from "lucide-react";
|
|
4
|
+
import { usePlaygroundInputsStore as w } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
5
|
+
import { getSchemaPlaceholder as N, getUniqueInputKey as k } from "../../../schemaGraph/utils.js";
|
|
6
|
+
import { useSelectedLocale as P } from "../../../../utils/locales/index.js";
|
|
7
|
+
import { cn as j } from "../../../../utils/cn.js";
|
|
8
|
+
const U = ({
|
|
9
|
+
name: a,
|
|
10
|
+
schema: n,
|
|
11
|
+
inputKeyPrefix: u,
|
|
12
|
+
enumType: m,
|
|
13
|
+
arrayIndex: p
|
|
14
|
+
}) => {
|
|
15
|
+
const g = P(), { getInput: d, setInput: s } = w(), l = N(n), f = n.type === "boolean" ? [!0, !1] : n.enum ?? [], r = k(u, n, p), h = d(r), i = ((t, e) => {
|
|
16
|
+
switch (t) {
|
|
17
|
+
case "integer":
|
|
18
|
+
return y(e) ? e : void 0;
|
|
19
|
+
case "number":
|
|
20
|
+
return v(e) ? e : void 0;
|
|
21
|
+
case "string":
|
|
22
|
+
return b(e) ? e : void 0;
|
|
23
|
+
case "boolean":
|
|
24
|
+
return S(e) ? e : void 0;
|
|
25
|
+
default:
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
})(m, h), x = (t) => {
|
|
29
|
+
m === "boolean" ? s(r, t.target.value === "true") : s(r, t.target.value);
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ c("div", { className: "mint:relative", children: [
|
|
32
|
+
/* @__PURE__ */ c(
|
|
33
|
+
"select",
|
|
34
|
+
{
|
|
35
|
+
className: j(
|
|
36
|
+
"mint:relative mint:text-playground-input mint:w-full mint:text-left mint:flex-1 mint:outline-0 mint:cursor-pointer mint:bg-transparent",
|
|
37
|
+
i !== void 0 ? "mint:text-gray-900! mint:dark:text-gray-100!" : "mint:text-gray-400! mint:dark:text-white/30!"
|
|
38
|
+
),
|
|
39
|
+
value: (i == null ? void 0 : i.toString()) ?? "",
|
|
40
|
+
"aria-label": l ?? g["aria.selectOption"].replace("{name}", a || "option"),
|
|
41
|
+
onChange: x,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ o("option", { value: "", disabled: !0, children: l ?? `select ${a || "option"}` }),
|
|
44
|
+
f.map((t) => /* @__PURE__ */ o("option", { value: t.toString(), children: t.toString() }, t.toString()))
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ o(I, { className: "mint:absolute mint:right-2 mint:top-1/2 mint:-translate-y-1/2 mint:h-4 mint:w-4 mint:text-gray-400 mint:dark:text-white/30 mint:pointer-events-none" })
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
U as SelectInput
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=SelectInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/SelectInput.tsx"],"sourcesContent":["import { isString, isNumber, isInteger, isBoolean } from '../../../../common/guards';\nimport { ChevronDownIcon } from 'lucide-react';\nimport { ChangeEvent } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { getSchemaPlaceholder, getUniqueInputKey } from '@/api-playground-2/schemaGraph/utils';\nimport { useSelectedLocale } from '@/utils/locales';\nimport { InputParams } from './DifferentiatedInput';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const SelectInput = ({\n name,\n schema,\n inputKeyPrefix,\n enumType,\n arrayIndex,\n}: InputParams & { enumType: string }) => {\n const locale = useSelectedLocale();\n const { getInput, setInput } = usePlaygroundInputsStore();\n const schemaPlaceholder = getSchemaPlaceholder(schema);\n const options = schema.type === 'boolean' ? [true, false] : schema.enum ?? [];\n\n const uniqueInputKey = getUniqueInputKey(inputKeyPrefix, schema, arrayIndex);\n const value = getInput(uniqueInputKey);\n\n const getSafeEnumValue = (enumType: string, value: unknown) => {\n switch (enumType) {\n case 'integer': {\n return isInteger(value) ? value : undefined;\n }\n case 'number': {\n return isNumber(value) ? value : undefined;\n }\n case 'string': {\n return isString(value) ? value : undefined;\n }\n case 'boolean': {\n return isBoolean(value) ? value : undefined;\n }\n default: {\n return undefined;\n }\n }\n };\n\n const safeValue = getSafeEnumValue(enumType, value);\n\n const onChange = (event: ChangeEvent<HTMLSelectElement>) => {\n if (enumType === 'boolean') {\n setInput(uniqueInputKey, event.target.value === 'true');\n } else {\n setInput(uniqueInputKey, event.target.value);\n }\n };\n\n return (\n <div className=\"mint:relative\">\n <select\n className={cn(\n 'mint:relative mint:text-playground-input mint:w-full mint:text-left mint:flex-1 mint:outline-0 mint:cursor-pointer mint:bg-transparent',\n safeValue !== undefined\n ? 'mint:text-gray-900! mint:dark:text-gray-100!'\n : 'mint:text-gray-400! mint:dark:text-white/30!'\n )}\n value={safeValue?.toString() ?? ''}\n aria-label={\n schemaPlaceholder ?? locale['aria.selectOption'].replace('{name}', name || 'option')\n }\n onChange={onChange}\n >\n <option value=\"\" disabled>\n {schemaPlaceholder ?? `select ${name || 'option'}`}\n </option>\n {options.map((opt) => (\n <option key={opt.toString()} value={opt.toString()}>\n {opt.toString()}\n </option>\n ))}\n </select>\n <ChevronDownIcon className=\"mint:absolute mint:right-2 mint:top-1/2 mint:-translate-y-1/2 mint:h-4 mint:w-4 mint:text-gray-400 mint:dark:text-white/30 mint:pointer-events-none\" />\n </div>\n );\n};\n"],"names":["SelectInput","name","schema","inputKeyPrefix","enumType","arrayIndex","locale","useSelectedLocale","getInput","setInput","usePlaygroundInputsStore","schemaPlaceholder","getSchemaPlaceholder","options","uniqueInputKey","getUniqueInputKey","value","safeValue","isInteger","isNumber","isString","isBoolean","onChange","event","jsxs","cn","jsx","opt","ChevronDownIcon"],"mappings":";;;;;;;AAUO,MAAMA,IAAc,CAAC;AAAA,EAC1B,MA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G,UAAQ,IACtB,UAAAf,KAAqB,UAAUV,KAAQ,QAAQ,GAAA,CAClD;AAAA,UACCY,EAAQ,IAAI,CAACc,MACZ,gBAAAD,EAAC,YAA4B,OAAOC,EAAI,SAAA,GACrC,YAAI,SAAA,EAAS,GADHA,EAAI,UAEjB,CACD;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEH,gBAAAD,EAACE,GAAA,EAAgB,WAAU,sJAAA,CAAsJ;AAAA,EAAA,GACnL;AAEJ;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs as y, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { isString as I } from "../../../../common/guards.js";
|
|
3
|
+
import { usePlaygroundInputsStore as b } from "../../../hooks/usePlaygroundInputsStore.js";
|
|
4
|
+
import { getSchemaPlaceholder as P, getUniqueInputKey as S } from "../../../schemaGraph/utils.js";
|
|
5
|
+
import { useSelectedLocale as j } from "../../../../utils/locales/index.js";
|
|
6
|
+
import { Ids as k } from "../../../types/index.js";
|
|
7
|
+
const A = ({ name: t, schema: i, inputKeyPrefix: p, arrayIndex: d }) => {
|
|
8
|
+
const g = j(), { getInput: f, setInput: l } = b(), s = P(i), { prefix: e, placeholder: a } = w(i.format), r = S(p, i, d), m = f(r), n = I(m) ? m : void 0, x = e && (n != null && n.startsWith(e)) ? n.substring(e.length) : n, h = (o) => {
|
|
9
|
+
const u = `${e ?? ""}${o}`;
|
|
10
|
+
u ? l(r, u) : l(r, void 0);
|
|
11
|
+
}, v = (o) => {
|
|
12
|
+
h(o.target.value);
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ y("div", { className: "mint:relative mint:flex mint:flex-1 mint:items-center", children: [
|
|
15
|
+
/* @__PURE__ */ c("div", { className: "mint:absolute mint:left-2.5 mint:top-0 mint:bottom-0 mint:flex mint:items-center mint:justify-center mint:text-sm mint:text-gray-800 mint:dark:text-gray-100", children: e }),
|
|
16
|
+
/* @__PURE__ */ c(
|
|
17
|
+
"input",
|
|
18
|
+
{
|
|
19
|
+
id: k.APIPlaygroundInput,
|
|
20
|
+
className: "mint:flex-1 mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input",
|
|
21
|
+
style: { paddingLeft: e ? e.length * 0.52 + "rem" : void 0 },
|
|
22
|
+
placeholder: s ?? a ?? `enter ${t ?? "value"}`,
|
|
23
|
+
"aria-label": s ?? a ?? g["aria.enterValue"].replace("{name}", t ?? "value"),
|
|
24
|
+
type: "text",
|
|
25
|
+
value: x ?? "",
|
|
26
|
+
onChange: v,
|
|
27
|
+
spellCheck: !1
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] });
|
|
31
|
+
}, w = (t) => {
|
|
32
|
+
switch (t == null ? void 0 : t.toLowerCase()) {
|
|
33
|
+
case "bearer":
|
|
34
|
+
return {
|
|
35
|
+
prefix: "Bearer ",
|
|
36
|
+
placeholder: "enter bearer token"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {};
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
A as StringInput
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=StringInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringInput.js","sources":["../../../../../src/api-playground-2/components/Request/inputs/StringInput.tsx"],"sourcesContent":["import { isString } from '../../../../common/guards';\nimport { ChangeEvent } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { getSchemaPlaceholder, getUniqueInputKey } from '@/api-playground-2/schemaGraph/utils';\nimport { useSelectedLocale } from '@/utils/locales';\n\nimport { InputParams } from './DifferentiatedInput';\nimport { Ids } from '@/api-playground-2/types';\nimport { cn } from \"../../../../utils/cn\";\n\nexport const StringInput = ({ name, schema, inputKeyPrefix, arrayIndex }: InputParams) => {\n const locale = useSelectedLocale();\n const { getInput, setInput } = usePlaygroundInputsStore();\n const schemaPlaceholder = getSchemaPlaceholder(schema);\n const { prefix, placeholder } = getInputAttributesForFormat(schema.format);\n const uniqueInputKey = getUniqueInputKey(inputKeyPrefix, schema, arrayIndex);\n const value = getInput(uniqueInputKey);\n\n const safeValue = isString(value) ? value : undefined;\n\n // remove modifications\n const unmodifiedValue =\n prefix && safeValue?.startsWith(prefix) ? safeValue.substring(prefix.length) : safeValue;\n\n const setModifiedValue = (newValue: string) => {\n // apply modifications\n const modifiedValue = `${prefix ?? ''}${newValue}`;\n\n if (!modifiedValue) setInput(uniqueInputKey, undefined);\n else setInput(uniqueInputKey, modifiedValue);\n };\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n setModifiedValue(event.target.value);\n };\n\n return (\n <div className=\"mint:relative mint:flex mint:flex-1 mint:items-center\">\n <div className=\"mint:absolute mint:left-2.5 mint:top-0 mint:bottom-0 mint:flex mint:items-center mint:justify-center mint:text-sm mint:text-gray-800 mint:dark:text-gray-100\">\n {prefix}\n </div>\n <input\n id={Ids.APIPlaygroundInput}\n className=\"mint:flex-1 mint:min-w-0 mint:bg-transparent mint:outline-0 mint:text-playground-input\"\n style={{ paddingLeft: prefix ? prefix.length * 0.52 + 'rem' : undefined }}\n placeholder={schemaPlaceholder ?? placeholder ?? `enter ${name ?? 'value'}`}\n aria-label={\n schemaPlaceholder ??\n placeholder ??\n locale['aria.enterValue'].replace('{name}', name ?? 'value')\n }\n type=\"text\"\n value={unmodifiedValue ?? ''}\n onChange={onChange}\n spellCheck={false}\n />\n </div>\n );\n};\n\ntype InputAttributes = {\n prefix?: string;\n placeholder?: string;\n};\n\nconst getInputAttributesForFormat = (format: string | undefined): InputAttributes => {\n switch (format?.toLowerCase()) {\n case 'bearer':\n return {\n prefix: 'Bearer ',\n placeholder: 'enter bearer token',\n };\n }\n return {};\n};\n"],"names":["StringInput","name","schema","inputKeyPrefix","arrayIndex","locale","useSelectedLocale","getInput","setInput","usePlaygroundInputsStore","schemaPlaceholder","getSchemaPlaceholder","prefix","placeholder","getInputAttributesForFormat","uniqueInputKey","getUniqueInputKey","value","safeValue","isString","unmodifiedValue","setModifiedValue","newValue","modifiedValue","onChange","event","jsxs","jsx","Ids","format"],"mappings":";;;;;;AAWO,MAAMA,IAAc,CAAC,EAAE,MAAAC,GAAM,QAAAC,GAAQ,gBAAAC,GAAgB,YAAAC,QAA8B;AACxF,QAAMC,IAASC,EAAA,GACT,EAAE,UAAAC,GAAU,UAAAC,EAAA,IAAaC,EAAA,GACzBC,IAAoBC,EAAqBT,CAAM,GAC/C,EAAE,QAAAU,GAAQ,aAAAC,EAAA,IAAgBC,EAA4BZ,EAAO,MAAM,GACnEa,IAAiBC,EAAkBb,GAAgBD,GAAQE,CAAU,GACrEa,IAAQV,EAASQ,CAAc,GAE/BG,IAAYC,EAASF,CAAK,IAAIA,IAAQ,QAGtCG,IACJR,MAAUM,KAAA,QAAAA,EAAW,WAAWN,MAAUM,EAAU,UAAUN,EAAO,MAAM,IAAIM,GAE3EG,IAAmB,CAACC,MAAqB;AAE7C,UAAMC,IAAgB,GAAGX,KAAU,EAAE,GAAGU,CAAQ;AAEhD,IAAKC,IACAf,EAASO,GAAgBQ,CAAa,IADvBf,EAASO,GAAgB,MAAS;AAAA,EAExD,GAEMS,IAAW,CAACC,MAAyC;AACzD,IAAAJ,EAAiBI,EAAM,OAAO,KAAK;AAAA,EACrC;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAU,yDACb,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,gKACZ,UAAAf,GACH;AAAA,IACA,gBAAAe;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAIC,EAAI;AAAA,QACR,WAAU;AAAA,QACV,OAAO,EAAE,aAAahB,IAASA,EAAO,SAAS,OAAO,QAAQ,OAAA;AAAA,QAC9D,aAAaF,KAAqBG,KAAe,SAASZ,KAAQ,OAAO;AAAA,QACzE,cACES,KACAG,KACAR,EAAO,iBAAiB,EAAE,QAAQ,UAAUJ,KAAQ,OAAO;AAAA,Q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