docusaurus-theme-openapi-docs 0.0.0-345

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.
Files changed (194) hide show
  1. package/LICENSE +21 -0
  2. package/babel.config.js +35 -0
  3. package/lib/index.js +48 -0
  4. package/lib/markdown/createDescription.js +20 -0
  5. package/lib/markdown/schema.js +121 -0
  6. package/lib/markdown/utils.js +45 -0
  7. package/lib/postman-code-generators.d.ts +9 -0
  8. package/lib/react-magic-dropzone.d.ts +9 -0
  9. package/lib/theme/ApiDemoPanel/Accept/index.js +41 -0
  10. package/lib/theme/ApiDemoPanel/Accept/slice.js +32 -0
  11. package/lib/theme/ApiDemoPanel/Authorization/auth-types.js +32 -0
  12. package/lib/theme/ApiDemoPanel/Authorization/index.js +174 -0
  13. package/lib/theme/ApiDemoPanel/Authorization/slice.js +137 -0
  14. package/lib/theme/ApiDemoPanel/Body/index.js +185 -0
  15. package/lib/theme/ApiDemoPanel/Body/slice.js +105 -0
  16. package/lib/theme/ApiDemoPanel/ContentType/index.js +41 -0
  17. package/lib/theme/ApiDemoPanel/ContentType/slice.js +32 -0
  18. package/lib/theme/ApiDemoPanel/Curl/index.js +235 -0
  19. package/lib/theme/ApiDemoPanel/Curl/styles.module.css +84 -0
  20. package/lib/theme/ApiDemoPanel/Execute/index.js +85 -0
  21. package/lib/theme/ApiDemoPanel/Execute/makeRequest.js +200 -0
  22. package/lib/theme/ApiDemoPanel/FloatingButton/index.js +32 -0
  23. package/lib/theme/ApiDemoPanel/FloatingButton/styles.module.css +26 -0
  24. package/lib/theme/ApiDemoPanel/FormFileUpload/index.js +96 -0
  25. package/lib/theme/ApiDemoPanel/FormFileUpload/styles.module.css +75 -0
  26. package/lib/theme/ApiDemoPanel/FormItem/index.js +35 -0
  27. package/lib/theme/ApiDemoPanel/FormItem/styles.module.css +7 -0
  28. package/lib/theme/ApiDemoPanel/FormMultiSelect/index.js +52 -0
  29. package/lib/theme/ApiDemoPanel/FormMultiSelect/styles.module.css +38 -0
  30. package/lib/theme/ApiDemoPanel/FormSelect/index.js +39 -0
  31. package/lib/theme/ApiDemoPanel/FormSelect/styles.module.css +51 -0
  32. package/lib/theme/ApiDemoPanel/FormTextInput/index.js +30 -0
  33. package/lib/theme/ApiDemoPanel/FormTextInput/styles.module.css +21 -0
  34. package/lib/theme/ApiDemoPanel/MethodEndpoint/index.js +60 -0
  35. package/lib/theme/ApiDemoPanel/ParamOptions/index.js +248 -0
  36. package/lib/theme/ApiDemoPanel/ParamOptions/slice.js +35 -0
  37. package/lib/theme/ApiDemoPanel/ParamOptions/styles.module.css +180 -0
  38. package/lib/theme/ApiDemoPanel/Response/index.js +75 -0
  39. package/lib/theme/ApiDemoPanel/Response/slice.js +37 -0
  40. package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +51 -0
  41. package/lib/theme/ApiDemoPanel/Server/index.js +109 -0
  42. package/lib/theme/ApiDemoPanel/Server/slice.js +41 -0
  43. package/lib/theme/ApiDemoPanel/Server/styles.module.css +61 -0
  44. package/lib/theme/ApiDemoPanel/VSCode/index.js +252 -0
  45. package/lib/theme/ApiDemoPanel/VSCode/styles.module.css +19 -0
  46. package/lib/theme/ApiDemoPanel/buildPostmanRequest.js +328 -0
  47. package/lib/theme/ApiDemoPanel/hooks.js +20 -0
  48. package/lib/theme/ApiDemoPanel/index.js +132 -0
  49. package/lib/theme/ApiDemoPanel/persistanceMiddleware.js +44 -0
  50. package/lib/theme/ApiDemoPanel/postman-collection.d.ts +10 -0
  51. package/lib/theme/ApiDemoPanel/storage-utils.js +47 -0
  52. package/lib/theme/ApiDemoPanel/store.js +48 -0
  53. package/lib/theme/ApiDemoPanel/styles.module.css +44 -0
  54. package/lib/theme/ApiItem/index.js +160 -0
  55. package/lib/theme/ApiItem/styles.module.css +109 -0
  56. package/lib/theme/ApiTabs/index.js +258 -0
  57. package/lib/theme/ApiTabs/styles.module.css +118 -0
  58. package/lib/theme/ParamsItem/index.js +68 -0
  59. package/lib/theme/ParamsItem/styles.module.css +24 -0
  60. package/lib/theme/SchemaItem/index.js +58 -0
  61. package/lib/theme/SchemaItem/styles.module.css +24 -0
  62. package/lib/theme-classic.d.ts +8 -0
  63. package/lib/theme-openapi.d.ts +48 -0
  64. package/lib/theme-translations.d.ts +9 -0
  65. package/lib/types.js +1 -0
  66. package/lib-next/index.js +38 -0
  67. package/lib-next/markdown/createDescription.js +13 -0
  68. package/lib-next/markdown/schema.js +115 -0
  69. package/lib-next/markdown/utils.js +31 -0
  70. package/lib-next/postman-code-generators.d.ts +9 -0
  71. package/lib-next/react-magic-dropzone.d.ts +9 -0
  72. package/lib-next/theme/ApiDemoPanel/Accept/index.js +33 -0
  73. package/lib-next/theme/ApiDemoPanel/Accept/slice.js +19 -0
  74. package/lib-next/theme/ApiDemoPanel/Authorization/auth-types.js +22 -0
  75. package/lib-next/theme/ApiDemoPanel/Authorization/index.js +203 -0
  76. package/lib-next/theme/ApiDemoPanel/Authorization/slice.js +101 -0
  77. package/lib-next/theme/ApiDemoPanel/Body/index.js +210 -0
  78. package/lib-next/theme/ApiDemoPanel/Body/slice.js +89 -0
  79. package/lib-next/theme/ApiDemoPanel/ContentType/index.js +33 -0
  80. package/lib-next/theme/ApiDemoPanel/ContentType/slice.js +19 -0
  81. package/lib-next/theme/ApiDemoPanel/Curl/index.js +262 -0
  82. package/lib-next/theme/ApiDemoPanel/Curl/styles.module.css +84 -0
  83. package/lib-next/theme/ApiDemoPanel/Execute/index.js +73 -0
  84. package/lib-next/theme/ApiDemoPanel/Execute/makeRequest.js +181 -0
  85. package/lib-next/theme/ApiDemoPanel/FloatingButton/index.js +19 -0
  86. package/lib-next/theme/ApiDemoPanel/FloatingButton/styles.module.css +26 -0
  87. package/lib-next/theme/ApiDemoPanel/FormFileUpload/index.js +112 -0
  88. package/lib-next/theme/ApiDemoPanel/FormFileUpload/styles.module.css +75 -0
  89. package/lib-next/theme/ApiDemoPanel/FormItem/index.js +29 -0
  90. package/lib-next/theme/ApiDemoPanel/FormItem/styles.module.css +7 -0
  91. package/lib-next/theme/ApiDemoPanel/FormMultiSelect/index.js +49 -0
  92. package/lib-next/theme/ApiDemoPanel/FormMultiSelect/styles.module.css +38 -0
  93. package/lib-next/theme/ApiDemoPanel/FormSelect/index.js +28 -0
  94. package/lib-next/theme/ApiDemoPanel/FormSelect/styles.module.css +51 -0
  95. package/lib-next/theme/ApiDemoPanel/FormTextInput/index.js +23 -0
  96. package/lib-next/theme/ApiDemoPanel/FormTextInput/styles.module.css +21 -0
  97. package/lib-next/theme/ApiDemoPanel/MethodEndpoint/index.js +53 -0
  98. package/lib-next/theme/ApiDemoPanel/ParamOptions/index.js +284 -0
  99. package/lib-next/theme/ApiDemoPanel/ParamOptions/slice.js +22 -0
  100. package/lib-next/theme/ApiDemoPanel/ParamOptions/styles.module.css +180 -0
  101. package/lib-next/theme/ApiDemoPanel/Response/index.js +65 -0
  102. package/lib-next/theme/ApiDemoPanel/Response/slice.js +22 -0
  103. package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +48 -0
  104. package/lib-next/theme/ApiDemoPanel/Server/index.js +114 -0
  105. package/lib-next/theme/ApiDemoPanel/Server/slice.js +25 -0
  106. package/lib-next/theme/ApiDemoPanel/Server/styles.module.css +61 -0
  107. package/lib-next/theme/ApiDemoPanel/VSCode/index.js +265 -0
  108. package/lib-next/theme/ApiDemoPanel/VSCode/styles.module.css +19 -0
  109. package/lib-next/theme/ApiDemoPanel/buildPostmanRequest.js +309 -0
  110. package/lib-next/theme/ApiDemoPanel/hooks.js +9 -0
  111. package/lib-next/theme/ApiDemoPanel/index.js +108 -0
  112. package/lib-next/theme/ApiDemoPanel/persistanceMiddleware.js +38 -0
  113. package/lib-next/theme/ApiDemoPanel/postman-collection.d.ts +10 -0
  114. package/lib-next/theme/ApiDemoPanel/storage-utils.js +35 -0
  115. package/lib-next/theme/ApiDemoPanel/store.js +30 -0
  116. package/lib-next/theme/ApiDemoPanel/styles.module.css +44 -0
  117. package/lib-next/theme/ApiItem/index.js +171 -0
  118. package/lib-next/theme/ApiItem/styles.module.css +109 -0
  119. package/lib-next/theme/ApiTabs/index.js +258 -0
  120. package/lib-next/theme/ApiTabs/styles.module.css +118 -0
  121. package/lib-next/theme/ParamsItem/index.js +68 -0
  122. package/lib-next/theme/ParamsItem/styles.module.css +24 -0
  123. package/lib-next/theme/SchemaItem/index.js +58 -0
  124. package/lib-next/theme/SchemaItem/styles.module.css +24 -0
  125. package/lib-next/theme-classic.d.ts +8 -0
  126. package/lib-next/theme-openapi.d.ts +48 -0
  127. package/lib-next/theme-translations.d.ts +9 -0
  128. package/lib-next/types.js +1 -0
  129. package/package.json +74 -0
  130. package/src/index.ts +42 -0
  131. package/src/markdown/createDescription.ts +13 -0
  132. package/src/markdown/schema.ts +115 -0
  133. package/src/markdown/utils.ts +39 -0
  134. package/src/postman-code-generators.d.ts +9 -0
  135. package/src/react-magic-dropzone.d.ts +9 -0
  136. package/src/theme/ApiDemoPanel/Accept/index.tsx +35 -0
  137. package/src/theme/ApiDemoPanel/Accept/slice.ts +29 -0
  138. package/src/theme/ApiDemoPanel/Authorization/auth-types.ts +26 -0
  139. package/src/theme/ApiDemoPanel/Authorization/index.tsx +211 -0
  140. package/src/theme/ApiDemoPanel/Authorization/slice.ts +145 -0
  141. package/src/theme/ApiDemoPanel/Body/index.tsx +218 -0
  142. package/src/theme/ApiDemoPanel/Body/slice.ts +133 -0
  143. package/src/theme/ApiDemoPanel/ContentType/index.tsx +35 -0
  144. package/src/theme/ApiDemoPanel/ContentType/slice.ts +29 -0
  145. package/src/theme/ApiDemoPanel/Curl/index.tsx +278 -0
  146. package/src/theme/ApiDemoPanel/Curl/styles.module.css +84 -0
  147. package/src/theme/ApiDemoPanel/Execute/index.tsx +87 -0
  148. package/src/theme/ApiDemoPanel/Execute/makeRequest.ts +182 -0
  149. package/src/theme/ApiDemoPanel/FloatingButton/index.tsx +27 -0
  150. package/src/theme/ApiDemoPanel/FloatingButton/styles.module.css +26 -0
  151. package/src/theme/ApiDemoPanel/FormFileUpload/index.tsx +115 -0
  152. package/src/theme/ApiDemoPanel/FormFileUpload/styles.module.css +75 -0
  153. package/src/theme/ApiDemoPanel/FormItem/index.tsx +28 -0
  154. package/src/theme/ApiDemoPanel/FormItem/styles.module.css +7 -0
  155. package/src/theme/ApiDemoPanel/FormMultiSelect/index.tsx +54 -0
  156. package/src/theme/ApiDemoPanel/FormMultiSelect/styles.module.css +38 -0
  157. package/src/theme/ApiDemoPanel/FormSelect/index.tsx +36 -0
  158. package/src/theme/ApiDemoPanel/FormSelect/styles.module.css +51 -0
  159. package/src/theme/ApiDemoPanel/FormTextInput/index.tsx +32 -0
  160. package/src/theme/ApiDemoPanel/FormTextInput/styles.module.css +21 -0
  161. package/src/theme/ApiDemoPanel/MethodEndpoint/index.tsx +55 -0
  162. package/src/theme/ApiDemoPanel/ParamOptions/index.tsx +316 -0
  163. package/src/theme/ApiDemoPanel/ParamOptions/slice.ts +37 -0
  164. package/src/theme/ApiDemoPanel/ParamOptions/styles.module.css +180 -0
  165. package/src/theme/ApiDemoPanel/Response/index.tsx +66 -0
  166. package/src/theme/ApiDemoPanel/Response/slice.ts +31 -0
  167. package/src/theme/ApiDemoPanel/SecuritySchemes/index.tsx +49 -0
  168. package/src/theme/ApiDemoPanel/Server/index.tsx +103 -0
  169. package/src/theme/ApiDemoPanel/Server/slice.ts +40 -0
  170. package/src/theme/ApiDemoPanel/Server/styles.module.css +61 -0
  171. package/src/theme/ApiDemoPanel/VSCode/index.tsx +205 -0
  172. package/src/theme/ApiDemoPanel/VSCode/styles.module.css +19 -0
  173. package/src/theme/ApiDemoPanel/buildPostmanRequest.ts +305 -0
  174. package/src/theme/ApiDemoPanel/hooks.ts +13 -0
  175. package/src/theme/ApiDemoPanel/index.tsx +117 -0
  176. package/src/theme/ApiDemoPanel/persistanceMiddleware.ts +46 -0
  177. package/src/theme/ApiDemoPanel/postman-collection.d.ts +10 -0
  178. package/src/theme/ApiDemoPanel/storage-utils.ts +39 -0
  179. package/src/theme/ApiDemoPanel/store.ts +41 -0
  180. package/src/theme/ApiDemoPanel/styles.module.css +44 -0
  181. package/src/theme/ApiItem/index.tsx +171 -0
  182. package/src/theme/ApiItem/styles.module.css +109 -0
  183. package/src/theme/ApiTabs/index.js +258 -0
  184. package/src/theme/ApiTabs/styles.module.css +118 -0
  185. package/src/theme/ParamsItem/index.js +68 -0
  186. package/src/theme/ParamsItem/styles.module.css +24 -0
  187. package/src/theme/SchemaItem/index.js +58 -0
  188. package/src/theme/SchemaItem/styles.module.css +24 -0
  189. package/src/theme-classic.d.ts +8 -0
  190. package/src/theme-openapi.d.ts +48 -0
  191. package/src/theme-translations.d.ts +9 -0
  192. package/src/types.ts +70 -0
  193. package/tsconfig.json +10 -0
  194. package/yarn-error.log +15035 -0
@@ -0,0 +1,27 @@
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 styles from "./styles.module.css";
11
+
12
+ interface Props {
13
+ label?: string;
14
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
15
+ children?: React.ReactNode;
16
+ }
17
+
18
+ function FloatingButton({ label, onClick, children }: Props) {
19
+ return (
20
+ <div className={styles.floatingButton}>
21
+ {label && <button onClick={onClick}>{label}</button>}
22
+ {children}
23
+ </div>
24
+ );
25
+ }
26
+
27
+ export default FloatingButton;
@@ -0,0 +1,26 @@
1
+ .floatingButton {
2
+ position: relative;
3
+ }
4
+
5
+ .floatingButton button {
6
+ position: relative;
7
+ background: rgba(25, 26, 27, 0.9);
8
+ border: none;
9
+ border-radius: var(--ifm-global-radius);
10
+ color: var(--ifm-color-white);
11
+ cursor: pointer;
12
+ outline: none;
13
+ padding: 0.4rem 0.5rem;
14
+ opacity: 0;
15
+ visibility: hidden;
16
+ transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out,
17
+ bottom 0.2s ease-in-out;
18
+ position: absolute;
19
+ top: calc(var(--ifm-pre-padding) / 2);
20
+ right: calc(var(--ifm-pre-padding) / 2);
21
+ }
22
+
23
+ .floatingButton:hover button {
24
+ visibility: visible;
25
+ opacity: 1;
26
+ }
@@ -0,0 +1,115 @@
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, { useState } from "react";
9
+
10
+ import MagicDropzone from "react-magic-dropzone";
11
+
12
+ import FloatingButton from "../FloatingButton";
13
+ import styles from "./styles.module.css";
14
+
15
+ type PreviewFile = { preview: string } & File;
16
+
17
+ interface RenderPreviewProps {
18
+ file: PreviewFile;
19
+ }
20
+
21
+ function RenderPreview({ file }: RenderPreviewProps) {
22
+ switch (file.type) {
23
+ case "image/png":
24
+ case "image/jpeg":
25
+ case "image/jpg":
26
+ case "image/svg+xml":
27
+ return (
28
+ <img
29
+ style={{
30
+ borderRadius: "4px",
31
+ }}
32
+ src={file.preview}
33
+ alt=""
34
+ />
35
+ );
36
+ default:
37
+ return (
38
+ <div
39
+ style={{
40
+ display: "flex",
41
+ alignItems: "center",
42
+ minWidth: 0,
43
+ }}
44
+ >
45
+ <svg viewBox="0 0 100 120" style={{ width: "50px", height: "60px" }}>
46
+ <path
47
+ fillRule="evenodd"
48
+ fill="#b3beca"
49
+ 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"
50
+ />
51
+ <path
52
+ fillRule="evenodd"
53
+ fill="#90a1b1"
54
+ transform="translate(60, 0)"
55
+ 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"
56
+ />
57
+ </svg>
58
+ <div className={styles.filename}>{file.name}</div>
59
+ </div>
60
+ );
61
+ }
62
+ }
63
+
64
+ interface Props {
65
+ placeholder: string;
66
+ onChange?(file?: File): any;
67
+ }
68
+
69
+ function FormFileUpload({ placeholder, onChange }: Props) {
70
+ const [hover, setHover] = useState(false);
71
+ const [file, setFile] = useState<PreviewFile>();
72
+
73
+ function setAndNotifyFile(file?: PreviewFile) {
74
+ setFile(file);
75
+ onChange?.(file);
76
+ }
77
+
78
+ function handleDrop(accepted: PreviewFile[]) {
79
+ const [file] = accepted;
80
+ setAndNotifyFile(file);
81
+ setHover(false);
82
+ }
83
+
84
+ return (
85
+ <FloatingButton>
86
+ <MagicDropzone
87
+ className={hover ? styles.dropzoneHover : styles.dropzone}
88
+ onDrop={handleDrop}
89
+ onDragEnter={() => setHover(true)}
90
+ onDragLeave={() => setHover(false)}
91
+ multiple={false}
92
+ style={{ marginTop: "calc(var(--ifm-pre-padding) / 2)" }}
93
+ >
94
+ {file ? (
95
+ <>
96
+ <button
97
+ style={{ marginTop: "calc(var(--ifm-pre-padding) / 2)" }}
98
+ onClick={(e) => {
99
+ e.stopPropagation();
100
+ setAndNotifyFile(undefined);
101
+ }}
102
+ >
103
+ Clear
104
+ </button>
105
+ <RenderPreview file={file} />
106
+ </>
107
+ ) : (
108
+ <div className={styles.dropzoneContent}>{placeholder}</div>
109
+ )}
110
+ </MagicDropzone>
111
+ </FloatingButton>
112
+ );
113
+ }
114
+
115
+ 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,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
+
8
+ import React from "react";
9
+
10
+ import styles from "./styles.module.css";
11
+
12
+ interface Props {
13
+ label: string;
14
+ type?: string;
15
+ children?: React.ReactNode;
16
+ }
17
+
18
+ function FormItem({ label, type, children }: Props) {
19
+ return (
20
+ <div className={styles.formItem}>
21
+ <code>{label}</code>
22
+ {type && <span style={{ opacity: 0.6 }}> — {type}</span>}
23
+ <div>{children}</div>
24
+ </div>
25
+ );
26
+ }
27
+
28
+ export default FormItem;
@@ -0,0 +1,7 @@
1
+ .formItem {
2
+ margin-top: var(--ifm-pre-padding);
3
+ }
4
+
5
+ .formItem:first-child {
6
+ margin-top: 0;
7
+ }
@@ -0,0 +1,54 @@
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 styles from "./styles.module.css";
11
+
12
+ interface Props {
13
+ value?: string;
14
+ options: string[];
15
+ onChange?: React.ChangeEventHandler<HTMLSelectElement>;
16
+ }
17
+
18
+ function FormMultiSelect({ value, options, onChange }: Props) {
19
+ if (options.length === 0) {
20
+ return null;
21
+ }
22
+
23
+ let height;
24
+ if (options.length < 6) {
25
+ const selectPadding = 12 * 2;
26
+ const rawHeight = options.length * 29;
27
+ const innerMargins = 4 * options.length - 1;
28
+ const outerMargins = 4 * 2;
29
+ const mysteryScroll = 1;
30
+ height =
31
+ rawHeight + innerMargins + outerMargins + selectPadding + mysteryScroll;
32
+ }
33
+
34
+ return (
35
+ <select
36
+ style={{ height: height }}
37
+ className={styles.selectInput}
38
+ value={value}
39
+ onChange={onChange}
40
+ size={Math.min(6, options.length + 1)}
41
+ multiple
42
+ >
43
+ {options.map((option) => {
44
+ return (
45
+ <option key={option} value={option}>
46
+ {option}
47
+ </option>
48
+ );
49
+ })}
50
+ </select>
51
+ );
52
+ }
53
+
54
+ 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,36 @@
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 styles from "./styles.module.css";
11
+
12
+ interface Props {
13
+ value?: string;
14
+ options?: string[];
15
+ onChange?: React.ChangeEventHandler<HTMLSelectElement>;
16
+ }
17
+
18
+ function FormSelect({ value, options, onChange }: Props) {
19
+ if (!Array.isArray(options) || options.length === 0) {
20
+ return null;
21
+ }
22
+
23
+ return (
24
+ <select className={styles.selectInput} value={value} onChange={onChange}>
25
+ {options.map((option) => {
26
+ return (
27
+ <option key={option} value={option}>
28
+ {option}
29
+ </option>
30
+ );
31
+ })}
32
+ </select>
33
+ );
34
+ }
35
+
36
+ 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,32 @@
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 styles from "./styles.module.css";
11
+
12
+ interface Props {
13
+ value?: string;
14
+ placeholder?: string;
15
+ password?: boolean;
16
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
17
+ }
18
+
19
+ function FormTextInput({ value, placeholder, password, onChange }: Props) {
20
+ return (
21
+ <input
22
+ className={styles.input}
23
+ type={password ? "password" : "text"}
24
+ placeholder={placeholder}
25
+ value={value}
26
+ onChange={onChange}
27
+ autoComplete="off"
28
+ />
29
+ );
30
+ }
31
+
32
+ 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,55 @@
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
+ const methodStyle = {
11
+ borderRadius: "var(--ifm-global-radius)",
12
+ };
13
+
14
+ function colorForMethod(method: string) {
15
+ switch (method.toLowerCase()) {
16
+ case "get":
17
+ return "primary";
18
+ case "put":
19
+ return "warning";
20
+ case "patch":
21
+ return "warning";
22
+ case "post":
23
+ return "success";
24
+ case "delete":
25
+ return "danger";
26
+ default:
27
+ return undefined;
28
+ }
29
+ }
30
+
31
+ interface Props {
32
+ method: string;
33
+ path: string;
34
+ }
35
+
36
+ function MethodEndpoint({ method, path }: Props) {
37
+ return (
38
+ <pre
39
+ style={{
40
+ background: "var(--openapi-card-background-color)",
41
+ borderRadius: "var(--openapi-card-border-radius)",
42
+ }}
43
+ >
44
+ <span
45
+ style={methodStyle}
46
+ className={"badge badge--" + colorForMethod(method)}
47
+ >
48
+ {method.toUpperCase()}
49
+ </span>{" "}
50
+ <span>{path.replace(/{([a-z0-9-_]+)}/gi, ":$1")}</span>
51
+ </pre>
52
+ );
53
+ }
54
+
55
+ export default MethodEndpoint;