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,33 +5,59 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- import React from "react";
8
+ import React, { useId } from "react";
9
+
10
+ import FormLabel from "@theme/ApiExplorer/FormLabel";
9
11
 
10
12
  export interface Props {
11
13
  value?: string;
12
14
  options?: string[];
13
15
  onChange?: React.ChangeEventHandler<HTMLSelectElement>;
16
+ label?: string;
17
+ type?: string;
18
+ required?: boolean;
19
+ ariaLabelledBy?: string;
20
+ ariaLabel?: string;
14
21
  }
15
22
 
16
- function FormSelect({ value, options, onChange }: Props) {
23
+ function FormSelect({
24
+ value,
25
+ options,
26
+ onChange,
27
+ label,
28
+ type,
29
+ required,
30
+ ariaLabelledBy,
31
+ ariaLabel,
32
+ }: Props) {
33
+ const id = useId();
34
+
17
35
  if (!Array.isArray(options) || options.length === 0) {
18
36
  return null;
19
37
  }
20
38
 
21
39
  return (
22
- <select
23
- className="openapi-explorer__select-input"
24
- value={value}
25
- onChange={onChange}
26
- >
27
- {options.map((option) => {
28
- return (
29
- <option key={option} value={option}>
30
- {option}
31
- </option>
32
- );
33
- })}
34
- </select>
40
+ <>
41
+ {label && (
42
+ <FormLabel htmlFor={id} label={label} type={type} required={required} />
43
+ )}
44
+ <select
45
+ id={label ? id : undefined}
46
+ className="openapi-explorer__select-input"
47
+ value={value}
48
+ onChange={onChange}
49
+ aria-labelledby={!label ? ariaLabelledBy : undefined}
50
+ aria-label={!label && !ariaLabelledBy ? ariaLabel : undefined}
51
+ >
52
+ {options.map((option) => {
53
+ return (
54
+ <option key={option} value={option}>
55
+ {option}
56
+ </option>
57
+ );
58
+ })}
59
+ </select>
60
+ </>
35
61
  );
36
62
  }
37
63
 
@@ -6,10 +6,11 @@
6
6
  * ========================================================================== */
7
7
 
8
8
  // @ts-nocheck
9
- import React from "react";
9
+ import React, { useId } from "react";
10
10
 
11
11
  import { translate } from "@docusaurus/Translate";
12
12
  import { ErrorMessage } from "@hookform/error-message";
13
+ import FormLabel from "@theme/ApiExplorer/FormLabel";
13
14
  import { OPENAPI_FORM } from "@theme/translationIds";
14
15
  import clsx from "clsx";
15
16
  import { useFormContext } from "react-hook-form";
@@ -21,6 +22,9 @@ export interface Props {
21
22
  onChange?: React.ChangeEventHandler<HTMLInputElement>;
22
23
  paramName?: string;
23
24
  isRequired?: boolean;
25
+ label?: string;
26
+ type?: string;
27
+ required?: boolean;
24
28
  }
25
29
 
26
30
  function FormTextInput({
@@ -30,7 +34,12 @@ function FormTextInput({
30
34
  password,
31
35
  onChange,
32
36
  paramName,
37
+ label,
38
+ type,
39
+ required,
33
40
  }: Props) {
41
+ const id = useId();
42
+
34
43
  placeholder = placeholder?.split("\n")[0];
35
44
 
36
45
  const {
@@ -42,6 +51,9 @@ function FormTextInput({
42
51
 
43
52
  return (
44
53
  <>
54
+ {label && (
55
+ <FormLabel htmlFor={id} label={label} type={type} required={required} />
56
+ )}
45
57
  {paramName ? (
46
58
  <input
47
59
  {...register(paramName, {
@@ -52,6 +64,7 @@ function FormTextInput({
52
64
  })
53
65
  : false,
54
66
  })}
67
+ id={label ? id : undefined}
55
68
  className={clsx("openapi-explorer__form-item-input", {
56
69
  error: showErrorMessage,
57
70
  })}
@@ -64,6 +77,7 @@ function FormTextInput({
64
77
  />
65
78
  ) : (
66
79
  <input
80
+ id={label ? id : undefined}
67
81
  className="openapi-explorer__form-item-input"
68
82
  type={password ? "password" : "text"}
69
83
  placeholder={placeholder}
@@ -10,6 +10,7 @@ import React, { useEffect, useState } from "react";
10
10
  import { translate } from "@docusaurus/Translate";
11
11
  import { ErrorMessage } from "@hookform/error-message";
12
12
  import { nanoid } from "@reduxjs/toolkit";
13
+ import FormLabel from "@theme/ApiExplorer/FormLabel";
13
14
  import FormSelect from "@theme/ApiExplorer/FormSelect";
14
15
  import FormTextInput from "@theme/ApiExplorer/FormTextInput";
15
16
  import { Param, setParam } from "@theme/ApiExplorer/ParamOptions/slice";
@@ -19,6 +20,9 @@ import { Controller, useFormContext } from "react-hook-form";
19
20
 
20
21
  export interface ParamProps {
21
22
  param: Param;
23
+ label?: string;
24
+ type?: string;
25
+ required?: boolean;
22
26
  }
23
27
 
24
28
  function ArrayItem({
@@ -31,6 +35,7 @@ function ArrayItem({
31
35
  if (param.schema?.items?.type === "boolean") {
32
36
  return (
33
37
  <FormSelect
38
+ ariaLabel={param.description || param.name}
34
39
  options={["---", "true", "false"]}
35
40
  onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
36
41
  const val = e.target.value;
@@ -52,7 +57,12 @@ function ArrayItem({
52
57
  );
53
58
  }
54
59
 
55
- export default function ParamArrayFormItem({ param }: ParamProps) {
60
+ export default function ParamArrayFormItem({
61
+ param,
62
+ label,
63
+ type,
64
+ required,
65
+ }: ParamProps) {
56
66
  const [items, setItems] = useState<{ id: string; value?: string }[]>([]);
57
67
  const dispatch = useTypedDispatch();
58
68
 
@@ -122,6 +132,7 @@ export default function ParamArrayFormItem({ param }: ParamProps) {
122
132
 
123
133
  return (
124
134
  <>
135
+ {label && <FormLabel label={label} type={type} required={required} />}
125
136
  <Controller
126
137
  control={control}
127
138
  rules={{
@@ -145,6 +156,7 @@ export default function ParamArrayFormItem({ param }: ParamProps) {
145
156
  <button
146
157
  className="openapi-explorer__delete-btn"
147
158
  onClick={handleDeleteItem(item)}
159
+ aria-label="Delete"
148
160
  >
149
161
  <svg
150
162
  focusable="false"
@@ -157,7 +169,6 @@ export default function ParamArrayFormItem({ param }: ParamProps) {
157
169
  aria-hidden="true"
158
170
  >
159
171
  <path 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"></path>
160
- <title>Delete</title>
161
172
  </svg>
162
173
  </button>
163
174
  </div>
@@ -17,9 +17,17 @@ import { Controller, useFormContext } from "react-hook-form";
17
17
 
18
18
  export interface ParamProps {
19
19
  param: Param;
20
+ label?: string;
21
+ type?: string;
22
+ required?: boolean;
20
23
  }
21
24
 
22
- export default function ParamBooleanFormItem({ param }: ParamProps) {
25
+ export default function ParamBooleanFormItem({
26
+ param,
27
+ label,
28
+ type,
29
+ required,
30
+ }: ParamProps) {
23
31
  const dispatch = useTypedDispatch();
24
32
 
25
33
  const {
@@ -44,6 +52,9 @@ export default function ParamBooleanFormItem({ param }: ParamProps) {
44
52
  name="paramBoolean"
45
53
  render={({ field: { onChange } }) => (
46
54
  <FormSelect
55
+ label={label}
56
+ type={type}
57
+ required={required}
47
58
  options={["---", "true", "false"]}
48
59
  onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
49
60
  const val = e.target.value;
@@ -18,9 +18,17 @@ import { Controller, useFormContext } from "react-hook-form";
18
18
 
19
19
  export interface ParamProps {
20
20
  param: Param;
21
+ label?: string;
22
+ type?: string;
23
+ required?: boolean;
21
24
  }
22
25
 
23
- export default function ParamMultiSelectFormItem({ param }: ParamProps) {
26
+ export default function ParamMultiSelectFormItem({
27
+ param,
28
+ label,
29
+ type,
30
+ required,
31
+ }: ParamProps) {
24
32
  const {
25
33
  control,
26
34
  formState: { errors },
@@ -75,6 +83,9 @@ export default function ParamMultiSelectFormItem({ param }: ParamProps) {
75
83
  name="paramMultiSelect"
76
84
  render={({ field: { onChange } }) => (
77
85
  <FormMultiSelect
86
+ label={label}
87
+ type={type}
88
+ required={required}
78
89
  options={options as string[]}
79
90
  onChange={(e: any) => handleChange(e, onChange)}
80
91
  showErrors={!!showErrorMessage}
@@ -18,9 +18,17 @@ import { Controller, useFormContext } from "react-hook-form";
18
18
 
19
19
  export interface ParamProps {
20
20
  param: Param;
21
+ label?: string;
22
+ type?: string;
23
+ required?: boolean;
21
24
  }
22
25
 
23
- export default function ParamSelectFormItem({ param }: ParamProps) {
26
+ export default function ParamSelectFormItem({
27
+ param,
28
+ label,
29
+ type,
30
+ required,
31
+ }: ParamProps) {
24
32
  const {
25
33
  control,
26
34
  formState: { errors },
@@ -47,6 +55,9 @@ export default function ParamSelectFormItem({ param }: ParamProps) {
47
55
  name="paramSelect"
48
56
  render={({ field: { onChange } }) => (
49
57
  <FormSelect
58
+ label={label}
59
+ type={type}
60
+ required={required}
50
61
  options={["---", ...(options as string[])]}
51
62
  onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
52
63
  const val = e.target.value;
@@ -13,12 +13,23 @@ import { useTypedDispatch } from "@theme/ApiItem/hooks";
13
13
 
14
14
  export interface ParamProps {
15
15
  param: Param;
16
+ label?: string;
17
+ type?: string;
18
+ required?: boolean;
16
19
  }
17
20
 
18
- export default function ParamTextFormItem({ param }: ParamProps) {
21
+ export default function ParamTextFormItem({
22
+ param,
23
+ label,
24
+ type,
25
+ required,
26
+ }: ParamProps) {
19
27
  const dispatch = useTypedDispatch();
20
28
  return (
21
29
  <FormTextInput
30
+ label={label}
31
+ type={type}
32
+ required={required}
22
33
  isRequired={param.required}
23
34
  paramName={param.name}
24
35
  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),
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- import React, { useState } from "react";
8
+ import React, { useState, useId } from "react";
9
9
 
10
10
  import { translate } from "@docusaurus/Translate";
11
11
  import FormItem from "@theme/ApiExplorer/FormItem";
@@ -19,6 +19,12 @@ import { OPENAPI_PARAM_OPTIONS } from "@theme/translationIds";
19
19
 
20
20
  import { Param } from "./slice";
21
21
 
22
+ export interface LabelProps {
23
+ label?: string;
24
+ type?: string;
25
+ required?: boolean;
26
+ }
27
+
22
28
  export interface ParamProps {
23
29
  param: Param;
24
30
  }
@@ -45,35 +51,80 @@ export function getSchemaEnum(schema: any): any[] | undefined {
45
51
  return undefined;
46
52
  }
47
53
 
48
- function ParamOption({ param }: ParamProps) {
54
+ function ParamOption({
55
+ param,
56
+ label,
57
+ type,
58
+ required,
59
+ }: ParamProps & LabelProps) {
49
60
  const schemaEnum = getSchemaEnum(param.schema);
50
61
  const itemsEnum = getSchemaEnum(param.schema?.items);
51
62
 
52
63
  if (param.schema?.type === "array" && itemsEnum) {
53
- return <ParamMultiSelectFormItem param={param} />;
64
+ return (
65
+ <ParamMultiSelectFormItem
66
+ param={param}
67
+ label={label}
68
+ type={type}
69
+ required={required}
70
+ />
71
+ );
54
72
  }
55
73
 
56
74
  if (param.schema?.type === "array") {
57
- return <ParamArrayFormItem param={param} />;
75
+ return (
76
+ <ParamArrayFormItem
77
+ param={param}
78
+ label={label}
79
+ type={type}
80
+ required={required}
81
+ />
82
+ );
58
83
  }
59
84
 
60
85
  if (schemaEnum) {
61
- return <ParamSelectFormItem param={param} />;
86
+ return (
87
+ <ParamSelectFormItem
88
+ param={param}
89
+ label={label}
90
+ type={type}
91
+ required={required}
92
+ />
93
+ );
62
94
  }
63
95
 
64
96
  if (param.schema?.type === "boolean") {
65
- return <ParamBooleanFormItem param={param} />;
97
+ return (
98
+ <ParamBooleanFormItem
99
+ param={param}
100
+ label={label}
101
+ type={type}
102
+ required={required}
103
+ />
104
+ );
66
105
  }
67
106
 
68
107
  // integer, number, string, int32, int64, float, double, object, byte, binary,
69
108
  // date-time, date, password
70
- return <ParamTextFormItem param={param} />;
109
+ return (
110
+ <ParamTextFormItem
111
+ param={param}
112
+ label={label}
113
+ type={type}
114
+ required={required}
115
+ />
116
+ );
71
117
  }
72
118
 
73
119
  function ParamOptionWrapper({ param }: ParamProps) {
74
120
  return (
75
- <FormItem label={param.name} type={param.in} required={param.required}>
76
- <ParamOption param={param} />
121
+ <FormItem>
122
+ <ParamOption
123
+ param={param}
124
+ label={param.name}
125
+ type={param.in}
126
+ required={param.required}
127
+ />
77
128
  </FormItem>
78
129
  );
79
130
  }
@@ -81,6 +132,8 @@ function ParamOptionWrapper({ param }: ParamProps) {
81
132
  function ParamOptions() {
82
133
  const [showOptional, setShowOptional] = useState(false);
83
134
 
135
+ const optionalId = useId();
136
+
84
137
  const pathParams = useTypedSelector((state: any) => state.params.path);
85
138
  const queryParams = useTypedSelector((state: any) => state.params.query);
86
139
  const cookieParams = useTypedSelector((state: any) => state.params.cookie);
@@ -109,6 +162,8 @@ function ParamOptions() {
109
162
  <button
110
163
  type="button"
111
164
  className="openapi-explorer__show-more-btn"
165
+ aria-expanded={showOptional}
166
+ aria-controls={optionalId}
112
167
  onClick={() => setShowOptional((prev) => !prev)}
113
168
  >
114
169
  <span
@@ -162,6 +217,7 @@ function ParamOptions() {
162
217
  ? "openapi-explorer__show-options"
163
218
  : "openapi-explorer__hide-options"
164
219
  }
220
+ id={optionalId}
165
221
  >
166
222
  {optionalParams.map((param) => (
167
223
  <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
  }
@@ -6,7 +6,7 @@
6
6
  * ========================================================================== */
7
7
 
8
8
  // @ts-nocheck
9
- import React, { useState } from "react";
9
+ import React, { useState, useId } from "react";
10
10
 
11
11
  import { useDoc } from "@docusaurus/plugin-content-docs/client";
12
12
  import { translate } from "@docusaurus/Translate";
@@ -67,6 +67,8 @@ function Request({ item }: { item: ApiItem }) {
67
67
  const [expandParams, setExpandParams] = useState(true);
68
68
  const [expandServer, setExpandServer] = useState(true);
69
69
 
70
+ const serverLabelId = useId();
71
+
70
72
  const allParams = [
71
73
  ...pathParams,
72
74
  ...queryParams,
@@ -251,7 +253,8 @@ function Request({ item }: { item: ApiItem }) {
251
253
  })}
252
254
  </span>
253
255
  {allDetailsExpanded ? (
254
- <span
256
+ <button
257
+ type="button"
255
258
  className="openapi-explorer__expand-details-btn"
256
259
  onClick={collapseAllDetails}
257
260
  >
@@ -259,9 +262,10 @@ function Request({ item }: { item: ApiItem }) {
259
262
  id: OPENAPI_REQUEST.COLLAPSE_ALL,
260
263
  message: "Collapse all",
261
264
  })}
262
- </span>
265
+ </button>
263
266
  ) : (
264
- <span
267
+ <button
268
+ type="button"
265
269
  className="openapi-explorer__expand-details-btn"
266
270
  onClick={expandAllDetails}
267
271
  >
@@ -269,7 +273,7 @@ function Request({ item }: { item: ApiItem }) {
269
273
  id: OPENAPI_REQUEST.EXPAND_ALL,
270
274
  message: "Expand all",
271
275
  })}
272
- </span>
276
+ </button>
273
277
  )}
274
278
  </div>
275
279
  <div className="openapi-explorer__details-outer-container">
@@ -279,6 +283,7 @@ function Request({ item }: { item: ApiItem }) {
279
283
  className="openapi-explorer__details-container"
280
284
  >
281
285
  <summary
286
+ id={serverLabelId}
282
287
  className="openapi-explorer__details-summary"
283
288
  onClick={(e) => {
284
289
  e.preventDefault();
@@ -290,7 +295,7 @@ function Request({ item }: { item: ApiItem }) {
290
295
  message: "Base URL",
291
296
  })}
292
297
  </summary>
293
- <Server />
298
+ <Server labelId={serverLabelId} />
294
299
  </details>
295
300
  )}
296
301
  {showAuth && (
@@ -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
  }
@@ -84,7 +84,8 @@ function Response({ item }: { item: ApiItem }) {
84
84
  <span className="openapi-explorer__response-title">
85
85
  {translate({ id: OPENAPI_RESPONSE.TITLE, message: "Response" })}
86
86
  </span>
87
- <span
87
+ <button
88
+ type="button"
88
89
  className="openapi-explorer__response-clear-btn"
89
90
  onClick={() => {
90
91
  dispatch(clearResponse());
@@ -93,7 +94,7 @@ function Response({ item }: { item: ApiItem }) {
93
94
  }}
94
95
  >
95
96
  {translate({ id: OPENAPI_RESPONSE.CLEAR, message: "Clear" })}
96
- </span>
97
+ </button>
97
98
  </div>
98
99
  <div
99
100
  style={{
@@ -17,7 +17,11 @@ import { OPENAPI_SERVER } from "@theme/translationIds";
17
17
 
18
18
  import { setServer, setServerVariable } from "./slice";
19
19
 
20
- function Server() {
20
+ interface ServerProps {
21
+ labelId?: string;
22
+ }
23
+
24
+ function Server({ labelId }: ServerProps) {
21
25
  const [isEditing, setIsEditing] = useState(false);
22
26
  const value = useTypedSelector((state: any) => state.server.value);
23
27
  const options = useTypedSelector((state: any) => state.server.options);
@@ -79,6 +83,7 @@ function Server() {
79
83
  >
80
84
  <FormItem>
81
85
  <FormSelect
86
+ ariaLabelledBy={labelId}
82
87
  options={options.map((s: any) => s.url)}
83
88
  onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
84
89
  dispatch(
@@ -99,8 +104,9 @@ function Server() {
99
104
  Object.keys(value.variables).map((key) => {
100
105
  if (value.variables?.[key].enum !== undefined) {
101
106
  return (
102
- <FormItem label={key}>
107
+ <FormItem>
103
108
  <FormSelect
109
+ label={key}
104
110
  options={value.variables[key].enum}
105
111
  onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
106
112
  dispatch(
@@ -115,8 +121,9 @@ function Server() {
115
121
  );
116
122
  }
117
123
  return (
118
- <FormItem label={key}>
124
+ <FormItem>
119
125
  <FormTextInput
126
+ label={key}
120
127
  placeholder={value.variables?.[key].default}
121
128
  onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
122
129
  dispatch(