docusaurus-theme-openapi-docs 0.0.0-1109 → 0.0.0-1130

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 (69) hide show
  1. package/lib/index.js +2 -0
  2. package/lib/theme/ApiExplorer/Accept/index.js +2 -1
  3. package/lib/theme/ApiExplorer/Authorization/index.js +12 -18
  4. package/lib/theme/ApiExplorer/Body/FormBodyItem/index.d.ts +3 -1
  5. package/lib/theme/ApiExplorer/Body/FormBodyItem/index.js +61 -29
  6. package/lib/theme/ApiExplorer/Body/index.js +4 -6
  7. package/lib/theme/ApiExplorer/ContentType/index.js +2 -1
  8. package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
  9. package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -4
  10. package/lib/theme/ApiExplorer/FormItem/index.js +2 -26
  11. package/lib/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
  12. package/lib/theme/ApiExplorer/FormLabel/index.d.ts +9 -0
  13. package/lib/theme/ApiExplorer/FormLabel/index.js +50 -0
  14. package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +4 -1
  15. package/lib/theme/ApiExplorer/FormMultiSelect/index.js +97 -19
  16. package/lib/theme/ApiExplorer/FormSelect/index.d.ts +6 -1
  17. package/lib/theme/ApiExplorer/FormSelect/index.js +96 -15
  18. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +4 -1
  19. package/lib/theme/ApiExplorer/FormTextInput/index.js +71 -1
  20. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +4 -1
  21. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +11 -3
  22. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +4 -1
  23. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +4 -1
  24. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +4 -1
  25. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +4 -1
  26. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +4 -1
  27. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +4 -1
  28. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +4 -1
  29. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +4 -1
  30. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
  31. package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +5 -0
  32. package/lib/theme/ApiExplorer/ParamOptions/index.js +27 -3
  33. package/lib/theme/ApiExplorer/Request/_Request.scss +11 -0
  34. package/lib/theme/ApiExplorer/Request/index.js +9 -3
  35. package/lib/theme/ApiExplorer/Response/_Response.scss +11 -0
  36. package/lib/theme/ApiExplorer/Response/index.js +2 -1
  37. package/lib/theme/ApiExplorer/Server/index.d.ts +4 -1
  38. package/lib/theme/ApiExplorer/Server/index.js +6 -3
  39. package/lib/theme/Schema/index.js +83 -7
  40. package/lib/theme/styles.scss +1 -0
  41. package/package.json +4 -3
  42. package/src/index.ts +2 -0
  43. package/src/theme/ApiExplorer/Accept/index.tsx +2 -1
  44. package/src/theme/ApiExplorer/Authorization/index.tsx +27 -33
  45. package/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx +44 -26
  46. package/src/theme/ApiExplorer/Body/index.tsx +7 -8
  47. package/src/theme/ApiExplorer/ContentType/index.tsx +2 -1
  48. package/src/theme/ApiExplorer/FormItem/_FormItem.scss +0 -5
  49. package/src/theme/ApiExplorer/FormItem/index.tsx +2 -16
  50. package/src/theme/ApiExplorer/FormLabel/_FormLabel.scss +4 -0
  51. package/src/theme/ApiExplorer/FormLabel/index.tsx +43 -0
  52. package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +40 -20
  53. package/src/theme/ApiExplorer/FormSelect/index.tsx +41 -15
  54. package/src/theme/ApiExplorer/FormTextInput/index.tsx +15 -1
  55. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +13 -2
  56. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +12 -1
  57. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +12 -1
  58. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +12 -1
  59. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +12 -1
  60. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +0 -9
  61. package/src/theme/ApiExplorer/ParamOptions/index.tsx +65 -9
  62. package/src/theme/ApiExplorer/Request/_Request.scss +11 -0
  63. package/src/theme/ApiExplorer/Request/index.tsx +11 -6
  64. package/src/theme/ApiExplorer/Response/_Response.scss +11 -0
  65. package/src/theme/ApiExplorer/Response/index.tsx +3 -2
  66. package/src/theme/ApiExplorer/Server/index.tsx +10 -3
  67. package/src/theme/Schema/index.tsx +97 -7
  68. package/src/theme/styles.scss +1 -0
  69. package/tsconfig.tsbuildinfo +1 -1
@@ -5,31 +5,112 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
+ var __createBinding =
9
+ (this && this.__createBinding) ||
10
+ (Object.create
11
+ ? function (o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (
15
+ !desc ||
16
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
17
+ ) {
18
+ desc = {
19
+ enumerable: true,
20
+ get: function () {
21
+ return m[k];
22
+ },
23
+ };
24
+ }
25
+ Object.defineProperty(o, k2, desc);
26
+ }
27
+ : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+ var __setModuleDefault =
32
+ (this && this.__setModuleDefault) ||
33
+ (Object.create
34
+ ? function (o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }
37
+ : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar =
41
+ (this && this.__importStar) ||
42
+ (function () {
43
+ var ownKeys = function (o) {
44
+ ownKeys =
45
+ Object.getOwnPropertyNames ||
46
+ function (o) {
47
+ var ar = [];
48
+ for (var k in o)
49
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50
+ return ar;
51
+ };
52
+ return ownKeys(o);
53
+ };
54
+ return function (mod) {
55
+ if (mod && mod.__esModule) return mod;
56
+ var result = {};
57
+ if (mod != null)
58
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
59
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
8
64
  var __importDefault =
9
65
  (this && this.__importDefault) ||
10
66
  function (mod) {
11
67
  return mod && mod.__esModule ? mod : { default: mod };
12
68
  };
13
69
  Object.defineProperty(exports, "__esModule", { value: true });
14
- const react_1 = __importDefault(require("react"));
15
- function FormSelect({ value, options, onChange }) {
70
+ const react_1 = __importStar(require("react"));
71
+ const FormLabel_1 = __importDefault(require("@theme/ApiExplorer/FormLabel"));
72
+ function FormSelect({
73
+ value,
74
+ options,
75
+ onChange,
76
+ label,
77
+ type,
78
+ required,
79
+ ariaLabelledBy,
80
+ ariaLabel,
81
+ }) {
82
+ const id = (0, react_1.useId)();
16
83
  if (!Array.isArray(options) || options.length === 0) {
17
84
  return null;
18
85
  }
19
86
  return react_1.default.createElement(
20
- "select",
21
- {
22
- className: "openapi-explorer__select-input",
23
- value: value,
24
- onChange: onChange,
25
- },
26
- options.map((option) => {
27
- return react_1.default.createElement(
28
- "option",
29
- { key: option, value: option },
30
- option
31
- );
32
- })
87
+ react_1.default.Fragment,
88
+ null,
89
+ label &&
90
+ react_1.default.createElement(FormLabel_1.default, {
91
+ htmlFor: id,
92
+ label: label,
93
+ type: type,
94
+ required: required,
95
+ }),
96
+ react_1.default.createElement(
97
+ "select",
98
+ {
99
+ id: label ? id : undefined,
100
+ className: "openapi-explorer__select-input",
101
+ value: value,
102
+ onChange: onChange,
103
+ "aria-labelledby": !label ? ariaLabelledBy : undefined,
104
+ "aria-label": !label && !ariaLabelledBy ? ariaLabel : undefined,
105
+ },
106
+ options.map((option) => {
107
+ return react_1.default.createElement(
108
+ "option",
109
+ { key: option, value: option },
110
+ option
111
+ );
112
+ })
113
+ )
33
114
  );
34
115
  }
35
116
  exports.default = FormSelect;
@@ -6,6 +6,9 @@ export interface Props {
6
6
  onChange?: React.ChangeEventHandler<HTMLInputElement>;
7
7
  paramName?: string;
8
8
  isRequired?: boolean;
9
+ label?: string;
10
+ type?: string;
11
+ required?: boolean;
9
12
  }
10
- declare function FormTextInput({ isRequired, value, placeholder, password, onChange, paramName, }: Props): React.JSX.Element;
13
+ declare function FormTextInput({ isRequired, value, placeholder, password, onChange, paramName, label, type, required, }: Props): React.JSX.Element;
11
14
  export default FormTextInput;
@@ -5,6 +5,62 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
+ var __createBinding =
9
+ (this && this.__createBinding) ||
10
+ (Object.create
11
+ ? function (o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (
15
+ !desc ||
16
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
17
+ ) {
18
+ desc = {
19
+ enumerable: true,
20
+ get: function () {
21
+ return m[k];
22
+ },
23
+ };
24
+ }
25
+ Object.defineProperty(o, k2, desc);
26
+ }
27
+ : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+ var __setModuleDefault =
32
+ (this && this.__setModuleDefault) ||
33
+ (Object.create
34
+ ? function (o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }
37
+ : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar =
41
+ (this && this.__importStar) ||
42
+ (function () {
43
+ var ownKeys = function (o) {
44
+ ownKeys =
45
+ Object.getOwnPropertyNames ||
46
+ function (o) {
47
+ var ar = [];
48
+ for (var k in o)
49
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50
+ return ar;
51
+ };
52
+ return ownKeys(o);
53
+ };
54
+ return function (mod) {
55
+ if (mod && mod.__esModule) return mod;
56
+ var result = {};
57
+ if (mod != null)
58
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
59
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
8
64
  var __importDefault =
9
65
  (this && this.__importDefault) ||
10
66
  function (mod) {
@@ -12,9 +68,10 @@ var __importDefault =
12
68
  };
13
69
  Object.defineProperty(exports, "__esModule", { value: true });
14
70
  // @ts-nocheck
15
- const react_1 = __importDefault(require("react"));
71
+ const react_1 = __importStar(require("react"));
16
72
  const Translate_1 = require("@docusaurus/Translate");
17
73
  const error_message_1 = require("@hookform/error-message");
74
+ const FormLabel_1 = __importDefault(require("@theme/ApiExplorer/FormLabel"));
18
75
  const translationIds_1 = require("@theme/translationIds");
19
76
  const clsx_1 = __importDefault(require("clsx"));
20
77
  const react_hook_form_1 = require("react-hook-form");
@@ -25,7 +82,11 @@ function FormTextInput({
25
82
  password,
26
83
  onChange,
27
84
  paramName,
85
+ label,
86
+ type,
87
+ required,
28
88
  }) {
89
+ const id = (0, react_1.useId)();
29
90
  placeholder = placeholder?.split("\n")[0];
30
91
  const {
31
92
  register,
@@ -35,6 +96,13 @@ function FormTextInput({
35
96
  return react_1.default.createElement(
36
97
  react_1.default.Fragment,
37
98
  null,
99
+ label &&
100
+ react_1.default.createElement(FormLabel_1.default, {
101
+ htmlFor: id,
102
+ label: label,
103
+ type: type,
104
+ required: required,
105
+ }),
38
106
  paramName
39
107
  ? react_1.default.createElement("input", {
40
108
  ...register(paramName, {
@@ -45,6 +113,7 @@ function FormTextInput({
45
113
  })
46
114
  : false,
47
115
  }),
116
+ id: label ? id : undefined,
48
117
  className: (0, clsx_1.default)("openapi-explorer__form-item-input", {
49
118
  error: showErrorMessage,
50
119
  }),
@@ -56,6 +125,7 @@ function FormTextInput({
56
125
  autoComplete: "off",
57
126
  })
58
127
  : react_1.default.createElement("input", {
128
+ id: label ? id : undefined,
59
129
  className: "openapi-explorer__form-item-input",
60
130
  type: password ? "password" : "text",
61
131
  placeholder: placeholder,
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamArrayFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamArrayFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -72,6 +72,7 @@ const react_1 = __importStar(require("react"));
72
72
  const Translate_1 = require("@docusaurus/Translate");
73
73
  const error_message_1 = require("@hookform/error-message");
74
74
  const toolkit_1 = require("@reduxjs/toolkit");
75
+ const FormLabel_1 = __importDefault(require("@theme/ApiExplorer/FormLabel"));
75
76
  const FormSelect_1 = __importDefault(require("@theme/ApiExplorer/FormSelect"));
76
77
  const FormTextInput_1 = __importDefault(
77
78
  require("@theme/ApiExplorer/FormTextInput")
@@ -84,6 +85,7 @@ function ArrayItem({ param, onChange, initialValue }) {
84
85
  const [value, setValue] = (0, react_1.useState)(initialValue || "");
85
86
  if (param.schema?.items?.type === "boolean") {
86
87
  return react_1.default.createElement(FormSelect_1.default, {
88
+ ariaLabel: param.description || param.name,
87
89
  options: ["---", "true", "false"],
88
90
  onChange: (e) => {
89
91
  const val = e.target.value;
@@ -100,7 +102,7 @@ function ArrayItem({ param, onChange, initialValue }) {
100
102
  },
101
103
  });
102
104
  }
103
- function ParamArrayFormItem({ param }) {
105
+ function ParamArrayFormItem({ param, label, type, required }) {
104
106
  const [items, setItems] = (0, react_1.useState)([]);
105
107
  const dispatch = (0, hooks_1.useTypedDispatch)();
106
108
  const {
@@ -158,6 +160,12 @@ function ParamArrayFormItem({ param }) {
158
160
  return react_1.default.createElement(
159
161
  react_1.default.Fragment,
160
162
  null,
163
+ label &&
164
+ react_1.default.createElement(FormLabel_1.default, {
165
+ label: label,
166
+ type: type,
167
+ required: required,
168
+ }),
161
169
  react_1.default.createElement(react_hook_form_1.Controller, {
162
170
  control: control,
163
171
  rules: {
@@ -187,6 +195,7 @@ function ParamArrayFormItem({ param }) {
187
195
  {
188
196
  className: "openapi-explorer__delete-btn",
189
197
  onClick: handleDeleteItem(item),
198
+ "aria-label": "Delete",
190
199
  },
191
200
  react_1.default.createElement(
192
201
  "svg",
@@ -202,8 +211,7 @@ function ParamArrayFormItem({ param }) {
202
211
  },
203
212
  react_1.default.createElement("path", {
204
213
  d: "M24 9.4L22.6 8 16 14.6 9.4 8 8 9.4 14.6 16 8 22.6 9.4 24 16 17.4 22.6 24 24 22.6 17.4 16 24 9.4z",
205
- }),
206
- react_1.default.createElement("title", null, "Delete")
214
+ })
207
215
  )
208
216
  )
209
217
  )
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamBooleanFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamBooleanFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -20,7 +20,7 @@ const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
20
20
  const hooks_1 = require("@theme/ApiItem/hooks");
21
21
  const translationIds_1 = require("@theme/translationIds");
22
22
  const react_hook_form_1 = require("react-hook-form");
23
- function ParamBooleanFormItem({ param }) {
23
+ function ParamBooleanFormItem({ param, label, type, required }) {
24
24
  const dispatch = (0, hooks_1.useTypedDispatch)();
25
25
  const {
26
26
  control,
@@ -43,6 +43,9 @@ function ParamBooleanFormItem({ param }) {
43
43
  name: "paramBoolean",
44
44
  render: ({ field: { onChange } }) =>
45
45
  react_1.default.createElement(FormSelect_1.default, {
46
+ label: label,
47
+ type: type,
48
+ required: required,
46
49
  options: ["---", "true", "false"],
47
50
  onChange: (e) => {
48
51
  const val = e.target.value;
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamMultiSelectFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamMultiSelectFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -23,7 +23,7 @@ const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
23
23
  const hooks_1 = require("@theme/ApiItem/hooks");
24
24
  const translationIds_1 = require("@theme/translationIds");
25
25
  const react_hook_form_1 = require("react-hook-form");
26
- function ParamMultiSelectFormItem({ param }) {
26
+ function ParamMultiSelectFormItem({ param, label, type, required }) {
27
27
  const {
28
28
  control,
29
29
  formState: { errors },
@@ -78,6 +78,9 @@ function ParamMultiSelectFormItem({ param }) {
78
78
  name: "paramMultiSelect",
79
79
  render: ({ field: { onChange } }) =>
80
80
  react_1.default.createElement(FormMultiSelect_1.default, {
81
+ label: label,
82
+ type: type,
83
+ required: required,
81
84
  options: options,
82
85
  onChange: (e) => handleChange(e, onChange),
83
86
  showErrors: !!showErrorMessage,
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamSelectFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamSelectFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -21,7 +21,7 @@ const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
21
21
  const hooks_1 = require("@theme/ApiItem/hooks");
22
22
  const translationIds_1 = require("@theme/translationIds");
23
23
  const react_hook_form_1 = require("react-hook-form");
24
- function ParamSelectFormItem({ param }) {
24
+ function ParamSelectFormItem({ param, label, type, required }) {
25
25
  const {
26
26
  control,
27
27
  formState: { errors },
@@ -45,6 +45,9 @@ function ParamSelectFormItem({ param }) {
45
45
  name: "paramSelect",
46
46
  render: ({ field: { onChange } }) =>
47
47
  react_1.default.createElement(FormSelect_1.default, {
48
+ label: label,
49
+ type: type,
50
+ required: required,
48
51
  options: ["---", ...options],
49
52
  onChange: (e) => {
50
53
  const val = e.target.value;
@@ -2,5 +2,8 @@ import React from "react";
2
2
  import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
3
3
  export interface ParamProps {
4
4
  param: Param;
5
+ label?: string;
6
+ type?: string;
7
+ required?: boolean;
5
8
  }
6
- export default function ParamTextFormItem({ param }: ParamProps): React.JSX.Element;
9
+ export default function ParamTextFormItem({ param, label, type, required, }: ParamProps): React.JSX.Element;
@@ -18,9 +18,12 @@ const FormTextInput_1 = __importDefault(
18
18
  );
19
19
  const slice_1 = require("@theme/ApiExplorer/ParamOptions/slice");
20
20
  const hooks_1 = require("@theme/ApiItem/hooks");
21
- function ParamTextFormItem({ param }) {
21
+ function ParamTextFormItem({ param, label, type, required }) {
22
22
  const dispatch = (0, hooks_1.useTypedDispatch)();
23
23
  return react_1.default.createElement(FormTextInput_1.default, {
24
+ label: label,
25
+ type: type,
26
+ required: required,
24
27
  isRequired: param.required,
25
28
  paramName: param.name,
26
29
  placeholder: param.description || param.name,
@@ -63,15 +63,10 @@
63
63
  margin-top: calc(var(--ifm-pre-padding) / 2);
64
64
  background-color: var(--openapi-input-background);
65
65
  border: none;
66
- outline: none;
67
66
  color: var(--ifm-pre-color);
68
67
  border-radius: 4px;
69
68
  margin-left: 4px;
70
69
 
71
- &:focus {
72
- outline: 0;
73
- }
74
-
75
70
  &:active {
76
71
  box-shadow: inset 0px 0px 0px 2px var(--openapi-input-border);
77
72
  }
@@ -102,10 +97,6 @@
102
97
  background-color: var(--openapi-input-border);
103
98
  }
104
99
 
105
- &:focus {
106
- outline: 0;
107
- }
108
-
109
100
  &:active {
110
101
  box-shadow:
111
102
  inset 0 0 0 1px var(--openapi-input-border),
@@ -1,5 +1,10 @@
1
1
  import React from "react";
2
2
  import { Param } from "./slice";
3
+ export interface LabelProps {
4
+ label?: string;
5
+ type?: string;
6
+ required?: boolean;
7
+ }
3
8
  export interface ParamProps {
4
9
  param: Param;
5
10
  }
@@ -107,44 +107,65 @@ function getSchemaEnum(schema) {
107
107
  }
108
108
  return undefined;
109
109
  }
110
- function ParamOption({ param }) {
110
+ function ParamOption({ param, label, type, required }) {
111
111
  const schemaEnum = getSchemaEnum(param.schema);
112
112
  const itemsEnum = getSchemaEnum(param.schema?.items);
113
113
  if (param.schema?.type === "array" && itemsEnum) {
114
114
  return react_1.default.createElement(ParamMultiSelectFormItem_1.default, {
115
115
  param: param,
116
+ label: label,
117
+ type: type,
118
+ required: required,
116
119
  });
117
120
  }
118
121
  if (param.schema?.type === "array") {
119
122
  return react_1.default.createElement(ParamArrayFormItem_1.default, {
120
123
  param: param,
124
+ label: label,
125
+ type: type,
126
+ required: required,
121
127
  });
122
128
  }
123
129
  if (schemaEnum) {
124
130
  return react_1.default.createElement(ParamSelectFormItem_1.default, {
125
131
  param: param,
132
+ label: label,
133
+ type: type,
134
+ required: required,
126
135
  });
127
136
  }
128
137
  if (param.schema?.type === "boolean") {
129
138
  return react_1.default.createElement(ParamBooleanFormItem_1.default, {
130
139
  param: param,
140
+ label: label,
141
+ type: type,
142
+ required: required,
131
143
  });
132
144
  }
133
145
  // integer, number, string, int32, int64, float, double, object, byte, binary,
134
146
  // date-time, date, password
135
147
  return react_1.default.createElement(ParamTextFormItem_1.default, {
136
148
  param: param,
149
+ label: label,
150
+ type: type,
151
+ required: required,
137
152
  });
138
153
  }
139
154
  function ParamOptionWrapper({ param }) {
140
155
  return react_1.default.createElement(
141
156
  FormItem_1.default,
142
- { label: param.name, type: param.in, required: param.required },
143
- react_1.default.createElement(ParamOption, { param: param })
157
+ null,
158
+ react_1.default.createElement(ParamOption, {
159
+ param: param,
160
+ label: param.name,
161
+ type: param.in,
162
+ required: param.required,
163
+ })
144
164
  );
145
165
  }
146
166
  function ParamOptions() {
147
167
  const [showOptional, setShowOptional] = (0, react_1.useState)(false);
168
+ const optionalId = (0, react_1.useId)();
148
169
  const pathParams = (0, hooks_1.useTypedSelector)(
149
170
  (state) => state.params.path
150
171
  );
@@ -183,6 +204,8 @@ function ParamOptions() {
183
204
  {
184
205
  type: "button",
185
206
  className: "openapi-explorer__show-more-btn",
207
+ "aria-expanded": showOptional,
208
+ "aria-controls": optionalId,
186
209
  onClick: () => setShowOptional((prev) => !prev),
187
210
  },
188
211
  react_1.default.createElement(
@@ -241,6 +264,7 @@ function ParamOptions() {
241
264
  className: showOptional
242
265
  ? "openapi-explorer__show-options"
243
266
  : "openapi-explorer__hide-options",
267
+ id: optionalId,
244
268
  },
245
269
  optionalParams.map((param) =>
246
270
  react_1.default.createElement(ParamOptionWrapper, {
@@ -48,6 +48,17 @@
48
48
  }
49
49
 
50
50
  .openapi-explorer__expand-details-btn {
51
+ -webkit-appearance: none;
52
+ -moz-appearance: none;
53
+ appearance: none;
54
+ padding: 0;
55
+ cursor: pointer;
56
+ border: 0px solid transparent;
57
+ background-color: transparent;
58
+ text-transform: inherit;
59
+ font-weight: inherit;
60
+ font-size: inherit;
61
+
51
62
  &:hover {
52
63
  cursor: pointer;
53
64
  }
@@ -140,6 +140,7 @@ function Request({ item }) {
140
140
  const [expandBody, setExpandBody] = (0, react_1.useState)(true);
141
141
  const [expandParams, setExpandParams] = (0, react_1.useState)(true);
142
142
  const [expandServer, setExpandServer] = (0, react_1.useState)(true);
143
+ const serverLabelId = (0, react_1.useId)();
143
144
  const allParams = [
144
145
  ...pathParams,
145
146
  ...queryParams,
@@ -313,8 +314,9 @@ function Request({ item }) {
313
314
  ),
314
315
  allDetailsExpanded
315
316
  ? react_1.default.createElement(
316
- "span",
317
+ "button",
317
318
  {
319
+ type: "button",
318
320
  className: "openapi-explorer__expand-details-btn",
319
321
  onClick: collapseAllDetails,
320
322
  },
@@ -324,8 +326,9 @@ function Request({ item }) {
324
326
  })
325
327
  )
326
328
  : react_1.default.createElement(
327
- "span",
329
+ "button",
328
330
  {
331
+ type: "button",
329
332
  className: "openapi-explorer__expand-details-btn",
330
333
  onClick: expandAllDetails,
331
334
  },
@@ -349,6 +352,7 @@ function Request({ item }) {
349
352
  react_1.default.createElement(
350
353
  "summary",
351
354
  {
355
+ id: serverLabelId,
352
356
  className: "openapi-explorer__details-summary",
353
357
  onClick: (e) => {
354
358
  e.preventDefault();
@@ -360,7 +364,9 @@ function Request({ item }) {
360
364
  message: "Base URL",
361
365
  })
362
366
  ),
363
- react_1.default.createElement(Server_1.default, null)
367
+ react_1.default.createElement(Server_1.default, {
368
+ labelId: serverLabelId,
369
+ })
364
370
  ),
365
371
  showAuth &&
366
372
  react_1.default.createElement(
@@ -43,6 +43,17 @@
43
43
  }
44
44
 
45
45
  .openapi-explorer__response-clear-btn {
46
+ -webkit-appearance: none;
47
+ -moz-appearance: none;
48
+ appearance: none;
49
+ padding: 0;
50
+ cursor: pointer;
51
+ border: 0px solid transparent;
52
+ background-color: transparent;
53
+ text-transform: inherit;
54
+ font-weight: inherit;
55
+ font-size: inherit;
56
+
46
57
  &:hover {
47
58
  cursor: pointer;
48
59
  }
@@ -152,8 +152,9 @@ function Response({ item }) {
152
152
  })
153
153
  ),
154
154
  react_1.default.createElement(
155
- "span",
155
+ "button",
156
156
  {
157
+ type: "button",
157
158
  className: "openapi-explorer__response-clear-btn",
158
159
  onClick: () => {
159
160
  dispatch((0, slice_1.clearResponse)());
@@ -1,3 +1,6 @@
1
1
  import React from "react";
2
- declare function Server(): React.JSX.Element | null;
2
+ interface ServerProps {
3
+ labelId?: string;
4
+ }
5
+ declare function Server({ labelId }: ServerProps): React.JSX.Element | null;
3
6
  export default Server;