docusaurus-theme-openapi-docs 1.0.0
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/LICENSE +21 -0
- package/babel.config.js +35 -0
- package/lib/index.js +48 -0
- package/lib/markdown/createDescription.js +20 -0
- package/lib/markdown/schema.js +121 -0
- package/lib/markdown/utils.js +45 -0
- package/lib/theme/ApiDemoPanel/Accept/index.js +41 -0
- package/lib/theme/ApiDemoPanel/Accept/slice.js +32 -0
- package/lib/theme/ApiDemoPanel/Authorization/auth-types.js +32 -0
- package/lib/theme/ApiDemoPanel/Authorization/index.js +174 -0
- package/lib/theme/ApiDemoPanel/Authorization/slice.js +137 -0
- package/lib/theme/ApiDemoPanel/Body/index.js +185 -0
- package/lib/theme/ApiDemoPanel/Body/slice.js +105 -0
- package/lib/theme/ApiDemoPanel/ContentType/index.js +41 -0
- package/lib/theme/ApiDemoPanel/ContentType/slice.js +32 -0
- package/lib/theme/ApiDemoPanel/Curl/index.js +236 -0
- package/lib/theme/ApiDemoPanel/Curl/styles.module.css +84 -0
- package/lib/theme/ApiDemoPanel/Execute/index.js +85 -0
- package/lib/theme/ApiDemoPanel/Execute/makeRequest.js +202 -0
- package/lib/theme/ApiDemoPanel/FloatingButton/index.js +32 -0
- package/lib/theme/ApiDemoPanel/FloatingButton/styles.module.css +26 -0
- package/lib/theme/ApiDemoPanel/FormFileUpload/index.js +97 -0
- package/lib/theme/ApiDemoPanel/FormFileUpload/styles.module.css +75 -0
- package/lib/theme/ApiDemoPanel/FormItem/index.js +35 -0
- package/lib/theme/ApiDemoPanel/FormItem/styles.module.css +7 -0
- package/lib/theme/ApiDemoPanel/FormMultiSelect/index.js +52 -0
- package/lib/theme/ApiDemoPanel/FormMultiSelect/styles.module.css +38 -0
- package/lib/theme/ApiDemoPanel/FormSelect/index.js +39 -0
- package/lib/theme/ApiDemoPanel/FormSelect/styles.module.css +51 -0
- package/lib/theme/ApiDemoPanel/FormTextInput/index.js +30 -0
- package/lib/theme/ApiDemoPanel/FormTextInput/styles.module.css +21 -0
- package/lib/theme/ApiDemoPanel/MethodEndpoint/index.js +60 -0
- package/lib/theme/ApiDemoPanel/ParamOptions/index.js +248 -0
- package/lib/theme/ApiDemoPanel/ParamOptions/slice.js +35 -0
- package/lib/theme/ApiDemoPanel/ParamOptions/styles.module.css +180 -0
- package/lib/theme/ApiDemoPanel/Response/index.js +75 -0
- package/lib/theme/ApiDemoPanel/Response/slice.js +37 -0
- package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +51 -0
- package/lib/theme/ApiDemoPanel/Server/index.js +109 -0
- package/lib/theme/ApiDemoPanel/Server/slice.js +41 -0
- package/lib/theme/ApiDemoPanel/Server/styles.module.css +61 -0
- package/lib/theme/ApiDemoPanel/VSCode/index.js +252 -0
- package/lib/theme/ApiDemoPanel/VSCode/styles.module.css +19 -0
- package/lib/theme/ApiDemoPanel/buildPostmanRequest.js +329 -0
- package/lib/theme/ApiDemoPanel/hooks.js +20 -0
- package/lib/theme/ApiDemoPanel/index.js +134 -0
- package/lib/theme/ApiDemoPanel/persistanceMiddleware.js +44 -0
- package/lib/theme/ApiDemoPanel/postman-collection.d.ts +10 -0
- package/lib/theme/ApiDemoPanel/storage-utils.js +47 -0
- package/lib/theme/ApiDemoPanel/store.js +48 -0
- package/lib/theme/ApiDemoPanel/styles.module.css +44 -0
- package/lib/theme/ApiItem/index.js +160 -0
- package/lib/theme/ApiItem/styles.module.css +109 -0
- package/lib/theme/ParamsItem/index.js +68 -0
- package/lib/theme/ParamsItem/styles.module.css +24 -0
- package/lib/theme/SchemaItem/index.js +58 -0
- package/lib/theme/SchemaItem/styles.module.css +24 -0
- package/lib/theme/Tabs/index.js +258 -0
- package/lib/theme/Tabs/styles.module.css +118 -0
- package/lib/theme-classic.d.ts +8 -0
- package/lib/theme-openapi.d.ts +48 -0
- package/lib/theme-translations.d.ts +9 -0
- package/lib/types.js +1 -0
- package/lib-next/index.js +38 -0
- package/lib-next/markdown/createDescription.js +13 -0
- package/lib-next/markdown/schema.js +115 -0
- package/lib-next/markdown/utils.js +31 -0
- package/lib-next/theme/ApiDemoPanel/Accept/index.js +33 -0
- package/lib-next/theme/ApiDemoPanel/Accept/slice.js +19 -0
- package/lib-next/theme/ApiDemoPanel/Authorization/auth-types.js +22 -0
- package/lib-next/theme/ApiDemoPanel/Authorization/index.js +203 -0
- package/lib-next/theme/ApiDemoPanel/Authorization/slice.js +101 -0
- package/lib-next/theme/ApiDemoPanel/Body/index.js +210 -0
- package/lib-next/theme/ApiDemoPanel/Body/slice.js +89 -0
- package/lib-next/theme/ApiDemoPanel/ContentType/index.js +33 -0
- package/lib-next/theme/ApiDemoPanel/ContentType/slice.js +19 -0
- package/lib-next/theme/ApiDemoPanel/Curl/index.js +264 -0
- package/lib-next/theme/ApiDemoPanel/Curl/styles.module.css +84 -0
- package/lib-next/theme/ApiDemoPanel/Execute/index.js +74 -0
- package/lib-next/theme/ApiDemoPanel/Execute/makeRequest.js +183 -0
- package/lib-next/theme/ApiDemoPanel/FloatingButton/index.js +19 -0
- package/lib-next/theme/ApiDemoPanel/FloatingButton/styles.module.css +26 -0
- package/lib-next/theme/ApiDemoPanel/FormFileUpload/index.js +113 -0
- package/lib-next/theme/ApiDemoPanel/FormFileUpload/styles.module.css +75 -0
- package/lib-next/theme/ApiDemoPanel/FormItem/index.js +29 -0
- package/lib-next/theme/ApiDemoPanel/FormItem/styles.module.css +7 -0
- package/lib-next/theme/ApiDemoPanel/FormMultiSelect/index.js +49 -0
- package/lib-next/theme/ApiDemoPanel/FormMultiSelect/styles.module.css +38 -0
- package/lib-next/theme/ApiDemoPanel/FormSelect/index.js +28 -0
- package/lib-next/theme/ApiDemoPanel/FormSelect/styles.module.css +51 -0
- package/lib-next/theme/ApiDemoPanel/FormTextInput/index.js +23 -0
- package/lib-next/theme/ApiDemoPanel/FormTextInput/styles.module.css +21 -0
- package/lib-next/theme/ApiDemoPanel/MethodEndpoint/index.js +53 -0
- package/lib-next/theme/ApiDemoPanel/ParamOptions/index.js +284 -0
- package/lib-next/theme/ApiDemoPanel/ParamOptions/slice.js +22 -0
- package/lib-next/theme/ApiDemoPanel/ParamOptions/styles.module.css +180 -0
- package/lib-next/theme/ApiDemoPanel/Response/index.js +65 -0
- package/lib-next/theme/ApiDemoPanel/Response/slice.js +22 -0
- package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +48 -0
- package/lib-next/theme/ApiDemoPanel/Server/index.js +114 -0
- package/lib-next/theme/ApiDemoPanel/Server/slice.js +25 -0
- package/lib-next/theme/ApiDemoPanel/Server/styles.module.css +61 -0
- package/lib-next/theme/ApiDemoPanel/VSCode/index.js +265 -0
- package/lib-next/theme/ApiDemoPanel/VSCode/styles.module.css +19 -0
- package/lib-next/theme/ApiDemoPanel/buildPostmanRequest.js +310 -0
- package/lib-next/theme/ApiDemoPanel/hooks.js +9 -0
- package/lib-next/theme/ApiDemoPanel/index.js +110 -0
- package/lib-next/theme/ApiDemoPanel/persistanceMiddleware.js +38 -0
- package/lib-next/theme/ApiDemoPanel/postman-collection.d.ts +10 -0
- package/lib-next/theme/ApiDemoPanel/storage-utils.js +35 -0
- package/lib-next/theme/ApiDemoPanel/store.js +30 -0
- package/lib-next/theme/ApiDemoPanel/styles.module.css +44 -0
- package/lib-next/theme/ApiItem/index.js +171 -0
- package/lib-next/theme/ApiItem/styles.module.css +109 -0
- package/lib-next/theme/ParamsItem/index.js +68 -0
- package/lib-next/theme/ParamsItem/styles.module.css +24 -0
- package/lib-next/theme/SchemaItem/index.js +58 -0
- package/lib-next/theme/SchemaItem/styles.module.css +24 -0
- package/lib-next/theme/Tabs/index.js +258 -0
- package/lib-next/theme/Tabs/styles.module.css +118 -0
- package/lib-next/theme-classic.d.ts +8 -0
- package/lib-next/theme-openapi.d.ts +48 -0
- package/lib-next/theme-translations.d.ts +9 -0
- package/lib-next/types.js +1 -0
- package/package.json +68 -0
- package/src/index.ts +42 -0
- package/src/markdown/createDescription.ts +13 -0
- package/src/markdown/schema.ts +115 -0
- package/src/markdown/utils.ts +39 -0
- package/src/theme/ApiDemoPanel/Accept/index.tsx +35 -0
- package/src/theme/ApiDemoPanel/Accept/slice.ts +29 -0
- package/src/theme/ApiDemoPanel/Authorization/auth-types.ts +26 -0
- package/src/theme/ApiDemoPanel/Authorization/index.tsx +211 -0
- package/src/theme/ApiDemoPanel/Authorization/slice.ts +145 -0
- package/src/theme/ApiDemoPanel/Body/index.tsx +218 -0
- package/src/theme/ApiDemoPanel/Body/slice.ts +133 -0
- package/src/theme/ApiDemoPanel/ContentType/index.tsx +35 -0
- package/src/theme/ApiDemoPanel/ContentType/slice.ts +29 -0
- package/src/theme/ApiDemoPanel/Curl/index.tsx +280 -0
- package/src/theme/ApiDemoPanel/Curl/styles.module.css +84 -0
- package/src/theme/ApiDemoPanel/Execute/index.tsx +88 -0
- package/src/theme/ApiDemoPanel/Execute/makeRequest.ts +184 -0
- package/src/theme/ApiDemoPanel/FloatingButton/index.tsx +27 -0
- package/src/theme/ApiDemoPanel/FloatingButton/styles.module.css +26 -0
- package/src/theme/ApiDemoPanel/FormFileUpload/index.tsx +116 -0
- package/src/theme/ApiDemoPanel/FormFileUpload/styles.module.css +75 -0
- package/src/theme/ApiDemoPanel/FormItem/index.tsx +28 -0
- package/src/theme/ApiDemoPanel/FormItem/styles.module.css +7 -0
- package/src/theme/ApiDemoPanel/FormMultiSelect/index.tsx +54 -0
- package/src/theme/ApiDemoPanel/FormMultiSelect/styles.module.css +38 -0
- package/src/theme/ApiDemoPanel/FormSelect/index.tsx +36 -0
- package/src/theme/ApiDemoPanel/FormSelect/styles.module.css +51 -0
- package/src/theme/ApiDemoPanel/FormTextInput/index.tsx +32 -0
- package/src/theme/ApiDemoPanel/FormTextInput/styles.module.css +21 -0
- package/src/theme/ApiDemoPanel/MethodEndpoint/index.tsx +55 -0
- package/src/theme/ApiDemoPanel/ParamOptions/index.tsx +316 -0
- package/src/theme/ApiDemoPanel/ParamOptions/slice.ts +37 -0
- package/src/theme/ApiDemoPanel/ParamOptions/styles.module.css +180 -0
- package/src/theme/ApiDemoPanel/Response/index.tsx +66 -0
- package/src/theme/ApiDemoPanel/Response/slice.ts +31 -0
- package/src/theme/ApiDemoPanel/SecuritySchemes/index.tsx +49 -0
- package/src/theme/ApiDemoPanel/Server/index.tsx +103 -0
- package/src/theme/ApiDemoPanel/Server/slice.ts +40 -0
- package/src/theme/ApiDemoPanel/Server/styles.module.css +61 -0
- package/src/theme/ApiDemoPanel/VSCode/index.tsx +205 -0
- package/src/theme/ApiDemoPanel/VSCode/styles.module.css +19 -0
- package/src/theme/ApiDemoPanel/buildPostmanRequest.ts +307 -0
- package/src/theme/ApiDemoPanel/hooks.ts +13 -0
- package/src/theme/ApiDemoPanel/index.tsx +118 -0
- package/src/theme/ApiDemoPanel/persistanceMiddleware.ts +46 -0
- package/src/theme/ApiDemoPanel/postman-collection.d.ts +10 -0
- package/src/theme/ApiDemoPanel/storage-utils.ts +39 -0
- package/src/theme/ApiDemoPanel/store.ts +41 -0
- package/src/theme/ApiDemoPanel/styles.module.css +44 -0
- package/src/theme/ApiItem/index.tsx +171 -0
- package/src/theme/ApiItem/styles.module.css +109 -0
- package/src/theme/ParamsItem/index.js +68 -0
- package/src/theme/ParamsItem/styles.module.css +24 -0
- package/src/theme/SchemaItem/index.js +58 -0
- package/src/theme/SchemaItem/styles.module.css +24 -0
- package/src/theme/Tabs/index.js +258 -0
- package/src/theme/Tabs/styles.module.css +118 -0
- package/src/theme-classic.d.ts +8 -0
- package/src/theme-openapi.d.ts +48 -0
- package/src/theme-translations.d.ts +9 -0
- package/src/types.ts +70 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
import React, { useState } from "react"; // @ts-ignore
|
|
8
|
+
|
|
9
|
+
import MagicDropzone from "react-magic-dropzone";
|
|
10
|
+
import FloatingButton from "../FloatingButton";
|
|
11
|
+
import styles from "./styles.module.css";
|
|
12
|
+
|
|
13
|
+
function RenderPreview({ file }) {
|
|
14
|
+
switch (file.type) {
|
|
15
|
+
case "image/png":
|
|
16
|
+
case "image/jpeg":
|
|
17
|
+
case "image/jpg":
|
|
18
|
+
case "image/svg+xml":
|
|
19
|
+
return (
|
|
20
|
+
<img
|
|
21
|
+
style={{
|
|
22
|
+
borderRadius: "4px",
|
|
23
|
+
}}
|
|
24
|
+
src={file.preview}
|
|
25
|
+
alt=""
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
default:
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
style={{
|
|
33
|
+
display: "flex",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
minWidth: 0,
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<svg
|
|
39
|
+
viewBox="0 0 100 120"
|
|
40
|
+
style={{
|
|
41
|
+
width: "50px",
|
|
42
|
+
height: "60px",
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<path
|
|
46
|
+
fillRule="evenodd"
|
|
47
|
+
fill="#b3beca"
|
|
48
|
+
d="M100.000,39.790 L100.000,105.000 C100.000,113.284 93.284,120.000 85.000,120.000 L15.000,120.000 C6.716,120.000 -0.000,113.284 -0.000,105.000 L-0.000,15.000 C-0.000,6.716 6.716,-0.000 15.000,-0.000 L60.210,-0.000 L100.000,39.790 Z"
|
|
49
|
+
/>
|
|
50
|
+
<path
|
|
51
|
+
fillRule="evenodd"
|
|
52
|
+
fill="#90a1b1"
|
|
53
|
+
transform="translate(60, 0)"
|
|
54
|
+
d="M0.210,-0.000 L40.000,39.790 L40.000,40.000 L15.000,40.000 C6.716,40.000 0.000,33.284 0.000,25.000 L0.000,-0.000 L0.210,-0.000 Z"
|
|
55
|
+
/>
|
|
56
|
+
</svg>
|
|
57
|
+
<div className={styles.filename}>{file.name}</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function FormFileUpload({ placeholder, onChange }) {
|
|
64
|
+
const [hover, setHover] = useState(false);
|
|
65
|
+
const [file, setFile] = useState();
|
|
66
|
+
|
|
67
|
+
function setAndNotifyFile(file) {
|
|
68
|
+
setFile(file);
|
|
69
|
+
onChange?.(file);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function handleDrop(accepted) {
|
|
73
|
+
const [file] = accepted;
|
|
74
|
+
setAndNotifyFile(file);
|
|
75
|
+
setHover(false);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<FloatingButton>
|
|
80
|
+
<MagicDropzone
|
|
81
|
+
className={hover ? styles.dropzoneHover : styles.dropzone}
|
|
82
|
+
onDrop={handleDrop}
|
|
83
|
+
onDragEnter={() => setHover(true)}
|
|
84
|
+
onDragLeave={() => setHover(false)}
|
|
85
|
+
multiple={false}
|
|
86
|
+
style={{
|
|
87
|
+
marginTop: "calc(var(--ifm-pre-padding) / 2)",
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
{file ? (
|
|
91
|
+
<>
|
|
92
|
+
<button
|
|
93
|
+
style={{
|
|
94
|
+
marginTop: "calc(var(--ifm-pre-padding) / 2)",
|
|
95
|
+
}}
|
|
96
|
+
onClick={(e) => {
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
setAndNotifyFile(undefined);
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
Clear
|
|
102
|
+
</button>
|
|
103
|
+
<RenderPreview file={file} />
|
|
104
|
+
</>
|
|
105
|
+
) : (
|
|
106
|
+
<div className={styles.dropzoneContent}>{placeholder}</div>
|
|
107
|
+
)}
|
|
108
|
+
</MagicDropzone>
|
|
109
|
+
</FloatingButton>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export default FormFileUpload;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.dropzone {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
border: 2px dashed var(--openapi-monaco-border-color);
|
|
7
|
+
/* border: 2px dashed var(--ifm-color-primary); */
|
|
8
|
+
background-color: var(--openapi-input-background);
|
|
9
|
+
|
|
10
|
+
width: 100%;
|
|
11
|
+
/* min-height: 120px; */
|
|
12
|
+
/* padding: 16px 11px; */
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
padding: var(--ifm-pre-padding);
|
|
15
|
+
font-size: var(--ifm-code-font-size);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dropzoneHover {
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
border: 2px dashed var(--openapi-monaco-border-color);
|
|
24
|
+
background-color: var(--openapi-input-background);
|
|
25
|
+
width: 100%;
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
padding: var(--ifm-pre-padding);
|
|
28
|
+
font-size: var(--ifm-code-font-size);
|
|
29
|
+
border: 2px dashed var(--ifm-color-primary);
|
|
30
|
+
|
|
31
|
+
background: linear-gradient(
|
|
32
|
+
var(--openapi-dropzone-hover-shim),
|
|
33
|
+
var(--openapi-dropzone-hover-shim)
|
|
34
|
+
),
|
|
35
|
+
linear-gradient(var(--ifm-color-primary), var(--ifm-color-primary));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dropzone:hover {
|
|
39
|
+
border: 2px dashed var(--ifm-color-primary);
|
|
40
|
+
background: linear-gradient(
|
|
41
|
+
var(--openapi-dropzone-hover-shim),
|
|
42
|
+
var(--openapi-dropzone-hover-shim)
|
|
43
|
+
),
|
|
44
|
+
linear-gradient(var(--ifm-color-primary), var(--ifm-color-primary));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.dropzoneContent {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
flex-wrap: wrap;
|
|
52
|
+
margin: var(--ifm-pre-padding) 0;
|
|
53
|
+
color: var(--openapi-dropzone-color);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dropzone:hover .dropzoneContent {
|
|
57
|
+
color: var(--ifm-pre-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.dropzoneHover .dropzoneContent {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
flex-wrap: wrap;
|
|
65
|
+
margin: var(--ifm-pre-padding) 0;
|
|
66
|
+
color: var(--ifm-pre-color);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.filename {
|
|
70
|
+
margin: 0 calc(var(--ifm-pre-padding) * 1.5);
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
text-overflow: ellipsis;
|
|
74
|
+
flex: 1;
|
|
75
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
import React from "react";
|
|
8
|
+
import styles from "./styles.module.css";
|
|
9
|
+
|
|
10
|
+
function FormItem({ label, type, children }) {
|
|
11
|
+
return (
|
|
12
|
+
<div className={styles.formItem}>
|
|
13
|
+
<code>{label}</code>
|
|
14
|
+
{type && (
|
|
15
|
+
<span
|
|
16
|
+
style={{
|
|
17
|
+
opacity: 0.6,
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
{" "}
|
|
21
|
+
— {type}
|
|
22
|
+
</span>
|
|
23
|
+
)}
|
|
24
|
+
<div>{children}</div>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default FormItem;
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
import React from "react";
|
|
8
|
+
import styles from "./styles.module.css";
|
|
9
|
+
|
|
10
|
+
function FormMultiSelect({ value, options, onChange }) {
|
|
11
|
+
if (options.length === 0) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let height;
|
|
16
|
+
|
|
17
|
+
if (options.length < 6) {
|
|
18
|
+
const selectPadding = 12 * 2;
|
|
19
|
+
const rawHeight = options.length * 29;
|
|
20
|
+
const innerMargins = 4 * options.length - 1;
|
|
21
|
+
const outerMargins = 4 * 2;
|
|
22
|
+
const mysteryScroll = 1;
|
|
23
|
+
height =
|
|
24
|
+
rawHeight + innerMargins + outerMargins + selectPadding + mysteryScroll;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<select
|
|
29
|
+
style={{
|
|
30
|
+
height: height,
|
|
31
|
+
}}
|
|
32
|
+
className={styles.selectInput}
|
|
33
|
+
value={value}
|
|
34
|
+
onChange={onChange}
|
|
35
|
+
size={Math.min(6, options.length + 1)}
|
|
36
|
+
multiple
|
|
37
|
+
>
|
|
38
|
+
{options.map((option) => {
|
|
39
|
+
return (
|
|
40
|
+
<option key={option} value={option}>
|
|
41
|
+
{option}
|
|
42
|
+
</option>
|
|
43
|
+
);
|
|
44
|
+
})}
|
|
45
|
+
</select>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default FormMultiSelect;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.inputBase {
|
|
2
|
+
margin-top: calc(var(--ifm-pre-padding) / 2);
|
|
3
|
+
/* height: 40px; */
|
|
4
|
+
background-color: var(--openapi-input-background);
|
|
5
|
+
border: none;
|
|
6
|
+
outline: none;
|
|
7
|
+
width: 100%;
|
|
8
|
+
font-size: var(--ifm-code-font-size);
|
|
9
|
+
color: var(--ifm-pre-color);
|
|
10
|
+
padding: 12px var(--ifm-pre-padding);
|
|
11
|
+
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
border: 2px solid transparent;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.selectInput {
|
|
17
|
+
composes: inputBase;
|
|
18
|
+
-moz-appearance: none;
|
|
19
|
+
-webkit-appearance: none;
|
|
20
|
+
appearance: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.selectInput option {
|
|
24
|
+
border-radius: 0.25rem;
|
|
25
|
+
color: var(--ifm-menu-color);
|
|
26
|
+
margin: 0.25rem 0;
|
|
27
|
+
padding: var(--ifm-menu-link-padding-vertical)
|
|
28
|
+
var(--ifm-menu-link-padding-horizontal);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.selectInput:focus option:checked {
|
|
32
|
+
/* background: #0f62fe linear-gradient(0deg, #0f62fe 0%, #0f62fe 100%); */
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.selectInput:focus {
|
|
36
|
+
/* box-shadow: inset 0px 0px 0px 2px white; */
|
|
37
|
+
border: 2px solid var(--openapi-input-border);
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import React from "react";
|
|
8
|
+
import styles from "./styles.module.css";
|
|
9
|
+
|
|
10
|
+
function FormSelect({ value, options, onChange }) {
|
|
11
|
+
if (!Array.isArray(options) || options.length === 0) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<select className={styles.selectInput} value={value} onChange={onChange}>
|
|
17
|
+
{options.map((option) => {
|
|
18
|
+
return (
|
|
19
|
+
<option key={option} value={option}>
|
|
20
|
+
{option}
|
|
21
|
+
</option>
|
|
22
|
+
);
|
|
23
|
+
})}
|
|
24
|
+
</select>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default FormSelect;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.inputBase {
|
|
2
|
+
margin-top: calc(var(--ifm-pre-padding) / 2);
|
|
3
|
+
/* height: 40px; */
|
|
4
|
+
background-color: var(--openapi-input-background);
|
|
5
|
+
border: none;
|
|
6
|
+
outline: none;
|
|
7
|
+
width: 100%;
|
|
8
|
+
font-size: var(--ifm-code-font-size);
|
|
9
|
+
color: var(--ifm-pre-color);
|
|
10
|
+
padding: 12px 48px 12px var(--ifm-pre-padding);
|
|
11
|
+
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
html[data-theme="dark"] .selectInput {
|
|
16
|
+
margin-top: calc(var(--ifm-pre-padding) / 2);
|
|
17
|
+
/* height: 40px; */
|
|
18
|
+
background-color: var(--openapi-input-background);
|
|
19
|
+
border: none;
|
|
20
|
+
outline: none;
|
|
21
|
+
width: 100%;
|
|
22
|
+
font-size: var(--ifm-code-font-size);
|
|
23
|
+
color: var(--ifm-pre-color);
|
|
24
|
+
/* padding: 12px var(--ifm-pre-padding); */
|
|
25
|
+
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
-moz-appearance: none;
|
|
28
|
+
-webkit-appearance: none;
|
|
29
|
+
appearance: none;
|
|
30
|
+
|
|
31
|
+
background-image: url('data:image/svg+xml;charset=US-ASCII,<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" fill="white"><path d="M8 11L3 6 3.7 5.3 8 9.6 12.3 5.3 13 6z"></path></svg>');
|
|
32
|
+
background-repeat: no-repeat;
|
|
33
|
+
background-position: right var(--ifm-pre-padding) top 50%;
|
|
34
|
+
background-size: auto auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.selectInput {
|
|
38
|
+
composes: inputBase;
|
|
39
|
+
-moz-appearance: none;
|
|
40
|
+
-webkit-appearance: none;
|
|
41
|
+
appearance: none;
|
|
42
|
+
|
|
43
|
+
background-image: url('data:image/svg+xml;charset=US-ASCII,<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 11L3 6 3.7 5.3 8 9.6 12.3 5.3 13 6z"></path></svg>');
|
|
44
|
+
background-repeat: no-repeat;
|
|
45
|
+
background-position: right var(--ifm-pre-padding) top 50%;
|
|
46
|
+
background-size: auto auto;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.selectInput:focus {
|
|
50
|
+
box-shadow: inset 0px 0px 0px 2px var(--openapi-input-border);
|
|
51
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
import React from "react";
|
|
8
|
+
import styles from "./styles.module.css";
|
|
9
|
+
|
|
10
|
+
function FormTextInput({ value, placeholder, password, onChange }) {
|
|
11
|
+
return (
|
|
12
|
+
<input
|
|
13
|
+
className={styles.input}
|
|
14
|
+
type={password ? "password" : "text"}
|
|
15
|
+
placeholder={placeholder}
|
|
16
|
+
value={value}
|
|
17
|
+
onChange={onChange}
|
|
18
|
+
autoComplete="off"
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default FormTextInput;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.inputBase {
|
|
2
|
+
margin-top: calc(var(--ifm-pre-padding) / 2);
|
|
3
|
+
/* height: 40px; */
|
|
4
|
+
background-color: var(--openapi-input-background);
|
|
5
|
+
border: none;
|
|
6
|
+
outline: none;
|
|
7
|
+
width: 100%;
|
|
8
|
+
font-size: var(--ifm-code-font-size);
|
|
9
|
+
color: var(--ifm-pre-color);
|
|
10
|
+
padding: 12px var(--ifm-pre-padding);
|
|
11
|
+
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.input {
|
|
16
|
+
composes: inputBase;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.input:focus {
|
|
20
|
+
box-shadow: inset 0px 0px 0px 2px var(--openapi-input-border);
|
|
21
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
import React from "react";
|
|
8
|
+
const methodStyle = {
|
|
9
|
+
borderRadius: "var(--ifm-global-radius)",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function colorForMethod(method) {
|
|
13
|
+
switch (method.toLowerCase()) {
|
|
14
|
+
case "get":
|
|
15
|
+
return "primary";
|
|
16
|
+
|
|
17
|
+
case "put":
|
|
18
|
+
return "warning";
|
|
19
|
+
|
|
20
|
+
case "patch":
|
|
21
|
+
return "warning";
|
|
22
|
+
|
|
23
|
+
case "post":
|
|
24
|
+
return "success";
|
|
25
|
+
|
|
26
|
+
case "delete":
|
|
27
|
+
return "danger";
|
|
28
|
+
|
|
29
|
+
default:
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function MethodEndpoint({ method, path }) {
|
|
35
|
+
return (
|
|
36
|
+
<pre
|
|
37
|
+
style={{
|
|
38
|
+
background: "var(--openapi-card-background-color)",
|
|
39
|
+
borderRadius: "var(--openapi-card-border-radius)",
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<span
|
|
43
|
+
style={methodStyle}
|
|
44
|
+
className={"badge badge--" + colorForMethod(method)}
|
|
45
|
+
>
|
|
46
|
+
{method.toUpperCase()}
|
|
47
|
+
</span>{" "}
|
|
48
|
+
<span>{path.replace(/{([a-z0-9-_]+)}/gi, ":$1")}</span>
|
|
49
|
+
</pre>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default MethodEndpoint;
|