@redocly/theme 0.56.0-next.9 → 0.56.0
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/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.js +2 -1
- package/lib/components/Button/ButtonGroup.d.ts +12 -0
- package/lib/components/Button/ButtonGroup.js +38 -0
- package/lib/components/Button/variables.js +32 -5
- package/lib/components/Catalog/Catalog.d.ts +1 -1
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +2 -2
- package/lib/components/Catalog/CatalogSelector.d.ts +1 -1
- package/lib/components/Catalog/CatalogSelector.js +4 -3
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
- package/lib/components/CodeBlock/CodeBlock.d.ts +16 -6
- package/lib/components/CodeBlock/CodeBlock.js +2 -2
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +4 -3
- package/lib/components/CodeBlock/CodeBlockControls.js +8 -5
- package/lib/components/CodeBlock/CodeBlockDropdown.d.ts +3 -0
- package/lib/components/CodeBlock/CodeBlockDropdown.js +35 -0
- package/lib/components/CodeBlock/CodeBlockTabs.d.ts +2 -2
- package/lib/components/CodeBlock/CodeBlockTabs.js +18 -9
- package/lib/components/CodeBlock/variables.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +1 -0
- package/lib/components/Dropdown/DropdownMenu.js +4 -0
- package/lib/components/Dropdown/variables.js +1 -0
- package/lib/components/Footer/FooterItem.js +4 -7
- package/lib/components/Footer/variables.js +2 -2
- package/lib/components/Markdown/Markdown.js +9 -9
- package/lib/components/Markdown/styles/headingAnchor.js +0 -1
- package/lib/components/Menu/MenuItem.js +5 -5
- package/lib/components/Menu/variables.js +1 -1
- package/lib/components/Navbar/NavbarItem.js +8 -39
- package/lib/components/Navbar/variables.js +2 -2
- package/lib/components/PageActions/PageActions.d.ts +6 -0
- package/lib/components/PageActions/PageActions.js +104 -0
- package/lib/components/PageActions/PageActionsMenuItem.d.ts +7 -0
- package/lib/components/PageActions/PageActionsMenuItem.js +58 -0
- package/lib/components/PageActions/variables.d.ts +1 -0
- package/lib/components/PageActions/variables.dark.d.ts +1 -0
- package/lib/components/PageActions/variables.dark.js +9 -0
- package/lib/components/PageActions/variables.js +37 -0
- package/lib/components/TableOfContent/TableOfContent.js +15 -12
- package/lib/components/Tags/CounterTag.d.ts +1 -1
- package/lib/components/Tags/HttpTag.d.ts +1 -1
- package/lib/core/constants/common.d.ts +4 -0
- package/lib/core/constants/common.js +5 -1
- package/lib/core/contexts/CodeSnippetContext.d.ts +7 -0
- package/lib/core/contexts/CodeSnippetContext.js +23 -0
- package/lib/core/contexts/index.d.ts +1 -0
- package/lib/core/contexts/index.js +1 -0
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -0
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -0
- package/lib/core/hooks/code-walkthrough/use-renderable-files.d.ts +1 -2
- package/lib/core/hooks/code-walkthrough/use-renderable-files.js +2 -2
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/use-active-heading.d.ts +7 -2
- package/lib/core/hooks/use-active-heading.js +160 -23
- package/lib/core/hooks/use-codeblock-tabs-controls.d.ts +2 -2
- package/lib/core/hooks/use-codeblock-tabs-controls.js +6 -6
- package/lib/core/hooks/use-local-state.d.ts +1 -0
- package/lib/core/hooks/use-local-state.js +32 -0
- package/lib/core/hooks/use-page-actions.d.ts +2 -0
- package/lib/core/hooks/use-page-actions.js +101 -0
- package/lib/core/hooks/use-theme-hooks.js +2 -0
- package/lib/core/styles/dark.js +2 -0
- package/lib/core/styles/global.js +2 -0
- package/lib/core/types/hooks.d.ts +2 -1
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/index.js +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/page-actions.d.ts +15 -0
- package/lib/core/types/page-actions.js +3 -0
- package/lib/core/types/sidebar.d.ts +1 -0
- package/lib/core/utils/enhanced-smoothstep.d.ts +5 -0
- package/lib/core/utils/enhanced-smoothstep.js +15 -0
- package/lib/core/utils/get-file-icon.d.ts +3 -2
- package/lib/core/utils/get-file-icon.js +109 -29
- package/lib/core/utils/icon-resolver.d.ts +28 -0
- package/lib/core/utils/icon-resolver.js +52 -0
- package/lib/core/utils/index.d.ts +4 -1
- package/lib/core/utils/index.js +4 -1
- package/lib/core/utils/lang-to-name.d.ts +1 -0
- package/lib/core/utils/lang-to-name.js +37 -0
- package/lib/core/utils/{text-transform.js → string.js} +1 -1
- package/lib/ext/configure.d.ts +1 -1
- package/lib/icons/CDNIcon/CDNIcon.d.ts +14 -0
- package/lib/icons/CDNIcon/CDNIcon.js +48 -0
- package/lib/icons/ChatGptIcon/ChatGptIcon.d.ts +9 -0
- package/lib/icons/ChatGptIcon/ChatGptIcon.js +22 -0
- package/lib/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon.d.ts +9 -0
- package/lib/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon.js +23 -0
- package/lib/icons/ClaudeIcon/ClaudeIcon.d.ts +9 -0
- package/lib/icons/ClaudeIcon/ClaudeIcon.js +22 -0
- package/lib/icons/GenericIcon/GenericIcon.d.ts +11 -0
- package/lib/icons/GenericIcon/GenericIcon.js +61 -0
- package/lib/icons/MarkdownFullIcon/MarkdownFullIcon.d.ts +9 -0
- package/lib/icons/MarkdownFullIcon/MarkdownFullIcon.js +23 -0
- package/lib/icons/NoneIcon/NoneIcon.d.ts +9 -0
- package/lib/icons/NoneIcon/NoneIcon.js +17 -0
- package/lib/icons/types.d.ts +6 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +6 -0
- package/lib/layouts/CodeWalkthroughLayout.js +2 -2
- package/lib/layouts/DocumentationLayout.js +14 -10
- package/lib/markdoc/components/Cards/CardIcon.js +7 -19
- package/lib/markdoc/components/CodeGroup/CodeGroup.d.ts +4 -0
- package/lib/markdoc/components/CodeGroup/CodeGroup.js +72 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +7 -4
- package/lib/markdoc/components/Heading/Heading.d.ts +2 -1
- package/lib/markdoc/components/Heading/Heading.js +21 -3
- package/lib/markdoc/components/Icon/Icon.d.ts +3 -0
- package/lib/markdoc/components/Icon/Icon.js +29 -0
- package/lib/markdoc/components/Tabs/Tab.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tab.js +5 -2
- package/lib/markdoc/components/Tabs/Tabs.d.ts +1 -1
- package/lib/markdoc/components/Tabs/variables.js +2 -0
- package/lib/markdoc/components/default.d.ts +2 -0
- package/lib/markdoc/components/default.js +2 -0
- package/lib/markdoc/default.js +4 -0
- package/lib/markdoc/tags/card.js +1 -1
- package/lib/markdoc/tags/code-group.d.ts +2 -0
- package/lib/markdoc/tags/code-group.js +23 -0
- package/lib/markdoc/tags/code-snippet.js +1 -1
- package/lib/markdoc/tags/icon.d.ts +2 -0
- package/lib/markdoc/tags/icon.js +16 -0
- package/lib/markdoc/tags/tab.js +1 -0
- package/package.json +3 -3
- package/src/components/Button/Button.tsx +3 -2
- package/src/components/Button/ButtonGroup.tsx +53 -0
- package/src/components/Button/variables.ts +32 -5
- package/src/components/Catalog/Catalog.tsx +1 -1
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +1 -1
- package/src/components/Catalog/CatalogSelector.tsx +3 -1
- package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
- package/src/components/CodeBlock/CodeBlock.tsx +14 -5
- package/src/components/CodeBlock/CodeBlockControls.tsx +14 -6
- package/src/components/CodeBlock/CodeBlockDropdown.tsx +53 -0
- package/src/components/CodeBlock/CodeBlockTabs.tsx +29 -20
- package/src/components/CodeBlock/variables.ts +1 -1
- package/src/components/Dropdown/Dropdown.tsx +1 -0
- package/src/components/Dropdown/DropdownMenu.tsx +4 -0
- package/src/components/Dropdown/variables.ts +1 -0
- package/src/components/Footer/FooterItem.tsx +5 -12
- package/src/components/Footer/variables.ts +2 -2
- package/src/components/Markdown/Markdown.tsx +3 -3
- package/src/components/Markdown/styles/headingAnchor.ts +0 -1
- package/src/components/Menu/MenuItem.tsx +5 -5
- package/src/components/Menu/variables.ts +1 -1
- package/src/components/Navbar/NavbarItem.tsx +8 -17
- package/src/components/Navbar/variables.ts +2 -2
- package/src/components/PageActions/PageActions.tsx +110 -0
- package/src/components/PageActions/PageActionsMenuItem.tsx +73 -0
- package/src/components/PageActions/variables.dark.ts +6 -0
- package/src/components/PageActions/variables.ts +34 -0
- package/src/components/TableOfContent/TableOfContent.tsx +33 -36
- package/src/core/constants/common.ts +4 -0
- package/src/core/contexts/CodeSnippetContext.tsx +31 -0
- package/src/core/contexts/index.ts +1 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/code-walkthrough/use-renderable-files.ts +3 -4
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/use-active-heading.ts +199 -28
- package/src/core/hooks/use-codeblock-tabs-controls.ts +8 -8
- package/src/core/hooks/use-local-state.ts +30 -0
- package/src/core/hooks/use-page-actions.ts +115 -0
- package/src/core/hooks/use-theme-hooks.ts +2 -0
- package/src/core/styles/dark.ts +2 -1
- package/src/core/styles/global.ts +2 -0
- package/src/core/types/hooks.ts +2 -0
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +12 -0
- package/src/core/types/page-actions.ts +18 -0
- package/src/core/types/sidebar.ts +1 -0
- package/src/core/utils/enhanced-smoothstep.ts +14 -0
- package/src/core/utils/get-file-icon.tsx +94 -0
- package/src/core/utils/icon-resolver.ts +57 -0
- package/src/core/utils/index.ts +4 -1
- package/src/core/utils/lang-to-name.ts +35 -0
- package/src/ext/configure.ts +1 -1
- package/src/icons/CDNIcon/CDNIcon.tsx +47 -0
- package/src/icons/ChatGptIcon/ChatGptIcon.tsx +23 -0
- package/src/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon.tsx +24 -0
- package/src/icons/ClaudeIcon/ClaudeIcon.tsx +23 -0
- package/src/icons/GenericIcon/GenericIcon.tsx +69 -0
- package/src/icons/MarkdownFullIcon/MarkdownFullIcon.tsx +24 -0
- package/src/icons/NoneIcon/NoneIcon.tsx +17 -0
- package/src/icons/types.ts +7 -0
- package/src/index.ts +6 -0
- package/src/layouts/CodeWalkthroughLayout.tsx +1 -1
- package/src/layouts/DocumentationLayout.tsx +23 -13
- package/src/markdoc/components/Cards/CardIcon.tsx +6 -21
- package/src/markdoc/components/CodeGroup/CodeGroup.tsx +78 -0
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +7 -4
- package/src/markdoc/components/Heading/Heading.tsx +22 -3
- package/src/markdoc/components/Icon/Icon.tsx +16 -0
- package/src/markdoc/components/Tabs/Tab.tsx +6 -1
- package/src/markdoc/components/Tabs/Tabs.tsx +1 -1
- package/src/markdoc/components/Tabs/variables.ts +2 -0
- package/src/markdoc/components/default.ts +2 -0
- package/src/markdoc/default.ts +4 -0
- package/src/markdoc/tags/card.ts +1 -1
- package/src/markdoc/tags/code-group.ts +21 -0
- package/src/markdoc/tags/code-snippet.ts +1 -1
- package/src/markdoc/tags/icon.ts +14 -0
- package/src/markdoc/tags/tab.ts +1 -0
- package/src/core/utils/get-file-icon.ts +0 -42
- /package/lib/core/utils/{text-transform.d.ts → string.d.ts} +0 -0
- /package/src/core/utils/{text-transform.ts → string.ts} +0 -0
|
@@ -13,13 +13,13 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
13
13
|
size?: ButtonSize;
|
|
14
14
|
extraClass?: string;
|
|
15
15
|
to?: string;
|
|
16
|
+
external?: boolean;
|
|
16
17
|
icon?: JSX.Element;
|
|
17
18
|
iconPosition?: 'left' | 'right';
|
|
18
19
|
title?: string;
|
|
19
20
|
tabIndex?: number;
|
|
20
21
|
onClick?: (e?: any) => void;
|
|
21
22
|
ref?: React.Ref<HTMLButtonElement>;
|
|
22
|
-
type?: 'button' | 'submit' | 'reset';
|
|
23
23
|
}
|
|
24
24
|
export declare function generateClassName({ variant, tone, size, extraClass, }: ButtonProps): string;
|
|
25
25
|
export declare const Button: import("styled-components").StyledComponent<React.FC<ButtonProps>, any, ButtonProps, never>;
|
|
@@ -55,6 +55,7 @@ const StyledButtonLink = (0, styled_components_1.default)(Link_1.Link) `
|
|
|
55
55
|
`;
|
|
56
56
|
function generateClassName({ variant = 'secondary', tone = 'default', size = 'medium', extraClass = '', }) {
|
|
57
57
|
const classNames = [
|
|
58
|
+
'button',
|
|
58
59
|
extraClass,
|
|
59
60
|
`button-tone-${tone}`,
|
|
60
61
|
`button-variant-${variant}`,
|
|
@@ -161,7 +162,7 @@ const ButtonComponent = (props) => {
|
|
|
161
162
|
props.children,
|
|
162
163
|
props.icon && props.iconPosition === 'right' && props.icon));
|
|
163
164
|
if (props.to) {
|
|
164
|
-
return (react_1.default.createElement(StyledButtonLink, { to: props.to, onClick: props.onClick }, button));
|
|
165
|
+
return (react_1.default.createElement(StyledButtonLink, { to: props.to, external: props.external, onClick: props.onClick }, button));
|
|
165
166
|
}
|
|
166
167
|
else {
|
|
167
168
|
return button;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { JSX } from 'react';
|
|
3
|
+
import type { ButtonSize } from '../../components/Button/Button';
|
|
4
|
+
type ButtonGroupVariant = 'outlined';
|
|
5
|
+
type ButtonGroupProps = {
|
|
6
|
+
variant?: ButtonGroupVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function ButtonGroup(props: ButtonGroupProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
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.ButtonGroup = ButtonGroup;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
function ButtonGroup(props) {
|
|
10
|
+
const { variant = 'outlined', className = '', children, size = 'medium' } = props;
|
|
11
|
+
return (react_1.default.createElement(ButtonGroupWrapper, { "data-component-name": "Button/ButtonGroup", className: `button-group-${variant} button-group-size-${size} ${className}` }, children));
|
|
12
|
+
}
|
|
13
|
+
const ButtonGroupWrapper = styled_components_1.default.div `
|
|
14
|
+
display: flex;
|
|
15
|
+
line-height: var(--button-line-height);
|
|
16
|
+
|
|
17
|
+
.button {
|
|
18
|
+
border-radius: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
& > .button:first-child,
|
|
22
|
+
*:first-child > .button {
|
|
23
|
+
border-top-left-radius: var(--button-border-radius);
|
|
24
|
+
border-bottom-left-radius: var(--button-border-radius);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
& > .button:last-child,
|
|
28
|
+
*:last-child > .button {
|
|
29
|
+
border-top-right-radius: var(--button-border-radius);
|
|
30
|
+
border-bottom-right-radius: var(--button-border-radius);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
& > .button:not(:first-child),
|
|
34
|
+
*:not(:first-child) > .button {
|
|
35
|
+
border-left: none;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
//# sourceMappingURL=ButtonGroup.js.map
|
|
@@ -93,9 +93,12 @@ exports.button = (0, styled_components_1.css) `
|
|
|
93
93
|
* @tokens Button size
|
|
94
94
|
*/
|
|
95
95
|
|
|
96
|
-
.button-size-small
|
|
96
|
+
.button-size-small,
|
|
97
|
+
.button-group-size-small .button {
|
|
98
|
+
--button-font-size: var(--font-size-base);
|
|
97
99
|
--button-border-radius: var(--border-radius);
|
|
98
100
|
--button-padding: 1px var(--spacing-sm);
|
|
101
|
+
--button-line-height: var(--line-height-base);
|
|
99
102
|
|
|
100
103
|
--button-icon-size: 14px;
|
|
101
104
|
--button-icon-padding: 5px; /* Padding for small buttons with only icon */
|
|
@@ -103,11 +106,25 @@ exports.button = (0, styled_components_1.css) `
|
|
|
103
106
|
--button-icon-right-padding: 1px 10px 1px var(--spacing-sm); /* Padding for small buttons with icon on the right */
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
.button-size-
|
|
109
|
+
.button-size-medium,
|
|
110
|
+
.button-group-size-medium .button {
|
|
111
|
+
--button-font-size: var(--font-size-base);
|
|
112
|
+
--button-border-radius: var(--border-radius-md);
|
|
113
|
+
--button-padding: 5px var(--spacing-sm);
|
|
114
|
+
--button-line-height: var(--line-height-base);
|
|
115
|
+
|
|
116
|
+
--button-icon-size: 16px;
|
|
117
|
+
--button-icon-padding: var(--spacing-xs); /* Padding for buttons with only icon */
|
|
118
|
+
--button-icon-left-padding: 5px var(--spacing-base) 5px 14px; /* Padding for buttons with icon on the left */
|
|
119
|
+
--button-icon-right-padding: 5px 14px 5px var(--spacing-base); /* Padding for buttons with icon on the right */
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.button-size-large,
|
|
123
|
+
.button-group-size-large .button {
|
|
107
124
|
--button-font-size: var(--font-size-lg); // @presenter FontSize
|
|
108
|
-
--button-
|
|
109
|
-
--border-radius: var(--border-radius-lg);
|
|
125
|
+
--button-border-radius: var(--border-radius-md);
|
|
110
126
|
--button-padding: var(--spacing-xs) var(--spacing-md);
|
|
127
|
+
--button-line-height: var(--line-height-lg); // @presenter LineHeight
|
|
111
128
|
|
|
112
129
|
--button-icon-size: 18px;
|
|
113
130
|
--button-icon-padding: 11px; /* Padding for large buttons with only icon */
|
|
@@ -155,7 +172,8 @@ exports.button = (0, styled_components_1.css) `
|
|
|
155
172
|
--button-border-color-danger-pressed: transparent;
|
|
156
173
|
}
|
|
157
174
|
|
|
158
|
-
.button-variant-outlined
|
|
175
|
+
.button-variant-outlined,
|
|
176
|
+
.button-group-outlined .button {
|
|
159
177
|
--button-color: var(--button-content-color-custom); // @presenter Color
|
|
160
178
|
--button-color-hover: var(--button-content-color-custom-hover); // @presenter Color
|
|
161
179
|
--button-color-active: var(--button-content-color-custom-hover); // @presenter Color
|
|
@@ -165,6 +183,15 @@ exports.button = (0, styled_components_1.css) `
|
|
|
165
183
|
--button-bg-color-disabled: transparent; // @presenter Color
|
|
166
184
|
--button-border-width: 1px;
|
|
167
185
|
--button-border-width-disabled: 1px;
|
|
186
|
+
--button-bg-color: transparent; // @presenter Color
|
|
187
|
+
--button-border-color-disabled: var(--color-warm-grey-2); // @presenter Color
|
|
188
|
+
--button-border-color-danger: var(--color-raspberry-6); // @presenter Color
|
|
189
|
+
--button-border-color-danger-hover: var(--color-raspberry-7); // @presenter Color
|
|
190
|
+
--button-border-color-danger-pressed: var(--color-raspberry-8); // @presenter Color
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.button-group-outlined .button {
|
|
194
|
+
--button-bg-color-hover: var(--color-hover-base); // @presenter Color
|
|
168
195
|
}
|
|
169
196
|
|
|
170
197
|
.button-variant-text {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { CatalogEntityConfig } from '@redocly/config';
|
|
3
3
|
import { BffCatalogEntityList } from '../../core/types';
|
|
4
|
-
import { CatalogSwitcherItem } from '../../core';
|
|
4
|
+
import { CatalogSwitcherItem } from '../../core/types/catalog';
|
|
5
5
|
export type CatalogProps = {
|
|
6
6
|
catalogConfig: CatalogEntityConfig;
|
|
7
7
|
entitiesTypes: string[];
|
|
@@ -13,13 +13,13 @@ const ArrowRightIcon_1 = require("../../../icons/ArrowRightIcon/ArrowRightIcon")
|
|
|
13
13
|
const ArrowUpRightIcon_1 = require("../../../icons/ArrowUpRightIcon/ArrowUpRightIcon");
|
|
14
14
|
const CatalogTagsWithTooltip_1 = require("../../../components/Catalog/CatalogTagsWithTooltip");
|
|
15
15
|
const CatalogEntityIcon_1 = require("../../../components/Catalog/CatalogEntityIcon");
|
|
16
|
-
const
|
|
16
|
+
const utils_1 = require("../../../core/utils");
|
|
17
17
|
const Tooltip_1 = require("../../../components/Tooltip/Tooltip");
|
|
18
18
|
function CatalogCard({ entity, catalogConfig }) {
|
|
19
19
|
var _a, _b, _c;
|
|
20
20
|
const { useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
21
21
|
const telemetry = useTelemetry();
|
|
22
|
-
const pathPrefix = (0,
|
|
22
|
+
const pathPrefix = (0, utils_1.getPathPrefix)();
|
|
23
23
|
return (react_1.default.createElement(CatalogCardWrapper, { "data-component-name": "Catalog/CatalogCardView/CatalogCard", onClick: () => {
|
|
24
24
|
window.location.assign(`${pathPrefix}/catalogs/${catalogConfig.slug}/entities/${entity.key}`);
|
|
25
25
|
telemetry.send({ type: 'catalog_item.clicked' });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { Select } from '../../components/Select/Select';
|
|
3
|
-
import { CatalogSwitcherItem, SortOption } from '../../core';
|
|
3
|
+
import { CatalogSwitcherItem, SortOption } from '../../core/types/catalog';
|
|
4
4
|
export type CatalogSelectorProps = {
|
|
5
5
|
catalogSwitcherItems: CatalogSwitcherItem[];
|
|
6
6
|
setSearchQuery: (query: string) => void;
|
|
@@ -9,13 +9,14 @@ const react_1 = __importDefault(require("react"));
|
|
|
9
9
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
10
|
const react_router_dom_1 = require("react-router-dom");
|
|
11
11
|
const Select_1 = require("../../components/Select/Select");
|
|
12
|
-
const
|
|
12
|
+
const utils_1 = require("../../core/utils");
|
|
13
|
+
const hooks_1 = require("../../core/hooks");
|
|
13
14
|
const ChevronDownIcon_1 = require("../../icons/ChevronDownIcon/ChevronDownIcon");
|
|
14
15
|
function CatalogSelector({ catalogSwitcherItems, setSearchQuery, setSortOption, }) {
|
|
15
|
-
const { useTranslate } = (0,
|
|
16
|
+
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
16
17
|
const { translate } = useTranslate();
|
|
17
18
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
18
|
-
const pathPrefix = (0,
|
|
19
|
+
const pathPrefix = (0, utils_1.getPathPrefix)();
|
|
19
20
|
const options = catalogSwitcherItems.map((item) => ({
|
|
20
21
|
value: item.slug,
|
|
21
22
|
element: translate(item.labelTranslationKey),
|
|
@@ -8,7 +8,8 @@ export type CodeBlockProps = {
|
|
|
8
8
|
header?: CodeBlockControlsProps;
|
|
9
9
|
dataTestId?: string;
|
|
10
10
|
className?: string;
|
|
11
|
-
tabs?:
|
|
11
|
+
tabs?: CodeBlockTabItems;
|
|
12
|
+
dropdown?: CodeBlockDropdownItems;
|
|
12
13
|
withLineNumbers?: boolean;
|
|
13
14
|
startLineNumber?: number;
|
|
14
15
|
highlightedHtml?: string;
|
|
@@ -24,12 +25,21 @@ type UnstableExternalCodeSample = {
|
|
|
24
25
|
label?: string;
|
|
25
26
|
get: (source: ExternalSource) => string;
|
|
26
27
|
};
|
|
27
|
-
export type
|
|
28
|
-
|
|
28
|
+
export type CodeBlockTabItems = {
|
|
29
|
+
items: {
|
|
29
30
|
name: string;
|
|
31
|
+
lang?: string;
|
|
30
32
|
}[];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
onChange: (name: string) => void;
|
|
34
|
+
value: string;
|
|
35
|
+
};
|
|
36
|
+
export type CodeBlockDropdownItems = {
|
|
37
|
+
items: {
|
|
38
|
+
name: string;
|
|
39
|
+
lang?: string;
|
|
40
|
+
}[];
|
|
41
|
+
onChange: (name: string | string[]) => void;
|
|
42
|
+
value: string;
|
|
33
43
|
};
|
|
34
44
|
type ExternalSource = {
|
|
35
45
|
sample: UnstableExternalCodeSample;
|
|
@@ -38,5 +48,5 @@ type ExternalSource = {
|
|
|
38
48
|
properties?: any;
|
|
39
49
|
operation?: any;
|
|
40
50
|
};
|
|
41
|
-
export declare function CodeBlock({ lang, source, externalSource, header, dataTestId, codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, hideCodeColors, wrapContents, children, ...rest }: React.PropsWithChildren<CodeBlockProps>): JSX.Element;
|
|
51
|
+
export declare function CodeBlock({ lang, source, externalSource, header, dataTestId, codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, dropdown, hideCodeColors, wrapContents, children, ...rest }: React.PropsWithChildren<CodeBlockProps>): JSX.Element;
|
|
42
52
|
export {};
|
|
@@ -47,7 +47,7 @@ const CodeBlockContainer_1 = require("../../components/CodeBlock/CodeBlockContai
|
|
|
47
47
|
const CodeBlockControls_1 = require("../../components/CodeBlock/CodeBlockControls");
|
|
48
48
|
function CodeBlock(_a) {
|
|
49
49
|
var _b, _c, _d, _e, _f, _g;
|
|
50
|
-
var { lang, source, externalSource, header, dataTestId = 'source-code', codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, hideCodeColors, wrapContents = false, children } = _a, rest = __rest(_a, ["lang", "source", "externalSource", "header", "dataTestId", "codeBlockRef", "highlightedHtml", "withLineNumbers", "startLineNumber", "className", "codeBlockMaxHeight", "tabs", "hideCodeColors", "wrapContents", "children"]);
|
|
50
|
+
var { lang, source, externalSource, header, dataTestId = 'source-code', codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, dropdown, hideCodeColors, wrapContents = false, children } = _a, rest = __rest(_a, ["lang", "source", "externalSource", "header", "dataTestId", "codeBlockRef", "highlightedHtml", "withLineNumbers", "startLineNumber", "className", "codeBlockMaxHeight", "tabs", "dropdown", "hideCodeColors", "wrapContents", "children"]);
|
|
51
51
|
const [sourceCode, setSourceCode] = (0, react_1.useState)((_d = (source || ((_c = (_b = externalSource === null || externalSource === void 0 ? void 0 : externalSource.sample) === null || _b === void 0 ? void 0 : _b.get) === null || _c === void 0 ? void 0 : _c.call(_b, externalSource)))) !== null && _d !== void 0 ? _d : '');
|
|
52
52
|
const { useCodeHighlight } = (0, hooks_1.useThemeHooks)();
|
|
53
53
|
const { highlight } = useCodeHighlight() || {};
|
|
@@ -77,7 +77,7 @@ function CodeBlock(_a) {
|
|
|
77
77
|
const controls = (header === null || header === void 0 ? void 0 : header.controls) && Object.assign(Object.assign({}, header === null || header === void 0 ? void 0 : header.controls), { report: Object.assign(Object.assign({}, (_e = header === null || header === void 0 ? void 0 : header.controls) === null || _e === void 0 ? void 0 : _e.report), { props: reportButton.props }), copy: ((_f = header === null || header === void 0 ? void 0 : header.controls) === null || _f === void 0 ? void 0 : _f.copy) ? Object.assign(Object.assign({}, (_g = header === null || header === void 0 ? void 0 : header.controls) === null || _g === void 0 ? void 0 : _g.copy), { data: sourceCode }) : undefined });
|
|
78
78
|
return (react_1.default.createElement(CodeBlockWrapper, { "data-component-name": "CodeBlock/CodeBlock", className: className },
|
|
79
79
|
react_1.default.createElement(ContainerWrapper, null,
|
|
80
|
-
react_1.default.createElement(CodeBlockControls_1.CodeBlockControls, { tabs: tabs, className: header === null || header === void 0 ? void 0 : header.className, title: header === null || header === void 0 ? void 0 : header.title, controls: controls }),
|
|
80
|
+
react_1.default.createElement(CodeBlockControls_1.CodeBlockControls, { tabs: tabs, dropdown: dropdown, className: header === null || header === void 0 ? void 0 : header.className, title: header === null || header === void 0 ? void 0 : header.title, controls: controls }),
|
|
81
81
|
react_1.default.createElement(CodeBlockContainer_1.CodeBlockContainer, { ref: codeBlockRef, withLineNumbers: withLineNumbers, dangerouslySetInnerHTML: highlightedCode
|
|
82
82
|
? {
|
|
83
83
|
__html: highlightedCode,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { JSX } from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { CodeBlockDropdownItems, CodeBlockTabItems } from '../../components/CodeBlock/CodeBlock';
|
|
4
4
|
export type CodeBlockControlsProps = {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
className?: string;
|
|
7
7
|
title?: React.ReactNode | string;
|
|
8
8
|
controls?: ControlItems | false;
|
|
9
|
-
tabs?:
|
|
9
|
+
tabs?: CodeBlockTabItems;
|
|
10
|
+
dropdown?: CodeBlockDropdownItems;
|
|
10
11
|
};
|
|
11
12
|
type ControlItems = {
|
|
12
13
|
copy?: CopyControlProps;
|
|
@@ -33,5 +34,5 @@ type CopyControlProps = ControlProps & {
|
|
|
33
34
|
handleOutside?: boolean;
|
|
34
35
|
};
|
|
35
36
|
export type ControlItemType = 'text' | 'icon';
|
|
36
|
-
export declare function CodeBlockControls({ children, className, title, controls, tabs, }: CodeBlockControlsProps): JSX.Element | null;
|
|
37
|
+
export declare function CodeBlockControls({ children, className, title, controls, tabs, dropdown, }: CodeBlockControlsProps): JSX.Element | null;
|
|
37
38
|
export {};
|
|
@@ -16,7 +16,8 @@ const MinimizeIcon_1 = require("../../icons/MinimizeIcon/MinimizeIcon");
|
|
|
16
16
|
const SelectIcon_1 = require("../../icons/SelectIcon/SelectIcon");
|
|
17
17
|
const WarningSquareIcon_1 = require("../../icons/WarningSquareIcon/WarningSquareIcon");
|
|
18
18
|
const Button_1 = require("../../components/Button/Button");
|
|
19
|
-
|
|
19
|
+
const CodeBlockDropdown_1 = require("../../components/CodeBlock/CodeBlockDropdown");
|
|
20
|
+
function CodeBlockControls({ children, className, title, controls, tabs, dropdown, }) {
|
|
20
21
|
var _a, _b, _c, _d, _e;
|
|
21
22
|
const { codeSnippet } = (0, hooks_1.useThemeConfig)();
|
|
22
23
|
const { useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
@@ -30,11 +31,12 @@ function CodeBlockControls({ children, className, title, controls, tabs, }) {
|
|
|
30
31
|
deselect: null,
|
|
31
32
|
report: null,
|
|
32
33
|
};
|
|
33
|
-
const isEmptyTitle = !title && !tabs;
|
|
34
|
+
const isEmptyTitle = !title && !tabs && !dropdown;
|
|
34
35
|
const defaultControls = controls ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
35
36
|
title && react_1.default.createElement(Title, null, title),
|
|
36
37
|
tabs && react_1.default.createElement(CodeBlockTabs_1.CodeBlockTabs, { tabs: tabs }),
|
|
37
38
|
react_1.default.createElement(ControlsWrapper, null,
|
|
39
|
+
dropdown && react_1.default.createElement(CodeBlockDropdown_1.CodeBlockDropdown, Object.assign({}, dropdown)),
|
|
38
40
|
report && !((_a = report === null || report === void 0 ? void 0 : report.props) === null || _a === void 0 ? void 0 : _a.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, { tooltipTranslationKey: "codeSnippet.report.tooltipText", placement: "top" },
|
|
39
41
|
react_1.default.createElement(ControlButton, Object.assign({ variant: "text", size: "small", "data-testid": "report-button", icon: controlsType === 'icon' ? react_1.default.createElement(WarningSquareIcon_1.WarningSquareIcon, { size: "18px" }) : undefined }, report.props), controlsType != 'icon' && (((_b = report.props) === null || _b === void 0 ? void 0 : _b.buttonText) || 'Report')))) : null,
|
|
40
42
|
expand && !((_c = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.expand) === null || _c === void 0 ? void 0 : _c.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, { tooltipTranslationKey: "codeSnippet.expand.tooltipText", placement: "top" },
|
|
@@ -61,7 +63,8 @@ function CodeBlockControls({ children, className, title, controls, tabs, }) {
|
|
|
61
63
|
}
|
|
62
64
|
const ContainerWrapper = styled_components_1.default.div `
|
|
63
65
|
display: grid;
|
|
64
|
-
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
align-items: center;
|
|
65
68
|
gap: var(--spacing-sm);
|
|
66
69
|
font-size: var(--code-block-controls-font-size);
|
|
67
70
|
font-family: var(--code-block-controls-font-family);
|
|
@@ -74,13 +77,12 @@ const ContainerWrapper = styled_components_1.default.div `
|
|
|
74
77
|
z-index: 1;
|
|
75
78
|
${({ $isEmptyTitle }) => $isEmptyTitle &&
|
|
76
79
|
`
|
|
77
|
-
grid-template-columns: 1fr;
|
|
78
|
-
padding-left: var(--spacing-xxs);
|
|
79
80
|
position: absolute;
|
|
80
81
|
right: 0;
|
|
81
82
|
width: auto;
|
|
82
83
|
border: none;
|
|
83
84
|
background-color: transparent;
|
|
85
|
+
grid-template-columns: 1fr;
|
|
84
86
|
margin: 0;
|
|
85
87
|
`}
|
|
86
88
|
`;
|
|
@@ -90,6 +92,7 @@ const Title = styled_components_1.default.span `
|
|
|
90
92
|
color: var(--code-block-controls-text-color);
|
|
91
93
|
width: 100%;
|
|
92
94
|
font-weight: var(--code-block-controls-font-weight);
|
|
95
|
+
padding-left: var(--spacing-xs);
|
|
93
96
|
`;
|
|
94
97
|
const ControlsWrapper = styled_components_1.default.div `
|
|
95
98
|
display: flex;
|
|
@@ -0,0 +1,35 @@
|
|
|
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.CodeBlockDropdown = CodeBlockDropdown;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
10
|
+
const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
|
|
11
|
+
const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
|
|
12
|
+
const Button_1 = require("../../components/Button/Button");
|
|
13
|
+
const ChevronSortIcon_1 = require("../../icons/ChevronSortIcon/ChevronSortIcon");
|
|
14
|
+
const NoneIcon_1 = require("../../icons/NoneIcon/NoneIcon");
|
|
15
|
+
const utils_1 = require("../../core/utils");
|
|
16
|
+
function CodeBlockDropdown({ items, onChange, value }) {
|
|
17
|
+
const activeItem = items.find((item) => item.name === value) || items[0];
|
|
18
|
+
const icon = (activeItem === null || activeItem === void 0 ? void 0 : activeItem.lang) ? (0, utils_1.getFileIconByLanguage)(activeItem === null || activeItem === void 0 ? void 0 : activeItem.lang) : null;
|
|
19
|
+
return (react_1.default.createElement(StyledDropdown, { alignment: "end", trigger: react_1.default.createElement(Button_1.Button, { icon: react_1.default.createElement(ChevronSortIcon_1.ChevronSortIcon, null), iconPosition: "right", variant: "text", size: "small" },
|
|
20
|
+
icon,
|
|
21
|
+
activeItem.name) },
|
|
22
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, null, items.map((item) => {
|
|
23
|
+
const icon = (0, utils_1.getFileIconByLanguage)(item.lang || '');
|
|
24
|
+
return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: item.lang, onAction: () => onChange(item.name), active: item.name === activeItem.name, prefix: item.lang ? icon : react_1.default.createElement(NoneIcon_1.NoneIcon, { size: "var(--icon-size)" }) }, item.name));
|
|
25
|
+
}))));
|
|
26
|
+
}
|
|
27
|
+
const StyledDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown) `
|
|
28
|
+
margin-left: auto;
|
|
29
|
+
--icon-size: 18px;
|
|
30
|
+
--button-color: var(--text-color-secondary);
|
|
31
|
+
button.button-size-small {
|
|
32
|
+
--button-icon-size: 18px;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
//# sourceMappingURL=CodeBlockDropdown.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JSX } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CodeBlockTabItems } from '../../components/CodeBlock/CodeBlock';
|
|
3
3
|
export type CodeBlockTabsProps = {
|
|
4
|
-
tabs:
|
|
4
|
+
tabs: CodeBlockTabItems;
|
|
5
5
|
};
|
|
6
6
|
export declare function CodeBlockTabs({ tabs }: CodeBlockTabsProps): JSX.Element;
|
|
@@ -28,9 +28,9 @@ const react_1 = __importStar(require("react"));
|
|
|
28
28
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
29
29
|
const hooks_1 = require("../../core/hooks");
|
|
30
30
|
const Button_1 = require("../../components/Button/Button");
|
|
31
|
-
const DocumentBlankIcon_1 = require("../../icons/DocumentBlankIcon/DocumentBlankIcon");
|
|
32
31
|
const ChevronLeftIcon_1 = require("../../icons/ChevronLeftIcon/ChevronLeftIcon");
|
|
33
32
|
const ChevronRightIcon_1 = require("../../icons/ChevronRightIcon/ChevronRightIcon");
|
|
33
|
+
const get_file_icon_1 = require("../../core/utils/get-file-icon");
|
|
34
34
|
function CodeBlockTabs({ tabs }) {
|
|
35
35
|
const containerRef = (0, react_1.useRef)(null);
|
|
36
36
|
const tabRefs = (0, react_1.useRef)([]);
|
|
@@ -40,18 +40,27 @@ function CodeBlockTabs({ tabs }) {
|
|
|
40
40
|
tabRefs,
|
|
41
41
|
});
|
|
42
42
|
(0, react_1.useEffect)(() => {
|
|
43
|
-
const activeTab = tabRefs.current.find((tab) => (tab === null || tab === void 0 ? void 0 : tab.dataset.name) === tabs.
|
|
43
|
+
const activeTab = tabRefs.current.find((tab) => (tab === null || tab === void 0 ? void 0 : tab.dataset.name) === tabs.value);
|
|
44
44
|
if (activeTab) {
|
|
45
45
|
activeTab.scrollIntoView({ block: 'nearest', inline: 'center' });
|
|
46
46
|
}
|
|
47
|
-
}, [tabs.
|
|
47
|
+
}, [tabs.value]);
|
|
48
48
|
return (react_1.default.createElement(CodeBlockTabsWrapper, { ref: containerRef, "data-component-name": "CodeBlock/CodeBlockTabs" },
|
|
49
49
|
react_1.default.createElement(ShadowWrapper, null,
|
|
50
|
-
react_1.default.createElement(Tabs, null, tabs.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
react_1.default.createElement(Tabs, null, tabs.items.map(({ name, lang }, i) => {
|
|
51
|
+
var _a;
|
|
52
|
+
const ext = (_a = name.match(/\.([^.]+)$/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
53
|
+
const fileIcon = lang
|
|
54
|
+
? (0, get_file_icon_1.getFileIconByLanguage)(lang)
|
|
55
|
+
: ext
|
|
56
|
+
? (0, get_file_icon_1.getFileIconByExt)(ext)
|
|
57
|
+
: null;
|
|
58
|
+
return (react_1.default.createElement(Tab, { ref: (el) => {
|
|
59
|
+
tabRefs.current[i] = el;
|
|
60
|
+
}, "data-name": name, active: name === tabs.value, key: name + i, onClick: () => tabs.onChange(name) },
|
|
61
|
+
fileIcon,
|
|
62
|
+
name));
|
|
63
|
+
}))),
|
|
55
64
|
showControls && (react_1.default.createElement(Controls, null,
|
|
56
65
|
react_1.default.createElement(ControlButton, { size: "small", onClick: handlePrevTab, "data-testid": "prev-button" },
|
|
57
66
|
react_1.default.createElement(ChevronLeftIcon_1.ChevronLeftIcon, null)),
|
|
@@ -61,7 +70,6 @@ function CodeBlockTabs({ tabs }) {
|
|
|
61
70
|
const CodeBlockTabsWrapper = styled_components_1.default.div `
|
|
62
71
|
display: flex;
|
|
63
72
|
overflow: hidden;
|
|
64
|
-
padding: var(--spacing-xxs) 0;
|
|
65
73
|
`;
|
|
66
74
|
const Controls = styled_components_1.default.div `
|
|
67
75
|
display: flex;
|
|
@@ -98,6 +106,7 @@ const Tabs = styled_components_1.default.div `
|
|
|
98
106
|
}
|
|
99
107
|
`;
|
|
100
108
|
const Tab = styled_components_1.default.button `
|
|
109
|
+
--icon-size: 18px;
|
|
101
110
|
display: inline-flex;
|
|
102
111
|
align-items: center;
|
|
103
112
|
|
|
@@ -75,7 +75,7 @@ exports.code = (0, styled_components_1.css) `
|
|
|
75
75
|
--code-block-controls-border: 1px solid var(--border-color-secondary); // @presenter Border
|
|
76
76
|
--code-block-icon-controls-bg-color: var(--code-block-controls-bg-color);
|
|
77
77
|
--code-block-text-controls-bg-color: var(--code-block-controls-bg-color);
|
|
78
|
-
--code-block-controls-padding: var(--spacing-
|
|
78
|
+
--code-block-controls-padding: var(--spacing-xxs);
|
|
79
79
|
--code-block-controls-height: 20px;
|
|
80
80
|
--code-block-controls-width: 20px;
|
|
81
81
|
|
|
@@ -78,6 +78,7 @@ const DropdownWrapper = styled_components_1.default.div `
|
|
|
78
78
|
text-decoration: none;
|
|
79
79
|
`;
|
|
80
80
|
const ChildrenWrapper = styled_components_1.default.div `
|
|
81
|
+
padding-top: var(--dropdown-menu-margin-top);
|
|
81
82
|
position: absolute;
|
|
82
83
|
top: ${({ placement }) => (placement === 'top' ? 'auto' : '100%')};
|
|
83
84
|
bottom: ${({ placement }) => (placement === 'top' ? '100%' : 'auto')};
|
|
@@ -25,6 +25,10 @@ const DropdownMenuWrapper = styled_components_1.default.ul `
|
|
|
25
25
|
line-height: var(--dropdown-menu-line-height);
|
|
26
26
|
color: var(--dropdown-menu-text-color);
|
|
27
27
|
|
|
28
|
+
/* Make sure the spacing is not overriden by the markdown list styles */
|
|
29
|
+
--md-list-margin: 0;
|
|
30
|
+
--md-list-left-padding: var(--dropdown-menu-padding);
|
|
31
|
+
|
|
28
32
|
margin: 0;
|
|
29
33
|
min-width: var(--dropdown-menu-min-width);
|
|
30
34
|
max-width: var(--dropdown-menu-max-width);
|
|
@@ -11,6 +11,7 @@ exports.dropdown = (0, styled_components_1.css) `
|
|
|
11
11
|
--dropdown-menu-line-height: var(--line-height-base); // @presenter LineHeight
|
|
12
12
|
--dropdown-menu-text-color: var(--text-color-secondary); // @presenter Color
|
|
13
13
|
|
|
14
|
+
--dropdown-menu-margin-top: var(--spacing-xxs);
|
|
14
15
|
--dropdown-menu-min-width: 100px;
|
|
15
16
|
--dropdown-menu-max-width: 424px;
|
|
16
17
|
--dropdown-menu-max-height: 300px;
|
|
@@ -9,10 +9,9 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
9
9
|
const hooks_1 = require("../../core/hooks");
|
|
10
10
|
const LaunchIcon_1 = require("../../icons/LaunchIcon/LaunchIcon");
|
|
11
11
|
const Link_1 = require("../../components/Link/Link");
|
|
12
|
-
const Image_1 = require("../../components/Image/Image");
|
|
13
12
|
const utils_1 = require("../../core/utils");
|
|
13
|
+
const GenericIcon_1 = require("../../icons/GenericIcon/GenericIcon");
|
|
14
14
|
function FooterItem({ item, iconsOnly, className }) {
|
|
15
|
-
var _a, _b;
|
|
16
15
|
const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
17
16
|
const telemetry = useTelemetry();
|
|
18
17
|
const { translate } = useTranslate();
|
|
@@ -23,9 +22,7 @@ function FooterItem({ item, iconsOnly, className }) {
|
|
|
23
22
|
const iconWithoutLabel = Boolean(item.label === item.link && hasIcon);
|
|
24
23
|
return (react_1.default.createElement(FooterItemWrapper, { className: className, "data-component-name": "Footer/FooterItem", iconsOnly: iconsOnly, item: item }, item.type === 'separator' ? (react_1.default.createElement(FooterSeparator, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label))) : (react_1.default.createElement(FooterLink, { to: item.link, external: item.external, target: item.target, "data-testid": item.label, onClick: () => telemetry.send({ type: 'footer_item.clicked' }), "data-translation-key": item.labelTranslationKey },
|
|
25
24
|
hasIcon ? (react_1.default.createElement(FooterLinkIcon, { iconsOnly: iconsOnly },
|
|
26
|
-
react_1.default.createElement(
|
|
27
|
-
? `${item.label} icon`
|
|
28
|
-
: `${(_b = (_a = (item.icon || item.srcSet)) === null || _a === void 0 ? void 0 : _a.split('/').pop()) === null || _b === void 0 ? void 0 : _b.split('.')[0]} icon` }))) : null,
|
|
25
|
+
react_1.default.createElement(GenericIcon_1.GenericIcon, { icon: item.icon, srcSet: item.srcSet }))) : null,
|
|
29
26
|
!iconWithoutLabel ? translate(item.labelTranslationKey, item.label) : null,
|
|
30
27
|
item.external ? react_1.default.createElement(LaunchIcon_1.LaunchIcon, { size: "10px" }) : null))));
|
|
31
28
|
}
|
|
@@ -36,9 +33,9 @@ const FooterSeparator = styled_components_1.default.div `
|
|
|
36
33
|
opacity: var(--footer-separator-item-opacity);
|
|
37
34
|
`;
|
|
38
35
|
const FooterLinkIcon = styled_components_1.default.div `
|
|
36
|
+
--icon-width: var(--footer-item-icon-width);
|
|
37
|
+
--icon-height: var(--footer-item-icon-height);
|
|
39
38
|
display: inline-flex;
|
|
40
|
-
width: var(--footer-item-icon-width);
|
|
41
|
-
height: var(--footer-item-icon-height);
|
|
42
39
|
margin-right: ${({ iconsOnly }) => (iconsOnly ? '0' : 'var(--footer-item-icon-margin-right)')};
|
|
43
40
|
vertical-align: middle;
|
|
44
41
|
border: 1px solid var(--footer-item-icon-border-color);
|
|
@@ -28,8 +28,8 @@ exports.footer = (0, styled_components_1.css) `
|
|
|
28
28
|
--footer-link-padding-vertical: var(--spacing-xs); // @presenter Spacing
|
|
29
29
|
--footer-link-padding-horizontal: 0;
|
|
30
30
|
|
|
31
|
-
--footer-item-icon-width: var(--spacing-
|
|
32
|
-
--footer-item-icon-height: var(--spacing-
|
|
31
|
+
--footer-item-icon-width: var(--spacing-base); // @presenter Spacing
|
|
32
|
+
--footer-item-icon-height: var(--spacing-base); // @presenter Spacing
|
|
33
33
|
--footer-item-icon-margin-right: var(--spacing-sm); // @presenter Spacing
|
|
34
34
|
--footer-item-icon-border-color: var(--border-color-primary); // @presenter Color
|
|
35
35
|
--footer-item-icon-border-radius: 12px; // @presenter BorderRadius
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Markdown = void 0;
|
|
27
27
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
28
|
-
const
|
|
28
|
+
const utils_1 = require("../../core/utils");
|
|
29
29
|
const baseTable_1 = require("../../components/Markdown/styles/baseTable");
|
|
30
30
|
const links_1 = require("../../components/Markdown/styles/links");
|
|
31
31
|
const headingAnchor_1 = require("../../components/Markdown/styles/headingAnchor");
|
|
@@ -130,37 +130,37 @@ exports.Markdown = styled_components_1.default.main.attrs(({ className }) => ({
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
h1.md {
|
|
133
|
-
${(0,
|
|
133
|
+
${(0, utils_1.typography)('h1')};
|
|
134
134
|
margin: var(--h1-margin-top) 0 var(--h1-margin-bottom) 0;
|
|
135
135
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
h2.md {
|
|
139
|
-
${(0,
|
|
139
|
+
${(0, utils_1.typography)('h2')};
|
|
140
140
|
margin: var(--h2-margin-top) 0 var(--h2-margin-bottom) 0;
|
|
141
141
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
h3.md {
|
|
145
|
-
${(0,
|
|
145
|
+
${(0, utils_1.typography)('h3')};
|
|
146
146
|
margin: var(--h3-margin-top) 0 var(--h3-margin-bottom) 0;
|
|
147
147
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
h4.md {
|
|
151
|
-
${(0,
|
|
151
|
+
${(0, utils_1.typography)('h4')};
|
|
152
152
|
margin: var(--h4-margin-top) 0 var(--h4-margin-bottom) 0;
|
|
153
153
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
h5.md {
|
|
157
|
-
${(0,
|
|
157
|
+
${(0, utils_1.typography)('h5')};
|
|
158
158
|
margin: var(--h5-margin-top) 0 var(--h5-margin-bottom) 0;
|
|
159
159
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
h6.md {
|
|
163
|
-
${(0,
|
|
163
|
+
${(0, utils_1.typography)('h6')};
|
|
164
164
|
margin: var(--h6-margin-top) 0 var(--h6-margin-bottom) 0;
|
|
165
165
|
${(0, headingAnchor_1.headingAnchorCss)()};
|
|
166
166
|
}
|
|
@@ -257,8 +257,8 @@ exports.Markdown = styled_components_1.default.main.attrs(({ className }) => ({
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
ul,
|
|
261
|
-
ol {
|
|
260
|
+
ul.md,
|
|
261
|
+
ol.md {
|
|
262
262
|
padding-left: var(--md-list-left-padding);
|
|
263
263
|
margin: var(--md-list-margin);
|
|
264
264
|
|