@redocly/theme 0.8.1 → 0.8.3
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.
- package/lib/Button/Button.js +2 -2
- package/lib/Catalog/Filter.js +1 -3
- package/lib/Markdown/Admonition.d.ts +2 -1
- package/lib/Markdown/Admonition.js +2 -2
- package/lib/Profile/Profile.js +1 -1
- package/lib/ReferenceDocs/ClearButton.d.ts +8 -0
- package/lib/ReferenceDocs/ClearButton.js +48 -0
- package/lib/ReferenceDocs/DevOnboardingTryItSecurity.d.ts +3 -0
- package/lib/ReferenceDocs/DevOnboardingTryItSecurity.js +158 -0
- package/lib/ReferenceDocs/Dropdown.d.ts +28 -0
- package/lib/ReferenceDocs/Dropdown.js +150 -0
- package/lib/ReferenceDocs/TryItSecurityApps.d.ts +7 -0
- package/lib/ReferenceDocs/TryItSecurityApps.js +15 -0
- package/lib/ReferenceDocs/index.d.ts +1 -0
- package/lib/ReferenceDocs/index.js +18 -0
- package/lib/Sidebar/FooterWrapper.d.ts +3 -0
- package/lib/Sidebar/FooterWrapper.js +15 -0
- package/lib/Sidebar/HeaderWrapper.d.ts +3 -0
- package/lib/Sidebar/HeaderWrapper.js +15 -0
- package/lib/Sidebar/MenuContainer.d.ts +5 -3
- package/lib/Sidebar/MenuContainer.js +3 -2
- package/lib/Sidebar/MenuItemLabel.js +2 -2
- package/lib/Sidebar/Sidebar.d.ts +0 -1
- package/lib/Sidebar/Sidebar.js +1 -6
- package/lib/Sidebar/SidebarLayout.d.ts +4 -2
- package/lib/Sidebar/SidebarLayout.js +7 -28
- package/lib/Sidebar/index.d.ts +2 -0
- package/lib/Sidebar/index.js +2 -0
- package/lib/SourceCode/SourceCode.d.ts +3 -2
- package/lib/SourceCode/SourceCode.js +5 -5
- package/lib/globalStyle.js +9 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/mocks/hooks/index.d.ts +1 -1
- package/lib/mocks/hooks/index.js +3 -1
- package/lib/mocks/useGlobalData.d.ts +1 -0
- package/lib/mocks/useGlobalData.js +8 -0
- package/package.json +1 -1
- package/src/Button/Button.tsx +8 -4
- package/src/Catalog/Filter.tsx +1 -1
- package/src/Markdown/Admonition.tsx +3 -0
- package/src/Profile/Profile.tsx +1 -1
- package/src/ReferenceDocs/ClearButton.tsx +32 -0
- package/src/ReferenceDocs/DevOnboardingTryItSecurity.tsx +161 -0
- package/src/ReferenceDocs/Dropdown.tsx +202 -0
- package/src/ReferenceDocs/TryItSecurityApps.tsx +17 -0
- package/src/ReferenceDocs/index.ts +1 -0
- package/src/Sidebar/FooterWrapper.tsx +9 -0
- package/src/Sidebar/HeaderWrapper.tsx +9 -0
- package/src/Sidebar/MenuContainer.tsx +8 -3
- package/src/Sidebar/MenuItemLabel.tsx +2 -2
- package/src/Sidebar/Sidebar.tsx +1 -7
- package/src/Sidebar/SidebarLayout.tsx +12 -34
- package/src/Sidebar/index.ts +2 -0
- package/src/SourceCode/SourceCode.tsx +6 -0
- package/src/globalStyle.ts +9 -0
- package/src/index.ts +1 -0
- package/src/mocks/hooks/index.ts +2 -0
- package/src/mocks/useGlobalData.tsx +3 -0
package/lib/Button/Button.js
CHANGED
|
@@ -73,8 +73,8 @@ exports.baseButtonStyles = (0, styled_components_1.css) `
|
|
|
73
73
|
box-shadow: var(--button-active-box-shadow);
|
|
74
74
|
}
|
|
75
75
|
`;
|
|
76
|
-
const StyledButton = styled_components_1.default.button.attrs(({ color = 'default', extraClass }) => ({
|
|
77
|
-
className: `button-color-${color}${extraClass ? ` ${extraClass}` : ''}`,
|
|
76
|
+
const StyledButton = styled_components_1.default.button.attrs(({ color = 'default', extraClass, variant }) => ({
|
|
77
|
+
className: `button-color-${color}${variant ? ` button-variant-${variant}` : ''}${extraClass ? ` ${extraClass}` : ''}`,
|
|
78
78
|
'data-component-name': 'Button/Button',
|
|
79
79
|
})) `
|
|
80
80
|
text-decoration: none;
|
package/lib/Catalog/Filter.js
CHANGED
|
@@ -12,9 +12,7 @@ function Filter({ filter }) {
|
|
|
12
12
|
if (!filter.parentUsed)
|
|
13
13
|
return null;
|
|
14
14
|
return (react_1.default.createElement(FilterGroup, { key: filter.property + filter.title },
|
|
15
|
-
react_1.default.createElement(FilterTitle, null,
|
|
16
|
-
filter.title,
|
|
17
|
-
" filter"),
|
|
15
|
+
react_1.default.createElement(FilterTitle, null, filter.title),
|
|
18
16
|
filter.type === 'select' ? (react_1.default.createElement(StyledSelect, { onChange: (e) => filter.selectOption(e.target.value), value: ((_a = filter.selectedOptions.values().next()) === null || _a === void 0 ? void 0 : _a.value) || '' },
|
|
19
17
|
react_1.default.createElement("option", { key: "none", value: "" }, "All"),
|
|
20
18
|
filter.filteredOptions.map((value) => (react_1.default.createElement("option", { key: value.value, value: value.value },
|
|
@@ -4,8 +4,9 @@ interface AdmonitionTypeProps {
|
|
|
4
4
|
}
|
|
5
5
|
export interface AdmonitionProps extends Partial<AdmonitionTypeProps> {
|
|
6
6
|
name?: string;
|
|
7
|
+
className?: string;
|
|
7
8
|
'data-source'?: string;
|
|
8
9
|
'data-hash'?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare function Admonition({ type, name, children, 'data-source': dataSource, 'data-hash': dataHash, }: React.PropsWithChildren<AdmonitionProps>): JSX.Element;
|
|
11
|
+
export declare function Admonition({ type, name, children, className, 'data-source': dataSource, 'data-hash': dataHash, }: React.PropsWithChildren<AdmonitionProps>): JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -7,8 +7,8 @@ exports.Admonition = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const AlertIcon_1 = require("../icons/AlertIcon/AlertIcon");
|
|
10
|
-
function Admonition({ type = 'info', name, children, 'data-source': dataSource, 'data-hash': dataHash, }) {
|
|
11
|
-
return (react_1.default.createElement(Wrapper, { type: type, "data-component-name": "Markdown/Admonition", "data-source": dataSource, "data-hash": dataHash },
|
|
10
|
+
function Admonition({ type = 'info', name, children, className, 'data-source': dataSource, 'data-hash': dataHash, }) {
|
|
11
|
+
return (react_1.default.createElement(Wrapper, { type: type, className: className, "data-component-name": "Markdown/Admonition", "data-source": dataSource, "data-hash": dataHash },
|
|
12
12
|
react_1.default.createElement(AlertIcon_1.AlertIcon, { type: type }),
|
|
13
13
|
name ? react_1.default.createElement(Heading, { type: type }, name) : null,
|
|
14
14
|
react_1.default.createElement(Content, null, children)));
|
package/lib/Profile/Profile.js
CHANGED
|
@@ -27,7 +27,7 @@ exports.Profile = void 0;
|
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
29
29
|
const utils_1 = require("../utils");
|
|
30
|
-
function ProfileComponent({ name, imageUrl, onClick, color }) {
|
|
30
|
+
function ProfileComponent({ name = 'User', imageUrl, onClick, color }) {
|
|
31
31
|
var _a;
|
|
32
32
|
if (imageUrl) {
|
|
33
33
|
return (react_1.default.createElement(ProfileWrapper, { onClick: onClick },
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ClearButtonProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
handleClear?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ClearButton: import("styled-components").StyledComponent<React.NamedExoticComponent<ClearButtonProps>, any, {}, never>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ClearButton = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const ClearButtonComponent = ({ className, style, handleClear }) => (react_1.default.createElement("button", { className: className, style: style, onClick: handleClear }, "\u2715"));
|
|
33
|
+
exports.ClearButton = (0, styled_components_1.default)((0, react_1.memo)(ClearButtonComponent)) `
|
|
34
|
+
z-index: 1;
|
|
35
|
+
position: absolute;
|
|
36
|
+
right: 24px;
|
|
37
|
+
top: 50%;
|
|
38
|
+
transform: translateY(-50%);
|
|
39
|
+
color: #89949f;
|
|
40
|
+
background: none;
|
|
41
|
+
border: none;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
color: #fff;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
//# sourceMappingURL=ClearButton.js.map
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.DevOnboardingTryItSecurity = void 0;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const _theme_1 = require("../index.js");
|
|
32
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
33
|
+
const usePageData_1 = require("../mocks/hooks/usePageData");
|
|
34
|
+
const Dropdown_1 = require("./Dropdown");
|
|
35
|
+
function DevOnboardingTryItSecurity(props) {
|
|
36
|
+
const apiId = props.apiId;
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
const { userData } = (0, usePageData_1.usePageData)('userData') || {};
|
|
39
|
+
// TODO: handle error
|
|
40
|
+
const [_error, setError] = React.useState();
|
|
41
|
+
const [apps, setApps] = React.useState();
|
|
42
|
+
const [appId, setAppId] = React.useState('');
|
|
43
|
+
const [loading, setLoading] = React.useState(true);
|
|
44
|
+
const [appLoading, setAppLoading] = React.useState(false);
|
|
45
|
+
const [selectedAppSecret, setSelectedAppSecret] = React.useState();
|
|
46
|
+
const [acceptValueUpdate, setAcceptValueUpdate] = React.useState(true);
|
|
47
|
+
const initialRender = React.useRef(true);
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
if (!props.value && initialRender.current)
|
|
50
|
+
return;
|
|
51
|
+
if (acceptValueUpdate) {
|
|
52
|
+
setAcceptValueUpdate(false);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
setAppId('');
|
|
56
|
+
}
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, [props.value]);
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
initialRender.current = false;
|
|
61
|
+
const prevAppId = sessionStorage.getItem('redocly_onboarding:prevAppId');
|
|
62
|
+
if (prevAppId) {
|
|
63
|
+
setAppId(prevAppId);
|
|
64
|
+
}
|
|
65
|
+
if (userData === null || userData === void 0 ? void 0 : userData.isAuthenticated) {
|
|
66
|
+
fetch(`/api/api-keys/api-products/${apiId}/access?expand=1`).then((res) => {
|
|
67
|
+
return res
|
|
68
|
+
.json()
|
|
69
|
+
.then((data) => {
|
|
70
|
+
if (res.ok) {
|
|
71
|
+
setApps(data.apps);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
setError(data.message);
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
.catch(() => setError('Something went wrong'))
|
|
78
|
+
.finally(() => setLoading(false));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, [apiId, userData === null || userData === void 0 ? void 0 : userData.isAuthenticated]);
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
sessionStorage.setItem('redocly_onboarding:prevAppId', appId || '');
|
|
84
|
+
}, [appId]);
|
|
85
|
+
if (!apiId) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
const loadAppCredentials = (appId) => {
|
|
89
|
+
setAppLoading(true);
|
|
90
|
+
fetch(`/api/api-keys/apps/${appId}`).then((res) => {
|
|
91
|
+
return res
|
|
92
|
+
.json()
|
|
93
|
+
.then((data) => {
|
|
94
|
+
if (res.ok) {
|
|
95
|
+
const cred = data.credentials.find((cred) => cred.status === 'approved');
|
|
96
|
+
setAcceptValueUpdate(true);
|
|
97
|
+
setSelectedAppSecret(cred.clientSecret);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
setError(data.message);
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
.catch(() => setError('Something went wrong'))
|
|
104
|
+
.finally(() => setAppLoading(false));
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const placeholder = loading ? 'Loading your apps...' : undefined;
|
|
108
|
+
return (React.createElement(React.Fragment, null,
|
|
109
|
+
React.createElement(FormLabel, { htmlFor: "server" }, "Select app: "),
|
|
110
|
+
React.createElement(FormControl, null,
|
|
111
|
+
React.createElement(TryItDropdown, { placeholder: placeholder, value: appId || placeholder, options: (apps === null || apps === void 0 ? void 0 : apps.map((app) => ({ title: app.title, value: app.id }))) || [], fullWidth: true, onChange: ({ value }) => {
|
|
112
|
+
setAppId(value);
|
|
113
|
+
loadAppCredentials(value);
|
|
114
|
+
} }),
|
|
115
|
+
React.createElement(UseKeyButton, { disabled: !selectedAppSecret || appLoading, color: "secondary", blinking: appLoading, onClick: () => selectedAppSecret && props.onChange(selectedAppSecret) }, "Use key"))));
|
|
116
|
+
}
|
|
117
|
+
exports.DevOnboardingTryItSecurity = DevOnboardingTryItSecurity;
|
|
118
|
+
const TryItDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown) `
|
|
119
|
+
.dropdown-select,
|
|
120
|
+
label {
|
|
121
|
+
background-color: var(--panel-try-it-dropdown-background-color);
|
|
122
|
+
border: var(--panel-try-it-dropdown-border);
|
|
123
|
+
color: var(--panel-try-it-dropdown-color);
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
const FormControl = styled_components_1.default.div `
|
|
127
|
+
width: 100%;
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
margin-bottom: 10px;
|
|
131
|
+
|
|
132
|
+
&:last-child {
|
|
133
|
+
margin-bottom: 0;
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
const FormLabel = styled_components_1.default.label `
|
|
137
|
+
padding-bottom: 6px;
|
|
138
|
+
display: block;
|
|
139
|
+
white-space: nowrap;
|
|
140
|
+
line-height: 1em;
|
|
141
|
+
|
|
142
|
+
${({ required }) => required &&
|
|
143
|
+
`
|
|
144
|
+
&:after {
|
|
145
|
+
display: inline-block;
|
|
146
|
+
content: '*';
|
|
147
|
+
margin-left: 4px;
|
|
148
|
+
color: var(--color-error-500);
|
|
149
|
+
}
|
|
150
|
+
`}
|
|
151
|
+
`;
|
|
152
|
+
const UseKeyButton = (0, styled_components_1.default)(_theme_1.Button) `
|
|
153
|
+
width: 100px;
|
|
154
|
+
align-self: flex-end;
|
|
155
|
+
margin-top: 16px;
|
|
156
|
+
margin-right: 0;
|
|
157
|
+
`;
|
|
158
|
+
//# sourceMappingURL=DevOnboardingTryItSecurity.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DropdownOption {
|
|
3
|
+
idx?: number;
|
|
4
|
+
value: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
serverUrl?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DropdownProps {
|
|
10
|
+
options: DropdownOption[];
|
|
11
|
+
onChange: (option: DropdownOption) => void;
|
|
12
|
+
handleClear?: () => void;
|
|
13
|
+
clearable?: boolean;
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
value?: string;
|
|
18
|
+
dense?: boolean;
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
variant?: 'dark' | 'light';
|
|
21
|
+
}
|
|
22
|
+
export interface ArrowIconProps {
|
|
23
|
+
className?: string;
|
|
24
|
+
variant?: 'light' | 'dark';
|
|
25
|
+
style?: React.CSSProperties;
|
|
26
|
+
}
|
|
27
|
+
export declare const Dropdown: import("styled-components").StyledComponent<React.NamedExoticComponent<DropdownProps>, any, {}, never>;
|
|
28
|
+
export declare const normalizeText: (description?: string | Record<string, any>) => string;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.normalizeText = exports.Dropdown = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const ClearButton_1 = require("./ClearButton");
|
|
33
|
+
const ArrowSvg = ({ className, style }) => (react_1.default.createElement("svg", { className: className, style: style, xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
34
|
+
react_1.default.createElement("polyline", { points: "6 9 12 15 18 9" })));
|
|
35
|
+
const ArrowIcon = (0, styled_components_1.default)(ArrowSvg) `
|
|
36
|
+
position: absolute;
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
z-index: 1;
|
|
39
|
+
top: 50%;
|
|
40
|
+
-webkit-transform: translateY(-50%);
|
|
41
|
+
-ms-transform: translateY(-50%);
|
|
42
|
+
transform: translateY(-50%);
|
|
43
|
+
right: 8px;
|
|
44
|
+
margin: auto;
|
|
45
|
+
text-align: center;
|
|
46
|
+
polyline {
|
|
47
|
+
color: ${(props) => props.variant === 'dark' && 'white'};
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
const DropdownComponent = ({ options, onChange, handleClear, clearable, placeholder, value = '', className, variant = 'light', }) => {
|
|
51
|
+
var _a;
|
|
52
|
+
const handleOnChange = (event) => {
|
|
53
|
+
const { selectedIndex } = event.target;
|
|
54
|
+
const index = placeholder || !value ? selectedIndex - 1 : selectedIndex;
|
|
55
|
+
onChange(options[index]);
|
|
56
|
+
};
|
|
57
|
+
const renderOptions = (0, react_1.useMemo)(() => options.map(({ idx, value, title }, index) => {
|
|
58
|
+
const normalizedValue = (0, exports.normalizeText)(value);
|
|
59
|
+
return (react_1.default.createElement("option", { key: idx || normalizedValue + index, value: normalizedValue, className: "dropdown-option" }, title || normalizedValue));
|
|
60
|
+
}), [options]);
|
|
61
|
+
const normalizedValue = (0, exports.normalizeText)(value);
|
|
62
|
+
const title = ((_a = options.find((option) => option.value === value)) === null || _a === void 0 ? void 0 : _a.title) || normalizedValue;
|
|
63
|
+
return (react_1.default.createElement("div", { className: className + ' dropdown-wrapper' },
|
|
64
|
+
react_1.default.createElement(ArrowIcon, { variant: variant }),
|
|
65
|
+
clearable && (normalizedValue === null || normalizedValue === void 0 ? void 0 : normalizedValue.length) > 0 && react_1.default.createElement(ClearButton_1.ClearButton, { handleClear: handleClear }),
|
|
66
|
+
react_1.default.createElement("select", { onChange: handleOnChange, value: normalizedValue, className: "dropdown-select" },
|
|
67
|
+
placeholder && (react_1.default.createElement("option", { disabled: true, hidden: true, value: placeholder }, placeholder)),
|
|
68
|
+
!normalizedValue && !placeholder && react_1.default.createElement("option", { disabled: true }),
|
|
69
|
+
renderOptions),
|
|
70
|
+
react_1.default.createElement("label", null, title)));
|
|
71
|
+
};
|
|
72
|
+
exports.Dropdown = (0, styled_components_1.default)((0, react_1.memo)(DropdownComponent)) `
|
|
73
|
+
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
outline: none;
|
|
76
|
+
display: inline-block;
|
|
77
|
+
border-radius: var(--border-radius);
|
|
78
|
+
vertical-align: bottom;
|
|
79
|
+
position: relative;
|
|
80
|
+
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
text-transform: none;
|
|
83
|
+
|
|
84
|
+
label {
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
min-width: 90px;
|
|
87
|
+
height: 36px;
|
|
88
|
+
outline: none;
|
|
89
|
+
display: inline-block;
|
|
90
|
+
color: var(--dropdown-text-color);
|
|
91
|
+
border-radius: var(--border-radius);
|
|
92
|
+
border: var(--dropdown-border);
|
|
93
|
+
padding: var(--dropdown-padding);
|
|
94
|
+
vertical-align: bottom;
|
|
95
|
+
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
96
|
+
text-transform: none;
|
|
97
|
+
line-height: inherit;
|
|
98
|
+
font-size: var(--dropdown-font-size);
|
|
99
|
+
font-family: inherit;
|
|
100
|
+
text-overflow: ellipsis;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
|
|
104
|
+
&,
|
|
105
|
+
&:hover,
|
|
106
|
+
&:focus-within {
|
|
107
|
+
border: 1px solid var(--border-color);
|
|
108
|
+
box-shadow: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
${({ variant }) => (variant === 'dark' ? darkDropdownStyle : '')};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.dropdown-select {
|
|
115
|
+
position: absolute;
|
|
116
|
+
top: 0;
|
|
117
|
+
left: 0;
|
|
118
|
+
width: 100%;
|
|
119
|
+
height: 100%;
|
|
120
|
+
opacity: 0;
|
|
121
|
+
border: none;
|
|
122
|
+
appearance: none;
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
|
|
125
|
+
color: var(--text-color);
|
|
126
|
+
line-height: inherit;
|
|
127
|
+
font-size: 14px;
|
|
128
|
+
font-family: inherit;
|
|
129
|
+
padding: var(--dropdown-padding);
|
|
130
|
+
${({ variant }) => (variant === 'dark' ? darkDropdownStyle : '')};
|
|
131
|
+
|
|
132
|
+
`;
|
|
133
|
+
const darkDropdownStyle = `
|
|
134
|
+
background-color: var(--panel-samples-dropdown-background-color);
|
|
135
|
+
border: var(--panel-samples-dropdown-border);
|
|
136
|
+
color: var(--panel-samples-dropdown-color);
|
|
137
|
+
|
|
138
|
+
&,
|
|
139
|
+
&:hover,
|
|
140
|
+
&:focus-within {
|
|
141
|
+
border: none;
|
|
142
|
+
box-shadow: none;
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
function isString(value) {
|
|
146
|
+
return typeof value === 'string';
|
|
147
|
+
}
|
|
148
|
+
const normalizeText = (description) => isString(description) ? description : description === null || description === void 0 ? void 0 : description.raw;
|
|
149
|
+
exports.normalizeText = normalizeText;
|
|
150
|
+
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TryItSecurityApps = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../mocks/hooks");
|
|
9
|
+
const DevOnboardingTryItSecurity_1 = require("./DevOnboardingTryItSecurity");
|
|
10
|
+
function TryItSecurityApps(props) {
|
|
11
|
+
const { hasDeveloperOnboarding } = (0, hooks_1.useGlobalData)() || {};
|
|
12
|
+
return hasDeveloperOnboarding && props.apiId ? react_1.default.createElement(DevOnboardingTryItSecurity_1.DevOnboardingTryItSecurity, Object.assign({}, props)) : null;
|
|
13
|
+
}
|
|
14
|
+
exports.TryItSecurityApps = TryItSecurityApps;
|
|
15
|
+
//# sourceMappingURL=TryItSecurityApps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TryItSecurityApps';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TryItSecurityApps"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FooterWrapper = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.FooterWrapper = styled_components_1.default.div.attrs(() => ({
|
|
9
|
+
'data-component-name': 'Sidebar/FooterWrapper',
|
|
10
|
+
})) `
|
|
11
|
+
margin: var(--sidebar-offset-top) 0 var(--sidebar-spacing-unit) var(--sidebar-offset-left);
|
|
12
|
+
padding-top: var(--sidebar-spacing-unit);
|
|
13
|
+
border-top: solid 1px #daddde;
|
|
14
|
+
`;
|
|
15
|
+
//# sourceMappingURL=FooterWrapper.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.HeaderWrapper = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.HeaderWrapper = styled_components_1.default.div.attrs(() => ({
|
|
9
|
+
'data-component-name': 'Sidebar/HeaderWrapper',
|
|
10
|
+
})) `
|
|
11
|
+
margin: var(--sidebar-offset-top) 0 0 var(--sidebar-offset-left);
|
|
12
|
+
padding-bottom: var(--sidebar-spacing-unit);
|
|
13
|
+
border-bottom: solid 1px #daddde;
|
|
14
|
+
`;
|
|
15
|
+
//# sourceMappingURL=HeaderWrapper.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
interface MenuContainerProps {
|
|
2
|
+
growContent?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare const MenuContainer: import("styled-components").StyledComponent<"div", any, MenuContainerProps, never>;
|
|
5
|
+
export {};
|
|
@@ -5,12 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MenuContainer = void 0;
|
|
7
7
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
-
exports.MenuContainer = styled_components_1.default.div.attrs(() => ({
|
|
8
|
+
exports.MenuContainer = styled_components_1.default.div.attrs(({ growContent }) => ({
|
|
9
9
|
'data-component-name': 'Sidebar/MenuContainer',
|
|
10
|
+
growContent: growContent === undefined ? true : growContent,
|
|
10
11
|
})) `
|
|
11
12
|
position: relative;
|
|
12
13
|
overflow-y: auto;
|
|
13
|
-
flex-grow: 1;
|
|
14
|
+
flex-grow: ${({ growContent }) => (growContent ? 1 : 0)};
|
|
14
15
|
padding-top: var(--sidebar-offset-top);
|
|
15
16
|
`;
|
|
16
17
|
//# sourceMappingURL=MenuContainer.js.map
|
|
@@ -35,8 +35,8 @@ exports.MenuItemLabel = styled_components_1.default.li.attrs(() => ({
|
|
|
35
35
|
: null};
|
|
36
36
|
|
|
37
37
|
:hover {
|
|
38
|
-
color: var(--sidebar-item-
|
|
39
|
-
background-color: var(--sidebar-item-
|
|
38
|
+
color: var(--sidebar-item-hover-color);
|
|
39
|
+
background-color: var(--sidebar-item-hover-background-color);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
:empty {
|
package/lib/Sidebar/Sidebar.d.ts
CHANGED
package/lib/Sidebar/Sidebar.js
CHANGED
|
@@ -23,15 +23,10 @@ exports.Sidebar = styled_components_1.default.aside.attrs(() => ({
|
|
|
23
23
|
width: 100%;
|
|
24
24
|
-webkit-font-smoothing: antialiased;
|
|
25
25
|
|
|
26
|
-
${({ isNavbar }) => `
|
|
27
|
-
top: ${isNavbar ? 'var(--navbar-height)' : '0'};
|
|
28
|
-
height: calc(100vh ${isNavbar ? '- var(--navbar-height)' : ''});
|
|
29
|
-
`};
|
|
30
|
-
|
|
31
26
|
${({ opened, animate }) => `
|
|
32
27
|
opacity: ${opened ? '1' : '0'};
|
|
33
28
|
pointer-events: ${opened ? 'auto' : 'none'};
|
|
34
|
-
|
|
29
|
+
|
|
35
30
|
& > * {
|
|
36
31
|
transform: ${opened ? 'translate(0, 0)' : 'translate(0, 40px)'};
|
|
37
32
|
transition: ${animate ? 'transform 0.65s ease, opacity 0.25s ease;' : 'none'};
|
|
@@ -6,7 +6,9 @@ interface SidebarLayoutProps {
|
|
|
6
6
|
label: string;
|
|
7
7
|
slug: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
footer?: React.ReactNode;
|
|
10
|
+
header?: React.ReactNode;
|
|
11
|
+
growContent?: boolean;
|
|
10
12
|
}
|
|
11
|
-
export declare function SidebarLayout({ versions, menu,
|
|
13
|
+
export declare function SidebarLayout({ versions, menu, footer, header, growContent, }: SidebarLayoutProps): JSX.Element | null;
|
|
12
14
|
export {};
|