docusaurus-theme-openapi-docs 0.0.0-388 → 0.0.0-392
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/theme/ApiDemoPanel/FloatingButton/index.js +4 -2
- package/lib/theme/ApiDemoPanel/FloatingButton/styles.module.css +3 -2
- package/lib/theme/ApiDemoPanel/LiveEditor/index.js +17 -4
- package/lib/theme/ApiDemoPanel/LiveEditor/styles.module.css +2 -1
- package/lib/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -4
- package/lib/theme/ApiDemoPanel/Server/index.js +1 -1
- package/lib/theme/ApiDemoPanel/Server/styles.module.css +0 -4
- package/lib/theme/ApiItem/styles.module.css +20 -4
- package/lib/theme/ApiTabs/index.js +11 -1
- package/lib/theme/ApiTabs/styles.module.css +0 -1
- package/lib/theme/SchemaTabs/index.js +257 -0
- package/lib/theme/SchemaTabs/styles.module.css +110 -0
- package/lib-next/theme/ApiDemoPanel/FloatingButton/index.js +6 -2
- package/lib-next/theme/ApiDemoPanel/FloatingButton/styles.module.css +3 -2
- package/lib-next/theme/ApiDemoPanel/LiveEditor/index.js +14 -3
- package/lib-next/theme/ApiDemoPanel/LiveEditor/styles.module.css +2 -1
- package/lib-next/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -4
- package/lib-next/theme/ApiDemoPanel/Server/index.js +1 -0
- package/lib-next/theme/ApiDemoPanel/Server/styles.module.css +0 -4
- package/lib-next/theme/ApiItem/styles.module.css +20 -4
- package/lib-next/theme/ApiTabs/index.js +11 -1
- package/lib-next/theme/ApiTabs/styles.module.css +0 -1
- package/lib-next/theme/SchemaTabs/index.js +257 -0
- package/lib-next/theme/SchemaTabs/styles.module.css +110 -0
- package/package.json +3 -3
- package/src/theme/ApiDemoPanel/FloatingButton/index.tsx +6 -2
- package/src/theme/ApiDemoPanel/FloatingButton/styles.module.css +3 -2
- package/src/theme/ApiDemoPanel/LiveEditor/index.tsx +15 -3
- package/src/theme/ApiDemoPanel/LiveEditor/styles.module.css +2 -1
- package/src/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -4
- package/src/theme/ApiDemoPanel/Server/index.tsx +1 -0
- package/src/theme/ApiDemoPanel/Server/styles.module.css +0 -4
- package/src/theme/ApiItem/styles.module.css +20 -4
- package/src/theme/ApiTabs/index.js +11 -1
- package/src/theme/ApiTabs/styles.module.css +0 -1
- package/src/theme/SchemaTabs/index.js +257 -0
- package/src/theme/SchemaTabs/styles.module.css +110 -0
|
@@ -22,8 +22,10 @@ function FloatingButton({
|
|
|
22
22
|
onClick,
|
|
23
23
|
children
|
|
24
24
|
}) {
|
|
25
|
-
return <div className={_stylesModule.default.floatingButton}>
|
|
26
|
-
{label && <button onClick={onClick}>
|
|
25
|
+
return <div tabIndex={0} className={_stylesModule.default.floatingButton}>
|
|
26
|
+
{label && <button tabIndex={0} onClick={onClick}>
|
|
27
|
+
{label}
|
|
28
|
+
</button>}
|
|
27
29
|
{children}
|
|
28
30
|
</div>;
|
|
29
31
|
}
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
border-radius: var(--ifm-global-radius);
|
|
10
10
|
color: var(--ifm-color-white);
|
|
11
11
|
cursor: pointer;
|
|
12
|
-
outline: none;
|
|
13
12
|
padding: 0.4rem 0.5rem;
|
|
14
13
|
opacity: 0;
|
|
15
14
|
visibility: hidden;
|
|
@@ -20,7 +19,9 @@
|
|
|
20
19
|
right: calc(var(--ifm-pre-padding) / 2);
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
.floatingButton:hover button
|
|
22
|
+
.floatingButton:hover button,
|
|
23
|
+
.floatingButton:focus-visible button,
|
|
24
|
+
.floatingButton button:focus-visible {
|
|
24
25
|
visibility: visible;
|
|
25
26
|
opacity: 1;
|
|
26
27
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _themeCommon = require("@docusaurus/theme-common");
|
|
11
11
|
|
|
@@ -19,6 +19,10 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.css"));
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
22
26
|
/* ============================================================================
|
|
23
27
|
* Copyright (c) Palo Alto Networks
|
|
24
28
|
*
|
|
@@ -29,9 +33,18 @@ function Live({
|
|
|
29
33
|
onEdit
|
|
30
34
|
}) {
|
|
31
35
|
const isBrowser = (0, _useIsBrowser.default)();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
const [editorDisabled, setEditorDisabled] = (0, _react.useState)(false); // TODO: Temporary solution for disabling tab key
|
|
37
|
+
|
|
38
|
+
const handleKeydown = event => {
|
|
39
|
+
if (event.key === "Tab") {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
setEditorDisabled(true);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return <div onClick={() => setEditorDisabled(false)}>
|
|
46
|
+
<_reactLive.LiveEditor key={String(isBrowser)} className={_stylesModule.default.playgroundEditor} onChange={onEdit} disabled={editorDisabled} onKeyDown={handleKeydown} />
|
|
47
|
+
</div>;
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
const LiveComponent = (0, _reactLive.withLive)(Live);
|
|
@@ -73,7 +73,7 @@ function Server() {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return <div className={_stylesModule.default.optionsPanel}>
|
|
76
|
-
<button className={_stylesModule.default.showMoreButton} onClick={() => setIsEditing(false)}>
|
|
76
|
+
<button className={_stylesModule.default.showMoreButton} onClick={() => setIsEditing(false)} tabIndex={0}>
|
|
77
77
|
Hide
|
|
78
78
|
</button>
|
|
79
79
|
<_FormItem.default label="Endpoint">
|
|
@@ -70,10 +70,6 @@
|
|
|
70
70
|
padding-top: 5px;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
:global(.theme-api-markdown details li:last-child) {
|
|
74
|
-
border-left: none;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
73
|
:global(.theme-api-markdown details p) {
|
|
78
74
|
margin-bottom: 0;
|
|
79
75
|
}
|
|
@@ -147,6 +143,11 @@
|
|
|
147
143
|
border-bottom-color: var(--ifm-color-success);
|
|
148
144
|
}
|
|
149
145
|
|
|
146
|
+
:global(.language-python) {
|
|
147
|
+
max-height: 500px;
|
|
148
|
+
overflow: auto;
|
|
149
|
+
}
|
|
150
|
+
|
|
150
151
|
:global(.code__tab--go::after) {
|
|
151
152
|
content: "";
|
|
152
153
|
width: 32px;
|
|
@@ -165,6 +166,11 @@
|
|
|
165
166
|
border-bottom-color: var(--ifm-color-info);
|
|
166
167
|
}
|
|
167
168
|
|
|
169
|
+
:global(.language-go) {
|
|
170
|
+
max-height: 500px;
|
|
171
|
+
overflow: auto;
|
|
172
|
+
}
|
|
173
|
+
|
|
168
174
|
:global(.code__tab--javascript::after) {
|
|
169
175
|
content: "";
|
|
170
176
|
width: 32px;
|
|
@@ -183,6 +189,11 @@
|
|
|
183
189
|
border-bottom-color: var(--ifm-color-warning);
|
|
184
190
|
}
|
|
185
191
|
|
|
192
|
+
:global(.language-javascript) {
|
|
193
|
+
max-height: 500px;
|
|
194
|
+
overflow: auto;
|
|
195
|
+
}
|
|
196
|
+
|
|
186
197
|
:global(.code__tab--bash::after) {
|
|
187
198
|
content: "";
|
|
188
199
|
width: 32px;
|
|
@@ -200,3 +211,8 @@
|
|
|
200
211
|
:global(.code__tab--bash.tabs__item--active) {
|
|
201
212
|
border-bottom-color: var(--ifm-color-danger);
|
|
202
213
|
}
|
|
214
|
+
|
|
215
|
+
:global(.language-bash) {
|
|
216
|
+
max-height: 500px;
|
|
217
|
+
overflow: auto;
|
|
218
|
+
}
|
|
@@ -9,6 +9,7 @@ import React, {
|
|
|
9
9
|
Children,
|
|
10
10
|
cloneElement,
|
|
11
11
|
isValidElement,
|
|
12
|
+
useEffect,
|
|
12
13
|
useRef,
|
|
13
14
|
useState,
|
|
14
15
|
} from "react";
|
|
@@ -142,7 +143,16 @@ function ApiTabsComponent(props) {
|
|
|
142
143
|
};
|
|
143
144
|
|
|
144
145
|
const tabItemListContainerRef = useRef(null);
|
|
145
|
-
const showTabArrows =
|
|
146
|
+
const [showTabArrows, setShowTabArrows] = useState(false);
|
|
147
|
+
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
const tabOffsetWidth = tabItemListContainerRef.current.offsetWidth;
|
|
150
|
+
const tabScrollWidth = tabItemListContainerRef.current.scrollWidth;
|
|
151
|
+
|
|
152
|
+
if (tabOffsetWidth < tabScrollWidth) {
|
|
153
|
+
setShowTabArrows(true);
|
|
154
|
+
}
|
|
155
|
+
}, []);
|
|
146
156
|
|
|
147
157
|
const handleRightClick = () => {
|
|
148
158
|
tabItemListContainerRef.current.scrollLeft += 90;
|
|
@@ -0,0 +1,257 @@
|
|
|
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, {
|
|
9
|
+
Children,
|
|
10
|
+
cloneElement,
|
|
11
|
+
isValidElement,
|
|
12
|
+
useEffect,
|
|
13
|
+
useRef,
|
|
14
|
+
useState,
|
|
15
|
+
} from "react";
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
duplicates,
|
|
19
|
+
useScrollPositionBlocker,
|
|
20
|
+
useTabGroupChoice,
|
|
21
|
+
} from "@docusaurus/theme-common";
|
|
22
|
+
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
23
|
+
import clsx from "clsx";
|
|
24
|
+
|
|
25
|
+
import styles from "./styles.module.css"; // A very rough duck type, but good enough to guard against mistakes while
|
|
26
|
+
|
|
27
|
+
// allowing customization
|
|
28
|
+
|
|
29
|
+
function isTabItem(comp) {
|
|
30
|
+
return typeof comp.props.value !== "undefined";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function SchemaTabsComponent(props) {
|
|
34
|
+
const {
|
|
35
|
+
lazy,
|
|
36
|
+
block,
|
|
37
|
+
defaultValue: defaultValueProp,
|
|
38
|
+
values: valuesProp,
|
|
39
|
+
groupId,
|
|
40
|
+
className,
|
|
41
|
+
} = props;
|
|
42
|
+
const children = Children.map(props.children, (child) => {
|
|
43
|
+
if (isValidElement(child) && isTabItem(child)) {
|
|
44
|
+
return child;
|
|
45
|
+
} // child.type.name will give non-sensical values in prod because of
|
|
46
|
+
// minification, but we assume it won't throw in prod.
|
|
47
|
+
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Docusaurus error: Bad <Tabs> child <${
|
|
50
|
+
// @ts-expect-error: guarding against unexpected cases
|
|
51
|
+
typeof child.type === "string" ? child.type : child.type.name
|
|
52
|
+
}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
const values =
|
|
56
|
+
valuesProp ?? // We only pick keys that we recognize. MDX would inject some keys by default
|
|
57
|
+
children.map(({ props: { value, label, attributes } }) => ({
|
|
58
|
+
value,
|
|
59
|
+
label,
|
|
60
|
+
attributes,
|
|
61
|
+
}));
|
|
62
|
+
const dup = duplicates(values, (a, b) => a.value === b.value);
|
|
63
|
+
|
|
64
|
+
if (dup.length > 0) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
`Docusaurus error: Duplicate values "${dup
|
|
67
|
+
.map((a) => a.value)
|
|
68
|
+
.join(", ")}" found in <Tabs>. Every value needs to be unique.`
|
|
69
|
+
);
|
|
70
|
+
} // When defaultValueProp is null, don't show a default tab
|
|
71
|
+
|
|
72
|
+
const defaultValue =
|
|
73
|
+
defaultValueProp === null
|
|
74
|
+
? defaultValueProp
|
|
75
|
+
: defaultValueProp ??
|
|
76
|
+
children.find((child) => child.props.default)?.props.value ??
|
|
77
|
+
children[0]?.props.value;
|
|
78
|
+
|
|
79
|
+
if (defaultValue !== null && !values.some((a) => a.value === defaultValue)) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`Docusaurus error: The <Tabs> has a defaultValue "${defaultValue}" but none of its children has the corresponding value. Available values are: ${values
|
|
82
|
+
.map((a) => a.value)
|
|
83
|
+
.join(
|
|
84
|
+
", "
|
|
85
|
+
)}. If you intend to show no default tab, use defaultValue={null} instead.`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const { tabGroupChoices, setTabGroupChoices } = useTabGroupChoice();
|
|
90
|
+
const [selectedValue, setSelectedValue] = useState(defaultValue);
|
|
91
|
+
const tabRefs = [];
|
|
92
|
+
const { blockElementScrollPositionUntilNextRender } =
|
|
93
|
+
useScrollPositionBlocker();
|
|
94
|
+
|
|
95
|
+
if (groupId != null) {
|
|
96
|
+
const relevantTabGroupChoice = tabGroupChoices[groupId];
|
|
97
|
+
|
|
98
|
+
if (
|
|
99
|
+
relevantTabGroupChoice != null &&
|
|
100
|
+
relevantTabGroupChoice !== selectedValue &&
|
|
101
|
+
values.some((value) => value.value === relevantTabGroupChoice)
|
|
102
|
+
) {
|
|
103
|
+
setSelectedValue(relevantTabGroupChoice);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const handleTabChange = (event) => {
|
|
108
|
+
const newTab = event.currentTarget;
|
|
109
|
+
const newTabIndex = tabRefs.indexOf(newTab);
|
|
110
|
+
const newTabValue = values[newTabIndex].value;
|
|
111
|
+
|
|
112
|
+
if (newTabValue !== selectedValue) {
|
|
113
|
+
blockElementScrollPositionUntilNextRender(newTab);
|
|
114
|
+
setSelectedValue(newTabValue);
|
|
115
|
+
|
|
116
|
+
if (groupId != null) {
|
|
117
|
+
setTabGroupChoices(groupId, newTabValue);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const handleKeydown = (event) => {
|
|
123
|
+
let focusElement = null;
|
|
124
|
+
|
|
125
|
+
switch (event.key) {
|
|
126
|
+
case "ArrowRight": {
|
|
127
|
+
const nextTab = tabRefs.indexOf(event.currentTarget) + 1;
|
|
128
|
+
focusElement = tabRefs[nextTab] || tabRefs[0];
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
case "ArrowLeft": {
|
|
133
|
+
const prevTab = tabRefs.indexOf(event.currentTarget) - 1;
|
|
134
|
+
focusElement = tabRefs[prevTab] || tabRefs[tabRefs.length - 1];
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
default:
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
focusElement?.focus();
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const tabItemListContainerRef = useRef(null);
|
|
146
|
+
const [showTabArrows, setShowTabArrows] = useState(false);
|
|
147
|
+
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
const tabOffsetWidth = tabItemListContainerRef.current.offsetWidth;
|
|
150
|
+
const tabScrollWidth = tabItemListContainerRef.current.scrollWidth;
|
|
151
|
+
|
|
152
|
+
if (tabOffsetWidth < tabScrollWidth) {
|
|
153
|
+
setShowTabArrows(true);
|
|
154
|
+
}
|
|
155
|
+
}, []);
|
|
156
|
+
|
|
157
|
+
const handleRightClick = () => {
|
|
158
|
+
tabItemListContainerRef.current.scrollLeft += 90;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const handleLeftClick = () => {
|
|
162
|
+
tabItemListContainerRef.current.scrollLeft -= 90;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<div className="tabs__container">
|
|
167
|
+
<div className={styles.schemaTabsTopSection}>
|
|
168
|
+
<div className={styles.schemaTabsContainer}>
|
|
169
|
+
{showTabArrows && (
|
|
170
|
+
<button
|
|
171
|
+
className={clsx(styles.tabArrow, styles.tabArrowLeft)}
|
|
172
|
+
onClick={handleLeftClick}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
175
|
+
<ul
|
|
176
|
+
ref={tabItemListContainerRef}
|
|
177
|
+
role="tablist"
|
|
178
|
+
aria-orientation="horizontal"
|
|
179
|
+
className={clsx(
|
|
180
|
+
styles.schemaTabsListContainer,
|
|
181
|
+
"tabs",
|
|
182
|
+
{
|
|
183
|
+
"tabs--block": block,
|
|
184
|
+
},
|
|
185
|
+
className
|
|
186
|
+
)}
|
|
187
|
+
>
|
|
188
|
+
{values.map(({ value, label, attributes }) => {
|
|
189
|
+
return (
|
|
190
|
+
<li
|
|
191
|
+
role="tab"
|
|
192
|
+
tabIndex={selectedValue === value ? 0 : -1}
|
|
193
|
+
aria-selected={selectedValue === value}
|
|
194
|
+
key={value}
|
|
195
|
+
ref={(tabControl) => tabRefs.push(tabControl)}
|
|
196
|
+
onKeyDown={handleKeydown}
|
|
197
|
+
onFocus={handleTabChange}
|
|
198
|
+
onClick={handleTabChange}
|
|
199
|
+
{...attributes}
|
|
200
|
+
className={clsx(
|
|
201
|
+
"tabs__item",
|
|
202
|
+
styles.tabItem,
|
|
203
|
+
attributes?.className,
|
|
204
|
+
{
|
|
205
|
+
[styles.schemaTabActive]: selectedValue === value,
|
|
206
|
+
}
|
|
207
|
+
)}
|
|
208
|
+
>
|
|
209
|
+
<span className={styles.schemaTabLabel}>
|
|
210
|
+
{label ?? value}
|
|
211
|
+
</span>
|
|
212
|
+
</li>
|
|
213
|
+
);
|
|
214
|
+
})}
|
|
215
|
+
</ul>
|
|
216
|
+
{showTabArrows && (
|
|
217
|
+
<button
|
|
218
|
+
className={clsx(styles.tabArrow, styles.tabArrowRight)}
|
|
219
|
+
onClick={handleRightClick}
|
|
220
|
+
/>
|
|
221
|
+
)}
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
<hr />
|
|
225
|
+
{lazy ? (
|
|
226
|
+
cloneElement(
|
|
227
|
+
children.filter(
|
|
228
|
+
(tabItem) => tabItem.props.value === selectedValue
|
|
229
|
+
)[0],
|
|
230
|
+
{
|
|
231
|
+
className: clsx("margin-vert--md", styles.schemaTabsContainer),
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
) : (
|
|
235
|
+
<div className={clsx("margin-vert--md", styles.schemaTabsContainer)}>
|
|
236
|
+
{children.map((tabItem, i) =>
|
|
237
|
+
cloneElement(tabItem, {
|
|
238
|
+
key: i,
|
|
239
|
+
hidden: tabItem.props.value !== selectedValue,
|
|
240
|
+
})
|
|
241
|
+
)}
|
|
242
|
+
</div>
|
|
243
|
+
)}
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export default function SchemaTabs(props) {
|
|
249
|
+
const isBrowser = useIsBrowser();
|
|
250
|
+
return (
|
|
251
|
+
<SchemaTabsComponent // Remount tabs after hydration
|
|
252
|
+
// Temporary fix for https://github.com/facebook/docusaurus/issues/5653
|
|
253
|
+
key={String(isBrowser)}
|
|
254
|
+
{...props}
|
|
255
|
+
/>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
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
|
+
.tabItem {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
height: 1.8rem;
|
|
13
|
+
margin-top: 0 !important;
|
|
14
|
+
margin-right: 0.5rem;
|
|
15
|
+
border: 1px solid var(--openapi-code-dim-dark);
|
|
16
|
+
border-radius: var(--ifm-global-radius);
|
|
17
|
+
color: var(--openapi-code-dim-dark);
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.tabItem:hover {
|
|
22
|
+
color: var(--ifm-color-emphasis-500) !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tabItem:last-child {
|
|
26
|
+
margin-right: 0 !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Open API Schema Tabs */
|
|
30
|
+
.schemaTabsTopSection {
|
|
31
|
+
margin-top: 1rem;
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
align-items: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.schemaTabsTopSection + hr {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.schemaTabsContainer {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
max-width: 390px;
|
|
45
|
+
padding-left: 3px;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.schemaTabsListContainer {
|
|
50
|
+
padding: 0 0.25rem;
|
|
51
|
+
overflow-y: hidden;
|
|
52
|
+
overflow-x: scroll;
|
|
53
|
+
scroll-behavior: smooth;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.schemaTabsListContainer::-webkit-scrollbar {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.tabItem.schemaTabActive {
|
|
61
|
+
border: 1px solid var(--ifm-color-primary);
|
|
62
|
+
color: var(--ifm-color-primary);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.schemaTabLabel {
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.schemaTabsContainer {
|
|
70
|
+
max-width: 600px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Tab Arrows */
|
|
74
|
+
.tabArrow {
|
|
75
|
+
content: "";
|
|
76
|
+
height: 1.25rem;
|
|
77
|
+
width: 1.25rem;
|
|
78
|
+
padding: 0 0.75rem;
|
|
79
|
+
border: none;
|
|
80
|
+
min-width: 1.25rem;
|
|
81
|
+
background: var(--ifm-menu-link-sublist-icon) 50% / 2rem 2rem;
|
|
82
|
+
filter: var(--ifm-menu-link-sublist-icon-filter);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.tabArrow:hover {
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.tabArrowLeft {
|
|
90
|
+
transform: rotate(270deg);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.tabArrowRight {
|
|
94
|
+
transform: rotate(90deg);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@media screen and (max-width: 500px) {
|
|
98
|
+
.schemaTabsTopSection {
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
align-items: flex-start;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.schemaTabsContainer {
|
|
104
|
+
width: 100%;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.tabItem {
|
|
108
|
+
height: 100%;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -9,8 +9,12 @@ import styles from "./styles.module.css";
|
|
|
9
9
|
|
|
10
10
|
function FloatingButton({ label, onClick, children }) {
|
|
11
11
|
return (
|
|
12
|
-
<div className={styles.floatingButton}>
|
|
13
|
-
{label &&
|
|
12
|
+
<div tabIndex={0} className={styles.floatingButton}>
|
|
13
|
+
{label && (
|
|
14
|
+
<button tabIndex={0} onClick={onClick}>
|
|
15
|
+
{label}
|
|
16
|
+
</button>
|
|
17
|
+
)}
|
|
14
18
|
{children}
|
|
15
19
|
</div>
|
|
16
20
|
);
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
border-radius: var(--ifm-global-radius);
|
|
10
10
|
color: var(--ifm-color-white);
|
|
11
11
|
cursor: pointer;
|
|
12
|
-
outline: none;
|
|
13
12
|
padding: 0.4rem 0.5rem;
|
|
14
13
|
opacity: 0;
|
|
15
14
|
visibility: hidden;
|
|
@@ -20,7 +19,9 @@
|
|
|
20
19
|
right: calc(var(--ifm-pre-padding) / 2);
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
.floatingButton:hover button
|
|
22
|
+
.floatingButton:hover button,
|
|
23
|
+
.floatingButton:focus-visible button,
|
|
24
|
+
.floatingButton button:focus-visible {
|
|
24
25
|
visibility: visible;
|
|
25
26
|
opacity: 1;
|
|
26
27
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
* ========================================================================== */
|
|
7
|
-
import React from "react";
|
|
7
|
+
import React, { useState } from "react";
|
|
8
8
|
import { usePrismTheme } from "@docusaurus/theme-common";
|
|
9
9
|
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
10
10
|
import { LiveProvider, LiveEditor, withLive } from "react-live";
|
|
@@ -13,14 +13,25 @@ import styles from "./styles.module.css";
|
|
|
13
13
|
|
|
14
14
|
function Live({ onEdit }) {
|
|
15
15
|
const isBrowser = useIsBrowser();
|
|
16
|
+
const [editorDisabled, setEditorDisabled] = useState(false); // TODO: Temporary solution for disabling tab key
|
|
17
|
+
|
|
18
|
+
const handleKeydown = (event) => {
|
|
19
|
+
if (event.key === "Tab") {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
setEditorDisabled(true);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
16
25
|
return (
|
|
17
|
-
|
|
26
|
+
<div onClick={() => setEditorDisabled(false)}>
|
|
18
27
|
<LiveEditor
|
|
19
28
|
key={String(isBrowser)}
|
|
20
29
|
className={styles.playgroundEditor}
|
|
21
30
|
onChange={onEdit}
|
|
31
|
+
disabled={editorDisabled}
|
|
32
|
+
onKeyDown={handleKeydown}
|
|
22
33
|
/>
|
|
23
|
-
|
|
34
|
+
</div>
|
|
24
35
|
);
|
|
25
36
|
}
|
|
26
37
|
|