@redocly/theme 0.65.0-next.3 → 0.65.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Button/Button.d.ts +1 -0
- package/lib/components/Button/Button.js +14 -2
- package/lib/components/Catalog/CatalogTags.js +1 -0
- package/lib/components/Catalog/variables.js +1 -0
- package/lib/components/Dropdown/DropdownMenuItem.js +18 -6
- package/lib/components/LanguagePicker/LanguagePicker.js +3 -2
- package/lib/components/Markdown/Markdown.js +92 -26
- package/lib/components/Markdown/styles/base-table.js +2 -1
- package/lib/components/Markdown/styles/heading-anchor.d.ts +1 -1
- package/lib/components/Markdown/styles/heading-anchor.js +1 -1
- package/lib/components/Search/variables.js +1 -3
- package/lib/components/UserMenu/LoginButton.js +1 -1
- package/lib/core/constants/heading.d.ts +9 -0
- package/lib/core/constants/heading.js +13 -0
- package/lib/core/constants/index.d.ts +2 -0
- package/lib/core/constants/index.js +2 -0
- package/lib/core/constants/markdown.d.ts +1 -0
- package/lib/core/constants/markdown.js +5 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +0 -11
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +7 -2
- package/lib/core/hooks/use-active-heading.js +2 -1
- package/lib/core/hooks/use-language-picker.d.ts +6 -1
- package/lib/core/hooks/use-language-picker.js +10 -2
- package/lib/core/styles/palette.dark.js +27 -0
- package/lib/core/styles/palette.js +30 -0
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +2 -2
- package/lib/layouts/CodeWalkthroughLayout.js +3 -1
- package/lib/layouts/DocumentationLayout.js +3 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +8 -7
- package/lib/markdoc/components/Heading/Heading.js +12 -24
- package/package.json +2 -2
- package/src/components/Button/Button.tsx +9 -2
- package/src/components/Catalog/CatalogTags.tsx +1 -0
- package/src/components/Catalog/variables.ts +1 -0
- package/src/components/Dropdown/DropdownMenuItem.tsx +27 -27
- package/src/components/LanguagePicker/LanguagePicker.tsx +3 -2
- package/src/components/Markdown/Markdown.tsx +102 -26
- package/src/components/Markdown/styles/base-table.ts +3 -1
- package/src/components/Markdown/styles/heading-anchor.ts +1 -1
- package/src/components/Search/variables.ts +3 -3
- package/src/components/UserMenu/LoginButton.tsx +1 -0
- package/src/core/constants/heading.ts +9 -0
- package/src/core/constants/index.ts +2 -0
- package/src/core/constants/markdown.ts +1 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +10 -2
- package/src/core/hooks/use-active-heading.ts +2 -1
- package/src/core/hooks/use-language-picker.ts +33 -8
- package/src/core/styles/palette.dark.ts +27 -0
- package/src/core/styles/palette.ts +30 -0
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +8 -2
- package/src/layouts/CodeWalkthroughLayout.tsx +3 -1
- package/src/layouts/DocumentationLayout.tsx +3 -1
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +7 -8
- package/src/markdoc/components/Heading/Heading.tsx +36 -29
|
@@ -20,6 +20,9 @@ function brandPaletteLight(palette) {
|
|
|
20
20
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
21
21
|
|
|
22
22
|
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
23
|
+
|
|
24
|
+
--search-ai-gradient-start-color: var(--color-brand-10); // @presenter Color
|
|
25
|
+
--search-ai-gradient-end-color: var(--color-brand-7); // @presenter Color
|
|
23
26
|
`;
|
|
24
27
|
case 'pink':
|
|
25
28
|
return (0, styled_components_1.css) `
|
|
@@ -37,6 +40,9 @@ function brandPaletteLight(palette) {
|
|
|
37
40
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
38
41
|
|
|
39
42
|
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
43
|
+
|
|
44
|
+
--search-ai-gradient-start-color: var(--color-brand-7); // @presenter Color
|
|
45
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
40
46
|
`;
|
|
41
47
|
case 'coral':
|
|
42
48
|
return (0, styled_components_1.css) `
|
|
@@ -54,6 +60,9 @@ function brandPaletteLight(palette) {
|
|
|
54
60
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
55
61
|
|
|
56
62
|
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
63
|
+
|
|
64
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
65
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
57
66
|
`;
|
|
58
67
|
case 'amber':
|
|
59
68
|
return (0, styled_components_1.css) `
|
|
@@ -71,6 +80,9 @@ function brandPaletteLight(palette) {
|
|
|
71
80
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
72
81
|
|
|
73
82
|
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
83
|
+
|
|
84
|
+
--search-ai-gradient-start-color: var(--color-brand-7); // @presenter Color
|
|
85
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
74
86
|
`;
|
|
75
87
|
case 'jade':
|
|
76
88
|
return (0, styled_components_1.css) `
|
|
@@ -88,6 +100,9 @@ function brandPaletteLight(palette) {
|
|
|
88
100
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
89
101
|
|
|
90
102
|
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
103
|
+
|
|
104
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
105
|
+
--search-ai-gradient-end-color: var(--color-brand-5); // @presenter Color
|
|
91
106
|
`;
|
|
92
107
|
case 'cyan':
|
|
93
108
|
return (0, styled_components_1.css) `
|
|
@@ -105,6 +120,9 @@ function brandPaletteLight(palette) {
|
|
|
105
120
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
106
121
|
|
|
107
122
|
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
123
|
+
|
|
124
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
125
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
108
126
|
`;
|
|
109
127
|
case 'ocean':
|
|
110
128
|
return (0, styled_components_1.css) `
|
|
@@ -122,6 +140,9 @@ function brandPaletteLight(palette) {
|
|
|
122
140
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
123
141
|
|
|
124
142
|
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
143
|
+
|
|
144
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
145
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
125
146
|
`;
|
|
126
147
|
case 'indigo':
|
|
127
148
|
return (0, styled_components_1.css) `
|
|
@@ -139,6 +160,9 @@ function brandPaletteLight(palette) {
|
|
|
139
160
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
140
161
|
|
|
141
162
|
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
163
|
+
|
|
164
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
165
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
142
166
|
`;
|
|
143
167
|
case 'iris':
|
|
144
168
|
return (0, styled_components_1.css) `
|
|
@@ -156,6 +180,9 @@ function brandPaletteLight(palette) {
|
|
|
156
180
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
157
181
|
|
|
158
182
|
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
183
|
+
|
|
184
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
185
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
159
186
|
`;
|
|
160
187
|
default:
|
|
161
188
|
return (0, styled_components_1.css) `
|
|
@@ -202,6 +229,9 @@ function brandPaletteLight(palette) {
|
|
|
202
229
|
--link-color-primary-hover-legacy: var(--color-blue-7); // @presenter Color
|
|
203
230
|
--link-color-primary-pressed-legacy: var(--color-blue-8); // @presenter Color
|
|
204
231
|
--link-color-visited-legacy: var(--color-purple-7); // @presenter Color
|
|
232
|
+
|
|
233
|
+
--search-ai-gradient-start-color-legacy: #715efe; // @presenter Color
|
|
234
|
+
--search-ai-gradient-end-color-legacy: #ff5cdc; // @presenter Color
|
|
205
235
|
`;
|
|
206
236
|
}
|
|
207
237
|
}
|
|
@@ -68,8 +68,8 @@ const Icon = (props) => {
|
|
|
68
68
|
return (react_1.default.createElement("svg", Object.assign({ viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, restProps),
|
|
69
69
|
!isColorOverridden && (react_1.default.createElement("defs", null,
|
|
70
70
|
react_1.default.createElement("linearGradient", { id: "gradient", x1: "0", y1: "0", x2: "1", y2: "0" },
|
|
71
|
-
react_1.default.createElement("stop", { offset: "0%", stopColor: "
|
|
72
|
-
react_1.default.createElement("stop", { offset: "100%", stopColor: "
|
|
71
|
+
react_1.default.createElement("stop", { offset: "0%", stopColor: "var(--search-ai-gradient-start-color, var(--search-ai-gradient-start-color-legacy))" }),
|
|
72
|
+
react_1.default.createElement("stop", { offset: "100%", stopColor: "var(--search-ai-gradient-end-color, var(--search-ai-gradient-end-color-legacy))" })))),
|
|
73
73
|
react_1.default.createElement("path", { d: "M11.2597 9.12114C8.08498 8.40423 7.59322 7.91247 6.87631 4.73772C6.84346 4.59262 6.7143 4.48929 6.56505 4.48929C6.4158 4.48929 6.28664 4.59262 6.2538 4.73772C5.53657 7.91247 5.04513 8.40423 1.87038 9.12114C1.72495 9.1543 1.62163 9.28314 1.62163 9.43239C1.62163 9.58164 1.72495 9.71048 1.87038 9.74365C5.04513 10.4609 5.53657 10.9526 6.2538 14.1271C6.28664 14.2722 6.4158 14.3755 6.56505 14.3755C6.7143 14.3755 6.84346 14.2722 6.87631 14.1271C7.59354 10.9526 8.08498 10.4609 11.2597 9.74365C11.4052 9.71048 11.5082 9.58164 11.5082 9.43239C11.5082 9.28314 11.4048 9.1543 11.2597 9.12114Z", fill: fill }),
|
|
74
74
|
react_1.default.createElement("path", { d: "M14.1299 4.17834C12.4423 3.79725 12.2053 3.5603 11.8242 1.87294C11.7911 1.72752 11.6622 1.62451 11.513 1.62451C11.3637 1.62451 11.2349 1.72752 11.2017 1.87294C10.8206 3.5603 10.5837 3.79725 8.8963 4.17834C8.75088 4.21151 8.64787 4.34035 8.64787 4.4896C8.64787 4.63885 8.75088 4.76769 8.8963 4.80086C10.5837 5.18195 10.8206 5.4189 11.2017 7.10658C11.2349 7.25168 11.3637 7.35501 11.513 7.35501C11.6622 7.35501 11.7911 7.25168 11.8242 7.10658C12.2053 5.4189 12.4423 5.18195 14.1299 4.80086C14.275 4.76769 14.3784 4.63885 14.3784 4.4896C14.3784 4.34035 14.275 4.21151 14.1299 4.17834Z", fill: fill })));
|
|
75
75
|
};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CodeWalkthroughLayout = CodeWalkthroughLayout;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const constants_1 = require("../core/constants");
|
|
9
10
|
const utils_1 = require("../core/utils");
|
|
10
11
|
function CodeWalkthroughLayout({ className, children, }) {
|
|
11
12
|
return (react_1.default.createElement(LayoutWrapper, { "data-component-name": "Layout/CodeWalkthroughLayout", className: className },
|
|
@@ -66,7 +67,8 @@ const ContentWrapper = styled_components_1.default.section `
|
|
|
66
67
|
margin-right: auto;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
&:first-child > h1:first-child
|
|
70
|
+
&:first-child > h1:first-child,
|
|
71
|
+
&:first-child > .${constants_1.H1_CLASS}:first-child {
|
|
70
72
|
// disable margin top for h1 on the title heading
|
|
71
73
|
margin-top: 0;
|
|
72
74
|
}
|
|
@@ -7,6 +7,7 @@ exports.DocumentationLayout = DocumentationLayout;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const utils_1 = require("../core/utils");
|
|
10
|
+
const constants_1 = require("../core/constants");
|
|
10
11
|
const CodeSnippetContext_1 = require("../core/contexts/CodeSnippetContext");
|
|
11
12
|
const DocumentationLayoutTop_1 = require("../layouts/DocumentationLayoutTop");
|
|
12
13
|
const DocumentationLayoutBottom_1 = require("../layouts/DocumentationLayoutBottom");
|
|
@@ -41,7 +42,8 @@ const ContentWrapper = styled_components_1.default.section `
|
|
|
41
42
|
|
|
42
43
|
padding: var(--md-content-padding);
|
|
43
44
|
|
|
44
|
-
article:first-child > h1:first-child
|
|
45
|
+
article:first-child > h1:first-child,
|
|
46
|
+
article:first-child > .${constants_1.H1_CLASS}:first-child {
|
|
45
47
|
// disable margin top for h1 on the title heading
|
|
46
48
|
margin-top: 0;
|
|
47
49
|
}
|
|
@@ -40,9 +40,11 @@ exports.StepWrapper = void 0;
|
|
|
40
40
|
exports.CodeStep = CodeStep;
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
43
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
43
44
|
const Marker_1 = require("../../../components/Marker/Marker");
|
|
44
45
|
const contexts_1 = require("../../../core/contexts");
|
|
45
46
|
function CodeStep({ id, heading, when, unless, children, }) {
|
|
47
|
+
const location = (0, react_router_dom_1.useLocation)();
|
|
46
48
|
const compRef = (0, react_1.useRef)(null);
|
|
47
49
|
const markerRef = (0, react_1.useRef)(null);
|
|
48
50
|
const { areConditionsMet } = (0, react_1.useContext)(contexts_1.CodeWalkthroughControlsStateContext);
|
|
@@ -66,15 +68,14 @@ function CodeStep({ id, heading, when, unless, children, }) {
|
|
|
66
68
|
const handleRegisterMarker = (0, react_1.useCallback)((element) => registerMarker(id, element), [registerMarker, id]);
|
|
67
69
|
const handleRemoveMarker = (0, react_1.useCallback)((element) => removeMarker(id, element), [removeMarker, id]);
|
|
68
70
|
(0, react_1.useEffect)(() => {
|
|
69
|
-
// If the step is active during first render, scroll to it
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
71
|
+
// If the step is active during navigation or first render, scroll to it
|
|
72
|
+
if (!isActive)
|
|
73
|
+
return;
|
|
74
|
+
const timer = setTimeout(handleActivateStep, 5);
|
|
75
|
+
return () => clearTimeout(timer);
|
|
75
76
|
// Ignore dependency array because we only need to run this once
|
|
76
77
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
|
-
}, []);
|
|
78
|
+
}, [location.pathname]);
|
|
78
79
|
(0, react_1.useEffect)(() => {
|
|
79
80
|
var _a, _b;
|
|
80
81
|
const currentCompRef = compRef.current;
|
|
@@ -45,6 +45,7 @@ const utils_1 = require("../../../core/utils");
|
|
|
45
45
|
const LinkIcon_1 = require("../../../icons/LinkIcon/LinkIcon");
|
|
46
46
|
const PageActions_1 = require("../../../components/PageActions/PageActions");
|
|
47
47
|
const hooks_1 = require("../../../core/hooks");
|
|
48
|
+
const constants_1 = require("../../../core/constants");
|
|
48
49
|
function renderWithSpanWrapper(children) {
|
|
49
50
|
const childrenArray = react_1.default.Children.toArray(children);
|
|
50
51
|
if (childrenArray.length === 0)
|
|
@@ -65,47 +66,34 @@ function renderWithSpanWrapper(children) {
|
|
|
65
66
|
middleChildren.length > 0 && react_1.default.createElement(StyledHeadingText, null, middleChildren),
|
|
66
67
|
isImage(last) && last));
|
|
67
68
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Class name for all MD tags
|
|
70
|
-
*/
|
|
71
|
-
const mdClassName = 'md';
|
|
72
69
|
function Heading({ level, id, children, 'data-source': dataSource, 'data-hash': dataHash, className, __idx, }) {
|
|
73
70
|
var _a, _b;
|
|
74
71
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
75
72
|
const { usePageProps } = (0, hooks_1.useThemeHooks)();
|
|
76
73
|
const pageProps = usePageProps();
|
|
77
74
|
const isMarkdownPage = ((_a = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _a === void 0 ? void 0 : _a.type) === 'markdown' || ((_b = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _b === void 0 ? void 0 : _b.type) === 'asciidoc';
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
linkEl,
|
|
88
|
-
react_1.default.createElement("span", null, renderWithSpanWrapper(children)),
|
|
89
|
-
isMarkdownPage && __idx === 0 ? react_1.default.createElement(PageActions_1.PageActions, { pageSlug: pathname }) : null));
|
|
75
|
+
const headingTextId = `${id}-heading-text`;
|
|
76
|
+
const linkEl = (react_1.default.createElement("a", { "aria-labelledby": headingTextId, href: `#${id}`, className: (0, utils_1.concatClassNames)(constants_1.ANCHOR_CLASS, 'before') },
|
|
77
|
+
react_1.default.createElement(LinkIcon_1.LinkIcon, { "aria-hidden": "true", focusable: "false", color: "--heading-anchor-color" })));
|
|
78
|
+
const headingText = (0, react_1.createElement)(`h${level}`, { id: headingTextId }, renderWithSpanWrapper(children));
|
|
79
|
+
return (react_1.default.createElement("div", { id: id, className: (0, utils_1.concatClassNames)(constants_1.HEADING_ANCHOR_CLASS, constants_1.MARKDOWN_CLASS_NAME, `${constants_1.HEADING_CLASS_PREFIX}-${level}`, className), "data-component-name": "Markdoc/Heading/Heading", "data-source": dataSource, "data-hash": dataHash },
|
|
80
|
+
react_1.default.createElement(HeadingContentWrapper, null,
|
|
81
|
+
linkEl,
|
|
82
|
+
headingText,
|
|
83
|
+
isMarkdownPage && __idx === 0 ? react_1.default.createElement(PageActions_1.PageActions, { pageSlug: pathname }) : null)));
|
|
90
84
|
}
|
|
91
85
|
const HeadingContentWrapper = styled_components_1.default.div `
|
|
92
86
|
display: flex;
|
|
93
87
|
gap: var(--spacing-xs);
|
|
94
88
|
|
|
95
|
-
& > .
|
|
89
|
+
& > .${constants_1.ANCHOR_CLASS} {
|
|
96
90
|
display: flex;
|
|
97
91
|
align-items: center;
|
|
98
92
|
height: 1lh;
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
& > span {
|
|
102
|
-
display: flex;
|
|
103
|
-
align-items: flex-start;
|
|
104
|
-
gap: var(--spacing-sm);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
95
|
&:has([data-component-name='PageActions/PageActions']:hover) {
|
|
108
|
-
&& .
|
|
96
|
+
&& .${constants_1.ANCHOR_CLASS} svg {
|
|
109
97
|
visibility: hidden;
|
|
110
98
|
}
|
|
111
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.65.0-next.
|
|
3
|
+
"version": "0.65.0-next.5",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vitest": "4.0.10",
|
|
64
64
|
"vitest-when": "0.6.2",
|
|
65
65
|
"webpack": "5.105.2",
|
|
66
|
-
"@redocly/realm-asyncapi-sdk": "0.11.0-next.
|
|
66
|
+
"@redocly/realm-asyncapi-sdk": "0.11.0-next.3"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@tanstack/react-query": "5.62.3",
|
|
@@ -28,6 +28,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
28
28
|
extraClass?: string;
|
|
29
29
|
to?: string;
|
|
30
30
|
external?: boolean;
|
|
31
|
+
languageInsensitive?: boolean;
|
|
31
32
|
icon?: JSX.Element;
|
|
32
33
|
iconPosition?: 'left' | 'right';
|
|
33
34
|
title?: string;
|
|
@@ -175,12 +176,13 @@ const StyledButton = styled.button.attrs((props: ButtonProps) => ({
|
|
|
175
176
|
`;
|
|
176
177
|
|
|
177
178
|
const ButtonComponent: React.FC<ButtonProps> = (props) => {
|
|
179
|
+
const { languageInsensitive, ...buttonProps } = props;
|
|
178
180
|
const tabIndex = 'tabIndex' in props ? props.tabIndex : props.to ? -1 : undefined;
|
|
179
181
|
|
|
180
182
|
const button = (
|
|
181
183
|
<StyledButton
|
|
182
184
|
data-component-name="Button/Button"
|
|
183
|
-
{...
|
|
185
|
+
{...buttonProps}
|
|
184
186
|
iconOnly={!props.children && props.icon !== null}
|
|
185
187
|
tabIndex={tabIndex}
|
|
186
188
|
>
|
|
@@ -192,7 +194,12 @@ const ButtonComponent: React.FC<ButtonProps> = (props) => {
|
|
|
192
194
|
|
|
193
195
|
if (props.to) {
|
|
194
196
|
return (
|
|
195
|
-
<StyledButtonLink
|
|
197
|
+
<StyledButtonLink
|
|
198
|
+
to={props.to}
|
|
199
|
+
external={props.external}
|
|
200
|
+
languageInsensitive={languageInsensitive}
|
|
201
|
+
onClick={props.onClick}
|
|
202
|
+
>
|
|
196
203
|
{button}
|
|
197
204
|
</StyledButtonLink>
|
|
198
205
|
);
|
|
@@ -148,6 +148,7 @@ export const catalog = css`
|
|
|
148
148
|
*/
|
|
149
149
|
--catalog-tags-more-button-font-size: var(--font-size-base);
|
|
150
150
|
--catalog-tags-more-button-margin-left: 4px;
|
|
151
|
+
--catalog-tags-row-gap: var(--spacing-xxs);
|
|
151
152
|
--catalog-tags-placeholder-bg-color: var(--bg-color);
|
|
152
153
|
--catalog-tags-not-connected-font-size: var(--font-size-base);
|
|
153
154
|
--catalog-tags-not-connected-line-height: var(--line-height-base);
|
|
@@ -55,16 +55,25 @@ export function DropdownMenuItem({
|
|
|
55
55
|
|
|
56
56
|
className = className || '' + (active ? ' active' : '');
|
|
57
57
|
|
|
58
|
+
const sharedProps = {
|
|
59
|
+
$active: active,
|
|
60
|
+
$dangerous: dangerous,
|
|
61
|
+
$disabled: disabled,
|
|
62
|
+
$separator: separator,
|
|
63
|
+
$separatorLine: separatorLine,
|
|
64
|
+
'data-component-name': 'Dropdown/DropdownMenuItem',
|
|
65
|
+
className,
|
|
66
|
+
onClick: handleClick,
|
|
67
|
+
role,
|
|
68
|
+
style,
|
|
69
|
+
};
|
|
70
|
+
|
|
58
71
|
if (to) {
|
|
59
72
|
return (
|
|
60
73
|
<DropdownMenuItemWrapper
|
|
61
74
|
as={Link}
|
|
62
|
-
data-component-name="Dropdown/DropdownMenuItem"
|
|
63
|
-
className={className}
|
|
64
|
-
$separatorLine={separatorLine}
|
|
65
75
|
to={to}
|
|
66
|
-
|
|
67
|
-
role={role}
|
|
76
|
+
{...sharedProps}
|
|
68
77
|
{...dataAttributes}
|
|
69
78
|
{...otherProps}
|
|
70
79
|
>
|
|
@@ -77,19 +86,10 @@ export function DropdownMenuItem({
|
|
|
77
86
|
|
|
78
87
|
return (
|
|
79
88
|
<DropdownMenuItemWrapper
|
|
80
|
-
|
|
81
|
-
className={className}
|
|
82
|
-
role={role}
|
|
83
|
-
style={style}
|
|
89
|
+
{...sharedProps}
|
|
84
90
|
{...dataAttributes}
|
|
85
|
-
onClick={handleClick}
|
|
86
91
|
onKeyDown={handleKeyDown}
|
|
87
92
|
tabIndex={onAction ? 0 : -1}
|
|
88
|
-
active={active}
|
|
89
|
-
disabled={disabled}
|
|
90
|
-
separator={separator}
|
|
91
|
-
dangerous={dangerous}
|
|
92
|
-
$separatorLine={separatorLine}
|
|
93
93
|
>
|
|
94
94
|
{prefix}
|
|
95
95
|
{children || content}
|
|
@@ -100,10 +100,10 @@ export function DropdownMenuItem({
|
|
|
100
100
|
|
|
101
101
|
const DropdownMenuItemWrapper = styled.li<{
|
|
102
102
|
$separatorLine?: boolean;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
dangerous?: boolean;
|
|
103
|
+
$separator?: boolean;
|
|
104
|
+
$active?: boolean;
|
|
105
|
+
$disabled?: boolean;
|
|
106
|
+
$dangerous?: boolean;
|
|
107
107
|
}>`
|
|
108
108
|
display: flex;
|
|
109
109
|
flex-direction: row;
|
|
@@ -140,8 +140,8 @@ const DropdownMenuItemWrapper = styled.li<{
|
|
|
140
140
|
color: var(--dropdown-menu-item-color-hover);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
${({ separator }) =>
|
|
144
|
-
separator &&
|
|
143
|
+
${({ $separator }) =>
|
|
144
|
+
$separator &&
|
|
145
145
|
css`
|
|
146
146
|
cursor: default;
|
|
147
147
|
pointer-events: none;
|
|
@@ -151,8 +151,8 @@ const DropdownMenuItemWrapper = styled.li<{
|
|
|
151
151
|
--dropdown-menu-item-bg-color-hover: var(--dropdown-menu-item-bg-color);
|
|
152
152
|
`}
|
|
153
153
|
|
|
154
|
-
${({ active }) =>
|
|
155
|
-
active &&
|
|
154
|
+
${({ $active }) =>
|
|
155
|
+
$active &&
|
|
156
156
|
css`
|
|
157
157
|
background-color: var(--dropdown-menu-item-bg-color-active);
|
|
158
158
|
color: var(--dropdown-menu-item-color-active);
|
|
@@ -161,8 +161,8 @@ const DropdownMenuItemWrapper = styled.li<{
|
|
|
161
161
|
}
|
|
162
162
|
`}
|
|
163
163
|
|
|
164
|
-
${({ disabled }) =>
|
|
165
|
-
disabled &&
|
|
164
|
+
${({ $disabled }) =>
|
|
165
|
+
$disabled &&
|
|
166
166
|
css`
|
|
167
167
|
cursor: default;
|
|
168
168
|
pointer-events: none;
|
|
@@ -187,8 +187,8 @@ const DropdownMenuItemWrapper = styled.li<{
|
|
|
187
187
|
}
|
|
188
188
|
`}
|
|
189
189
|
|
|
190
|
-
${({ dangerous }) =>
|
|
191
|
-
dangerous &&
|
|
190
|
+
${({ $dangerous }) =>
|
|
191
|
+
$dangerous &&
|
|
192
192
|
css`
|
|
193
193
|
&:hover,
|
|
194
194
|
& {
|
|
@@ -19,7 +19,7 @@ export type LanguagePickerProps = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export function LanguagePicker(props: LanguagePickerProps): JSX.Element | null {
|
|
22
|
-
const { currentLocale, locales,
|
|
22
|
+
const { currentLocale, locales, getLocaleUrl } = useLanguagePicker();
|
|
23
23
|
const { useTelemetry } = useThemeHooks();
|
|
24
24
|
const telemetry = useTelemetry();
|
|
25
25
|
|
|
@@ -37,8 +37,9 @@ export function LanguagePicker(props: LanguagePickerProps): JSX.Element | null {
|
|
|
37
37
|
|
|
38
38
|
const languageItems = locales.map((locale) => ({
|
|
39
39
|
content: locale.name || locale.code || '',
|
|
40
|
+
to: getLocaleUrl(locale.code),
|
|
41
|
+
languageInsensitive: true,
|
|
40
42
|
onAction: () => {
|
|
41
|
-
setLocale(locale.code);
|
|
42
43
|
props.onChangeLanguage(locale.code);
|
|
43
44
|
telemetry.sendLanguagePickerLocaleChangedMessage([{ object: 'locale', locale: locale.code }]);
|
|
44
45
|
},
|
|
@@ -6,6 +6,17 @@ import { typography } from '@redocly/theme/core/utils';
|
|
|
6
6
|
import { markdownBaseTableCss } from '@redocly/theme/components/Markdown/styles/base-table';
|
|
7
7
|
import { markdownLinksCss } from '@redocly/theme/components/Markdown/styles/links';
|
|
8
8
|
import { headingAnchorCss } from '@redocly/theme/components/Markdown/styles/heading-anchor';
|
|
9
|
+
import {
|
|
10
|
+
ANCHOR_CLASS,
|
|
11
|
+
H1_CLASS,
|
|
12
|
+
H2_CLASS,
|
|
13
|
+
H3_CLASS,
|
|
14
|
+
H4_CLASS,
|
|
15
|
+
H5_CLASS,
|
|
16
|
+
H6_CLASS,
|
|
17
|
+
HEADING_ANCHOR_CLASS,
|
|
18
|
+
MARKDOWN_CLASS_NAME,
|
|
19
|
+
} from '@redocly/theme/core/constants';
|
|
9
20
|
|
|
10
21
|
export type MarkdownProps = PropsWithChildren<{
|
|
11
22
|
className?: string;
|
|
@@ -66,17 +77,82 @@ export const Markdown = styled.main.attrs<{
|
|
|
66
77
|
max-width: 100%;
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
|
|
70
|
-
h2.md,
|
|
71
|
-
h3.md,
|
|
72
|
-
h4.md,
|
|
73
|
-
h5.md,
|
|
74
|
-
h6.md {
|
|
80
|
+
.${HEADING_ANCHOR_CLASS} {
|
|
75
81
|
font-weight: var(--heading-font-weight);
|
|
76
82
|
font-family: var(--heading-font-family);
|
|
77
83
|
position: relative;
|
|
78
84
|
|
|
79
85
|
scroll-margin-top: calc(var(--navbar-height) + var(--banner-height));
|
|
86
|
+
${headingAnchorCss(ANCHOR_CLASS)};
|
|
87
|
+
|
|
88
|
+
h1, h2, h3, h4, h5, h6 {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: flex-start;
|
|
91
|
+
gap: var(--spacing-sm);
|
|
92
|
+
margin: 0;
|
|
93
|
+
font: inherit;
|
|
94
|
+
color: inherit;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.${H1_CLASS} {
|
|
99
|
+
${typography('h1')};
|
|
100
|
+
margin: var(--h1-margin-top) 0 var(--h1-margin-bottom) 0;
|
|
101
|
+
|
|
102
|
+
h1 code {
|
|
103
|
+
font-size: var(--h1-font-size);
|
|
104
|
+
line-height: var(--h1-code-line-height);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.${H2_CLASS} {
|
|
109
|
+
${typography('h2')};
|
|
110
|
+
margin: var(--h2-margin-top) 0 var(--h2-margin-bottom) 0;
|
|
111
|
+
|
|
112
|
+
h2 code {
|
|
113
|
+
font-size: var(--h2-font-size);
|
|
114
|
+
line-height: var(--h2-code-line-height);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.${H3_CLASS} {
|
|
119
|
+
${typography('h3')};
|
|
120
|
+
margin: var(--h3-margin-top) 0 var(--h3-margin-bottom) 0;
|
|
121
|
+
|
|
122
|
+
h3 code {
|
|
123
|
+
font-size: var(--h3-font-size);
|
|
124
|
+
line-height: var(--h3-code-line-height);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.${H4_CLASS} {
|
|
129
|
+
${typography('h4')};
|
|
130
|
+
margin: var(--h4-margin-top) 0 var(--h4-margin-bottom) 0;
|
|
131
|
+
|
|
132
|
+
h4 code {
|
|
133
|
+
font-size: var(--h4-font-size);
|
|
134
|
+
line-height: var(--h4-code-line-height);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.${H5_CLASS} {
|
|
139
|
+
${typography('h5')};
|
|
140
|
+
margin: var(--h5-margin-top) 0 var(--h5-margin-bottom) 0;
|
|
141
|
+
|
|
142
|
+
h5 code {
|
|
143
|
+
font-size: var(--h5-font-size);
|
|
144
|
+
line-height: var(--h5-code-line-height);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.${H6_CLASS} {
|
|
149
|
+
${typography('h6')};
|
|
150
|
+
margin: var(--h6-margin-top) 0 var(--h6-margin-bottom) 0;
|
|
151
|
+
|
|
152
|
+
h6 code {
|
|
153
|
+
font-size: var(--h6-font-size);
|
|
154
|
+
line-height: var(--h6-code-line-height);
|
|
155
|
+
}
|
|
80
156
|
}
|
|
81
157
|
|
|
82
158
|
strong {
|
|
@@ -120,71 +196,71 @@ export const Markdown = styled.main.attrs<{
|
|
|
120
196
|
margin: var(--md-paragraph-margin);
|
|
121
197
|
}
|
|
122
198
|
|
|
123
|
-
|
|
199
|
+
/**
|
|
200
|
+
* @deprecated Legacy styles for ejected Heading components that render h1-h6 as the root.
|
|
201
|
+
*
|
|
202
|
+
* Deprecated legacy heading styles start.
|
|
203
|
+
*/
|
|
204
|
+
h1.${MARKDOWN_CLASS_NAME} {
|
|
124
205
|
${typography('h1')};
|
|
125
206
|
margin: var(--h1-margin-top) 0 var(--h1-margin-bottom) 0;
|
|
126
|
-
${headingAnchorCss()};
|
|
127
207
|
}
|
|
128
208
|
|
|
129
|
-
h2
|
|
209
|
+
h2.${MARKDOWN_CLASS_NAME} {
|
|
130
210
|
${typography('h2')};
|
|
131
211
|
margin: var(--h2-margin-top) 0 var(--h2-margin-bottom) 0;
|
|
132
|
-
${headingAnchorCss()};
|
|
133
212
|
}
|
|
134
213
|
|
|
135
|
-
h3
|
|
214
|
+
h3.${MARKDOWN_CLASS_NAME} {
|
|
136
215
|
${typography('h3')};
|
|
137
216
|
margin: var(--h3-margin-top) 0 var(--h3-margin-bottom) 0;
|
|
138
|
-
${headingAnchorCss()};
|
|
139
217
|
}
|
|
140
218
|
|
|
141
|
-
h4
|
|
219
|
+
h4.${MARKDOWN_CLASS_NAME} {
|
|
142
220
|
${typography('h4')};
|
|
143
221
|
margin: var(--h4-margin-top) 0 var(--h4-margin-bottom) 0;
|
|
144
|
-
${headingAnchorCss()};
|
|
145
222
|
}
|
|
146
223
|
|
|
147
|
-
h5
|
|
224
|
+
h5.${MARKDOWN_CLASS_NAME} {
|
|
148
225
|
${typography('h5')};
|
|
149
226
|
margin: var(--h5-margin-top) 0 var(--h5-margin-bottom) 0;
|
|
150
|
-
${headingAnchorCss()};
|
|
151
227
|
}
|
|
152
228
|
|
|
153
|
-
h6
|
|
229
|
+
h6.${MARKDOWN_CLASS_NAME} {
|
|
154
230
|
${typography('h6')};
|
|
155
231
|
margin: var(--h6-margin-top) 0 var(--h6-margin-bottom) 0;
|
|
156
|
-
${headingAnchorCss()};
|
|
157
232
|
}
|
|
158
233
|
|
|
159
|
-
h1
|
|
234
|
+
h1.${MARKDOWN_CLASS_NAME} code {
|
|
160
235
|
font-size: var(--h1-font-size);
|
|
161
236
|
line-height: var(--h1-code-line-height);
|
|
162
237
|
}
|
|
163
238
|
|
|
164
|
-
h2
|
|
239
|
+
h2.${MARKDOWN_CLASS_NAME} code {
|
|
165
240
|
font-size: var(--h2-font-size);
|
|
166
241
|
line-height: var(--h2-code-line-height);
|
|
167
242
|
}
|
|
168
243
|
|
|
169
|
-
h3
|
|
244
|
+
h3.${MARKDOWN_CLASS_NAME} code {
|
|
170
245
|
font-size: var(--h3-font-size);
|
|
171
246
|
line-height: var(--h3-code-line-height);
|
|
172
247
|
}
|
|
173
248
|
|
|
174
|
-
h4
|
|
249
|
+
h4.${MARKDOWN_CLASS_NAME} code {
|
|
175
250
|
font-size: var(--h4-font-size);
|
|
176
251
|
line-height: var(--h4-code-line-height);
|
|
177
252
|
}
|
|
178
253
|
|
|
179
|
-
h5
|
|
254
|
+
h5.${MARKDOWN_CLASS_NAME} code {
|
|
180
255
|
font-size: var(--h5-font-size);
|
|
181
256
|
line-height: var(--h5-code-line-height);
|
|
182
257
|
}
|
|
183
258
|
|
|
184
|
-
h6
|
|
259
|
+
h6.${MARKDOWN_CLASS_NAME} code {
|
|
185
260
|
font-size: var(--h6-font-size);
|
|
186
261
|
line-height: var(--h6-code-line-height);
|
|
187
262
|
}
|
|
263
|
+
/* Deprecated legacy heading styles end. */
|
|
188
264
|
|
|
189
265
|
code {
|
|
190
266
|
color: var(--inline-code-text-color);
|
|
@@ -248,8 +324,8 @@ export const Markdown = styled.main.attrs<{
|
|
|
248
324
|
}
|
|
249
325
|
}
|
|
250
326
|
|
|
251
|
-
ul
|
|
252
|
-
ol
|
|
327
|
+
ul.${MARKDOWN_CLASS_NAME},
|
|
328
|
+
ol.${MARKDOWN_CLASS_NAME} {
|
|
253
329
|
padding-left: var(--md-list-left-padding);
|
|
254
330
|
margin: var(--md-list-margin);
|
|
255
331
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
|
|
3
|
+
import { MARKDOWN_CLASS_NAME } from '@redocly/theme/core/constants';
|
|
4
|
+
|
|
3
5
|
export const markdownBaseTableCss = css`
|
|
4
6
|
.md-table-wrapper {
|
|
5
7
|
overflow-x: auto;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
table
|
|
10
|
+
table.${MARKDOWN_CLASS_NAME} {
|
|
9
11
|
width: 100%;
|
|
10
12
|
overflow: hidden;
|
|
11
13
|
word-break: keep-all;
|