@redocly/theme 0.9.2 → 0.9.4

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.
@@ -100,7 +100,7 @@ const StyledButton = styled_components_1.default.button.attrs(({ color = 'defaul
100
100
  }
101
101
 
102
102
  &:disabled {
103
- color: var(--button-disabled-background-color);
103
+ color: var(--button-disabled-color);
104
104
  background-color: transparent;
105
105
  }
106
106
  `
@@ -85,7 +85,7 @@ const CatalogPageContent = styled_components_1.default.main `
85
85
  `;
86
86
  const CatalogCards = styled_components_1.default.div `
87
87
  display: grid;
88
- grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
88
+ grid-template-columns: repeat(auto-fill, minmax(var(--api-catalog-card-min-width), 1fr));
89
89
  gap: 32px;
90
90
  `;
91
91
  const CatalogTitle = (0, styled_components_1.default)(H2_1.H2) `
@@ -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
  });
@@ -42,6 +42,8 @@ exports.PanelBody = styled_components_1.default.div.attrs(() => ({
42
42
  ${({ animate }) => animate && showPanelAnimation};
43
43
  ${({ hidden }) => hidden && 'visibility: hidden'};
44
44
 
45
+ overflow: hidden;
46
+
45
47
  background-color: var(--panel-body-background-color);
46
48
 
47
49
  font-family: var(--panel-body-font-family-local);
@@ -53,6 +53,7 @@ function DevOnboardingTryItSecurity(props) {
53
53
  }
54
54
  else {
55
55
  setAppId('');
56
+ setSelectedAppSecret('');
56
57
  }
57
58
  // eslint-disable-next-line react-hooks/exhaustive-deps
58
59
  }, [props.value]);
@@ -67,8 +68,13 @@ function DevOnboardingTryItSecurity(props) {
67
68
  return res
68
69
  .json()
69
70
  .then((data) => {
71
+ var _a;
70
72
  if (res.ok) {
71
73
  setApps(data.apps);
74
+ if ((_a = data.apps[0]) === null || _a === void 0 ? void 0 : _a.id) {
75
+ setAppId(data.apps[0].id);
76
+ loadAppCredentials(data.apps[0].id);
77
+ }
72
78
  }
73
79
  else {
74
80
  setError(data.message);
@@ -112,7 +118,7 @@ function DevOnboardingTryItSecurity(props) {
112
118
  setAppId(value);
113
119
  loadAppCredentials(value);
114
120
  } }),
115
- React.createElement(UseKeyButton, { disabled: !selectedAppSecret || appLoading, color: "secondary", blinking: appLoading, onClick: () => selectedAppSecret && props.onChange(selectedAppSecret) }, "Use key"))));
121
+ React.createElement(UseKeyButton, { disabled: !selectedAppSecret || appLoading, color: "secondary", onClick: () => selectedAppSecret && props.onChange(selectedAppSecret) }, appLoading ? 'Loading...' : 'Use key'))));
116
122
  }
117
123
  exports.DevOnboardingTryItSecurity = DevOnboardingTryItSecurity;
118
124
  const TryItDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown) `
@@ -152,7 +158,7 @@ const FormLabel = styled_components_1.default.label `
152
158
  const UseKeyButton = (0, styled_components_1.default)(Button_1.Button) `
153
159
  width: 100px;
154
160
  align-self: flex-end;
155
- margin-top: 16px;
161
+ margin-top: 10px;
156
162
  margin-right: 0;
157
163
  `;
158
164
  //# sourceMappingURL=DevOnboardingTryItSecurity.js.map
@@ -10,6 +10,11 @@ exports.FooterWrapper = styled_components_1.default.div.attrs(() => ({
10
10
  })) `
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
- border-top: solid 1px #daddde;
13
+ padding-right: var(--sidebar-spacing-unit);
14
+ border-top: solid 1px var(--border-color);
15
+
16
+ button {
17
+ margin: 0;
18
+ }
14
19
  `;
15
20
  //# sourceMappingURL=FooterWrapper.js.map
@@ -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
@@ -1093,19 +1093,19 @@ const apiReferencePanels = (0, styled_components_1.css) `
1093
1093
 
1094
1094
  --panel-try-it-action-button-width: auto;
1095
1095
  --panel-try-it-action-button-font-family: var(--panel-font-family); // @presenter FontFamily
1096
- --panel-try-it-action-button-font-weight: var(--panel-font-weight); // @presenter FontWeight
1096
+ --panel-try-it-action-button-font-weight: var(--font-weight-bold); // @presenter FontWeight
1097
1097
  --panel-try-it-action-button-font-size: var(--panel-font-size); // @presenter FontSize
1098
1098
  --panel-try-it-action-button-text-color: var(--text-color-inverse); // @presenter Color
1099
1099
  --panel-try-it-action-button-background-color: var(--color-primary-500); // @presenter Color
1100
1100
  --panel-try-it-action-button-border-color: transparent; // @presenter Color
1101
1101
 
1102
- --panel-try-it-action-button-active-text-color: var(--color-emphasis-900); // @presenter Color
1103
- --panel-try-it-action-button-active-background-color: var(--color-emphasis-700); // @presenter Color
1104
- --panel-try-it-action-button-active-border-color: var(--color-emphasis-700); // @presenter Color
1102
+ --panel-try-it-action-button-active-text-color: var(--text-color-inverse); // @presenter Color
1103
+ --panel-try-it-action-button-active-background-color: var(--color-primary-700); // @presenter Color
1104
+ --panel-try-it-action-button-active-border-color: var(--color-primary-700); // @presenter Color
1105
1105
 
1106
- --panel-try-it-action-button-hover-background-color: var(--color-emphasis-600); // @presenter Color
1107
- --panel-try-it-action-button-hover-text-color: var(--color-emphasis-800); // @presenter Color
1108
- --panel-try-it-action-button-hover-border-color: var(--color-emphasis-600); // @presenter Color
1106
+ --panel-try-it-action-button-hover-text-color: var(--text-color-inverse); // @presenter Color
1107
+ --panel-try-it-action-button-hover-background-color: var(--color-primary-600); // @presenter Color
1108
+ --panel-try-it-action-button-hover-border-color: var(--color-primary-600); // @presenter Color
1109
1109
 
1110
1110
  /**
1111
1111
  * @tokens Panel samples other styles
@@ -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);
@@ -1984,6 +1984,7 @@ exports.styles = (0, styled_components_1.css) `
1984
1984
  ${modal}
1985
1985
 
1986
1986
  --api-onboarding-table-text-color: #4e5356;
1987
+ --api-catalog-card-min-width: 250px;
1987
1988
 
1988
1989
  background-color: var(--background-color);
1989
1990
  color: var(--text-color);
@@ -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.2",
3
+ "version": "0.9.4",
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"
@@ -99,7 +99,7 @@ const StyledButton = styled.button.attrs(
99
99
  }
100
100
 
101
101
  &:disabled {
102
- color: var(--button-disabled-background-color);
102
+ color: var(--button-disabled-color);
103
103
  background-color: transparent;
104
104
  }
105
105
  `
@@ -113,7 +113,7 @@ const CatalogPageContent = styled.main`
113
113
 
114
114
  const CatalogCards = styled.div`
115
115
  display: grid;
116
- grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
116
+ grid-template-columns: repeat(auto-fill, minmax(var(--api-catalog-card-min-width), 1fr));
117
117
  gap: 32px;
118
118
  `;
119
119
 
@@ -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
 
@@ -24,6 +24,8 @@ export const PanelBody = styled.div.attrs(() => ({
24
24
  ${({ animate }) => animate && showPanelAnimation};
25
25
  ${({ hidden }) => hidden && 'visibility: hidden'};
26
26
 
27
+ overflow: hidden;
28
+
27
29
  background-color: var(--panel-body-background-color);
28
30
 
29
31
  font-family: var(--panel-body-font-family-local);
@@ -32,6 +32,7 @@ export function DevOnboardingTryItSecurity(props: TryItSecurityAppsProps) {
32
32
  setAcceptValueUpdate(false);
33
33
  } else {
34
34
  setAppId('');
35
+ setSelectedAppSecret('');
35
36
  }
36
37
  // eslint-disable-next-line react-hooks/exhaustive-deps
37
38
  }, [props.value]);
@@ -49,6 +50,11 @@ export function DevOnboardingTryItSecurity(props: TryItSecurityAppsProps) {
49
50
  .then((data: any) => {
50
51
  if (res.ok) {
51
52
  setApps(data.apps);
53
+
54
+ if (data.apps[0]?.id) {
55
+ setAppId(data.apps[0].id);
56
+ loadAppCredentials(data.apps[0].id);
57
+ }
52
58
  } else {
53
59
  setError(data.message);
54
60
  }
@@ -105,10 +111,9 @@ export function DevOnboardingTryItSecurity(props: TryItSecurityAppsProps) {
105
111
  <UseKeyButton
106
112
  disabled={!selectedAppSecret || appLoading}
107
113
  color="secondary"
108
- blinking={appLoading}
109
114
  onClick={() => selectedAppSecret && props.onChange(selectedAppSecret)}
110
115
  >
111
- Use key
116
+ {appLoading ? 'Loading...' : 'Use key'}
112
117
  </UseKeyButton>
113
118
  </FormControl>
114
119
  </>
@@ -156,6 +161,6 @@ const FormLabel = styled.label<{ required?: boolean }>`
156
161
  const UseKeyButton = styled(Button)`
157
162
  width: 100px;
158
163
  align-self: flex-end;
159
- margin-top: 16px;
164
+ margin-top: 10px;
160
165
  margin-right: 0;
161
166
  `;
@@ -5,5 +5,10 @@ export const FooterWrapper = styled.div.attrs(() => ({
5
5
  }))`
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
- border-top: solid 1px #daddde;
8
+ padding-right: var(--sidebar-spacing-unit);
9
+ border-top: solid 1px var(--border-color);
10
+
11
+ button {
12
+ margin: 0;
13
+ }
9
14
  `;
@@ -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
  `;
@@ -1101,19 +1101,19 @@ const apiReferencePanels = css`
1101
1101
 
1102
1102
  --panel-try-it-action-button-width: auto;
1103
1103
  --panel-try-it-action-button-font-family: var(--panel-font-family); // @presenter FontFamily
1104
- --panel-try-it-action-button-font-weight: var(--panel-font-weight); // @presenter FontWeight
1104
+ --panel-try-it-action-button-font-weight: var(--font-weight-bold); // @presenter FontWeight
1105
1105
  --panel-try-it-action-button-font-size: var(--panel-font-size); // @presenter FontSize
1106
1106
  --panel-try-it-action-button-text-color: var(--text-color-inverse); // @presenter Color
1107
1107
  --panel-try-it-action-button-background-color: var(--color-primary-500); // @presenter Color
1108
1108
  --panel-try-it-action-button-border-color: transparent; // @presenter Color
1109
1109
 
1110
- --panel-try-it-action-button-active-text-color: var(--color-emphasis-900); // @presenter Color
1111
- --panel-try-it-action-button-active-background-color: var(--color-emphasis-700); // @presenter Color
1112
- --panel-try-it-action-button-active-border-color: var(--color-emphasis-700); // @presenter Color
1110
+ --panel-try-it-action-button-active-text-color: var(--text-color-inverse); // @presenter Color
1111
+ --panel-try-it-action-button-active-background-color: var(--color-primary-700); // @presenter Color
1112
+ --panel-try-it-action-button-active-border-color: var(--color-primary-700); // @presenter Color
1113
1113
 
1114
- --panel-try-it-action-button-hover-background-color: var(--color-emphasis-600); // @presenter Color
1115
- --panel-try-it-action-button-hover-text-color: var(--color-emphasis-800); // @presenter Color
1116
- --panel-try-it-action-button-hover-border-color: var(--color-emphasis-600); // @presenter Color
1114
+ --panel-try-it-action-button-hover-text-color: var(--text-color-inverse); // @presenter Color
1115
+ --panel-try-it-action-button-hover-background-color: var(--color-primary-600); // @presenter Color
1116
+ --panel-try-it-action-button-hover-border-color: var(--color-primary-600); // @presenter Color
1117
1117
 
1118
1118
  /**
1119
1119
  * @tokens Panel samples other styles
@@ -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`
@@ -2012,6 +2012,7 @@ export const styles = css`
2012
2012
  ${modal}
2013
2013
 
2014
2014
  --api-onboarding-table-text-color: #4e5356;
2015
+ --api-catalog-card-min-width: 250px;
2015
2016
 
2016
2017
  background-color: var(--background-color);
2017
2018
  color: var(--text-color);
@@ -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 {