@redocly/theme 0.9.3 → 0.9.5

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.
@@ -31,15 +31,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
32
32
  });
33
33
  };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
34
37
  Object.defineProperty(exports, "__esModule", { value: true });
35
38
  exports.CopyButton = void 0;
36
39
  const react_1 = __importStar(require("react"));
40
+ const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
37
41
  const Button_1 = require("../Button");
38
42
  const CopyButton = ({ text, dataTestId = 'copy-button' }) => {
39
43
  const [title, setTitle] = (0, react_1.useState)('Copy');
40
44
  function write() {
41
45
  return __awaiter(this, void 0, void 0, function* () {
42
- yield navigator.clipboard.writeText(text);
46
+ yield (0, copy_to_clipboard_1.default)(text);
43
47
  setTitle('Copied!');
44
48
  setTimeout(() => setTitle('Copy'), 1500);
45
49
  });
@@ -88,7 +88,7 @@ function DevOnboardingTryItSecurity(props) {
88
88
  React.useEffect(() => {
89
89
  sessionStorage.setItem('redocly_onboarding:prevAppId', appId || '');
90
90
  }, [appId]);
91
- if (!apiId) {
91
+ if (!apiId || !(userData === null || userData === void 0 ? void 0 : userData.isAuthenticated)) {
92
92
  return null;
93
93
  }
94
94
  const loadAppCredentials = (appId) => {
@@ -11,7 +11,7 @@ exports.FooterWrapper = styled_components_1.default.div.attrs(() => ({
11
11
  margin: var(--sidebar-offset-top) 0 var(--sidebar-spacing-unit) var(--sidebar-offset-left);
12
12
  padding-top: var(--sidebar-spacing-unit);
13
13
  padding-right: var(--sidebar-spacing-unit);
14
- border-top: solid 1px #daddde;
14
+ border-top: solid 1px var(--border-color);
15
15
 
16
16
  button {
17
17
  margin: 0;
@@ -10,6 +10,6 @@ exports.HeaderWrapper = styled_components_1.default.div.attrs(() => ({
10
10
  })) `
11
11
  margin: var(--sidebar-offset-top) 0 0 var(--sidebar-offset-left);
12
12
  padding-bottom: var(--sidebar-spacing-unit);
13
- border-bottom: solid 1px #daddde;
13
+ border-bottom: solid 1px var(--border-color);
14
14
  `;
15
15
  //# sourceMappingURL=HeaderWrapper.js.map
@@ -1889,8 +1889,8 @@ const lastUpdated = (0, styled_components_1.css) `
1889
1889
  --last-updated-line-height: var(--line-height-base);
1890
1890
  `;
1891
1891
  const tile = (0, styled_components_1.css) `
1892
- --wide-tile-background-color: var(--color-secondary-50);
1893
- --thin-tile-background-color: var(--color-secondary-50);
1892
+ --wide-tile-background-color: var(--color-secondary-100);
1893
+ --thin-tile-background-color: var(--color-secondary-100);
1894
1894
  `;
1895
1895
  const apiLogsTable = (0, styled_components_1.css) `
1896
1896
  --api-logs-row-hover-background-color: var(--color-secondary-300);
@@ -53,7 +53,7 @@ exports.darkMode = (0, styled_components_1.css) `
53
53
  --panel-try-it-nested-body-background-color: #263041;
54
54
  --panel-try-it-tabs-active-background-color: #11151d;
55
55
  --panel-try-it-tabs-hover-background-color: #141a26;
56
- --color-emphasis-100: #0065fb;
56
+ --color-emphasis-100: #16202e;
57
57
  --color-secondary-400: #696969;
58
58
  --color-emphasis-700: #fff;
59
59
  --color-emphasis-800: #fff;
@@ -1,5 +1,5 @@
1
1
  export declare class ClipboardService {
2
2
  static isSupported(): boolean;
3
- static copyCustom(text: string): Promise<void>;
3
+ static copyCustom(text: string): boolean;
4
4
  static selectElement(element: HTMLDivElement | null): void;
5
5
  }
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.ClipboardService = void 0;
7
+ const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
4
8
  class ClipboardService {
5
9
  static isSupported() {
6
10
  return typeof navigator !== 'undefined' && !!navigator.clipboard;
7
11
  }
8
12
  static copyCustom(text) {
9
- return navigator.clipboard.writeText(text);
13
+ return (0, copy_to_clipboard_1.default)(text);
10
14
  }
11
15
  static selectElement(element) {
12
16
  if (!element) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "Shared UI components lib",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -99,6 +99,7 @@
99
99
  "zod": ">=3.19.1"
100
100
  },
101
101
  "dependencies": {
102
+ "copy-to-clipboard": "^3.3.3",
102
103
  "highlight-words-core": "^1.2.2",
103
104
  "hotkeys-js": "^3.10.1",
104
105
  "timeago.js": "^4.0.2"
@@ -1,4 +1,5 @@
1
1
  import React, { useState } from 'react';
2
+ import copy from 'copy-to-clipboard';
2
3
 
3
4
  import { Button } from '@theme/Button';
4
5
 
@@ -11,7 +12,7 @@ export const CopyButton = ({ text, dataTestId = 'copy-button' }: CopyButtonProps
11
12
  const [title, setTitle] = useState('Copy');
12
13
 
13
14
  async function write() {
14
- await navigator.clipboard.writeText(text);
15
+ await copy(text);
15
16
 
16
17
  setTitle('Copied!');
17
18
 
@@ -69,7 +69,7 @@ export function DevOnboardingTryItSecurity(props: TryItSecurityAppsProps) {
69
69
  sessionStorage.setItem('redocly_onboarding:prevAppId', appId || '');
70
70
  }, [appId]);
71
71
 
72
- if (!apiId) {
72
+ if (!apiId || !userData?.isAuthenticated) {
73
73
  return null;
74
74
  }
75
75
 
@@ -6,7 +6,7 @@ export const FooterWrapper = styled.div.attrs(() => ({
6
6
  margin: var(--sidebar-offset-top) 0 var(--sidebar-spacing-unit) var(--sidebar-offset-left);
7
7
  padding-top: var(--sidebar-spacing-unit);
8
8
  padding-right: var(--sidebar-spacing-unit);
9
- border-top: solid 1px #daddde;
9
+ border-top: solid 1px var(--border-color);
10
10
 
11
11
  button {
12
12
  margin: 0;
@@ -5,5 +5,5 @@ export const HeaderWrapper = styled.div.attrs(() => ({
5
5
  }))`
6
6
  margin: var(--sidebar-offset-top) 0 0 var(--sidebar-offset-left);
7
7
  padding-bottom: var(--sidebar-spacing-unit);
8
- border-bottom: solid 1px #daddde;
8
+ border-bottom: solid 1px var(--border-color);
9
9
  `;
@@ -1913,8 +1913,8 @@ const lastUpdated = css`
1913
1913
  `;
1914
1914
 
1915
1915
  const tile = css`
1916
- --wide-tile-background-color: var(--color-secondary-50);
1917
- --thin-tile-background-color: var(--color-secondary-50);
1916
+ --wide-tile-background-color: var(--color-secondary-100);
1917
+ --thin-tile-background-color: var(--color-secondary-100);
1918
1918
  `;
1919
1919
 
1920
1920
  const apiLogsTable = css`
@@ -51,7 +51,7 @@ export const darkMode = css`
51
51
  --panel-try-it-nested-body-background-color: #263041;
52
52
  --panel-try-it-tabs-active-background-color: #11151d;
53
53
  --panel-try-it-tabs-hover-background-color: #141a26;
54
- --color-emphasis-100: #0065fb;
54
+ --color-emphasis-100: #16202e;
55
55
  --color-secondary-400: #696969;
56
56
  --color-emphasis-700: #fff;
57
57
  --color-emphasis-800: #fff;
@@ -1,10 +1,11 @@
1
+ import copy from 'copy-to-clipboard';
1
2
  export class ClipboardService {
2
3
  static isSupported(): boolean {
3
4
  return typeof navigator !== 'undefined' && !!navigator.clipboard;
4
5
  }
5
6
 
6
- static copyCustom(text: string): Promise<void> {
7
- return navigator.clipboard.writeText(text);
7
+ static copyCustom(text: string): boolean {
8
+ return copy(text);
8
9
  }
9
10
 
10
11
  static selectElement(element: HTMLDivElement | null): void {