@gitbook/react-openapi 1.0.4 → 1.0.5
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 +7 -0
- package/dist/InteractiveSection.jsx +10 -9
- package/dist/OpenAPICodeSample.jsx +3 -3
- package/dist/OpenAPIDisclosure.jsx +1 -0
- package/dist/OpenAPIDisclosureGroup.d.ts +1 -1
- package/dist/OpenAPIDisclosureGroup.jsx +1 -0
- package/dist/OpenAPIResponseExample.jsx +8 -8
- package/dist/OpenAPIResponses.jsx +3 -3
- package/dist/OpenAPISchema.jsx +1 -1
- package/dist/OpenAPISpec.jsx +3 -4
- package/dist/OpenAPITabs.jsx +51 -47
- package/dist/StaticSection.d.ts +10 -0
- package/dist/StaticSection.jsx +23 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/useSyncedTabsGlobalState.d.ts +10 -1
- package/dist/useSyncedTabsGlobalState.js +19 -15
- package/package.json +1 -1
- package/src/InteractiveSection.tsx +10 -18
- package/src/OpenAPICodeSample.tsx +3 -3
- package/src/OpenAPIDisclosure.tsx +1 -0
- package/src/OpenAPIDisclosureGroup.tsx +11 -9
- package/src/OpenAPIResponseExample.tsx +8 -15
- package/src/OpenAPIResponses.tsx +3 -3
- package/src/OpenAPISchema.tsx +2 -2
- package/src/OpenAPISpec.tsx +3 -5
- package/src/OpenAPITabs.tsx +52 -63
- package/src/StaticSection.tsx +59 -0
- package/src/useSyncedTabsGlobalState.ts +33 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
import { mergeProps, useButton, useDisclosure, useFocusRing } from 'react-aria';
|
|
5
5
|
import { useDisclosureState } from 'react-stately';
|
|
6
|
+
import { Section, SectionBody, SectionHeader, SectionHeaderContent } from './StaticSection';
|
|
6
7
|
/**
|
|
7
8
|
* To optimize rendering, most of the components are server-components,
|
|
8
9
|
* and the interactiveness is mainly handled by a few key components like this one.
|
|
@@ -20,13 +21,13 @@ export function InteractiveSection(props) {
|
|
|
20
21
|
var _k = useDisclosure({}, state, panelRef), triggerProps = _k.buttonProps, panelProps = _k.panelProps;
|
|
21
22
|
var buttonProps = useButton(triggerProps, triggerRef).buttonProps;
|
|
22
23
|
var _l = useFocusRing(), isFocusVisible = _l.isFocusVisible, focusProps = _l.focusProps;
|
|
23
|
-
return (<
|
|
24
|
-
{header ? (<
|
|
24
|
+
return (<Section id={id} className={clsx('openapi-section', toggeable ? 'openapi-section-toggeable' : null, className, toggeable ? "".concat(className, "-").concat(state.isExpanded ? 'opened' : 'closed') : null)}>
|
|
25
|
+
{header ? (<SectionHeader onClick={function () {
|
|
25
26
|
if (toggeable) {
|
|
26
27
|
state.toggle();
|
|
27
28
|
}
|
|
28
|
-
}} className={
|
|
29
|
-
<
|
|
29
|
+
}} className={className}>
|
|
30
|
+
<SectionHeaderContent className={className}>
|
|
30
31
|
{(children || (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.body)) && toggeable ? (<button {...mergeProps(buttonProps, focusProps)} ref={triggerRef} className={clsx('openapi-section-toggle', "".concat(className, "-toggle"))} style={{
|
|
31
32
|
outline: isFocusVisible
|
|
32
33
|
? '2px solid rgb(var(--primary-color-500) / 0.4)'
|
|
@@ -35,7 +36,7 @@ export function InteractiveSection(props) {
|
|
|
35
36
|
{toggleIcon}
|
|
36
37
|
</button>) : null}
|
|
37
38
|
{header}
|
|
38
|
-
</
|
|
39
|
+
</SectionHeaderContent>
|
|
39
40
|
<div className={clsx('openapi-section-header-controls', "".concat(className, "-header-controls"))} onClick={function (event) {
|
|
40
41
|
event.stopPropagation();
|
|
41
42
|
}}>
|
|
@@ -48,13 +49,13 @@ export function InteractiveSection(props) {
|
|
|
48
49
|
</option>); })}
|
|
49
50
|
</select>) : null}
|
|
50
51
|
</div>
|
|
51
|
-
</
|
|
52
|
-
{(!toggeable || state.isExpanded) && (children || (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.body)) ? (<
|
|
52
|
+
</SectionHeader>) : null}
|
|
53
|
+
{(!toggeable || state.isExpanded) && (children || (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.body)) ? (<SectionBody ref={panelRef} {...panelProps} className={className}>
|
|
53
54
|
{children}
|
|
54
55
|
{selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.body}
|
|
55
|
-
</
|
|
56
|
+
</SectionBody>) : null}
|
|
56
57
|
{overlay ? (<div className={clsx('openapi-section-overlay', "".concat(className, "-overlay"))}>
|
|
57
58
|
{overlay}
|
|
58
59
|
</div>) : null}
|
|
59
|
-
</
|
|
60
|
+
</Section>);
|
|
60
61
|
}
|
|
@@ -9,8 +9,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { InteractiveSection } from './InteractiveSection';
|
|
13
12
|
import { OpenAPITabs, OpenAPITabsList, OpenAPITabsPanels } from './OpenAPITabs';
|
|
13
|
+
import { StaticSection } from './StaticSection';
|
|
14
14
|
import { codeSampleGenerators } from './code-samples';
|
|
15
15
|
import { generateMediaTypeExample, generateSchemaExample } from './generateSchemaExample';
|
|
16
16
|
import { stringifyOpenAPI } from './stringifyOpenAPI';
|
|
@@ -99,9 +99,9 @@ export function OpenAPICodeSample(props) {
|
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
101
|
return (<OpenAPITabs stateKey={createStateKey('codesample')} items={samples}>
|
|
102
|
-
<
|
|
102
|
+
<StaticSection header={<OpenAPITabsList />} className="openapi-codesample">
|
|
103
103
|
<OpenAPITabsPanels />
|
|
104
|
-
</
|
|
104
|
+
</StaticSection>
|
|
105
105
|
</OpenAPITabs>);
|
|
106
106
|
}
|
|
107
107
|
function getSecurityHeaders(securities) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DisclosureGroupProps } from 'react-stately';
|
|
1
2
|
interface Props {
|
|
2
3
|
groups: TDisclosureGroup[];
|
|
3
4
|
icon?: React.ReactNode;
|
|
@@ -11,7 +12,6 @@ type TDisclosureGroup = {
|
|
|
11
12
|
body?: React.ReactNode;
|
|
12
13
|
}[];
|
|
13
14
|
};
|
|
14
|
-
import { type DisclosureGroupProps } from 'react-stately';
|
|
15
15
|
/**
|
|
16
16
|
* Display an interactive OpenAPI disclosure group.
|
|
17
17
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InteractiveSection } from './InteractiveSection';
|
|
2
1
|
import { OpenAPITabs, OpenAPITabsList, OpenAPITabsPanels } from './OpenAPITabs';
|
|
2
|
+
import { StaticSection } from './StaticSection';
|
|
3
3
|
import { generateSchemaExample } from './generateSchemaExample';
|
|
4
4
|
import { json2xml } from './json2xml';
|
|
5
5
|
import { stringifyOpenAPI } from './stringifyOpenAPI';
|
|
@@ -66,9 +66,9 @@ export function OpenAPIResponseExample(props) {
|
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
68
|
return (<OpenAPITabs stateKey={createStateKey('response-example')} items={tabs}>
|
|
69
|
-
<
|
|
69
|
+
<StaticSection header={<OpenAPITabsList />} className="openapi-response-example">
|
|
70
70
|
<OpenAPITabsPanels />
|
|
71
|
-
</
|
|
71
|
+
</StaticSection>
|
|
72
72
|
</OpenAPITabs>);
|
|
73
73
|
}
|
|
74
74
|
function OpenAPIResponse(props) {
|
|
@@ -91,9 +91,9 @@ function OpenAPIResponse(props) {
|
|
|
91
91
|
};
|
|
92
92
|
});
|
|
93
93
|
return (<OpenAPITabs stateKey={createStateKey('response-media-types')} items={tabs}>
|
|
94
|
-
<
|
|
94
|
+
<StaticSection header={<OpenAPITabsList />} className="openapi-response-media-types">
|
|
95
95
|
<OpenAPITabsPanels />
|
|
96
|
-
</
|
|
96
|
+
</StaticSection>
|
|
97
97
|
</OpenAPITabs>);
|
|
98
98
|
}
|
|
99
99
|
function OpenAPIResponseMediaType(props) {
|
|
@@ -111,13 +111,13 @@ function OpenAPIResponseMediaType(props) {
|
|
|
111
111
|
return {
|
|
112
112
|
key: example.key,
|
|
113
113
|
label: example.example.summary || example.key,
|
|
114
|
-
body: (<OpenAPIExample example={
|
|
114
|
+
body: (<OpenAPIExample example={example.example} context={props.context} syntax={syntax}/>),
|
|
115
115
|
};
|
|
116
116
|
});
|
|
117
117
|
return (<OpenAPITabs stateKey={createStateKey('response-media-type-examples')} items={tabs}>
|
|
118
|
-
<
|
|
118
|
+
<StaticSection header={<OpenAPITabsList />} className="openapi-response-media-type-examples">
|
|
119
119
|
<OpenAPITabsPanels />
|
|
120
|
-
</
|
|
120
|
+
</StaticSection>
|
|
121
121
|
</OpenAPITabs>);
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { InteractiveSection } from './InteractiveSection';
|
|
2
1
|
import { Markdown } from './Markdown';
|
|
3
2
|
import { OpenAPIDisclosureGroup } from './OpenAPIDisclosureGroup';
|
|
4
3
|
import { OpenAPIResponse } from './OpenAPIResponse';
|
|
4
|
+
import { StaticSection } from './StaticSection';
|
|
5
5
|
/**
|
|
6
6
|
* Display an interactive response body.
|
|
7
7
|
*/
|
|
8
8
|
export function OpenAPIResponses(props) {
|
|
9
9
|
var responses = props.responses, context = props.context;
|
|
10
|
-
return (<
|
|
10
|
+
return (<StaticSection header="Responses" className="openapi-responses">
|
|
11
11
|
<OpenAPIDisclosureGroup allowsMultipleExpanded icon={context.icons.chevronRight} groups={Object.entries(responses).map(function (_a) {
|
|
12
12
|
var _b;
|
|
13
13
|
var statusCode = _a[0], response = _a[1];
|
|
@@ -31,5 +31,5 @@ export function OpenAPIResponses(props) {
|
|
|
31
31
|
}),
|
|
32
32
|
};
|
|
33
33
|
})}/>
|
|
34
|
-
</
|
|
34
|
+
</StaticSection>);
|
|
35
35
|
}
|
package/dist/OpenAPISchema.jsx
CHANGED
|
@@ -51,7 +51,7 @@ export function OpenAPISchemaProperties(props) {
|
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
return (<div id={id} className="openapi-schema-properties">
|
|
54
|
-
{properties.map(function (property) { return (<OpenAPISchemaProperty key={
|
|
54
|
+
{properties.map(function (property, index) { return (<OpenAPISchemaProperty key={index} circularRefs={circularRefs} {...property} context={context}/>); })}
|
|
55
55
|
</div>);
|
|
56
56
|
}
|
|
57
57
|
/**
|
package/dist/OpenAPISpec.jsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { InteractiveSection } from './InteractiveSection';
|
|
3
1
|
import { OpenAPIRequestBody } from './OpenAPIRequestBody';
|
|
4
2
|
import { OpenAPIResponses } from './OpenAPIResponses';
|
|
5
3
|
import { OpenAPISchemaProperties } from './OpenAPISchema';
|
|
6
4
|
import { OpenAPISecurities } from './OpenAPISecurities';
|
|
5
|
+
import { StaticSection } from './StaticSection';
|
|
7
6
|
import { parameterToProperty } from './utils';
|
|
8
7
|
/**
|
|
9
8
|
* Client component to render the spec for the request and response.
|
|
@@ -21,9 +20,9 @@ export function OpenAPISpec(props) {
|
|
|
21
20
|
{securities.length > 0 ? (<OpenAPISecurities securities={securities} context={context}/>) : null}
|
|
22
21
|
|
|
23
22
|
{parameterGroups.map(function (group) {
|
|
24
|
-
return (<
|
|
23
|
+
return (<StaticSection key={group.key} className="openapi-parameters" header={group.label}>
|
|
25
24
|
<OpenAPISchemaProperties properties={group.parameters.map(parameterToProperty)} context={context}/>
|
|
26
|
-
</
|
|
25
|
+
</StaticSection>);
|
|
27
26
|
})}
|
|
28
27
|
|
|
29
28
|
{operation.requestBody ? (<OpenAPIRequestBody requestBody={operation.requestBody} context={context}/>) : null}
|
package/dist/OpenAPITabs.jsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { Tab, TabList, TabPanel, Tabs } from 'react-aria-components';
|
|
4
|
-
import {
|
|
4
|
+
import { useEventCallback } from 'usehooks-ts';
|
|
5
5
|
import { Markdown } from './Markdown';
|
|
6
|
-
import {
|
|
6
|
+
import { getOrCreateTabStoreByKey } from './useSyncedTabsGlobalState';
|
|
7
7
|
var OpenAPITabsContext = createContext(null);
|
|
8
8
|
function useOpenAPITabsContext() {
|
|
9
9
|
var context = useContext(OpenAPITabsContext);
|
|
@@ -16,59 +16,62 @@ function useOpenAPITabsContext() {
|
|
|
16
16
|
* The OpenAPI Tabs wrapper component.
|
|
17
17
|
*/
|
|
18
18
|
export function OpenAPITabs(props) {
|
|
19
|
+
var _a, _b;
|
|
19
20
|
var children = props.children, items = props.items, stateKey = props.stateKey;
|
|
20
|
-
var _a = useIntersectionObserver({
|
|
21
|
-
threshold: 0.1,
|
|
22
|
-
rootMargin: '200px',
|
|
23
|
-
}), ref = _a[0], isIntersectionVisible = _a[1];
|
|
24
|
-
var isVisible = stateKey ? isIntersectionVisible : true;
|
|
25
|
-
var defaultTab = items[0];
|
|
26
|
-
var _b = useSyncedTabsGlobalState(), syncedTabs = _b[0], setSyncedTabs = _b[1];
|
|
27
21
|
var _c = useState(function () {
|
|
28
|
-
var _a, _b
|
|
29
|
-
if (
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}), selectedTabKey = _c[0], setSelectedTabKey = _c[1];
|
|
35
|
-
var _d = useState(defaultTab), selectedTab = _d[0], setSelectedTab = _d[1];
|
|
36
|
-
var handleSelectionChange = function (key) {
|
|
37
|
-
setSelectedTabKey(key);
|
|
38
|
-
if (stateKey) {
|
|
39
|
-
var tab_1 = items.find(function (item) { return item.key === key; });
|
|
40
|
-
if (!tab_1) {
|
|
41
|
-
return;
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if (stateKey && typeof window !== 'undefined') {
|
|
24
|
+
var store = getOrCreateTabStoreByKey(stateKey);
|
|
25
|
+
var tabKey_1 = store.getState().tabKey;
|
|
26
|
+
if (tabKey_1) {
|
|
27
|
+
return tabKey_1;
|
|
42
28
|
}
|
|
43
|
-
setSyncedTabs(function (state) {
|
|
44
|
-
var newState = new Map(state);
|
|
45
|
-
newState.set(stateKey, tab_1);
|
|
46
|
-
return newState;
|
|
47
|
-
});
|
|
48
29
|
}
|
|
49
|
-
|
|
30
|
+
return (_b = (_a = items[0]) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : null;
|
|
31
|
+
}), tabKey = _c[0], setTabKey = _c[1];
|
|
32
|
+
var selectTab = useEventCallback(function (key) {
|
|
33
|
+
if (!key || key === tabKey) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
var tab = items.find(function (item) { return item.key === key; });
|
|
37
|
+
if (!tab) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
setTabKey(key);
|
|
41
|
+
});
|
|
42
|
+
var selectedTab = (_b = (_a = items.find(function (item) { return item.key === tabKey; })) !== null && _a !== void 0 ? _a : items[0]) !== null && _b !== void 0 ? _b : null;
|
|
43
|
+
var cancelDeferRef = useRef(null);
|
|
50
44
|
useEffect(function () {
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
if (!items.some(function (item) { return item.key === (tabFromState_1 === null || tabFromState_1 === void 0 ? void 0 : tabFromState_1.key); })) {
|
|
54
|
-
return setSelectedTab(defaultTab);
|
|
55
|
-
}
|
|
56
|
-
if (tabFromState_1 && (tabFromState_1 === null || tabFromState_1 === void 0 ? void 0 : tabFromState_1.key) !== (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.key)) {
|
|
57
|
-
var tabFromItems = items.find(function (item) { return item.key === tabFromState_1.key; });
|
|
58
|
-
if (!tabFromItems) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
setSelectedTab(tabFromItems);
|
|
62
|
-
}
|
|
45
|
+
if (!stateKey) {
|
|
46
|
+
return undefined;
|
|
63
47
|
}
|
|
64
|
-
|
|
48
|
+
var store = getOrCreateTabStoreByKey(stateKey);
|
|
49
|
+
return store.subscribe(function (state) {
|
|
50
|
+
var _a;
|
|
51
|
+
(_a = cancelDeferRef.current) === null || _a === void 0 ? void 0 : _a.call(cancelDeferRef);
|
|
52
|
+
cancelDeferRef.current = defer(function () { return selectTab(state.tabKey); });
|
|
53
|
+
});
|
|
54
|
+
}, [stateKey, selectTab]);
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
return function () { var _a; return (_a = cancelDeferRef.current) === null || _a === void 0 ? void 0 : _a.call(cancelDeferRef); };
|
|
57
|
+
}, []);
|
|
65
58
|
var contextValue = useMemo(function () { return ({ items: items, selectedTab: selectedTab }); }, [items, selectedTab]);
|
|
66
59
|
return (<OpenAPITabsContext.Provider value={contextValue}>
|
|
67
|
-
<Tabs
|
|
60
|
+
<Tabs className="openapi-tabs" onSelectionChange={function (tabKey) {
|
|
61
|
+
selectTab(tabKey);
|
|
62
|
+
if (stateKey) {
|
|
63
|
+
var store = getOrCreateTabStoreByKey(stateKey);
|
|
64
|
+
store.setState({ tabKey: tabKey });
|
|
65
|
+
}
|
|
66
|
+
}} selectedKey={tabKey}>
|
|
68
67
|
{children}
|
|
69
68
|
</Tabs>
|
|
70
69
|
</OpenAPITabsContext.Provider>);
|
|
71
70
|
}
|
|
71
|
+
var defer = function (fn) {
|
|
72
|
+
var id = setTimeout(fn, 0);
|
|
73
|
+
return function () { return clearTimeout(id); };
|
|
74
|
+
};
|
|
72
75
|
/**
|
|
73
76
|
* The OpenAPI Tabs list component.
|
|
74
77
|
* This component should be used as a child of the OpenAPITabs component.
|
|
@@ -77,14 +80,14 @@ export function OpenAPITabs(props) {
|
|
|
77
80
|
export function OpenAPITabsList() {
|
|
78
81
|
var items = useOpenAPITabsContext().items;
|
|
79
82
|
return (<TabList className="openapi-tabs-list">
|
|
80
|
-
{items.map(function (tab) { return (<Tab style={function (_a) {
|
|
83
|
+
{items.map(function (tab) { return (<Tab key={tab.key} id={tab.key} style={function (_a) {
|
|
81
84
|
var isFocusVisible = _a.isFocusVisible;
|
|
82
85
|
return ({
|
|
83
86
|
outline: isFocusVisible
|
|
84
87
|
? '2px solid rgb(var(--primary-color-500)/0.4)'
|
|
85
88
|
: 'none',
|
|
86
89
|
});
|
|
87
|
-
}} className="openapi-tabs-tab"
|
|
90
|
+
}} className="openapi-tabs-tab">
|
|
88
91
|
{tab.label}
|
|
89
92
|
</Tab>); })}
|
|
90
93
|
</TabList>);
|
|
@@ -99,7 +102,8 @@ export function OpenAPITabsPanels() {
|
|
|
99
102
|
if (!selectedTab) {
|
|
100
103
|
return null;
|
|
101
104
|
}
|
|
102
|
-
|
|
105
|
+
var key = selectedTab.key.toString();
|
|
106
|
+
return (<TabPanel key={key} id={key} className="openapi-tabs-panel">
|
|
103
107
|
{selectedTab.body}
|
|
104
108
|
{selectedTab.description ? (<Markdown source={selectedTab.description} className="openapi-tabs-footer"/>) : null}
|
|
105
109
|
</TabPanel>);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export declare function Section(props: ComponentPropsWithoutRef<'div'>): import("react").JSX.Element;
|
|
3
|
+
export declare function SectionHeader(props: ComponentPropsWithoutRef<'div'>): import("react").JSX.Element;
|
|
4
|
+
export declare function SectionHeaderContent(props: ComponentPropsWithoutRef<'div'>): import("react").JSX.Element;
|
|
5
|
+
export declare const SectionBody: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare function StaticSection(props: {
|
|
7
|
+
className: string;
|
|
8
|
+
header: React.ReactNode;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
export function Section(props) {
|
|
4
|
+
return <div {...props} className={clsx('openapi-section', props.className)}/>;
|
|
5
|
+
}
|
|
6
|
+
export function SectionHeader(props) {
|
|
7
|
+
return (<div {...props} className={clsx('openapi-section-header', props.className && "".concat(props.className, "-header"))}/>);
|
|
8
|
+
}
|
|
9
|
+
export function SectionHeaderContent(props) {
|
|
10
|
+
return (<div {...props} className={clsx('openapi-section-header-content', props.className && "".concat(props.className, "-header-content"))}/>);
|
|
11
|
+
}
|
|
12
|
+
export var SectionBody = forwardRef(function SectionBody(props, ref) {
|
|
13
|
+
return (<div ref={ref} {...props} className={clsx('openapi-section-body', props.className && "".concat(props.className, "-body"))}/>);
|
|
14
|
+
});
|
|
15
|
+
export function StaticSection(props) {
|
|
16
|
+
var className = props.className, header = props.header, children = props.children;
|
|
17
|
+
return (<Section className={className}>
|
|
18
|
+
<SectionHeader className={className}>
|
|
19
|
+
<SectionHeaderContent className={className}>{header}</SectionHeaderContent>
|
|
20
|
+
</SectionHeader>
|
|
21
|
+
<SectionBody className={className}>{children}</SectionBody>
|
|
22
|
+
</Section>);
|
|
23
|
+
}
|