docusaurus-theme-openapi-docs 3.0.0-beta.1 → 3.0.0-beta.10
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/lib/markdown/utils.d.ts +3 -2
- package/lib/markdown/utils.js +1 -1
- package/lib/markdown/utils.test.d.ts +1 -0
- package/lib/markdown/utils.test.js +43 -0
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.d.ts +13 -0
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.js +199 -124
- package/lib/theme/ApiExplorer/Accept/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +25 -19
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +27 -16
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +115 -96
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +115 -54
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +41 -30
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +200 -120
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +36 -24
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +35 -28
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +72 -14
- package/lib/theme/ApiExplorer/Authorization/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Body/index.js +8 -1
- package/lib/theme/ApiExplorer/Body/slice.d.ts +3 -3
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +4 -14
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +86 -8
- package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +3 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +48 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +131 -76
- package/lib/theme/ApiExplorer/ContentType/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Export/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
- package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormSelect/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +4 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
- package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Request/_Request.scss +4 -2
- package/lib/theme/ApiExplorer/Request/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Request/makeRequest.js +50 -1
- package/lib/theme/ApiExplorer/Response/_Response.scss +4 -2
- package/lib/theme/ApiExplorer/Response/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Response/index.js +19 -19
- package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Server/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +1 -1
- package/lib/theme/ApiExplorer/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/index.js +1 -1
- package/lib/theme/ApiExplorer/storage-utils.d.ts +1 -1
- package/lib/theme/ApiItem/index.js +28 -3
- package/lib/theme/ApiItem/store.d.ts +6 -6
- package/lib/theme/ApiLogo/index.d.ts +2 -2
- package/lib/theme/ApiTabs/_ApiTabs.scss +3 -1
- package/lib/theme/ApiTabs/index.d.ts +7 -0
- package/lib/theme/ApiTabs/index.js +167 -103
- package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
- package/lib/theme/DiscriminatorTabs/index.js +152 -98
- package/lib/theme/Markdown/index.js +37 -0
- package/lib/theme/MimeTabs/index.d.ts +6 -0
- package/lib/theme/MimeTabs/index.js +169 -118
- package/lib/theme/OperationTabs/_OperationTabs.scss +71 -0
- package/lib/theme/OperationTabs/index.d.ts +3 -0
- package/lib/theme/OperationTabs/index.js +234 -0
- package/lib/theme/ParamsItem/index.d.ts +23 -0
- package/lib/theme/ParamsItem/index.js +170 -111
- package/lib/theme/ResponseSamples/index.d.ts +8 -0
- package/lib/theme/ResponseSamples/index.js +18 -13
- package/lib/theme/SchemaItem/index.d.ts +12 -0
- package/lib/theme/SchemaItem/index.js +121 -89
- package/lib/theme/SchemaTabs/_SchemaTabs.scss +0 -4
- package/lib/theme/SchemaTabs/index.d.ts +3 -0
- package/lib/theme/SchemaTabs/index.js +148 -95
- package/lib/theme/styles.scss +5 -0
- package/lib/types.d.ts +4 -4
- package/package.json +8 -7
- package/src/markdown/utils.test.ts +49 -0
- package/src/markdown/utils.ts +5 -3
- package/src/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +21 -8
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/{index.js → index.tsx} +6 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/{Element.js → Element.tsx} +5 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/{String.js → String.tsx} +4 -4
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/{index.js → index.tsx} +8 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/{index.js → index.tsx} +9 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +12 -2
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/{index.js → index.tsx} +2 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/{index.js → index.tsx} +11 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/{index.js → index.tsx} +10 -5
- package/src/theme/ApiExplorer/Body/index.tsx +3 -1
- package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +55 -0
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +94 -21
- package/src/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +53 -0
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
- package/src/theme/ApiExplorer/CodeTabs/{index.js → index.tsx} +64 -25
- package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +4 -4
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
- package/src/theme/ApiExplorer/Request/_Request.scss +4 -2
- package/src/theme/ApiExplorer/Request/makeRequest.ts +59 -4
- package/src/theme/ApiExplorer/Response/_Response.scss +4 -2
- package/src/theme/ApiExplorer/Response/index.tsx +2 -2
- package/src/theme/ApiExplorer/index.tsx +1 -1
- package/src/theme/ApiItem/index.tsx +22 -3
- package/src/theme/ApiLogo/index.tsx +1 -1
- package/src/theme/ApiTabs/_ApiTabs.scss +3 -1
- package/src/theme/ApiTabs/{index.js → index.tsx} +75 -31
- package/src/theme/DiscriminatorTabs/{index.js → index.tsx} +63 -28
- package/src/theme/Markdown/index.js +37 -0
- package/src/theme/MimeTabs/{index.js → index.tsx} +64 -30
- package/src/theme/OperationTabs/_OperationTabs.scss +71 -0
- package/src/theme/OperationTabs/index.tsx +218 -0
- package/src/theme/ParamsItem/{index.js → index.tsx} +48 -17
- package/src/theme/ResponseSamples/{index.js → index.tsx} +10 -1
- package/src/theme/SchemaItem/{index.js → index.tsx} +24 -18
- package/src/theme/SchemaTabs/_SchemaTabs.scss +0 -4
- package/src/theme/SchemaTabs/{index.js → index.tsx} +62 -29
- package/src/theme/styles.scss +5 -0
- package/src/theme-classic.d.ts +69 -2
- package/src/theme-openapi.d.ts +6 -0
- package/tsconfig.json +4 -1
|
@@ -1,24 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
var __createBinding =
|
|
9
|
+
(this && this.__createBinding) ||
|
|
10
|
+
(Object.create
|
|
11
|
+
? function (o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (
|
|
15
|
+
!desc ||
|
|
16
|
+
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
17
|
+
) {
|
|
18
|
+
desc = {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return m[k];
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
Object.defineProperty(o, k2, desc);
|
|
26
|
+
}
|
|
27
|
+
: function (o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
});
|
|
31
|
+
var __setModuleDefault =
|
|
32
|
+
(this && this.__setModuleDefault) ||
|
|
33
|
+
(Object.create
|
|
34
|
+
? function (o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}
|
|
37
|
+
: function (o, v) {
|
|
38
|
+
o["default"] = v;
|
|
39
|
+
});
|
|
40
|
+
var __importStar =
|
|
41
|
+
(this && this.__importStar) ||
|
|
42
|
+
function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null)
|
|
46
|
+
for (var k in mod)
|
|
47
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
48
|
+
__createBinding(result, mod, k);
|
|
49
|
+
__setModuleDefault(result, mod);
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
var __importDefault =
|
|
53
|
+
(this && this.__importDefault) ||
|
|
54
|
+
function (mod) {
|
|
55
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
56
|
+
};
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
const react_1 = __importStar(require("react"));
|
|
59
|
+
const internal_1 = require("@docusaurus/theme-common/internal");
|
|
60
|
+
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
61
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
62
|
+
const flatten_1 = __importDefault(require("lodash/flatten"));
|
|
18
63
|
function TabList({ className, block, selectedValue, selectValue, tabValues }) {
|
|
19
64
|
const tabRefs = [];
|
|
20
|
-
const { blockElementScrollPositionUntilNextRender } =
|
|
21
|
-
|
|
65
|
+
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
66
|
+
internal_1.useScrollPositionBlocker)();
|
|
22
67
|
const handleTabChange = (event) => {
|
|
23
68
|
const newTab = event.currentTarget;
|
|
24
69
|
const newTabIndex = tabRefs.indexOf(newTab);
|
|
@@ -50,136 +95,145 @@ function TabList({ className, block, selectedValue, selectValue, tabValues }) {
|
|
|
50
95
|
}
|
|
51
96
|
focusElement?.focus();
|
|
52
97
|
};
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
98
|
+
const tabItemListContainerRef = (0, react_1.useRef)(null);
|
|
99
|
+
const [showTabArrows, setShowTabArrows] = (0, react_1.useState)(false);
|
|
100
|
+
(0, react_1.useEffect)(() => {
|
|
58
101
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
59
102
|
for (let entry of entries) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
103
|
+
requestAnimationFrame(() => {
|
|
104
|
+
if (entry.target.clientWidth < entry.target.scrollWidth) {
|
|
105
|
+
setShowTabArrows(true);
|
|
106
|
+
} else {
|
|
107
|
+
setShowTabArrows(false);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
65
110
|
}
|
|
66
111
|
});
|
|
67
|
-
|
|
68
112
|
resizeObserver.observe(tabItemListContainerRef.current);
|
|
69
|
-
|
|
70
113
|
return () => {
|
|
71
114
|
resizeObserver.disconnect();
|
|
72
115
|
};
|
|
73
116
|
}, []);
|
|
74
|
-
|
|
75
117
|
const handleRightClick = () => {
|
|
76
118
|
tabItemListContainerRef.current.scrollLeft += 90;
|
|
77
119
|
};
|
|
78
|
-
|
|
79
120
|
const handleLeftClick = () => {
|
|
80
121
|
tabItemListContainerRef.current.scrollLeft -= 90;
|
|
81
122
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
123
|
+
return react_1.default.createElement(
|
|
124
|
+
"div",
|
|
125
|
+
{ className: "openapi-tabs__discriminator-top-section" },
|
|
126
|
+
react_1.default.createElement(
|
|
127
|
+
"div",
|
|
128
|
+
{ className: "openapi-tabs__discriminator-container" },
|
|
129
|
+
showTabArrows &&
|
|
130
|
+
react_1.default.createElement("button", {
|
|
131
|
+
className: "openapi-tabs__arrow left",
|
|
132
|
+
onClick: handleLeftClick,
|
|
133
|
+
}),
|
|
134
|
+
react_1.default.createElement(
|
|
135
|
+
"ul",
|
|
136
|
+
{
|
|
137
|
+
ref: tabItemListContainerRef,
|
|
138
|
+
role: "tablist",
|
|
139
|
+
"aria-orientation": "horizontal",
|
|
140
|
+
className: (0, clsx_1.default)(
|
|
97
141
|
"openapi-tabs__discriminator-list-container",
|
|
98
142
|
"tabs",
|
|
99
143
|
{
|
|
100
144
|
"tabs--block": block,
|
|
101
145
|
},
|
|
102
146
|
className
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
147
|
+
),
|
|
148
|
+
},
|
|
149
|
+
tabValues.map(({ value, label, attributes }) =>
|
|
150
|
+
react_1.default.createElement(
|
|
151
|
+
"li",
|
|
152
|
+
{
|
|
107
153
|
// TODO extract TabListItem
|
|
108
|
-
role
|
|
109
|
-
tabIndex
|
|
110
|
-
aria-selected
|
|
111
|
-
key
|
|
112
|
-
ref
|
|
113
|
-
onKeyDown
|
|
114
|
-
onClick
|
|
115
|
-
|
|
116
|
-
className
|
|
154
|
+
role: "tab",
|
|
155
|
+
tabIndex: selectedValue === value ? 0 : -1,
|
|
156
|
+
"aria-selected": selectedValue === value,
|
|
157
|
+
key: value,
|
|
158
|
+
ref: (tabControl) => tabRefs.push(tabControl),
|
|
159
|
+
onKeyDown: handleKeydown,
|
|
160
|
+
onClick: handleTabChange,
|
|
161
|
+
...attributes,
|
|
162
|
+
className: (0, clsx_1.default)(
|
|
117
163
|
"tabs__item",
|
|
118
164
|
"openapi-tabs__discriminator-item",
|
|
119
165
|
attributes?.className,
|
|
120
166
|
{
|
|
121
167
|
active: selectedValue === value,
|
|
122
168
|
}
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
169
|
+
),
|
|
170
|
+
},
|
|
171
|
+
react_1.default.createElement(
|
|
172
|
+
"span",
|
|
173
|
+
{ className: "openapi-tabs__discriminator-tab-label" },
|
|
174
|
+
label ?? value
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
)
|
|
178
|
+
),
|
|
179
|
+
showTabArrows &&
|
|
180
|
+
react_1.default.createElement("button", {
|
|
181
|
+
className: "openapi-tabs__arrow right",
|
|
182
|
+
onClick: handleRightClick,
|
|
183
|
+
})
|
|
184
|
+
)
|
|
139
185
|
);
|
|
140
186
|
}
|
|
141
187
|
function TabContent({ lazy, children, selectedValue }) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
188
|
+
const childTabs = (Array.isArray(children) ? children : [children]).filter(
|
|
189
|
+
Boolean
|
|
190
|
+
);
|
|
191
|
+
const flattenedChildTabs = (0, flatten_1.default)(childTabs);
|
|
145
192
|
if (lazy) {
|
|
146
|
-
const selectedTabItem =
|
|
193
|
+
const selectedTabItem = flattenedChildTabs.find(
|
|
147
194
|
(tabItem) => tabItem.props.value === selectedValue
|
|
148
195
|
);
|
|
149
196
|
if (!selectedTabItem) {
|
|
150
197
|
// fail-safe or fail-fast? not sure what's best here
|
|
151
198
|
return null;
|
|
152
199
|
}
|
|
153
|
-
return cloneElement(selectedTabItem, {
|
|
200
|
+
return (0, react_1.cloneElement)(selectedTabItem, {
|
|
201
|
+
className: "margin-top--md",
|
|
202
|
+
});
|
|
154
203
|
}
|
|
155
|
-
return (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
)
|
|
163
|
-
|
|
204
|
+
return react_1.default.createElement(
|
|
205
|
+
"div",
|
|
206
|
+
{ className: "margin-top--md" },
|
|
207
|
+
childTabs.map((tabItem, i) =>
|
|
208
|
+
(0, react_1.cloneElement)(tabItem, {
|
|
209
|
+
key: i,
|
|
210
|
+
hidden: tabItem.props.value !== selectedValue,
|
|
211
|
+
})
|
|
212
|
+
)
|
|
164
213
|
);
|
|
165
214
|
}
|
|
166
215
|
function TabsComponent(props) {
|
|
167
|
-
const tabs = useTabs(props);
|
|
168
|
-
return (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
216
|
+
const tabs = (0, internal_1.useTabs)(props);
|
|
217
|
+
return react_1.default.createElement(
|
|
218
|
+
"div",
|
|
219
|
+
{ className: "openapi-tabs__container" },
|
|
220
|
+
react_1.default.createElement(TabList, { ...props, ...tabs }),
|
|
221
|
+
react_1.default.createElement(TabContent, { ...props, ...tabs })
|
|
173
222
|
);
|
|
174
223
|
}
|
|
175
|
-
|
|
176
|
-
const isBrowser =
|
|
177
|
-
return (
|
|
178
|
-
|
|
224
|
+
function DiscriminatorTabs(props) {
|
|
225
|
+
const isBrowser = (0, useIsBrowser_1.default)();
|
|
226
|
+
return react_1.default.createElement(
|
|
227
|
+
TabsComponent,
|
|
228
|
+
// Remount tabs after hydration
|
|
229
|
+
// Temporary fix for https://github.com/facebook/docusaurus/issues/5653
|
|
230
|
+
{
|
|
179
231
|
// Remount tabs after hydration
|
|
180
232
|
// Temporary fix for https://github.com/facebook/docusaurus/issues/5653
|
|
181
|
-
key
|
|
182
|
-
|
|
183
|
-
|
|
233
|
+
key: String(isBrowser),
|
|
234
|
+
...props,
|
|
235
|
+
},
|
|
236
|
+
(0, internal_1.sanitizeTabsChildren)(props.children)
|
|
184
237
|
);
|
|
185
238
|
}
|
|
239
|
+
exports.default = DiscriminatorTabs;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import CodeBlock from "@theme/CodeBlock";
|
|
11
|
+
import ReactMarkdown from "react-markdown";
|
|
12
|
+
import rehypeRaw from "rehype-raw";
|
|
13
|
+
|
|
14
|
+
function Markdown({ children }) {
|
|
15
|
+
return (
|
|
16
|
+
<div>
|
|
17
|
+
<ReactMarkdown
|
|
18
|
+
children={children}
|
|
19
|
+
rehypePlugins={[rehypeRaw]}
|
|
20
|
+
components={{
|
|
21
|
+
pre: "div",
|
|
22
|
+
code({ node, inline, className, children, ...props }) {
|
|
23
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
24
|
+
if (inline) return <code>{children}</code>;
|
|
25
|
+
return !inline && match ? (
|
|
26
|
+
<CodeBlock className={className}>{children}</CodeBlock>
|
|
27
|
+
) : (
|
|
28
|
+
<CodeBlock>{children}</CodeBlock>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Markdown;
|