docusaurus-theme-openapi-docs 1.4.5 → 1.4.7

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 (78) hide show
  1. package/lib/theme/ApiDemoPanel/Accept/index.js +3 -3
  2. package/lib/theme/ApiDemoPanel/Authorization/index.js +9 -9
  3. package/lib/theme/ApiDemoPanel/Authorization/slice.js +1 -1
  4. package/lib/theme/ApiDemoPanel/Body/index.js +9 -13
  5. package/lib/theme/ApiDemoPanel/CodeTabs/index.js +1 -1
  6. package/lib/theme/ApiDemoPanel/ContentType/index.js +3 -3
  7. package/lib/theme/ApiDemoPanel/Curl/index.js +3 -3
  8. package/lib/theme/ApiDemoPanel/Execute/index.js +3 -3
  9. package/lib/theme/ApiDemoPanel/FormFileUpload/index.js +1 -1
  10. package/lib/theme/ApiDemoPanel/LiveEditor/index.js +1 -1
  11. package/lib/theme/ApiDemoPanel/ParamOptions/index.js +6 -6
  12. package/lib/theme/ApiDemoPanel/Request/index.js +7 -7
  13. package/lib/theme/ApiDemoPanel/Response/index.js +1 -1
  14. package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -1
  15. package/lib/theme/ApiDemoPanel/Server/index.js +5 -5
  16. package/lib/theme/ApiDemoPanel/index.js +5 -5
  17. package/lib/theme/ApiDemoPanel/persistanceMiddleware.js +1 -1
  18. package/lib/theme/ApiItem/index.js +3 -3
  19. package/lib/theme/ApiItem/store.js +7 -7
  20. package/lib/theme/MimeTabs/index.js +4 -6
  21. package/lib/theme/ParamsItem/index.js +9 -3
  22. package/lib/theme/SchemaItem/index.js +4 -2
  23. package/lib/theme-openapi.d.ts +186 -0
  24. package/lib-next/theme/ApiDemoPanel/Accept/index.js +3 -3
  25. package/lib-next/theme/ApiDemoPanel/Authorization/index.js +9 -9
  26. package/lib-next/theme/ApiDemoPanel/Authorization/slice.js +1 -1
  27. package/lib-next/theme/ApiDemoPanel/Body/index.js +9 -11
  28. package/lib-next/theme/ApiDemoPanel/CodeTabs/index.js +1 -1
  29. package/lib-next/theme/ApiDemoPanel/ContentType/index.js +3 -3
  30. package/lib-next/theme/ApiDemoPanel/Curl/index.js +3 -3
  31. package/lib-next/theme/ApiDemoPanel/Execute/index.js +3 -3
  32. package/lib-next/theme/ApiDemoPanel/FormFileUpload/index.js +1 -1
  33. package/lib-next/theme/ApiDemoPanel/LiveEditor/index.js +1 -1
  34. package/lib-next/theme/ApiDemoPanel/ParamOptions/index.js +9 -6
  35. package/lib-next/theme/ApiDemoPanel/Request/index.js +7 -7
  36. package/lib-next/theme/ApiDemoPanel/Response/index.js +1 -1
  37. package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -1
  38. package/lib-next/theme/ApiDemoPanel/Server/index.js +5 -5
  39. package/lib-next/theme/ApiDemoPanel/index.js +5 -5
  40. package/lib-next/theme/ApiDemoPanel/persistanceMiddleware.js +4 -1
  41. package/lib-next/theme/ApiItem/index.js +3 -3
  42. package/lib-next/theme/ApiItem/store.js +7 -7
  43. package/lib-next/theme/MimeTabs/index.js +4 -6
  44. package/lib-next/theme/ParamsItem/index.js +9 -3
  45. package/lib-next/theme/SchemaItem/index.js +4 -2
  46. package/lib-next/theme-openapi.d.ts +186 -0
  47. package/package.json +3 -3
  48. package/src/theme/ApiDemoPanel/Accept/index.tsx +7 -6
  49. package/src/theme/ApiDemoPanel/Authorization/index.tsx +20 -19
  50. package/src/theme/ApiDemoPanel/Authorization/slice.ts +3 -2
  51. package/src/theme/ApiDemoPanel/Body/index.tsx +16 -18
  52. package/src/theme/ApiDemoPanel/CodeTabs/index.tsx +3 -2
  53. package/src/theme/ApiDemoPanel/ContentType/index.tsx +9 -6
  54. package/src/theme/ApiDemoPanel/Curl/index.tsx +14 -14
  55. package/src/theme/ApiDemoPanel/Execute/index.tsx +15 -15
  56. package/src/theme/ApiDemoPanel/Execute/makeRequest.ts +1 -2
  57. package/src/theme/ApiDemoPanel/FloatingButton/index.tsx +1 -1
  58. package/src/theme/ApiDemoPanel/FormFileUpload/index.tsx +2 -2
  59. package/src/theme/ApiDemoPanel/FormItem/index.tsx +1 -1
  60. package/src/theme/ApiDemoPanel/FormMultiSelect/index.tsx +1 -1
  61. package/src/theme/ApiDemoPanel/FormSelect/index.tsx +1 -1
  62. package/src/theme/ApiDemoPanel/FormTextInput/index.tsx +1 -1
  63. package/src/theme/ApiDemoPanel/LiveEditor/index.tsx +1 -1
  64. package/src/theme/ApiDemoPanel/MethodEndpoint/index.tsx +1 -1
  65. package/src/theme/ApiDemoPanel/ParamOptions/index.tsx +26 -16
  66. package/src/theme/ApiDemoPanel/Request/index.tsx +10 -10
  67. package/src/theme/ApiDemoPanel/Response/index.tsx +2 -2
  68. package/src/theme/ApiDemoPanel/SecuritySchemes/index.tsx +4 -5
  69. package/src/theme/ApiDemoPanel/Server/index.tsx +14 -13
  70. package/src/theme/ApiDemoPanel/buildPostmanRequest.ts +2 -3
  71. package/src/theme/ApiDemoPanel/index.tsx +5 -6
  72. package/src/theme/ApiDemoPanel/persistanceMiddleware.ts +8 -4
  73. package/src/theme/ApiItem/index.tsx +8 -5
  74. package/src/theme/ApiItem/store.ts +7 -8
  75. package/src/theme/MimeTabs/index.js +4 -6
  76. package/src/theme/ParamsItem/index.js +9 -3
  77. package/src/theme/SchemaItem/index.js +4 -2
  78. package/src/theme-openapi.d.ts +186 -0
@@ -7,16 +7,17 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
11
- import FormItem from "../FormItem";
12
- import FormSelect from "../FormSelect";
13
- import FormTextInput from "../FormTextInput";
10
+ import FormItem from "@theme/ApiDemoPanel/FormItem";
11
+ import FormSelect from "@theme/ApiDemoPanel/FormSelect";
12
+ import FormTextInput from "@theme/ApiDemoPanel/FormTextInput";
13
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
14
+
14
15
  import { setAuthData, setSelectedAuth } from "./slice";
15
16
 
16
17
  function Authorization() {
17
- const data = useTypedSelector((state) => state.auth.data);
18
- const options = useTypedSelector((state) => state.auth.options);
19
- const selected = useTypedSelector((state) => state.auth.selected);
18
+ const data = useTypedSelector((state: any) => state.auth.data);
19
+ const options = useTypedSelector((state: any) => state.auth.options);
20
+ const selected = useTypedSelector((state: any) => state.auth.selected);
20
21
 
21
22
  const dispatch = useTypedDispatch();
22
23
 
@@ -35,21 +36,21 @@ function Authorization() {
35
36
  <FormSelect
36
37
  options={optionKeys}
37
38
  value={selected}
38
- onChange={(e) => {
39
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
39
40
  dispatch(setSelectedAuth(e.target.value));
40
41
  }}
41
42
  />
42
43
  </FormItem>
43
44
  )}
44
- {selectedAuth.map((a) => {
45
+ {selectedAuth.map((a: any) => {
45
46
  if (a.type === "http" && a.scheme === "bearer") {
46
47
  return (
47
48
  <FormItem label="Bearer Token" key={a.key + "-bearer"}>
48
49
  <FormTextInput
49
50
  placeholder="Bearer Token"
50
51
  value={data[a.key].token ?? ""}
51
- onChange={(e) => {
52
- const value = e.target.value.trim();
52
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
53
+ const value = e.target.value;
53
54
  dispatch(
54
55
  setAuthData({
55
56
  scheme: a.key,
@@ -69,8 +70,8 @@ function Authorization() {
69
70
  <FormTextInput
70
71
  placeholder="Bearer Token"
71
72
  value={data[a.key].token ?? ""}
72
- onChange={(e) => {
73
- const value = e.target.value.trim();
73
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
74
+ const value = e.target.value;
74
75
  dispatch(
75
76
  setAuthData({
76
77
  scheme: a.key,
@@ -91,8 +92,8 @@ function Authorization() {
91
92
  <FormTextInput
92
93
  placeholder="Username"
93
94
  value={data[a.key].username ?? ""}
94
- onChange={(e) => {
95
- const value = e.target.value.trim();
95
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
96
+ const value = e.target.value;
96
97
  dispatch(
97
98
  setAuthData({
98
99
  scheme: a.key,
@@ -108,8 +109,8 @@ function Authorization() {
108
109
  placeholder="Password"
109
110
  password
110
111
  value={data[a.key].password ?? ""}
111
- onChange={(e) => {
112
- const value = e.target.value.trim();
112
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
113
+ const value = e.target.value;
113
114
  dispatch(
114
115
  setAuthData({
115
116
  scheme: a.key,
@@ -130,8 +131,8 @@ function Authorization() {
130
131
  <FormTextInput
131
132
  placeholder={`${a.key}`}
132
133
  value={data[a.key].apiKey ?? ""}
133
- onChange={(e) => {
134
- const value = e.target.value.trim();
134
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
135
+ const value = e.target.value;
135
136
  dispatch(
136
137
  setAuthData({
137
138
  scheme: a.key,
@@ -6,13 +6,14 @@
6
6
  * ========================================================================== */
7
7
 
8
8
  import { createSlice, PayloadAction } from "@reduxjs/toolkit";
9
+ import { createStorage, hashArray } from "@theme/ApiDemoPanel/storage-utils";
9
10
  import {
10
11
  SecurityRequirementObject,
11
12
  SecuritySchemeObject,
12
13
  } from "docusaurus-plugin-openapi-docs/src/openapi/types";
14
+ /* eslint-disable import/no-extraneous-dependencies*/
15
+ import { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
13
16
 
14
- import { ThemeConfig } from "../../../types";
15
- import { createStorage, hashArray } from "../storage-utils";
16
17
  import { getAuthDataKeys } from "./auth-types";
17
18
 
18
19
  // The global definitions
@@ -7,21 +7,19 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import json2xml from "@theme/ApiDemoPanel/Body/json2xml";
11
+ import ContentType from "@theme/ApiDemoPanel/ContentType";
12
+ import FormFileUpload from "@theme/ApiDemoPanel/FormFileUpload";
13
+ import FormItem from "@theme/ApiDemoPanel/FormItem";
14
+ import FormSelect from "@theme/ApiDemoPanel/FormSelect";
15
+ import FormTextInput from "@theme/ApiDemoPanel/FormTextInput";
16
+ import LiveApp from "@theme/ApiDemoPanel/LiveEditor";
17
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
18
+ import SchemaTabs from "@theme/SchemaTabs";
10
19
  import TabItem from "@theme/TabItem";
11
20
  import { RequestBodyObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
12
21
  import format from "xml-formatter";
13
22
 
14
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
15
- // @ts-ignore
16
- import SchemaTabs from "../../SchemaTabs";
17
- import ContentType from "../ContentType";
18
- import FormSelect from "../FormSelect";
19
- import LiveApp from "../LiveEditor";
20
- import FormFileUpload from "./../FormFileUpload";
21
- import FormItem from "./../FormItem";
22
- import FormTextInput from "./../FormTextInput";
23
- // @ts-ignore
24
- import json2xml from "./json2xml";
25
23
  import {
26
24
  clearFormBodyKey,
27
25
  clearRawBody,
@@ -30,13 +28,13 @@ import {
30
28
  setStringFormBody,
31
29
  } from "./slice";
32
30
 
33
- interface Props {
31
+ export interface Props {
34
32
  jsonRequestBodyExample: string;
35
33
  requestBodyMetadata?: RequestBodyObject;
36
34
  }
37
35
 
38
36
  function BodyWrap({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
39
- const contentType = useTypedSelector((state) => state.contentType.value);
37
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
40
38
 
41
39
  // NOTE: We used to check if body was required, but opted to always show the request body
42
40
  // to reduce confusion, see: https://github.com/cloud-annotations/docusaurus-openapi/issues/145
@@ -58,7 +56,7 @@ function BodyWrap({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
58
56
  }
59
57
 
60
58
  function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
61
- const contentType = useTypedSelector((state) => state.contentType.value);
59
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
62
60
  const required = requestBodyMetadata?.required;
63
61
 
64
62
  const dispatch = useTypedDispatch();
@@ -93,7 +91,7 @@ function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
93
91
  <FormItem label="Body" required={required}>
94
92
  <FormFileUpload
95
93
  placeholder={schema.description || "Body"}
96
- onChange={(file) => {
94
+ onChange={(file: any) => {
97
95
  if (file === undefined) {
98
96
  dispatch(clearRawBody());
99
97
  return;
@@ -138,7 +136,7 @@ function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
138
136
  >
139
137
  <FormFileUpload
140
138
  placeholder={val.description || key}
141
- onChange={(file) => {
139
+ onChange={(file: any) => {
142
140
  if (file === undefined) {
143
141
  dispatch(clearFormBodyKey(key));
144
142
  return;
@@ -170,7 +168,7 @@ function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
170
168
  >
171
169
  <FormSelect
172
170
  options={["---", ...val.enum]}
173
- onChange={(e) => {
171
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
174
172
  const val = e.target.value;
175
173
  if (val === "---") {
176
174
  dispatch(clearFormBodyKey(key));
@@ -199,7 +197,7 @@ function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
199
197
  >
200
198
  <FormTextInput
201
199
  placeholder={val.description || key}
202
- onChange={(e) => {
200
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
203
201
  dispatch(
204
202
  setStringFormBody({ key: key, value: e.target.value })
205
203
  );
@@ -14,10 +14,11 @@ import React, {
14
14
 
15
15
  import { duplicates } from "@docusaurus/theme-common";
16
16
  import useIsBrowser from "@docusaurus/useIsBrowser";
17
+ import { languageSet } from "@theme/ApiDemoPanel/Curl";
18
+ import { Language } from "@theme/ApiDemoPanel/Curl";
17
19
  import type { Props as TabItemProps } from "@theme/TabItem";
18
20
  import clsx from "clsx";
19
21
 
20
- import { languageSet } from "../Curl";
21
22
  import styles from "./styles.module.css";
22
23
 
23
24
  const {
@@ -133,7 +134,7 @@ function TabsComponent(props: Props): JSX.Element {
133
134
  setSelectedValue(newTabValue);
134
135
  if (action) {
135
136
  const newLanguage = languageSet.filter(
136
- (lang) => lang.language === newTabValue
137
+ (lang: Language) => lang.language === newTabValue
137
138
  );
138
139
  action(newLanguage[0]);
139
140
  }
@@ -7,14 +7,15 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
11
- import FormItem from "./../FormItem";
12
- import FormSelect from "./../FormSelect";
10
+ import FormItem from "@theme/ApiDemoPanel/FormItem";
11
+ import FormSelect from "@theme/ApiDemoPanel/FormSelect";
12
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
13
+
13
14
  import { setContentType } from "./slice";
14
15
 
15
16
  function ContentType() {
16
- const value = useTypedSelector((state) => state.contentType.value);
17
- const options = useTypedSelector((state) => state.contentType.options);
17
+ const value = useTypedSelector((state: any) => state.contentType.value);
18
+ const options = useTypedSelector((state: any) => state.contentType.options);
18
19
  const dispatch = useTypedDispatch();
19
20
 
20
21
  if (options.length <= 1) {
@@ -26,7 +27,9 @@ function ContentType() {
26
27
  <FormSelect
27
28
  value={value}
28
29
  options={options}
29
- onChange={(e) => dispatch(setContentType(e.target.value))}
30
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
31
+ dispatch(setContentType(e.target.value))
32
+ }
30
33
  />
31
34
  </FormItem>
32
35
  );
@@ -10,15 +10,15 @@ import React, { useState, useEffect } from "react";
10
10
  import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
11
11
  import codegen from "@paloaltonetworks/postman-code-generators";
12
12
  import sdk from "@paloaltonetworks/postman-collection";
13
+ import buildPostmanRequest from "@theme/ApiDemoPanel/buildPostmanRequest";
14
+ import CodeTabs from "@theme/ApiDemoPanel/CodeTabs";
15
+ import { useTypedSelector } from "@theme/ApiItem/hooks";
13
16
  import CodeBlock from "@theme/CodeBlock";
14
17
  import clsx from "clsx";
15
18
 
16
- import { useTypedSelector } from "../../ApiItem/hooks";
17
- import CodeTabs from "../CodeTabs";
18
- import buildPostmanRequest from "./../buildPostmanRequest";
19
19
  import styles from "./styles.module.css";
20
20
 
21
- interface Language {
21
+ export interface Language {
22
22
  highlight?: string;
23
23
  language: string;
24
24
  logoClass?: string;
@@ -102,7 +102,7 @@ export const languageSet: Language[] = [
102
102
  },
103
103
  ];
104
104
 
105
- interface Props {
105
+ export interface Props {
106
106
  postman: sdk.Request;
107
107
  codeSamples: any; // TODO: Type this...
108
108
  }
@@ -124,17 +124,17 @@ function Curl({ postman, codeSamples }: Props) {
124
124
 
125
125
  const { siteConfig } = useDocusaurusContext();
126
126
 
127
- const contentType = useTypedSelector((state) => state.contentType.value);
128
- const accept = useTypedSelector((state) => state.accept.value);
129
- const server = useTypedSelector((state) => state.server.value);
130
- const body = useTypedSelector((state) => state.body);
127
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
128
+ const accept = useTypedSelector((state: any) => state.accept.value);
129
+ const server = useTypedSelector((state: any) => state.server.value);
130
+ const body = useTypedSelector((state: any) => state.body);
131
131
 
132
- const pathParams = useTypedSelector((state) => state.params.path);
133
- const queryParams = useTypedSelector((state) => state.params.query);
134
- const cookieParams = useTypedSelector((state) => state.params.cookie);
135
- const headerParams = useTypedSelector((state) => state.params.header);
132
+ const pathParams = useTypedSelector((state: any) => state.params.path);
133
+ const queryParams = useTypedSelector((state: any) => state.params.query);
134
+ const cookieParams = useTypedSelector((state: any) => state.params.cookie);
135
+ const headerParams = useTypedSelector((state: any) => state.params.header);
136
136
 
137
- const auth = useTypedSelector((state) => state.auth);
137
+ const auth = useTypedSelector((state: any) => state.auth);
138
138
 
139
139
  // TODO
140
140
  const langs = [
@@ -8,12 +8,12 @@
8
8
  import React from "react";
9
9
 
10
10
  import sdk from "@paloaltonetworks/postman-collection";
11
+ import buildPostmanRequest from "@theme/ApiDemoPanel/buildPostmanRequest";
12
+ import { Param } from "@theme/ApiDemoPanel/ParamOptions/slice";
13
+ import { setResponse } from "@theme/ApiDemoPanel/Response/slice";
14
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
11
15
  import Modal from "react-modal";
12
16
 
13
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
14
- import { Param } from "../ParamOptions/slice";
15
- import { setResponse } from "../Response/slice";
16
- import buildPostmanRequest from "./../buildPostmanRequest";
17
17
  import makeRequest from "./makeRequest";
18
18
 
19
19
  function validateRequest(params: {
@@ -32,22 +32,22 @@ function validateRequest(params: {
32
32
  return true;
33
33
  }
34
34
 
35
- interface Props {
35
+ export interface Props {
36
36
  postman: sdk.Request;
37
37
  proxy?: string;
38
38
  }
39
39
 
40
40
  function Execute({ postman, proxy }: Props) {
41
- const pathParams = useTypedSelector((state) => state.params.path);
42
- const queryParams = useTypedSelector((state) => state.params.query);
43
- const cookieParams = useTypedSelector((state) => state.params.cookie);
44
- const headerParams = useTypedSelector((state) => state.params.header);
45
- const contentType = useTypedSelector((state) => state.contentType.value);
46
- const body = useTypedSelector((state) => state.body);
47
- const accept = useTypedSelector((state) => state.accept.value);
48
- const server = useTypedSelector((state) => state.server.value);
49
- const params = useTypedSelector((state) => state.params);
50
- const auth = useTypedSelector((state) => state.auth);
41
+ const pathParams = useTypedSelector((state: any) => state.params.path);
42
+ const queryParams = useTypedSelector((state: any) => state.params.query);
43
+ const cookieParams = useTypedSelector((state: any) => state.params.cookie);
44
+ const headerParams = useTypedSelector((state: any) => state.params.header);
45
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
46
+ const body = useTypedSelector((state: any) => state.body);
47
+ const accept = useTypedSelector((state: any) => state.accept.value);
48
+ const server = useTypedSelector((state: any) => state.server.value);
49
+ const params = useTypedSelector((state: any) => state.params);
50
+ const auth = useTypedSelector((state: any) => state.auth);
51
51
 
52
52
  const isValidRequest = validateRequest(params);
53
53
 
@@ -6,8 +6,7 @@
6
6
  * ========================================================================== */
7
7
 
8
8
  import sdk from "@paloaltonetworks/postman-collection";
9
-
10
- import { Body } from "../Body/slice";
9
+ import { Body } from "@theme/ApiDemoPanel/Body/slice";
11
10
 
12
11
  function fetchWithtimeout(
13
12
  url: string,
@@ -9,7 +9,7 @@ import React from "react";
9
9
 
10
10
  import styles from "./styles.module.css";
11
11
 
12
- interface Props {
12
+ export interface Props {
13
13
  label?: string;
14
14
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
15
15
  children?: React.ReactNode;
@@ -7,9 +7,9 @@
7
7
 
8
8
  import React, { useState } from "react";
9
9
 
10
+ import FloatingButton from "@theme/ApiDemoPanel/FloatingButton";
10
11
  import MagicDropzone from "react-magic-dropzone";
11
12
 
12
- import FloatingButton from "../FloatingButton";
13
13
  import styles from "./styles.module.css";
14
14
 
15
15
  type PreviewFile = { preview: string } & File;
@@ -61,7 +61,7 @@ function RenderPreview({ file }: RenderPreviewProps) {
61
61
  }
62
62
  }
63
63
 
64
- interface Props {
64
+ export interface Props {
65
65
  placeholder: string;
66
66
  onChange?(file?: File): any;
67
67
  }
@@ -9,7 +9,7 @@ import React from "react";
9
9
 
10
10
  import styles from "./styles.module.css";
11
11
 
12
- interface Props {
12
+ export interface Props {
13
13
  label?: string;
14
14
  type?: string;
15
15
  required?: boolean | undefined;
@@ -9,7 +9,7 @@ import React from "react";
9
9
 
10
10
  import styles from "./styles.module.css";
11
11
 
12
- interface Props {
12
+ export interface Props {
13
13
  value?: string;
14
14
  options: string[];
15
15
  onChange?: React.ChangeEventHandler<HTMLSelectElement>;
@@ -9,7 +9,7 @@ import React from "react";
9
9
 
10
10
  import styles from "./styles.module.css";
11
11
 
12
- interface Props {
12
+ export interface Props {
13
13
  value?: string;
14
14
  options?: string[];
15
15
  onChange?: React.ChangeEventHandler<HTMLSelectElement>;
@@ -9,7 +9,7 @@ import React from "react";
9
9
 
10
10
  import styles from "./styles.module.css";
11
11
 
12
- interface Props {
12
+ export interface Props {
13
13
  value?: string;
14
14
  placeholder?: string;
15
15
  password?: boolean;
@@ -9,9 +9,9 @@ import React, { useEffect, useState } from "react";
9
9
 
10
10
  import { usePrismTheme } from "@docusaurus/theme-common";
11
11
  import useIsBrowser from "@docusaurus/useIsBrowser";
12
+ import { setStringRawBody } from "@theme/ApiDemoPanel/Body/slice";
12
13
  import { LiveProvider, LiveEditor, withLive } from "react-live";
13
14
 
14
- import { setStringRawBody } from "../Body/slice";
15
15
  import styles from "./styles.module.css";
16
16
 
17
17
  function Live({ onEdit }: any) {
@@ -30,7 +30,7 @@ function colorForMethod(method: string) {
30
30
  }
31
31
  }
32
32
 
33
- interface Props {
33
+ export interface Props {
34
34
  method: string;
35
35
  path: string;
36
36
  }
@@ -8,16 +8,16 @@
8
8
  import React, { useState, useEffect } from "react";
9
9
 
10
10
  import { nanoid } from "@reduxjs/toolkit";
11
+ import FormItem from "@theme/ApiDemoPanel/FormItem";
12
+ import FormMultiSelect from "@theme/ApiDemoPanel/FormMultiSelect";
13
+ import FormSelect from "@theme/ApiDemoPanel/FormSelect";
14
+ import FormTextInput from "@theme/ApiDemoPanel/FormTextInput";
15
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
11
16
 
12
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
13
- import FormItem from "./../FormItem";
14
- import FormMultiSelect from "./../FormMultiSelect";
15
- import FormSelect from "./../FormSelect";
16
- import FormTextInput from "./../FormTextInput";
17
17
  import { Param, setParam } from "./slice";
18
18
  import styles from "./styles.module.css";
19
19
 
20
- interface ParamProps {
20
+ export interface ParamProps {
21
21
  param: Param;
22
22
  }
23
23
 
@@ -54,10 +54,10 @@ function ParamOptionWrapper({ param }: ParamProps) {
54
54
  function ParamOptions() {
55
55
  const [showOptional, setShowOptional] = useState(false);
56
56
 
57
- const pathParams = useTypedSelector((state) => state.params.path);
58
- const queryParams = useTypedSelector((state) => state.params.query);
59
- const cookieParams = useTypedSelector((state) => state.params.cookie);
60
- const headerParams = useTypedSelector((state) => state.params.header);
57
+ const pathParams = useTypedSelector((state: any) => state.params.path);
58
+ const queryParams = useTypedSelector((state: any) => state.params.query);
59
+ const cookieParams = useTypedSelector((state: any) => state.params.cookie);
60
+ const headerParams = useTypedSelector((state: any) => state.params.header);
61
61
 
62
62
  const allParams = [
63
63
  ...pathParams,
@@ -142,7 +142,7 @@ function ArrayItem({
142
142
  return (
143
143
  <FormSelect
144
144
  options={["---", "true", "false"]}
145
- onChange={(e) => {
145
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
146
146
  const val = e.target.value;
147
147
  onChange(val === "---" ? undefined : val);
148
148
  }}
@@ -153,7 +153,7 @@ function ArrayItem({
153
153
  return (
154
154
  <FormTextInput
155
155
  placeholder={param.description || param.name}
156
- onChange={(e) => {
156
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
157
157
  onChange(e.target.value);
158
158
  }}
159
159
  />
@@ -246,7 +246,7 @@ function ParamSelectFormItem({ param }: ParamProps) {
246
246
  return (
247
247
  <FormSelect
248
248
  options={["---", ...(options as string[])]}
249
- onChange={(e) => {
249
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
250
250
  const val = e.target.value;
251
251
  dispatch(
252
252
  setParam({
@@ -265,7 +265,7 @@ function ParamBooleanFormItem({ param }: ParamProps) {
265
265
  return (
266
266
  <FormSelect
267
267
  options={["---", "true", "false"]}
268
- onChange={(e) => {
268
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
269
269
  const val = e.target.value;
270
270
  dispatch(
271
271
  setParam({
@@ -286,7 +286,7 @@ function ParamMultiSelectFormItem({ param }: ParamProps) {
286
286
  return (
287
287
  <FormMultiSelect
288
288
  options={options as string[]}
289
- onChange={(e) => {
289
+ onChange={(e: any) => {
290
290
  const values = Array.prototype.filter
291
291
  .call(e.target.options, (o) => o.selected)
292
292
  .map((o) => o.value);
@@ -308,7 +308,17 @@ function ParamTextFormItem({ param }: ParamProps) {
308
308
  return (
309
309
  <FormTextInput
310
310
  placeholder={param.description || param.name}
311
- onChange={(e) => dispatch(setParam({ ...param, value: e.target.value }))}
311
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
312
+ dispatch(
313
+ setParam({
314
+ ...param,
315
+ value:
316
+ param.in === "path" || param.in === "query"
317
+ ? e.target.value.replace(/\s/g, "%20")
318
+ : e.target.value,
319
+ })
320
+ )
321
+ }
312
322
  />
313
323
  );
314
324
  }
@@ -7,26 +7,26 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import { ThemeConfig } from "@docusaurus/types";
10
11
  import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
11
12
  import sdk from "@paloaltonetworks/postman-collection";
13
+ import Accept from "@theme/ApiDemoPanel/Accept";
14
+ import Authorization from "@theme/ApiDemoPanel/Authorization";
15
+ import Body from "@theme/ApiDemoPanel/Body";
16
+ import Execute from "@theme/ApiDemoPanel/Execute";
17
+ import ParamOptions from "@theme/ApiDemoPanel/ParamOptions";
18
+ import Server from "@theme/ApiDemoPanel/Server";
19
+ import { useTypedSelector } from "@theme/ApiItem/hooks";
12
20
  import { ParameterObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
13
21
  import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
14
22
 
15
- import { ThemeConfig } from "../../../types";
16
- import { useTypedSelector } from "../../ApiItem/hooks";
17
- import Accept from "../Accept";
18
- import Authorization from "../Authorization";
19
- import Body from "../Body";
20
- import Execute from "../Execute";
21
- import ParamOptions from "../ParamOptions";
22
- import Server from "../Server";
23
23
  import styles from "./styles.module.css";
24
24
 
25
25
  function Request({ item }: { item: NonNullable<ApiItem> }) {
26
- const response = useTypedSelector((state) => state.response.value);
26
+ const response = useTypedSelector((state: any) => state.response.value);
27
27
  const { siteConfig } = useDocusaurusContext();
28
28
  const themeConfig = siteConfig.themeConfig as ThemeConfig;
29
- const options = themeConfig.api;
29
+ const options = themeConfig.api as ApiItem;
30
30
  const postman = new sdk.Request(item.postman);
31
31
 
32
32
  const params = {
@@ -7,9 +7,9 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
10
11
  import CodeBlock from "@theme/CodeBlock";
11
12
 
12
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
13
13
  import { clearResponse } from "./slice";
14
14
 
15
15
  // TODO: We probably shouldn't attempt to format XML...
@@ -33,7 +33,7 @@ function formatXml(xml: string) {
33
33
  }
34
34
 
35
35
  function Response() {
36
- const response = useTypedSelector((state) => state.response.value);
36
+ const response = useTypedSelector((state: any) => state.response.value);
37
37
  const dispatch = useTypedDispatch();
38
38
 
39
39
  if (response === undefined) {
@@ -8,12 +8,11 @@
8
8
  import React from "react";
9
9
 
10
10
  import Link from "@docusaurus/Link";
11
-
12
- import { useTypedSelector } from "../../ApiItem/hooks";
11
+ import { useTypedSelector } from "@theme/ApiItem/hooks";
13
12
 
14
13
  function SecuritySchemes(props: any) {
15
- const options = useTypedSelector((state) => state.auth.options);
16
- const selected = useTypedSelector((state) => state.auth.selected);
14
+ const options = useTypedSelector((state: any) => state.auth.options);
15
+ const selected = useTypedSelector((state: any) => state.auth.selected);
17
16
  const infoAuthPath = `/${props.infoPath}#authentication`;
18
17
 
19
18
  if (selected === undefined) return null;
@@ -24,7 +23,7 @@ function SecuritySchemes(props: any) {
24
23
  <summary className={`details__request-summary`}>
25
24
  <h4>Authorization</h4>
26
25
  </summary>
27
- {selectedAuth.map((auth) => {
26
+ {selectedAuth.map((auth: any) => {
28
27
  const isApiKey = auth.type === "apiKey";
29
28
  const isBearer = auth.type === "http" && auth.key === "Bearer";
30
29
  const isOauth2 = auth.type === "oauth2";