docusaurus-theme-openapi-docs 1.4.2 → 1.4.4

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 (128) hide show
  1. package/lib/index.js +5 -8
  2. package/lib/markdown/createDescription.js +1 -2
  3. package/lib/markdown/schema.js +7 -42
  4. package/lib/markdown/utils.js +1 -7
  5. package/lib/theme/ApiDemoPanel/Accept/index.js +1 -10
  6. package/lib/theme/ApiDemoPanel/Accept/slice.js +1 -2
  7. package/lib/theme/ApiDemoPanel/Authorization/auth-types.js +7 -8
  8. package/lib/theme/ApiDemoPanel/Authorization/index.js +1 -19
  9. package/lib/theme/ApiDemoPanel/Authorization/slice.js +7 -21
  10. package/lib/theme/ApiDemoPanel/Body/index.js +14 -47
  11. package/lib/theme/ApiDemoPanel/Body/slice.js +1 -4
  12. package/lib/theme/ApiDemoPanel/CodeTabs/index.js +14 -46
  13. package/lib/theme/ApiDemoPanel/ContentType/index.js +1 -10
  14. package/lib/theme/ApiDemoPanel/ContentType/slice.js +1 -2
  15. package/lib/theme/ApiDemoPanel/Curl/index.js +9 -29
  16. package/lib/theme/ApiDemoPanel/Execute/index.js +6 -23
  17. package/lib/theme/ApiDemoPanel/Execute/makeRequest.js +4 -27
  18. package/lib/theme/ApiDemoPanel/Export/index.js +1 -8
  19. package/lib/theme/ApiDemoPanel/FloatingButton/index.js +1 -5
  20. package/lib/theme/ApiDemoPanel/FormFileUpload/index.js +1 -14
  21. package/lib/theme/ApiDemoPanel/FormItem/index.js +1 -5
  22. package/lib/theme/ApiDemoPanel/FormMultiSelect/index.js +1 -8
  23. package/lib/theme/ApiDemoPanel/FormSelect/index.js +1 -6
  24. package/lib/theme/ApiDemoPanel/FormTextInput/index.js +1 -6
  25. package/lib/theme/ApiDemoPanel/LiveEditor/index.js +3 -17
  26. package/lib/theme/ApiDemoPanel/MethodEndpoint/index.js +1 -12
  27. package/lib/theme/ApiDemoPanel/ParamOptions/index.js +20 -52
  28. package/lib/theme/ApiDemoPanel/ParamOptions/slice.js +1 -2
  29. package/lib/theme/ApiDemoPanel/Request/index.js +1 -15
  30. package/lib/theme/ApiDemoPanel/Response/index.js +1 -14
  31. package/lib/theme/ApiDemoPanel/Response/slice.js +1 -2
  32. package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -9
  33. package/lib/theme/ApiDemoPanel/Server/index.js +3 -27
  34. package/lib/theme/ApiDemoPanel/Server/slice.js +1 -3
  35. package/lib/theme/ApiDemoPanel/buildPostmanRequest.js +11 -62
  36. package/lib/theme/ApiDemoPanel/index.js +2 -14
  37. package/lib/theme/ApiDemoPanel/persistanceMiddleware.js +5 -11
  38. package/lib/theme/ApiDemoPanel/storage-utils.js +1 -7
  39. package/lib/theme/ApiItem/Layout/index.js +5 -22
  40. package/lib/theme/ApiItem/Layout/styles.module.css +0 -403
  41. package/lib/theme/ApiItem/hooks.js +1 -3
  42. package/lib/theme/ApiItem/index.js +14 -30
  43. package/lib/theme/ApiItem/store.js +1 -14
  44. package/lib/theme/ApiLogo/index.js +1 -4
  45. package/lib/theme/styles.css +428 -0
  46. package/lib/theme-classic.d.ts +5 -0
  47. package/lib-next/index.js +5 -3
  48. package/lib-next/markdown/createDescription.js +1 -1
  49. package/lib-next/markdown/schema.js +7 -35
  50. package/lib-next/markdown/utils.js +1 -4
  51. package/lib-next/theme/ApiDemoPanel/Accept/index.js +1 -4
  52. package/lib-next/theme/ApiDemoPanel/Accept/slice.js +1 -0
  53. package/lib-next/theme/ApiDemoPanel/Authorization/auth-types.js +7 -4
  54. package/lib-next/theme/ApiDemoPanel/Authorization/index.js +1 -8
  55. package/lib-next/theme/ApiDemoPanel/Authorization/slice.js +12 -14
  56. package/lib-next/theme/ApiDemoPanel/Body/index.js +16 -34
  57. package/lib-next/theme/ApiDemoPanel/Body/slice.js +1 -2
  58. package/lib-next/theme/ApiDemoPanel/CodeTabs/index.js +12 -26
  59. package/lib-next/theme/ApiDemoPanel/ContentType/index.js +1 -4
  60. package/lib-next/theme/ApiDemoPanel/ContentType/slice.js +1 -0
  61. package/lib-next/theme/ApiDemoPanel/Curl/index.js +11 -12
  62. package/lib-next/theme/ApiDemoPanel/Execute/index.js +10 -13
  63. package/lib-next/theme/ApiDemoPanel/Execute/makeRequest.js +4 -22
  64. package/lib-next/theme/ApiDemoPanel/Export/index.js +1 -5
  65. package/lib-next/theme/ApiDemoPanel/FloatingButton/index.js +1 -2
  66. package/lib-next/theme/ApiDemoPanel/FormFileUpload/index.js +1 -7
  67. package/lib-next/theme/ApiDemoPanel/FormItem/index.js +1 -2
  68. package/lib-next/theme/ApiDemoPanel/FormMultiSelect/index.js +1 -5
  69. package/lib-next/theme/ApiDemoPanel/FormSelect/index.js +1 -3
  70. package/lib-next/theme/ApiDemoPanel/FormTextInput/index.js +1 -2
  71. package/lib-next/theme/ApiDemoPanel/LiveEditor/index.js +3 -6
  72. package/lib-next/theme/ApiDemoPanel/MethodEndpoint/index.js +1 -9
  73. package/lib-next/theme/ApiDemoPanel/ParamOptions/index.js +34 -29
  74. package/lib-next/theme/ApiDemoPanel/ParamOptions/slice.js +1 -0
  75. package/lib-next/theme/ApiDemoPanel/Request/index.js +1 -2
  76. package/lib-next/theme/ApiDemoPanel/Response/index.js +3 -9
  77. package/lib-next/theme/ApiDemoPanel/Response/slice.js +1 -0
  78. package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -5
  79. package/lib-next/theme/ApiDemoPanel/Server/index.js +3 -13
  80. package/lib-next/theme/ApiDemoPanel/Server/slice.js +1 -0
  81. package/lib-next/theme/ApiDemoPanel/buildPostmanRequest.js +12 -49
  82. package/lib-next/theme/ApiDemoPanel/index.js +2 -4
  83. package/lib-next/theme/ApiDemoPanel/persistanceMiddleware.js +5 -6
  84. package/lib-next/theme/ApiDemoPanel/storage-utils.js +1 -3
  85. package/lib-next/theme/ApiItem/Layout/index.js +8 -9
  86. package/lib-next/theme/ApiItem/Layout/styles.module.css +0 -403
  87. package/lib-next/theme/ApiItem/hooks.js +1 -0
  88. package/lib-next/theme/ApiItem/index.js +14 -13
  89. package/lib-next/theme/ApiItem/store.js +1 -0
  90. package/lib-next/theme/ApiLogo/index.js +1 -0
  91. package/lib-next/theme/styles.css +428 -0
  92. package/lib-next/theme-classic.d.ts +5 -0
  93. package/package.json +5 -5
  94. package/src/index.ts +5 -0
  95. package/src/theme/ApiDemoPanel/Execute/index.tsx +1 -0
  96. package/src/theme/ApiDemoPanel/index.tsx +1 -2
  97. package/src/theme/ApiItem/Layout/index.tsx +5 -6
  98. package/src/theme/ApiItem/Layout/styles.module.css +0 -403
  99. package/src/theme/ApiItem/index.tsx +5 -4
  100. package/src/theme/styles.css +428 -0
  101. package/src/theme-classic.d.ts +5 -0
  102. package/lib/theme/ApiDemoPanel/styles.module.css +0 -44
  103. package/lib/theme/ApiItem/Content/index.js +0 -65
  104. package/lib/theme/ApiItem/Footer/index.js +0 -78
  105. package/lib/theme/ApiItem/Footer/styles.module.css +0 -18
  106. package/lib/theme/ApiItem/Metadata/index.js +0 -32
  107. package/lib/theme/ApiItem/Paginator/index.js +0 -33
  108. package/lib/theme/ApiItem/TOC/Desktop/index.js +0 -31
  109. package/lib/theme/ApiItem/TOC/Mobile/index.js +0 -35
  110. package/lib/theme/ApiItem/TOC/Mobile/styles.module.css +0 -19
  111. package/lib-next/theme/ApiDemoPanel/styles.module.css +0 -44
  112. package/lib-next/theme/ApiItem/Content/index.js +0 -55
  113. package/lib-next/theme/ApiItem/Footer/index.js +0 -88
  114. package/lib-next/theme/ApiItem/Footer/styles.module.css +0 -18
  115. package/lib-next/theme/ApiItem/Metadata/index.js +0 -21
  116. package/lib-next/theme/ApiItem/Paginator/index.js +0 -19
  117. package/lib-next/theme/ApiItem/TOC/Desktop/index.js +0 -22
  118. package/lib-next/theme/ApiItem/TOC/Mobile/index.js +0 -24
  119. package/lib-next/theme/ApiItem/TOC/Mobile/styles.module.css +0 -19
  120. package/src/theme/ApiDemoPanel/styles.module.css +0 -44
  121. package/src/theme/ApiItem/Content/index.tsx +0 -57
  122. package/src/theme/ApiItem/Footer/index.tsx +0 -101
  123. package/src/theme/ApiItem/Footer/styles.module.css +0 -18
  124. package/src/theme/ApiItem/Metadata/index.tsx +0 -24
  125. package/src/theme/ApiItem/Paginator/index.tsx +0 -21
  126. package/src/theme/ApiItem/TOC/Desktop/index.tsx +0 -25
  127. package/src/theme/ApiItem/TOC/Mobile/index.tsx +0 -28
  128. package/src/theme/ApiItem/TOC/Mobile/styles.module.css +0 -19
@@ -4,6 +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
+
7
8
  import React, { useState, useEffect } from "react";
8
9
  import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
9
10
  import codegen from "@paloaltonetworks/postman-code-generators";
@@ -87,7 +88,6 @@ export const languageSet = [
87
88
  variant: "cURL",
88
89
  },
89
90
  ];
90
-
91
91
  function CodeTab({ children, hidden, className, onClick }) {
92
92
  return (
93
93
  <div
@@ -101,9 +101,9 @@ function CodeTab({ children, hidden, className, onClick }) {
101
101
  </div>
102
102
  );
103
103
  }
104
-
105
104
  function Curl({ postman, codeSamples }) {
106
105
  // TODO: match theme for vscode.
106
+
107
107
  const { siteConfig } = useDocusaurusContext();
108
108
  const contentType = useTypedSelector((state) => state.contentType.value);
109
109
  const accept = useTypedSelector((state) => state.accept.value);
@@ -113,8 +113,9 @@ function Curl({ postman, codeSamples }) {
113
113
  const queryParams = useTypedSelector((state) => state.params.query);
114
114
  const cookieParams = useTypedSelector((state) => state.params.cookie);
115
115
  const headerParams = useTypedSelector((state) => state.params.header);
116
- const auth = useTypedSelector((state) => state.auth); // TODO
116
+ const auth = useTypedSelector((state) => state.auth);
117
117
 
118
+ // TODO
118
119
  const langs = [
119
120
  ...(siteConfig?.themeConfig?.languageTabs ?? languageSet),
120
121
  ...codeSamples,
@@ -127,7 +128,6 @@ function Curl({ postman, codeSamples }) {
127
128
  if (langs.length === 1) {
128
129
  return langs[0];
129
130
  }
130
-
131
131
  return defaultLang[0] ?? langs[0];
132
132
  });
133
133
  const [codeText, setCodeText] = useState("");
@@ -153,7 +153,6 @@ function Curl({ postman, codeSamples }) {
153
153
  if (error) {
154
154
  return;
155
155
  }
156
-
157
156
  setCodeText(snippet);
158
157
  }
159
158
  );
@@ -162,11 +161,15 @@ function Curl({ postman, codeSamples }) {
162
161
  } else if (language && !language.options) {
163
162
  const langSource = languageSet.filter(
164
163
  (lang) => lang.language === language.language
165
- ); // Merges user-defined language with default languageSet
164
+ );
165
+
166
+ // Merges user-defined language with default languageSet
166
167
  // This allows users to define only the minimal properties necessary in languageTabs
167
168
  // User-defined properties should override languageSet properties
168
-
169
- const mergedLanguage = { ...langSource[0], ...language };
169
+ const mergedLanguage = {
170
+ ...langSource[0],
171
+ ...language,
172
+ };
170
173
  const postmanRequest = buildPostmanRequest(postman, {
171
174
  queryParams,
172
175
  pathParams,
@@ -187,7 +190,6 @@ function Curl({ postman, codeSamples }) {
187
190
  if (error) {
188
191
  return;
189
192
  }
190
-
191
193
  setCodeText(snippet);
192
194
  }
193
195
  );
@@ -207,11 +209,9 @@ function Curl({ postman, codeSamples }) {
207
209
  server,
208
210
  auth,
209
211
  ]);
210
-
211
212
  if (language === undefined) {
212
213
  return null;
213
214
  }
214
-
215
215
  return (
216
216
  <>
217
217
  <CodeTabs groupId="code-samples" action={setLanguage}>
@@ -237,5 +237,4 @@ function Curl({ postman, codeSamples }) {
237
237
  </>
238
238
  );
239
239
  }
240
-
241
240
  export default Curl;
@@ -4,13 +4,13 @@
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
+
7
8
  import React from "react";
8
9
  import Modal from "react-modal";
9
10
  import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
10
11
  import { setResponse } from "../Response/slice";
11
12
  import buildPostmanRequest from "./../buildPostmanRequest";
12
13
  import makeRequest from "./makeRequest";
13
-
14
14
  function validateRequest(params) {
15
15
  for (let paramList of Object.values(params)) {
16
16
  for (let param of paramList) {
@@ -19,10 +19,8 @@ function validateRequest(params) {
19
19
  }
20
20
  }
21
21
  }
22
-
23
22
  return true;
24
23
  }
25
-
26
24
  function Execute({ postman, proxy }) {
27
25
  const pathParams = useTypedSelector((state) => state.params.path);
28
26
  const queryParams = useTypedSelector((state) => state.params.query);
@@ -47,26 +45,21 @@ function Execute({ postman, proxy }) {
47
45
  server,
48
46
  auth,
49
47
  });
50
-
51
48
  const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
52
-
53
49
  function openModal() {
54
50
  setIsOpen(true);
55
51
  }
56
-
57
52
  function closeModal() {
58
53
  setIsOpen(false);
59
54
  }
60
-
61
55
  function acceptAgreement() {
62
56
  setIsOpen(false);
63
57
  setAgreementAccepted(true);
64
58
  sessionStorage.setItem("agreement-ack", "true");
65
59
  }
66
-
67
- const [modalIsOpen, setIsOpen] = React.useState(false); // Set the following as default value to persist to session and enable modal
60
+ const [modalIsOpen, setIsOpen] = React.useState(false);
61
+ // Set the following as default value to persist to session and enable modal
68
62
  // sessionStorage.getItem("agreement-ack") === "true"
69
-
70
63
  const [agreementAccepted, setAgreementAccepted] = React.useState(true);
71
64
  const customStyles = {
72
65
  overlay: {
@@ -87,15 +80,20 @@ function Execute({ postman, proxy }) {
87
80
  maxWidth: "550px",
88
81
  },
89
82
  };
90
-
91
83
  if (agreementAccepted) {
92
84
  return (
93
85
  <button
94
86
  className="button button--sm button--secondary"
95
87
  disabled={!isValidRequest}
88
+ style={
89
+ !isValidRequest
90
+ ? {
91
+ pointerEvents: "all",
92
+ }
93
+ : {}
94
+ }
96
95
  onClick={async () => {
97
96
  dispatch(setResponse("Fetching..."));
98
-
99
97
  try {
100
98
  await delay(1200);
101
99
  const res = await makeRequest(postmanRequest, proxy, body);
@@ -166,5 +164,4 @@ function Execute({ postman, proxy }) {
166
164
  );
167
165
  }
168
166
  }
169
-
170
167
  export default Execute;
@@ -4,6 +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
+
7
8
  function fetchWithtimeout(url, options, timeout = 5000) {
8
9
  return Promise.race([
9
10
  fetch(url, options),
@@ -12,42 +13,37 @@ function fetchWithtimeout(url, options, timeout = 5000) {
12
13
  ),
13
14
  ]);
14
15
  }
15
-
16
16
  async function loadImage(content) {
17
17
  return new Promise((accept, reject) => {
18
18
  const reader = new FileReader();
19
-
20
19
  reader.onabort = () => {
21
20
  console.log("file reading was aborted");
22
21
  reject();
23
22
  };
24
-
25
23
  reader.onerror = () => {
26
24
  console.log("file reading has failed");
27
25
  reject();
28
26
  };
29
-
30
27
  reader.onload = () => {
31
28
  // Do whatever you want with the file contents
32
29
  const binaryStr = reader.result;
33
30
  accept(binaryStr);
34
31
  };
35
-
36
32
  reader.readAsArrayBuffer(content);
37
33
  });
38
34
  }
39
-
40
35
  async function makeRequest(request, proxy, _body) {
41
36
  const headers = request.toJSON().header;
42
37
  let myHeaders = new Headers();
43
-
44
38
  if (headers) {
45
39
  headers.forEach((header) => {
46
40
  if (header.key && header.value) {
47
41
  myHeaders.append(header.key, header.value);
48
42
  }
49
43
  });
50
- } // The following code handles multiple files in the same formdata param.
44
+ }
45
+
46
+ // The following code handles multiple files in the same formdata param.
51
47
  // It removes the form data params where the src property is an array of filepath strings
52
48
  // Splits that array into different form data params with src set as a single filepath string
53
49
  // TODO:
@@ -120,12 +116,10 @@ async function makeRequest(request, proxy, _body) {
120
116
 
121
117
  const body = request.body?.toJSON();
122
118
  let myBody = undefined;
123
-
124
119
  if (body !== undefined && Object.keys(body).length > 0) {
125
120
  switch (body.mode) {
126
121
  case "urlencoded": {
127
122
  myBody = new URLSearchParams();
128
-
129
123
  if (Array.isArray(body.urlencoded)) {
130
124
  for (const data of body.urlencoded) {
131
125
  if (data.key && data.value) {
@@ -133,18 +127,14 @@ async function makeRequest(request, proxy, _body) {
133
127
  }
134
128
  }
135
129
  }
136
-
137
130
  break;
138
131
  }
139
-
140
132
  case "raw": {
141
133
  myBody = (body.raw ?? "").toString();
142
134
  break;
143
135
  }
144
-
145
136
  case "formdata": {
146
137
  myBody = new FormData();
147
-
148
138
  if (Array.isArray(body.formdata)) {
149
139
  for (const data of body.formdata) {
150
140
  if (data.key && data.value) {
@@ -152,39 +142,31 @@ async function makeRequest(request, proxy, _body) {
152
142
  }
153
143
  }
154
144
  }
155
-
156
145
  break;
157
146
  }
158
-
159
147
  case "file": {
160
148
  if (_body.type === "raw" && _body.content?.type === "file") {
161
149
  myBody = await loadImage(_body.content.value.content);
162
150
  }
163
-
164
151
  break;
165
152
  }
166
-
167
153
  default:
168
154
  break;
169
155
  }
170
156
  }
171
-
172
157
  const requestOptions = {
173
158
  method: request.method,
174
159
  headers: myHeaders,
175
160
  body: myBody,
176
161
  };
177
162
  let finalUrl = request.url.toString();
178
-
179
163
  if (proxy) {
180
164
  // Ensure the proxy ends with a slash.
181
165
  let normalizedProxy = proxy.replace(/\/$/, "") + "/";
182
166
  finalUrl = normalizedProxy + request.url.toString();
183
167
  }
184
-
185
168
  return await fetchWithtimeout(finalUrl, requestOptions).then((response) => {
186
169
  return response.text();
187
170
  });
188
171
  }
189
-
190
172
  export default makeRequest;
@@ -4,19 +4,16 @@
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
+
7
8
  import React from "react";
8
9
  import fileSaver from "file-saver";
9
-
10
10
  const saveFile = (url) => {
11
11
  let fileName;
12
-
13
12
  if (url.endsWith("json") || url.endsWith("yaml") || url.endsWith("yml")) {
14
13
  fileName = url.substring(url.lastIndexOf("/") + 1);
15
14
  }
16
-
17
15
  fileSaver.saveAs(url, fileName ? fileName : "openapi.txt");
18
16
  };
19
-
20
17
  function Export({ url, proxy }) {
21
18
  return (
22
19
  <div
@@ -45,5 +42,4 @@ function Export({ url, proxy }) {
45
42
  </div>
46
43
  );
47
44
  }
48
-
49
45
  export default Export;
@@ -4,9 +4,9 @@
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
+
7
8
  import React from "react";
8
9
  import styles from "./styles.module.css";
9
-
10
10
  function FloatingButton({ label, onClick, children }) {
11
11
  return (
12
12
  <div tabIndex={0} className={styles.floatingButton}>
@@ -19,5 +19,4 @@ function FloatingButton({ label, onClick, children }) {
19
19
  </div>
20
20
  );
21
21
  }
22
-
23
22
  export default FloatingButton;
@@ -4,11 +4,11 @@
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
+
7
8
  import React, { useState } from "react";
8
9
  import MagicDropzone from "react-magic-dropzone";
9
10
  import FloatingButton from "../FloatingButton";
10
11
  import styles from "./styles.module.css";
11
-
12
12
  function RenderPreview({ file }) {
13
13
  switch (file.type) {
14
14
  case "image/png":
@@ -24,7 +24,6 @@ function RenderPreview({ file }) {
24
24
  alt=""
25
25
  />
26
26
  );
27
-
28
27
  default:
29
28
  return (
30
29
  <div
@@ -58,22 +57,18 @@ function RenderPreview({ file }) {
58
57
  );
59
58
  }
60
59
  }
61
-
62
60
  function FormFileUpload({ placeholder, onChange }) {
63
61
  const [hover, setHover] = useState(false);
64
62
  const [file, setFile] = useState();
65
-
66
63
  function setAndNotifyFile(file) {
67
64
  setFile(file);
68
65
  onChange?.(file);
69
66
  }
70
-
71
67
  function handleDrop(accepted) {
72
68
  const [file] = accepted;
73
69
  setAndNotifyFile(file);
74
70
  setHover(false);
75
71
  }
76
-
77
72
  return (
78
73
  <FloatingButton>
79
74
  <MagicDropzone
@@ -108,5 +103,4 @@ function FormFileUpload({ placeholder, onChange }) {
108
103
  </FloatingButton>
109
104
  );
110
105
  }
111
-
112
106
  export default FormFileUpload;
@@ -4,9 +4,9 @@
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
+
7
8
  import React from "react";
8
9
  import styles from "./styles.module.css";
9
-
10
10
  function FormItem({ label, type, required, children }) {
11
11
  return (
12
12
  <div className={styles.formItem}>
@@ -33,5 +33,4 @@ function FormItem({ label, type, required, children }) {
33
33
  </div>
34
34
  );
35
35
  }
36
-
37
36
  export default FormItem;
@@ -4,16 +4,14 @@
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
+
7
8
  import React from "react";
8
9
  import styles from "./styles.module.css";
9
-
10
10
  function FormMultiSelect({ value, options, onChange }) {
11
11
  if (options.length === 0) {
12
12
  return null;
13
13
  }
14
-
15
14
  let height;
16
-
17
15
  if (options.length < 6) {
18
16
  const selectPadding = 12 * 2;
19
17
  const rawHeight = options.length * 29;
@@ -23,7 +21,6 @@ function FormMultiSelect({ value, options, onChange }) {
23
21
  height =
24
22
  rawHeight + innerMargins + outerMargins + selectPadding + mysteryScroll;
25
23
  }
26
-
27
24
  return (
28
25
  <select
29
26
  style={{
@@ -45,5 +42,4 @@ function FormMultiSelect({ value, options, onChange }) {
45
42
  </select>
46
43
  );
47
44
  }
48
-
49
45
  export default FormMultiSelect;
@@ -4,14 +4,13 @@
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
+
7
8
  import React from "react";
8
9
  import styles from "./styles.module.css";
9
-
10
10
  function FormSelect({ value, options, onChange }) {
11
11
  if (!Array.isArray(options) || options.length === 0) {
12
12
  return null;
13
13
  }
14
-
15
14
  return (
16
15
  <select className={styles.selectInput} value={value} onChange={onChange}>
17
16
  {options.map((option) => {
@@ -24,5 +23,4 @@ function FormSelect({ value, options, onChange }) {
24
23
  </select>
25
24
  );
26
25
  }
27
-
28
26
  export default FormSelect;
@@ -4,9 +4,9 @@
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
+
7
8
  import React from "react";
8
9
  import styles from "./styles.module.css";
9
-
10
10
  function FormTextInput({ value, placeholder, password, onChange }) {
11
11
  placeholder = placeholder?.split("\n")[0];
12
12
  return (
@@ -21,5 +21,4 @@ function FormTextInput({ value, placeholder, password, onChange }) {
21
21
  />
22
22
  );
23
23
  }
24
-
25
24
  export default FormTextInput;
@@ -4,24 +4,24 @@
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
+
7
8
  import React, { useEffect, useState } from "react";
8
9
  import { usePrismTheme } from "@docusaurus/theme-common";
9
10
  import useIsBrowser from "@docusaurus/useIsBrowser";
10
11
  import { LiveProvider, LiveEditor, withLive } from "react-live";
11
12
  import { setStringRawBody } from "../Body/slice";
12
13
  import styles from "./styles.module.css";
13
-
14
14
  function Live({ onEdit }) {
15
15
  const isBrowser = useIsBrowser();
16
- const [editorDisabled, setEditorDisabled] = useState(false); // TODO: Temporary solution for disabling tab key
16
+ const [editorDisabled, setEditorDisabled] = useState(false);
17
17
 
18
+ // TODO: Temporary solution for disabling tab key
18
19
  const handleKeydown = (event) => {
19
20
  if (event.key === "Tab") {
20
21
  event.preventDefault();
21
22
  setEditorDisabled(true);
22
23
  }
23
24
  };
24
-
25
25
  return (
26
26
  <div onClick={() => setEditorDisabled(false)}>
27
27
  <LiveEditor
@@ -34,9 +34,7 @@ function Live({ onEdit }) {
34
34
  </div>
35
35
  );
36
36
  }
37
-
38
37
  const LiveComponent = withLive(Live);
39
-
40
38
  function App({ children, transformCode, value, language, action, ...props }) {
41
39
  const prismTheme = usePrismTheme();
42
40
  const [code, setCode] = React.useState(children);
@@ -57,6 +55,5 @@ function App({ children, transformCode, value, language, action, ...props }) {
57
55
  </div>
58
56
  );
59
57
  }
60
-
61
58
  const LiveApp = withLive(App);
62
59
  export default LiveApp;
@@ -4,36 +4,29 @@
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
+
7
8
  import React from "react";
8
9
  const methodStyle = {
9
10
  borderRadius: "var(--ifm-global-radius)",
10
11
  };
11
-
12
12
  function colorForMethod(method) {
13
13
  switch (method.toLowerCase()) {
14
14
  case "get":
15
15
  return "primary";
16
-
17
16
  case "post":
18
17
  return "success";
19
-
20
18
  case "delete":
21
19
  return "danger";
22
-
23
20
  case "put":
24
21
  return "info";
25
-
26
22
  case "patch":
27
23
  return "warning";
28
-
29
24
  case "head":
30
25
  return "secondary";
31
-
32
26
  default:
33
27
  return undefined;
34
28
  }
35
29
  }
36
-
37
30
  function MethodEndpoint({ method, path }) {
38
31
  return (
39
32
  <pre
@@ -52,5 +45,4 @@ function MethodEndpoint({ method, path }) {
52
45
  </pre>
53
46
  );
54
47
  }
55
-
56
48
  export default MethodEndpoint;