@gitbook/react-openapi 1.4.3 → 1.5.2
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/CHANGELOG.md +36 -0
- package/dist/InteractiveSection.js +59 -0
- package/dist/Markdown.js +10 -0
- package/dist/OpenAPICodeSample.js +219 -0
- package/dist/OpenAPICodeSampleInteractive.js +66 -0
- package/dist/OpenAPICodeSampleSelector.js +45 -0
- package/dist/OpenAPICopyButton.js +39 -0
- package/dist/OpenAPIDisclosure.js +30 -0
- package/dist/OpenAPIDisclosureGroup.js +75 -0
- package/dist/OpenAPIExample.js +41 -0
- package/dist/OpenAPIMediaType.js +58 -0
- package/dist/OpenAPIOperation.d.ts +12 -7
- package/dist/OpenAPIOperation.js +30 -0
- package/dist/OpenAPIOperationContext.d.ts +10 -6
- package/dist/OpenAPIOperationContext.js +30 -0
- package/dist/OpenAPIPath.js +51 -0
- package/dist/OpenAPIPrefillContextProvider.d.ts +11 -7
- package/dist/OpenAPIPrefillContextProvider.js +25 -0
- package/dist/OpenAPIRequestBody.js +28 -0
- package/dist/OpenAPIRequestBodyHeaderType.js +23 -0
- package/dist/OpenAPIResponse.js +39 -0
- package/dist/OpenAPIResponseExample.js +75 -0
- package/dist/OpenAPIResponseExampleContent.js +61 -0
- package/dist/OpenAPIResponses.js +61 -0
- package/dist/OpenAPISchema.js +373 -0
- package/dist/OpenAPISchemaName.js +45 -0
- package/dist/OpenAPISchemaServer.js +13 -0
- package/dist/OpenAPISecurities.js +124 -0
- package/dist/OpenAPISelect.js +45 -0
- package/dist/OpenAPISpec.js +73 -0
- package/dist/OpenAPIWebhook.d.ts +12 -7
- package/dist/OpenAPIWebhook.js +28 -0
- package/dist/OpenAPIWebhookExample.js +40 -0
- package/dist/ScalarApiButton.js +87 -0
- package/dist/StaticSection.js +37 -0
- package/dist/code-samples.js +267 -419
- package/dist/common/OpenAPIColumnSpec.js +23 -0
- package/dist/common/OpenAPIOperationDescription.js +18 -0
- package/dist/common/OpenAPIStability.js +17 -0
- package/dist/common/OpenAPISummary.js +27 -0
- package/dist/contentTypeChecks.js +24 -20
- package/dist/context.d.ts +68 -72
- package/dist/context.js +25 -39
- package/dist/decycle.js +39 -68
- package/dist/dereference.js +20 -64
- package/dist/generateSchemaExample.js +188 -332
- package/dist/getDisclosureLabel.js +15 -16
- package/dist/getOrCreateStoreByKey.js +20 -17
- package/dist/index.d.ts +12 -10
- package/dist/index.js +11 -8
- package/dist/json2xml.js +10 -5
- package/dist/resolveOpenAPIOperation.d.ts +11 -7
- package/dist/resolveOpenAPIOperation.js +88 -159
- package/dist/resolveOpenAPIWebhook.d.ts +11 -7
- package/dist/resolveOpenAPIWebhook.js +41 -116
- package/dist/schemas/OpenAPISchemaItem.js +26 -0
- package/dist/schemas/OpenAPISchemas.d.ts +16 -11
- package/dist/schemas/OpenAPISchemas.js +57 -0
- package/dist/schemas/resolveOpenAPISchemas.d.ts +9 -4
- package/dist/schemas/resolveOpenAPISchemas.js +15 -59
- package/dist/stringifyOpenAPI.js +12 -13
- package/dist/translate.js +43 -0
- package/dist/translations/de.js +47 -42
- package/dist/translations/en.d.ts +46 -42
- package/dist/translations/en.js +47 -42
- package/dist/translations/es.js +47 -42
- package/dist/translations/fr.js +47 -42
- package/dist/translations/index.d.ts +404 -391
- package/dist/translations/index.js +28 -24
- package/dist/translations/ja.js +47 -42
- package/dist/translations/nl.js +47 -42
- package/dist/translations/no.js +47 -42
- package/dist/translations/pt-br.js +47 -42
- package/dist/translations/types.d.ts +7 -5
- package/dist/translations/zh.js +47 -42
- package/dist/types.d.ts +30 -24
- package/dist/util/example.js +84 -0
- package/dist/util/server.js +32 -38
- package/dist/util/tryit-prefill.js +135 -121
- package/dist/utils.js +135 -196
- package/package.json +18 -11
- package/dist/InteractiveSection.d.ts +0 -33
- package/dist/InteractiveSection.jsx +0 -61
- package/dist/Markdown.d.ts +0 -4
- package/dist/Markdown.jsx +0 -5
- package/dist/OpenAPICodeSample.d.ts +0 -19
- package/dist/OpenAPICodeSample.jsx +0 -230
- package/dist/OpenAPICodeSampleInteractive.d.ts +0 -14
- package/dist/OpenAPICodeSampleInteractive.jsx +0 -73
- package/dist/OpenAPICodeSampleSelector.d.ts +0 -14
- package/dist/OpenAPICodeSampleSelector.jsx +0 -44
- package/dist/OpenAPICopyButton.d.ts +0 -13
- package/dist/OpenAPICopyButton.jsx +0 -35
- package/dist/OpenAPIDisclosure.d.ts +0 -11
- package/dist/OpenAPIDisclosure.jsx +0 -30
- package/dist/OpenAPIDisclosureGroup.d.ts +0 -23
- package/dist/OpenAPIDisclosureGroup.jsx +0 -83
- package/dist/OpenAPIExample.d.ts +0 -16
- package/dist/OpenAPIExample.jsx +0 -36
- package/dist/OpenAPIMediaType.d.ts +0 -21
- package/dist/OpenAPIMediaType.jsx +0 -61
- package/dist/OpenAPIOperation.jsx +0 -25
- package/dist/OpenAPIOperationContext.jsx +0 -26
- package/dist/OpenAPIOperationDescription.d.ts +0 -9
- package/dist/OpenAPIOperationDescription.jsx +0 -22
- package/dist/OpenAPIOperationStability.d.ts +0 -9
- package/dist/OpenAPIOperationStability.jsx +0 -27
- package/dist/OpenAPIPath.d.ts +0 -18
- package/dist/OpenAPIPath.jsx +0 -55
- package/dist/OpenAPIPrefillContextProvider.jsx +0 -19
- package/dist/OpenAPIRequestBody.d.ts +0 -11
- package/dist/OpenAPIRequestBody.jsx +0 -28
- package/dist/OpenAPIRequestBodyHeaderType.d.ts +0 -8
- package/dist/OpenAPIRequestBodyHeaderType.jsx +0 -25
- package/dist/OpenAPIResponse.d.ts +0 -10
- package/dist/OpenAPIResponse.jsx +0 -57
- package/dist/OpenAPIResponseExample.d.ts +0 -9
- package/dist/OpenAPIResponseExample.jsx +0 -105
- package/dist/OpenAPIResponseExampleContent.d.ts +0 -22
- package/dist/OpenAPIResponseExampleContent.jsx +0 -60
- package/dist/OpenAPIResponses.d.ts +0 -9
- package/dist/OpenAPIResponses.jsx +0 -77
- package/dist/OpenAPISchema.d.ts +0 -27
- package/dist/OpenAPISchema.jsx +0 -400
- package/dist/OpenAPISchemaName.d.ts +0 -16
- package/dist/OpenAPISchemaName.jsx +0 -43
- package/dist/OpenAPISchemaServer.d.ts +0 -12
- package/dist/OpenAPISchemaServer.jsx +0 -8
- package/dist/OpenAPISecurities.d.ts +0 -9
- package/dist/OpenAPISecurities.jsx +0 -114
- package/dist/OpenAPISelect.d.ts +0 -22
- package/dist/OpenAPISelect.jsx +0 -44
- package/dist/OpenAPISpec.d.ts +0 -6
- package/dist/OpenAPISpec.jsx +0 -80
- package/dist/OpenAPITabs.d.ts +0 -26
- package/dist/OpenAPITabs.jsx +0 -109
- package/dist/OpenAPIWebhook.jsx +0 -23
- package/dist/OpenAPIWebhookExample.d.ts +0 -6
- package/dist/OpenAPIWebhookExample.jsx +0 -41
- package/dist/ScalarApiButton.d.ts +0 -14
- package/dist/ScalarApiButton.jsx +0 -81
- package/dist/StaticSection.d.ts +0 -13
- package/dist/StaticSection.jsx +0 -32
- package/dist/code-samples.d.ts +0 -17
- package/dist/common/OpenAPIColumnSpec.d.ts +0 -6
- package/dist/common/OpenAPIColumnSpec.jsx +0 -20
- package/dist/common/OpenAPIOperationDescription.d.ts +0 -6
- package/dist/common/OpenAPIOperationDescription.jsx +0 -19
- package/dist/common/OpenAPIStability.d.ts +0 -4
- package/dist/common/OpenAPIStability.jsx +0 -15
- package/dist/common/OpenAPISummary.d.ts +0 -6
- package/dist/common/OpenAPISummary.jsx +0 -30
- package/dist/contentTypeChecks.d.ts +0 -10
- package/dist/decycle.d.ts +0 -2
- package/dist/dereference.d.ts +0 -5
- package/dist/generateSchemaExample.d.ts +0 -45
- package/dist/getDisclosureLabel.d.ts +0 -7
- package/dist/getOrCreateStoreByKey.d.ts +0 -10
- package/dist/json2xml.d.ts +0 -4
- package/dist/schemas/OpenAPISchemaItem.d.ts +0 -7
- package/dist/schemas/OpenAPISchemaItem.jsx +0 -16
- package/dist/schemas/OpenAPISchemas.jsx +0 -59
- package/dist/schemas/index.d.ts +0 -2
- package/dist/schemas/index.js +0 -2
- package/dist/stringifyOpenAPI.d.ts +0 -4
- package/dist/translate.d.ts +0 -10
- package/dist/translate.jsx +0 -75
- package/dist/translations/de.d.ts +0 -43
- package/dist/translations/es.d.ts +0 -43
- package/dist/translations/fr.d.ts +0 -43
- package/dist/translations/ja.d.ts +0 -43
- package/dist/translations/nl.d.ts +0 -43
- package/dist/translations/no.d.ts +0 -43
- package/dist/translations/pt-br.d.ts +0 -43
- package/dist/translations/types.js +0 -1
- package/dist/translations/zh.d.ts +0 -43
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types.js +0 -1
- package/dist/util/example.d.ts +0 -35
- package/dist/util/example.jsx +0 -103
- package/dist/util/server.d.ts +0 -9
- package/dist/util/tryit-prefill.d.ts +0 -20
- package/dist/utils.d.ts +0 -50
- package/src/InteractiveSection.tsx +0 -147
- package/src/Markdown.tsx +0 -12
- package/src/OpenAPICodeSample.tsx +0 -330
- package/src/OpenAPICodeSampleInteractive.tsx +0 -136
- package/src/OpenAPICodeSampleSelector.tsx +0 -94
- package/src/OpenAPICopyButton.tsx +0 -72
- package/src/OpenAPIDisclosure.tsx +0 -46
- package/src/OpenAPIDisclosureGroup.tsx +0 -158
- package/src/OpenAPIExample.tsx +0 -55
- package/src/OpenAPIMediaType.tsx +0 -139
- package/src/OpenAPIOperation.tsx +0 -35
- package/src/OpenAPIOperationContext.tsx +0 -45
- package/src/OpenAPIOperationDescription.tsx +0 -34
- package/src/OpenAPIOperationStability.tsx +0 -39
- package/src/OpenAPIPath.tsx +0 -90
- package/src/OpenAPIPrefillContextProvider.tsx +0 -40
- package/src/OpenAPIRequestBody.tsx +0 -54
- package/src/OpenAPIRequestBodyHeaderType.tsx +0 -36
- package/src/OpenAPIResponse.tsx +0 -82
- package/src/OpenAPIResponseExample.tsx +0 -151
- package/src/OpenAPIResponseExampleContent.tsx +0 -125
- package/src/OpenAPIResponses.tsx +0 -125
- package/src/OpenAPISchema.test.ts +0 -172
- package/src/OpenAPISchema.tsx +0 -654
- package/src/OpenAPISchemaName.tsx +0 -80
- package/src/OpenAPISchemaServer.tsx +0 -34
- package/src/OpenAPISecurities.tsx +0 -231
- package/src/OpenAPISelect.tsx +0 -96
- package/src/OpenAPISpec.tsx +0 -138
- package/src/OpenAPITabs.tsx +0 -147
- package/src/OpenAPIWebhook.tsx +0 -33
- package/src/OpenAPIWebhookExample.tsx +0 -60
- package/src/ScalarApiButton.tsx +0 -132
- package/src/StaticSection.tsx +0 -91
- package/src/__snapshots__/json2xml.test.ts.snap +0 -18
- package/src/code-samples.test.ts +0 -714
- package/src/code-samples.ts +0 -448
- package/src/common/OpenAPIColumnSpec.tsx +0 -31
- package/src/common/OpenAPIOperationDescription.tsx +0 -31
- package/src/common/OpenAPIStability.tsx +0 -23
- package/src/common/OpenAPISummary.tsx +0 -45
- package/src/contentTypeChecks.ts +0 -39
- package/src/context.ts +0 -99
- package/src/decycle.ts +0 -68
- package/src/dereference.ts +0 -29
- package/src/generateSchemaExample.test.ts +0 -1040
- package/src/generateSchemaExample.ts +0 -530
- package/src/getDisclosureLabel.ts +0 -25
- package/src/getOrCreateStoreByKey.ts +0 -33
- package/src/index.ts +0 -10
- package/src/json2xml.test.ts +0 -46
- package/src/json2xml.ts +0 -8
- package/src/resolveOpenAPIOperation.test.ts +0 -177
- package/src/resolveOpenAPIOperation.ts +0 -151
- package/src/resolveOpenAPIWebhook.ts +0 -99
- package/src/schemas/OpenAPISchemaItem.tsx +0 -34
- package/src/schemas/OpenAPISchemas.tsx +0 -98
- package/src/schemas/index.ts +0 -2
- package/src/schemas/resolveOpenAPISchemas.test.ts +0 -174
- package/src/schemas/resolveOpenAPISchemas.ts +0 -28
- package/src/stringifyOpenAPI.ts +0 -25
- package/src/translate.tsx +0 -80
- package/src/translations/de.ts +0 -43
- package/src/translations/en.ts +0 -43
- package/src/translations/es.ts +0 -43
- package/src/translations/fr.ts +0 -43
- package/src/translations/index.ts +0 -33
- package/src/translations/ja.ts +0 -43
- package/src/translations/nl.ts +0 -43
- package/src/translations/no.ts +0 -43
- package/src/translations/pt-br.ts +0 -43
- package/src/translations/types.ts +0 -7
- package/src/translations/zh.ts +0 -43
- package/src/types.ts +0 -46
- package/src/util/example.tsx +0 -129
- package/src/util/server.test.ts +0 -58
- package/src/util/server.ts +0 -47
- package/src/util/tryit-prefill.test.ts +0 -311
- package/src/util/tryit-prefill.ts +0 -160
- package/src/utils.ts +0 -255
package/dist/OpenAPIWebhook.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { OpenAPIContextInput } from "./context.js";
|
|
2
|
+
import { OpenAPIWebhookData } from "./types.js";
|
|
3
|
+
import * as react0 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/OpenAPIWebhook.d.ts
|
|
3
6
|
/**
|
|
4
7
|
* Display an interactive OpenAPI webhook.
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}):
|
|
9
|
+
declare function OpenAPIWebhook(props: {
|
|
10
|
+
className?: string;
|
|
11
|
+
data: OpenAPIWebhookData;
|
|
12
|
+
context: OpenAPIContextInput;
|
|
13
|
+
}): react0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { OpenAPIWebhook };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { resolveOpenAPIContext } from "./context.js";
|
|
2
|
+
import { OpenAPIColumnSpec } from "./common/OpenAPIColumnSpec.js";
|
|
3
|
+
import { OpenAPISummary } from "./common/OpenAPISummary.js";
|
|
4
|
+
import { OpenAPIWebhookExample } from "./OpenAPIWebhookExample.js";
|
|
5
|
+
import clsx from "classnames";
|
|
6
|
+
|
|
7
|
+
//#region src/OpenAPIWebhook.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Display an interactive OpenAPI webhook.
|
|
10
|
+
*/
|
|
11
|
+
function OpenAPIWebhook(props) {
|
|
12
|
+
const { className, data, context: contextInput } = props;
|
|
13
|
+
const context = resolveOpenAPIContext(contextInput);
|
|
14
|
+
return <div className={clsx("openapi-webhook", className)}>
|
|
15
|
+
<OpenAPISummary data={data} context={context} />
|
|
16
|
+
<div className="openapi-columns">
|
|
17
|
+
<OpenAPIColumnSpec data={data} context={context} />
|
|
18
|
+
<div className="openapi-column-preview">
|
|
19
|
+
<div className="openapi-column-preview-body">
|
|
20
|
+
<OpenAPIWebhookExample data={data} context={context} />
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { OpenAPIWebhook };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { OpenAPIEmptyExample } from "./OpenAPIExample.js";
|
|
2
|
+
import { createStateKey } from "./utils.js";
|
|
3
|
+
import { getOpenAPIClientContext } from "./context.js";
|
|
4
|
+
import { getExamples } from "./util/example.js";
|
|
5
|
+
import { OpenAPIMediaTypeContent } from "./OpenAPIMediaType.js";
|
|
6
|
+
|
|
7
|
+
//#region src/OpenAPIWebhookExample.tsx
|
|
8
|
+
function OpenAPIWebhookExample(props) {
|
|
9
|
+
const { data, context } = props;
|
|
10
|
+
const { operation } = data;
|
|
11
|
+
const items = (() => {
|
|
12
|
+
if (!operation.requestBody) return [];
|
|
13
|
+
return Object.entries(operation.requestBody.content).map(([key, value]) => {
|
|
14
|
+
if (!value?.schema) return {
|
|
15
|
+
key,
|
|
16
|
+
label: key,
|
|
17
|
+
body: <OpenAPIEmptyExample context={context} />
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
key,
|
|
21
|
+
label: key,
|
|
22
|
+
body: <></>,
|
|
23
|
+
examples: getExamples({
|
|
24
|
+
mediaTypeObject: value,
|
|
25
|
+
mediaType: key,
|
|
26
|
+
context
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
})();
|
|
31
|
+
return <div className="openapi-panel">
|
|
32
|
+
<h4 className="openapi-panel-heading">Payload</h4>
|
|
33
|
+
<div className="openapi-panel-body">
|
|
34
|
+
<OpenAPIMediaTypeContent selectIcon={context.icons.chevronDown} stateKey={createStateKey("request-body-media-type", context.blockKey)} items={items} context={getOpenAPIClientContext(context)} />
|
|
35
|
+
</div>
|
|
36
|
+
</div>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { OpenAPIWebhookExample };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { t } from "./translate.js";
|
|
5
|
+
import { useOpenAPIOperationContext } from "./OpenAPIOperationContext.js";
|
|
6
|
+
import { useOpenAPIPrefillContext } from "./OpenAPIPrefillContextProvider.js";
|
|
7
|
+
import { resolveTryItPrefillForOperation } from "./util/tryit-prefill.js";
|
|
8
|
+
import { Suspense, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { ApiClientModalProvider, useApiClientModal } from "@scalar/api-client-react";
|
|
10
|
+
import { createPortal } from "react-dom";
|
|
11
|
+
|
|
12
|
+
//#region src/ScalarApiButton.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Button which launches the Scalar API Client
|
|
15
|
+
*/
|
|
16
|
+
function ScalarApiButton(props) {
|
|
17
|
+
const { method, path, securities, servers, specUrl, context } = props;
|
|
18
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
+
const controllerRef = useRef(null);
|
|
20
|
+
return <div className="scalar scalar-activate">
|
|
21
|
+
<button className="scalar-activate-button button" onClick={() => {
|
|
22
|
+
controllerRef.current?.openClient?.();
|
|
23
|
+
setIsOpen(true);
|
|
24
|
+
}}>
|
|
25
|
+
{t(context.translation, "test_it")}
|
|
26
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 12" fill="currentColor">
|
|
27
|
+
<path stroke="currentColor" strokeWidth="1.5" d="M1 10.05V1.43c0-.2.2-.31.37-.22l7.26 4.08c.17.1.17.33.01.43l-7.26 4.54a.25.25 0 0 1-.38-.21Z" />
|
|
28
|
+
</svg>
|
|
29
|
+
</button>
|
|
30
|
+
|
|
31
|
+
{isOpen && createPortal(<Suspense fallback={null}>
|
|
32
|
+
<ScalarModal controllerRef={controllerRef} method={method} path={path} securities={securities} servers={servers} specUrl={specUrl} />
|
|
33
|
+
</Suspense>, document.body)}
|
|
34
|
+
</div>;
|
|
35
|
+
}
|
|
36
|
+
function ScalarModal(props) {
|
|
37
|
+
const { method, path, securities, servers, specUrl, controllerRef } = props;
|
|
38
|
+
const prefillInputContext = useOpenAPIPrefillContext()();
|
|
39
|
+
const prefillConfig = resolveTryItPrefillForOperation({
|
|
40
|
+
operation: {
|
|
41
|
+
securities,
|
|
42
|
+
servers
|
|
43
|
+
},
|
|
44
|
+
prefillInputContext
|
|
45
|
+
});
|
|
46
|
+
return <ApiClientModalProvider configuration={{
|
|
47
|
+
url: specUrl,
|
|
48
|
+
...prefillConfig
|
|
49
|
+
}} initialRequest={{
|
|
50
|
+
method,
|
|
51
|
+
path
|
|
52
|
+
}}>
|
|
53
|
+
<ScalarModalController method={method} path={path} controllerRef={controllerRef} />
|
|
54
|
+
</ApiClientModalProvider>;
|
|
55
|
+
}
|
|
56
|
+
function ScalarModalController(props) {
|
|
57
|
+
const { method, path, controllerRef } = props;
|
|
58
|
+
const openScalarClient = useApiClientModal()?.open;
|
|
59
|
+
const { onOpenClient: trackClientOpening } = useOpenAPIOperationContext();
|
|
60
|
+
const openClient = useMemo(() => {
|
|
61
|
+
if (openScalarClient) return () => {
|
|
62
|
+
openScalarClient({
|
|
63
|
+
method,
|
|
64
|
+
path,
|
|
65
|
+
_source: "gitbook"
|
|
66
|
+
});
|
|
67
|
+
trackClientOpening({
|
|
68
|
+
method,
|
|
69
|
+
path
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return null;
|
|
73
|
+
}, [
|
|
74
|
+
openScalarClient,
|
|
75
|
+
method,
|
|
76
|
+
path,
|
|
77
|
+
trackClientOpening
|
|
78
|
+
]);
|
|
79
|
+
useImperativeHandle(controllerRef, () => ({ openClient: openClient ? () => openClient() : void 0 }), [openClient]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
openClient?.();
|
|
82
|
+
}, [openClient]);
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
export { ScalarApiButton };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import clsx from "classnames";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/StaticSection.tsx
|
|
5
|
+
function Section(props) {
|
|
6
|
+
return <div {...props} className={clsx("openapi-section", props.className)} />;
|
|
7
|
+
}
|
|
8
|
+
function SectionHeader(props) {
|
|
9
|
+
return <div {...props} className={clsx("openapi-section-header", props.className ? `${props.className}-header` : void 0)} />;
|
|
10
|
+
}
|
|
11
|
+
function SectionHeaderContent(props) {
|
|
12
|
+
return <div {...props} className={clsx("openapi-section-header-content", props.className && `${props.className}-header-content`)} />;
|
|
13
|
+
}
|
|
14
|
+
const SectionBody = forwardRef(function SectionBody$1(props, ref) {
|
|
15
|
+
return <div ref={ref} {...props} className={clsx("openapi-section-body", props.className && `${props.className}-body`)} />;
|
|
16
|
+
});
|
|
17
|
+
function SectionFooter(props) {
|
|
18
|
+
return <div {...props} className={clsx("openapi-section-footer", props.className && `${props.className}-footer`)} />;
|
|
19
|
+
}
|
|
20
|
+
function SectionFooterContent(props) {
|
|
21
|
+
return <div {...props} className={clsx("openapi-section-footer-content", props.className && `${props.className}-footer-content`)} />;
|
|
22
|
+
}
|
|
23
|
+
function StaticSection(props) {
|
|
24
|
+
const { className, header, children, footer } = props;
|
|
25
|
+
return <Section className={className}>
|
|
26
|
+
{header ? <SectionHeader className={className}>
|
|
27
|
+
<SectionHeaderContent className={className}>{header}</SectionHeaderContent>
|
|
28
|
+
</SectionHeader> : null}
|
|
29
|
+
<SectionBody className={className}>{children}</SectionBody>
|
|
30
|
+
{footer ? <SectionFooter className={className}>
|
|
31
|
+
<SectionFooterContent className={className}>{footer}</SectionFooterContent>
|
|
32
|
+
</SectionFooter> : null}
|
|
33
|
+
</Section>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Section, SectionBody, SectionHeader, SectionHeaderContent, StaticSection };
|