docusaurus-theme-openapi-docs 0.0.0-391 → 0.0.0-392

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.
@@ -22,8 +22,10 @@ function FloatingButton({
22
22
  onClick,
23
23
  children
24
24
  }) {
25
- return <div className={_stylesModule.default.floatingButton}>
26
- {label && <button onClick={onClick}>{label}</button>}
25
+ return <div tabIndex={0} className={_stylesModule.default.floatingButton}>
26
+ {label && <button tabIndex={0} onClick={onClick}>
27
+ {label}
28
+ </button>}
27
29
  {children}
28
30
  </div>;
29
31
  }
@@ -9,7 +9,6 @@
9
9
  border-radius: var(--ifm-global-radius);
10
10
  color: var(--ifm-color-white);
11
11
  cursor: pointer;
12
- outline: none;
13
12
  padding: 0.4rem 0.5rem;
14
13
  opacity: 0;
15
14
  visibility: hidden;
@@ -20,7 +19,9 @@
20
19
  right: calc(var(--ifm-pre-padding) / 2);
21
20
  }
22
21
 
23
- .floatingButton:hover button {
22
+ .floatingButton:hover button,
23
+ .floatingButton:focus-visible button,
24
+ .floatingButton button:focus-visible {
24
25
  visibility: visible;
25
26
  opacity: 1;
26
27
  }
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _themeCommon = require("@docusaurus/theme-common");
11
11
 
@@ -19,6 +19,10 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.css"));
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
22
26
  /* ============================================================================
23
27
  * Copyright (c) Palo Alto Networks
24
28
  *
@@ -29,9 +33,18 @@ function Live({
29
33
  onEdit
30
34
  }) {
31
35
  const isBrowser = (0, _useIsBrowser.default)();
32
- return <>
33
- <_reactLive.LiveEditor key={String(isBrowser)} className={_stylesModule.default.playgroundEditor} onChange={onEdit} />
34
- </>;
36
+ const [editorDisabled, setEditorDisabled] = (0, _react.useState)(false); // TODO: Temporary solution for disabling tab key
37
+
38
+ const handleKeydown = event => {
39
+ if (event.key === "Tab") {
40
+ event.preventDefault();
41
+ setEditorDisabled(true);
42
+ }
43
+ };
44
+
45
+ return <div onClick={() => setEditorDisabled(false)}>
46
+ <_reactLive.LiveEditor key={String(isBrowser)} className={_stylesModule.default.playgroundEditor} onChange={onEdit} disabled={editorDisabled} onKeyDown={handleKeydown} />
47
+ </div>;
35
48
  }
36
49
 
37
50
  const LiveComponent = (0, _reactLive.withLive)(Live);
@@ -41,10 +41,6 @@
41
41
  display: block;
42
42
  }
43
43
 
44
- .showMoreButton:focus {
45
- outline: 0;
46
- }
47
-
48
44
  .showMoreButton:hover {
49
45
  /* text-decoration: underline; */
50
46
  /* background-color: red; */
@@ -73,7 +73,7 @@ function Server() {
73
73
  }
74
74
 
75
75
  return <div className={_stylesModule.default.optionsPanel}>
76
- <button className={_stylesModule.default.showMoreButton} onClick={() => setIsEditing(false)}>
76
+ <button className={_stylesModule.default.showMoreButton} onClick={() => setIsEditing(false)} tabIndex={0}>
77
77
  Hide
78
78
  </button>
79
79
  <_FormItem.default label="Endpoint">
@@ -28,10 +28,6 @@
28
28
  display: block;
29
29
  }
30
30
 
31
- .showMoreButton:focus {
32
- outline: 0;
33
- }
34
-
35
31
  .showMoreButton:hover {
36
32
  /* text-decoration: underline; */
37
33
  /* background-color: red; */
@@ -9,8 +9,12 @@ import styles from "./styles.module.css";
9
9
 
10
10
  function FloatingButton({ label, onClick, children }) {
11
11
  return (
12
- <div className={styles.floatingButton}>
13
- {label && <button onClick={onClick}>{label}</button>}
12
+ <div tabIndex={0} className={styles.floatingButton}>
13
+ {label && (
14
+ <button tabIndex={0} onClick={onClick}>
15
+ {label}
16
+ </button>
17
+ )}
14
18
  {children}
15
19
  </div>
16
20
  );
@@ -9,7 +9,6 @@
9
9
  border-radius: var(--ifm-global-radius);
10
10
  color: var(--ifm-color-white);
11
11
  cursor: pointer;
12
- outline: none;
13
12
  padding: 0.4rem 0.5rem;
14
13
  opacity: 0;
15
14
  visibility: hidden;
@@ -20,7 +19,9 @@
20
19
  right: calc(var(--ifm-pre-padding) / 2);
21
20
  }
22
21
 
23
- .floatingButton:hover button {
22
+ .floatingButton:hover button,
23
+ .floatingButton:focus-visible button,
24
+ .floatingButton button:focus-visible {
24
25
  visibility: visible;
25
26
  opacity: 1;
26
27
  }
@@ -4,7 +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
- import React from "react";
7
+ import React, { useState } from "react";
8
8
  import { usePrismTheme } from "@docusaurus/theme-common";
9
9
  import useIsBrowser from "@docusaurus/useIsBrowser";
10
10
  import { LiveProvider, LiveEditor, withLive } from "react-live";
@@ -13,14 +13,25 @@ import styles from "./styles.module.css";
13
13
 
14
14
  function Live({ onEdit }) {
15
15
  const isBrowser = useIsBrowser();
16
+ const [editorDisabled, setEditorDisabled] = useState(false); // TODO: Temporary solution for disabling tab key
17
+
18
+ const handleKeydown = (event) => {
19
+ if (event.key === "Tab") {
20
+ event.preventDefault();
21
+ setEditorDisabled(true);
22
+ }
23
+ };
24
+
16
25
  return (
17
- <>
26
+ <div onClick={() => setEditorDisabled(false)}>
18
27
  <LiveEditor
19
28
  key={String(isBrowser)}
20
29
  className={styles.playgroundEditor}
21
30
  onChange={onEdit}
31
+ disabled={editorDisabled}
32
+ onKeyDown={handleKeydown}
22
33
  />
23
- </>
34
+ </div>
24
35
  );
25
36
  }
26
37
 
@@ -41,10 +41,6 @@
41
41
  display: block;
42
42
  }
43
43
 
44
- .showMoreButton:focus {
45
- outline: 0;
46
- }
47
-
48
44
  .showMoreButton:hover {
49
45
  /* text-decoration: underline; */
50
46
  /* background-color: red; */
@@ -62,6 +62,7 @@ function Server() {
62
62
  <button
63
63
  className={styles.showMoreButton}
64
64
  onClick={() => setIsEditing(false)}
65
+ tabIndex={0}
65
66
  >
66
67
  Hide
67
68
  </button>
@@ -28,10 +28,6 @@
28
28
  display: block;
29
29
  }
30
30
 
31
- .showMoreButton:focus {
32
- outline: 0;
33
- }
34
-
35
31
  .showMoreButton:hover {
36
32
  /* text-decoration: underline; */
37
33
  /* background-color: red; */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "0.0.0-391",
4
+ "version": "0.0.0-392",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -50,7 +50,7 @@
50
50
  "buffer": "^6.0.3",
51
51
  "clsx": "^1.1.1",
52
52
  "crypto-js": "^4.1.1",
53
- "docusaurus-plugin-openapi-docs": "0.0.0-391",
53
+ "docusaurus-plugin-openapi-docs": "0.0.0-392",
54
54
  "immer": "^9.0.7",
55
55
  "lodash": "^4.17.20",
56
56
  "process": "^0.11.10",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "f61f756a734fd90ac876ce7af67f68e4204aa35d"
71
+ "gitHead": "04ea33fa332252a40c87d8018afe6cdb91cbdf8a"
72
72
  }
@@ -17,8 +17,12 @@ interface Props {
17
17
 
18
18
  function FloatingButton({ label, onClick, children }: Props) {
19
19
  return (
20
- <div className={styles.floatingButton}>
21
- {label && <button onClick={onClick}>{label}</button>}
20
+ <div tabIndex={0} className={styles.floatingButton}>
21
+ {label && (
22
+ <button tabIndex={0} onClick={onClick}>
23
+ {label}
24
+ </button>
25
+ )}
22
26
  {children}
23
27
  </div>
24
28
  );
@@ -9,7 +9,6 @@
9
9
  border-radius: var(--ifm-global-radius);
10
10
  color: var(--ifm-color-white);
11
11
  cursor: pointer;
12
- outline: none;
13
12
  padding: 0.4rem 0.5rem;
14
13
  opacity: 0;
15
14
  visibility: hidden;
@@ -20,7 +19,9 @@
20
19
  right: calc(var(--ifm-pre-padding) / 2);
21
20
  }
22
21
 
23
- .floatingButton:hover button {
22
+ .floatingButton:hover button,
23
+ .floatingButton:focus-visible button,
24
+ .floatingButton button:focus-visible {
24
25
  visibility: visible;
25
26
  opacity: 1;
26
27
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- import React from "react";
8
+ import React, { useState } from "react";
9
9
 
10
10
  import { usePrismTheme } from "@docusaurus/theme-common";
11
11
  import useIsBrowser from "@docusaurus/useIsBrowser";
@@ -16,14 +16,26 @@ import styles from "./styles.module.css";
16
16
 
17
17
  function Live({ onEdit }: any) {
18
18
  const isBrowser = useIsBrowser();
19
+ const [editorDisabled, setEditorDisabled] = useState(false);
20
+
21
+ // TODO: Temporary solution for disabling tab key
22
+ const handleKeydown = (event: React.KeyboardEvent) => {
23
+ if (event.key === "Tab") {
24
+ event.preventDefault();
25
+ setEditorDisabled(true);
26
+ }
27
+ };
28
+
19
29
  return (
20
- <>
30
+ <div onClick={() => setEditorDisabled(false)}>
21
31
  <LiveEditor
22
32
  key={String(isBrowser)}
23
33
  className={styles.playgroundEditor}
24
34
  onChange={onEdit}
35
+ disabled={editorDisabled}
36
+ onKeyDown={handleKeydown}
25
37
  />
26
- </>
38
+ </div>
27
39
  );
28
40
  }
29
41
 
@@ -41,10 +41,6 @@
41
41
  display: block;
42
42
  }
43
43
 
44
- .showMoreButton:focus {
45
- outline: 0;
46
- }
47
-
48
44
  .showMoreButton:hover {
49
45
  /* text-decoration: underline; */
50
46
  /* background-color: red; */
@@ -62,6 +62,7 @@ function Server() {
62
62
  <button
63
63
  className={styles.showMoreButton}
64
64
  onClick={() => setIsEditing(false)}
65
+ tabIndex={0}
65
66
  >
66
67
  Hide
67
68
  </button>
@@ -28,10 +28,6 @@
28
28
  display: block;
29
29
  }
30
30
 
31
- .showMoreButton:focus {
32
- outline: 0;
33
- }
34
-
35
31
  .showMoreButton:hover {
36
32
  /* text-decoration: underline; */
37
33
  /* background-color: red; */