@redocly/theme 0.56.0-next.12 → 0.56.0-next.14
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/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/Dropdown/Dropdown.js +1 -0
- package/lib/components/Dropdown/variables.js +1 -0
- package/lib/components/Footer/FooterItem.js +5 -10
- package/lib/components/Footer/variables.js +2 -2
- package/lib/components/Markdown/Markdown.js +7 -7
- package/lib/components/Menu/MenuItem.js +5 -15
- package/lib/components/Menu/variables.js +1 -1
- package/lib/components/Navbar/NavbarItem.js +8 -48
- package/lib/components/Navbar/variables.js +2 -2
- package/lib/core/types/sidebar.d.ts +1 -0
- package/lib/core/utils/icon-resolver.js +1 -4
- package/lib/ext/configure.d.ts +1 -1
- package/lib/icons/CDNIcon/CDNIcon.js +4 -4
- package/lib/icons/UniversalIcon/UniversalIcon.d.ts +11 -0
- package/lib/icons/UniversalIcon/UniversalIcon.js +61 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/layouts/CodeWalkthroughLayout.js +2 -2
- package/lib/markdoc/components/Cards/CardIcon.js +7 -19
- 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/tags/card.js +1 -1
- package/lib/markdoc/tags/tab.js +1 -0
- package/package.json +1 -1
- 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/Dropdown/Dropdown.tsx +1 -0
- package/src/components/Dropdown/variables.ts +1 -0
- package/src/components/Footer/FooterItem.tsx +10 -21
- package/src/components/Footer/variables.ts +2 -2
- package/src/components/Markdown/Markdown.tsx +1 -1
- package/src/components/Menu/MenuItem.tsx +6 -23
- package/src/components/Menu/variables.ts +1 -1
- package/src/components/Navbar/NavbarItem.tsx +8 -33
- package/src/components/Navbar/variables.ts +2 -2
- package/src/core/types/sidebar.ts +1 -0
- package/src/core/utils/icon-resolver.ts +1 -4
- package/src/ext/configure.ts +1 -1
- package/src/icons/CDNIcon/CDNIcon.tsx +4 -4
- package/src/icons/UniversalIcon/UniversalIcon.tsx +69 -0
- package/src/index.ts +1 -0
- package/src/layouts/CodeWalkthroughLayout.tsx +1 -1
- package/src/markdoc/components/Cards/CardIcon.tsx +6 -21
- 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/tags/card.ts +1 -1
- package/src/markdoc/tags/tab.ts +1 -0
|
@@ -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),
|
|
@@ -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
|
+
margin-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')};
|
|
@@ -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,11 +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");
|
|
14
|
-
const
|
|
13
|
+
const UniversalIcon_1 = require("../../icons/UniversalIcon/UniversalIcon");
|
|
15
14
|
function FooterItem({ item, iconsOnly, className }) {
|
|
16
|
-
var _a, _b;
|
|
17
15
|
const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
18
16
|
const telemetry = useTelemetry();
|
|
19
17
|
const { translate } = useTranslate();
|
|
@@ -22,12 +20,9 @@ function FooterItem({ item, iconsOnly, className }) {
|
|
|
22
20
|
}
|
|
23
21
|
const hasIcon = Boolean(item.icon || item.srcSet);
|
|
24
22
|
const iconWithoutLabel = Boolean(item.label === item.link && hasIcon);
|
|
25
|
-
const resolvedIcon = (0, utils_1.resolveIcon)(item.icon);
|
|
26
|
-
const iconComponent = item.srcSet || resolvedIcon.type === 'link' ? (react_1.default.createElement(Image_1.Image, { src: item.icon, srcSet: item.srcSet, alt: item.label && item.label !== item.link
|
|
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` })) : resolvedIcon.type === 'font-awesome' ? (react_1.default.createElement(CDNIcon_1.CDNIcon, { name: resolvedIcon.name, type: resolvedIcon.style })) : null;
|
|
29
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 },
|
|
30
|
-
hasIcon ? react_1.default.createElement(FooterLinkIcon, { iconsOnly: iconsOnly },
|
|
24
|
+
hasIcon ? (react_1.default.createElement(FooterLinkIcon, { iconsOnly: iconsOnly },
|
|
25
|
+
react_1.default.createElement(UniversalIcon_1.UniversalIcon, { icon: item.icon, srcSet: item.srcSet }))) : null,
|
|
31
26
|
!iconWithoutLabel ? translate(item.labelTranslationKey, item.label) : null,
|
|
32
27
|
item.external ? react_1.default.createElement(LaunchIcon_1.LaunchIcon, { size: "10px" }) : null))));
|
|
33
28
|
}
|
|
@@ -38,9 +33,9 @@ const FooterSeparator = styled_components_1.default.div `
|
|
|
38
33
|
opacity: var(--footer-separator-item-opacity);
|
|
39
34
|
`;
|
|
40
35
|
const FooterLinkIcon = styled_components_1.default.div `
|
|
36
|
+
--icon-width: var(--footer-item-icon-width);
|
|
37
|
+
--icon-height: var(--footer-item-icon-height);
|
|
41
38
|
display: inline-flex;
|
|
42
|
-
width: var(--footer-item-icon-width);
|
|
43
|
-
height: var(--footer-item-icon-height);
|
|
44
39
|
margin-right: ${({ iconsOnly }) => (iconsOnly ? '0' : 'var(--footer-item-icon-margin-right)')};
|
|
45
40
|
vertical-align: middle;
|
|
46
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
|
}
|
|
@@ -36,7 +36,7 @@ const constants_1 = require("../../core/constants");
|
|
|
36
36
|
const utils_1 = require("../../core/utils");
|
|
37
37
|
const ArrowRightIcon_1 = require("../../icons/ArrowRightIcon/ArrowRightIcon");
|
|
38
38
|
const Badge_1 = require("../../components/Badge/Badge");
|
|
39
|
-
const
|
|
39
|
+
const UniversalIcon_1 = require("../../icons/UniversalIcon/UniversalIcon");
|
|
40
40
|
function MenuItem(props) {
|
|
41
41
|
var _a;
|
|
42
42
|
const { item, depth, className, onClick } = props;
|
|
@@ -74,11 +74,9 @@ function MenuItem(props) {
|
|
|
74
74
|
};
|
|
75
75
|
const chevron = hasChevron ? (isExpanded ? (react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, { size: "var(--menu-item-label-chevron-size)", color: "--tree-content-color-default" })) : (react_1.default.createElement(ChevronRightIcon_1.ChevronRightIcon, { size: "var(--menu-item-label-chevron-size)", color: "--tree-content-color-default" }))) : null;
|
|
76
76
|
const httpColor = item.deprecated ? 'http-deprecated' : item.httpVerb;
|
|
77
|
-
const resolvedIcon = (0, utils_1.resolveIcon)(item.icon);
|
|
78
|
-
const iconComponent = resolvedIcon.type === 'link' ? (react_1.default.createElement(MenuItemIcon, { src: item.icon })) : resolvedIcon.type === 'font-awesome' ? (react_1.default.createElement(MenuItemCDNIcon, { name: resolvedIcon.name, type: resolvedIcon.style })) : null;
|
|
79
77
|
const label = item.label && (react_1.default.createElement(MenuItemLabelWrapper, { active: item.active, deprecated: item.deprecated, depth: depth, withChevron: hasChevron, isSeparator: isSeparator, onClick: handleOnClick, onKeyDown: handleExpandOnEnter, ref: labelRef, role: item.link ? 'none' : 'link', tabIndex: !item.link ? 0 : undefined, "data-testid": "menu-item-label" },
|
|
80
78
|
hasChevron ? react_1.default.createElement(ChevronWrapper, null, chevron) : null,
|
|
81
|
-
|
|
79
|
+
react_1.default.createElement(MenuItemIcon, { icon: item.icon, srcSet: item.srcSet }),
|
|
82
80
|
react_1.default.createElement(MenuItemLabelTextWrapper, null,
|
|
83
81
|
react_1.default.createElement(MenuItemLabel, null,
|
|
84
82
|
react_1.default.createElement("span", null, translate(item.labelTranslationKey, item.label)), (_a = item.badges) === null || _a === void 0 ? void 0 :
|
|
@@ -243,17 +241,9 @@ const MenuItemSubLabel = styled_components_1.default.div `
|
|
|
243
241
|
font-size: var(--menu-item-sublabel-font-size);
|
|
244
242
|
font-family: var(--menu-item-sublabel-font-family);
|
|
245
243
|
`;
|
|
246
|
-
const MenuItemIcon = styled_components_1.default.
|
|
247
|
-
width: var(--menu-item-icon-size);
|
|
248
|
-
height: var(--menu-item-icon-size);
|
|
249
|
-
margin: var(--menu-item-icon-margin);
|
|
250
|
-
border-radius: var(--menu-item-icon-border-radius);
|
|
251
|
-
flex-shrink: 0;
|
|
252
|
-
overflow: hidden;
|
|
253
|
-
`;
|
|
254
|
-
const MenuItemCDNIcon = (0, styled_components_1.default)(CDNIcon_1.CDNIcon) `
|
|
255
|
-
width: var(--menu-item-icon-size);
|
|
256
|
-
height: var(--menu-item-icon-size);
|
|
244
|
+
const MenuItemIcon = (0, styled_components_1.default)(UniversalIcon_1.UniversalIcon) `
|
|
245
|
+
--icon-width: var(--menu-item-icon-size);
|
|
246
|
+
--icon-height: var(--menu-item-icon-size);
|
|
257
247
|
margin: var(--menu-item-icon-margin);
|
|
258
248
|
flex-shrink: 0;
|
|
259
249
|
overflow: hidden;
|
|
@@ -71,7 +71,7 @@ exports.menu = (0, styled_components_1.css) `
|
|
|
71
71
|
* @tokens Menu item icons
|
|
72
72
|
*/
|
|
73
73
|
--menu-item-icon-size: var(--spacing-base);
|
|
74
|
-
--menu-item-icon-margin:
|
|
74
|
+
--menu-item-icon-margin: 0 var(--spacing-xxs) 0 0;
|
|
75
75
|
--menu-item-icon-border-radius: 100%;
|
|
76
76
|
|
|
77
77
|
--menu-item-external-icon-size: 10px;
|
|
@@ -1,34 +1,11 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.NavbarItem = NavbarItem;
|
|
30
7
|
const react_1 = __importDefault(require("react"));
|
|
31
|
-
const styled_components_1 =
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
9
|
const react_router_dom_1 = require("react-router-dom");
|
|
33
10
|
const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
|
|
34
11
|
const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
|
|
@@ -37,8 +14,7 @@ const hooks_1 = require("../../core/hooks");
|
|
|
37
14
|
const LaunchIcon_1 = require("../../icons/LaunchIcon/LaunchIcon");
|
|
38
15
|
const Link_1 = require("../../components/Link/Link");
|
|
39
16
|
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
40
|
-
const
|
|
41
|
-
const utils_2 = require("../../core/utils");
|
|
17
|
+
const UniversalIcon_1 = require("../../icons/UniversalIcon/UniversalIcon");
|
|
42
18
|
function NavbarItem({ navItem, className }) {
|
|
43
19
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
44
20
|
const { useTranslate, useL10nConfig, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
@@ -51,10 +27,8 @@ function NavbarItem({ navItem, className }) {
|
|
|
51
27
|
const normalizedPath = (item.link && item.link !== '/' ? (0, utils_1.removeTrailingSlash)(item.link) : item.link) || '';
|
|
52
28
|
const isActive = pathname ===
|
|
53
29
|
(0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(normalizedPath, defaultLocale, currentLocale, locales));
|
|
54
|
-
const resolvedIcon = (0, utils_2.resolveIcon)(item.icon);
|
|
55
|
-
const iconComponent = resolvedIcon.type === 'link' ? (react_1.default.createElement(NavbarIcon, { url: item.icon })) : resolvedIcon.type === 'font-awesome' ? (react_1.default.createElement(NavbarCDNIcon, { name: resolvedIcon.name, type: resolvedIcon.style })) : null;
|
|
56
30
|
const itemContent = (react_1.default.createElement(NavbarMenuItem, { as: item.link ? Link_1.Link : undefined, active: isActive, className: className, onClick: () => telemetry.send({ type: 'navbar.menu_item_clicked', payload: { type: item.type } }), external: item.external, target: item.target, to: item.link },
|
|
57
|
-
|
|
31
|
+
react_1.default.createElement(NavbarIcon, { icon: item.icon, srcSet: item.srcSet }),
|
|
58
32
|
react_1.default.createElement(NavbarLabel, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label)),
|
|
59
33
|
item.external ? react_1.default.createElement(ExternalLinkIcon, { size: "10px" }) : null));
|
|
60
34
|
if (navItem.items) {
|
|
@@ -64,7 +38,7 @@ function NavbarItem({ navItem, className }) {
|
|
|
64
38
|
if (item.type !== 'link' && item.type !== 'separator')
|
|
65
39
|
return null;
|
|
66
40
|
return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: `${item.label}_${index}`, to: item.link, separator: item.type === 'separator', separatorLine: item.separatorLine, "data-translation-key": item.labelTranslationKey, external: item.external },
|
|
67
|
-
react_1.default.createElement(NavbarIcon, {
|
|
41
|
+
react_1.default.createElement(NavbarIcon, { icon: item.icon, srcSet: item.srcSet }),
|
|
68
42
|
react_1.default.createElement(NavbarLabel, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label)),
|
|
69
43
|
item.external ? react_1.default.createElement(ExternalLinkIcon, { size: "10px" }) : null));
|
|
70
44
|
});
|
|
@@ -104,25 +78,11 @@ const NavbarLabel = styled_components_1.default.span `
|
|
|
104
78
|
cursor: pointer;
|
|
105
79
|
vertical-align: middle;
|
|
106
80
|
`;
|
|
107
|
-
const NavbarIcon = styled_components_1.default.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
background-image: url('${url}');
|
|
111
|
-
width: var(--navbar-item-icon-width);
|
|
112
|
-
height: var(--navbar-item-icon-height);
|
|
113
|
-
display: inline-block;
|
|
114
|
-
background-size: contain;
|
|
115
|
-
margin-right: var(--navbar-item-icon-margin-right);
|
|
116
|
-
vertical-align: middle;
|
|
117
|
-
background-position: center;
|
|
118
|
-
background-repeat: no-repeat;
|
|
119
|
-
`}
|
|
120
|
-
`;
|
|
121
|
-
const NavbarCDNIcon = (0, styled_components_1.default)(CDNIcon_1.CDNIcon) `
|
|
122
|
-
width: var(--navbar-item-icon-width);
|
|
123
|
-
height: var(--navbar-item-icon-height);
|
|
81
|
+
const NavbarIcon = (0, styled_components_1.default)(UniversalIcon_1.UniversalIcon) `
|
|
82
|
+
--icon-width: var(--navbar-item-icon-width);
|
|
83
|
+
--icon-height: var(--navbar-item-icon-height);
|
|
124
84
|
margin-right: var(--navbar-item-icon-margin-right);
|
|
125
|
-
|
|
85
|
+
`;
|
|
126
86
|
const ExternalLinkIcon = (0, styled_components_1.default)(LaunchIcon_1.LaunchIcon) `
|
|
127
87
|
margin-left: 5px;
|
|
128
88
|
`;
|
|
@@ -37,8 +37,8 @@ exports.navbar = (0, styled_components_1.css) `
|
|
|
37
37
|
--navbar-item-bg-color-hover: var(--bg-color);
|
|
38
38
|
--navbar-item-bottom-border-hover: none;
|
|
39
39
|
|
|
40
|
-
--navbar-item-icon-width: 1.
|
|
41
|
-
--navbar-item-icon-height: 1.
|
|
40
|
+
--navbar-item-icon-width: 1.25em; // @presenter Spacing
|
|
41
|
+
--navbar-item-icon-height: 1.25em; // @presenter Spacing
|
|
42
42
|
--navbar-item-icon-margin-right: 0.5em; // @presenter Spacing
|
|
43
43
|
|
|
44
44
|
--navbar-logo-height: var(--logo-height);
|
|
@@ -24,10 +24,7 @@ function resolveIcon(icon) {
|
|
|
24
24
|
return { type: 'invalid', reason: 'Icon must be a non-empty string' };
|
|
25
25
|
}
|
|
26
26
|
const trimmed = icon.trim();
|
|
27
|
-
const isLink = trimmed.
|
|
28
|
-
trimmed.startsWith('./') ||
|
|
29
|
-
trimmed.startsWith('../') ||
|
|
30
|
-
/^https?:\/\//.test(trimmed);
|
|
27
|
+
const isLink = trimmed.match(/\.(svg|png|jpg|jpeg|gif|ico|webp)$/) || /^https?:\/\//.test(trimmed);
|
|
31
28
|
if (isLink) {
|
|
32
29
|
return { type: 'link', value: trimmed };
|
|
33
30
|
}
|
package/lib/ext/configure.d.ts
CHANGED
|
@@ -28,21 +28,21 @@ const Icon = (props) => {
|
|
|
28
28
|
backgroundImage: `url(${cdnUrl}/${typeSegment}${name}.svg)`,
|
|
29
29
|
backgroundRepeat: 'no-repeat',
|
|
30
30
|
backgroundPosition: 'center',
|
|
31
|
-
backgroundSize: '
|
|
31
|
+
backgroundSize: 'contain',
|
|
32
32
|
}
|
|
33
33
|
: {
|
|
34
34
|
backgroundColor: color ? (0, utils_1.getCssColorVariable)(color) : 'currentColor',
|
|
35
35
|
maskImage: `url(${cdnUrl}/${typeSegment}${name}.svg)`,
|
|
36
36
|
maskRepeat: 'no-repeat',
|
|
37
37
|
maskPosition: 'center',
|
|
38
|
-
maskSize: '
|
|
38
|
+
maskSize: 'contain',
|
|
39
39
|
};
|
|
40
40
|
return (react_1.default.createElement("svg", Object.assign({}, rest, { style: Object.assign(Object.assign({}, styleProps), { display: 'inline-block', verticalAlign: 'middle' }) })));
|
|
41
41
|
};
|
|
42
42
|
exports.CDNIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
43
43
|
'data-component-name': 'icons/CDNIcon/CDNIcon',
|
|
44
44
|
})) `
|
|
45
|
-
height: ${({ size }) => size || 'var(--icon-
|
|
46
|
-
width: ${({ size }) => size || 'var(--icon-
|
|
45
|
+
height: ${({ size }) => size || 'var(--icon-height, 16px)'};
|
|
46
|
+
width: ${({ size }) => size || 'var(--icon-width, 16px)'};
|
|
47
47
|
`;
|
|
48
48
|
//# sourceMappingURL=CDNIcon.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface UniversalIconProps {
|
|
3
|
+
icon: string | React.ReactNode;
|
|
4
|
+
srcSet?: string;
|
|
5
|
+
rawContent?: string;
|
|
6
|
+
size?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
alt?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function UniversalIcon({ icon, srcSet, rawContent, size, color, alt, className, }: UniversalIconProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
@@ -0,0 +1,61 @@
|
|
|
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.UniversalIcon = UniversalIcon;
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
+
const CDNIcon_1 = require("../../icons/CDNIcon/CDNIcon");
|
|
33
|
+
const utils_1 = require("../../core/utils");
|
|
34
|
+
const InlineSvg_1 = require("../../markdoc/components/InlineSvg/InlineSvg");
|
|
35
|
+
const Image_1 = require("../../components/Image/Image");
|
|
36
|
+
function UniversalIcon({ icon, srcSet, rawContent, size, color, alt, className, }) {
|
|
37
|
+
if (srcSet) {
|
|
38
|
+
return React.createElement(Image_1.Image, { srcSet: srcSet, alt: alt, className: className });
|
|
39
|
+
}
|
|
40
|
+
const resolvedIcon = icon && typeof icon === 'string' ? (0, utils_1.resolveIcon)(icon) : null;
|
|
41
|
+
const iconComponent = rawContent ? (React.createElement(IconSvg, { fileRawContent: rawContent, className: className })) : (resolvedIcon === null || resolvedIcon === void 0 ? void 0 : resolvedIcon.type) === 'link' ? (React.createElement(IconImg, { src: resolvedIcon.value, alt: alt, className: className })) : (resolvedIcon === null || resolvedIcon === void 0 ? void 0 : resolvedIcon.type) === 'font-awesome' ? (React.createElement(CDNIcon_1.CDNIcon, { name: resolvedIcon.name, type: resolvedIcon.style, size: size, color: color, className: className })) : (icon);
|
|
42
|
+
return iconComponent;
|
|
43
|
+
}
|
|
44
|
+
const IconImg = styled_components_1.default.img `
|
|
45
|
+
width: var(--icon-width, 16px);
|
|
46
|
+
height: var(--icon-height, 16px);
|
|
47
|
+
display: inline-block;
|
|
48
|
+
object-fit: cover;
|
|
49
|
+
`;
|
|
50
|
+
const IconSvg = (0, styled_components_1.default)(InlineSvg_1.InlineSvg) `
|
|
51
|
+
width: var(--icon-width, 16px);
|
|
52
|
+
height: var(--icon-height, 16px);
|
|
53
|
+
display: inline-block;
|
|
54
|
+
|
|
55
|
+
svg {
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
fill: var(--icon-color, currentColor);
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
//# sourceMappingURL=UniversalIcon.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -254,6 +254,7 @@ export * from './icons/RabbitMQIcon/RabbitMQIcon';
|
|
|
254
254
|
export * from './icons/CurveAutoColonIcon/CurveAutoColonIcon';
|
|
255
255
|
export * from './icons/AiStarsIcon/AiStarsIcon';
|
|
256
256
|
export * from './icons/AiStarsGradientIcon/AiStarsGradientIcon';
|
|
257
|
+
export * from './icons/UniversalIcon/UniversalIcon';
|
|
257
258
|
export * from './layouts/RootLayout';
|
|
258
259
|
export * from './layouts/PageLayout';
|
|
259
260
|
export * from './layouts/NotFound';
|
package/lib/index.js
CHANGED
|
@@ -307,6 +307,7 @@ __exportStar(require("./icons/RabbitMQIcon/RabbitMQIcon"), exports);
|
|
|
307
307
|
__exportStar(require("./icons/CurveAutoColonIcon/CurveAutoColonIcon"), exports);
|
|
308
308
|
__exportStar(require("./icons/AiStarsIcon/AiStarsIcon"), exports);
|
|
309
309
|
__exportStar(require("./icons/AiStarsGradientIcon/AiStarsGradientIcon"), exports);
|
|
310
|
+
__exportStar(require("./icons/UniversalIcon/UniversalIcon"), exports);
|
|
310
311
|
/* Layouts */
|
|
311
312
|
__exportStar(require("./layouts/RootLayout"), exports);
|
|
312
313
|
__exportStar(require("./layouts/PageLayout"), exports);
|
|
@@ -6,7 +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
|
|
9
|
+
const utils_1 = require("../core/utils");
|
|
10
10
|
function CodeWalkthroughLayout({ className, children, }) {
|
|
11
11
|
return (react_1.default.createElement(LayoutWrapper, { "data-component-name": "Layout/CodeWalkthroughLayout", className: className },
|
|
12
12
|
react_1.default.createElement(ContentWrapper, null, children)));
|
|
@@ -61,7 +61,7 @@ const ContentWrapper = styled_components_1.default.section `
|
|
|
61
61
|
/* Full-width styling for all .code-walkthroughs */
|
|
62
62
|
.code-walkthrough {
|
|
63
63
|
width: 100%;
|
|
64
|
-
max-width: ${
|
|
64
|
+
max-width: ${utils_1.breakpoints.max};
|
|
65
65
|
margin-left: auto;
|
|
66
66
|
margin-right: auto;
|
|
67
67
|
}
|
|
@@ -6,28 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CardIcon = CardIcon;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const
|
|
9
|
+
const UniversalIcon_1 = require("../../../icons/UniversalIcon/UniversalIcon");
|
|
10
10
|
function CardIcon({ variant, src, rawContent, position }) {
|
|
11
|
-
return (react_1.default.createElement(CardIconWrapper, { "$variant": variant, "$position": position },
|
|
11
|
+
return (react_1.default.createElement(CardIconWrapper, { "$variant": variant, "$position": position },
|
|
12
|
+
react_1.default.createElement(UniversalIcon_1.UniversalIcon, { icon: src, rawContent: rawContent })));
|
|
12
13
|
}
|
|
13
|
-
const CardImg = styled_components_1.default.img `
|
|
14
|
-
width: var(--card-icon-width);
|
|
15
|
-
height: var(--card-icon-height);
|
|
16
|
-
display: inline-block;
|
|
17
|
-
object-fit: cover;
|
|
18
|
-
`;
|
|
19
|
-
const CardSvg = (0, styled_components_1.default)(InlineSvg_1.InlineSvg) `
|
|
20
|
-
width: var(--card-icon-width);
|
|
21
|
-
height: var(--card-icon-height);
|
|
22
|
-
display: inline-block;
|
|
23
|
-
|
|
24
|
-
svg {
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 100%;
|
|
27
|
-
fill: var(--card-icon-color);
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
14
|
const CardIconWrapper = styled_components_1.default.div `
|
|
15
|
+
--icon-width: var(--card-icon-width);
|
|
16
|
+
--icon-height: var(--card-icon-height);
|
|
17
|
+
--icon-color: var(--card-icon-color);
|
|
18
|
+
|
|
31
19
|
display: flex;
|
|
32
20
|
align-self: ${({ $position }) => ($position ? $position : 'auto')};
|
|
33
21
|
justify-content: center;
|
|
@@ -10,6 +10,7 @@ export type TabProps = {
|
|
|
10
10
|
onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
11
11
|
onClick: () => void;
|
|
12
12
|
icon?: React.ReactNode;
|
|
13
|
+
iconRawContent?: string;
|
|
13
14
|
};
|
|
14
|
-
export declare function TabComponent({ tabId, label, size, disabled, setRef, onKeyDown, onClick, icon, }: TabProps): JSX.Element;
|
|
15
|
+
export declare function TabComponent({ tabId, label, size, disabled, setRef, onKeyDown, onClick, icon, iconRawContent, }: TabProps): JSX.Element;
|
|
15
16
|
export declare const Tab: import("styled-components").StyledComponent<typeof TabComponent, any, {}, never>;
|
|
@@ -8,17 +8,20 @@ exports.TabComponent = TabComponent;
|
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
10
|
const TabList_1 = require("../../../markdoc/components/Tabs/TabList");
|
|
11
|
-
|
|
11
|
+
const UniversalIcon_1 = require("../../../icons/UniversalIcon/UniversalIcon");
|
|
12
|
+
function TabComponent({ tabId, label, size, disabled, setRef, onKeyDown, onClick, icon, iconRawContent, }) {
|
|
12
13
|
return (react_1.default.createElement(TabList_1.TabItem, { "data-component-name": "Markdoc/Tabs/Tab", size: size, tabIndex: 0 },
|
|
13
14
|
react_1.default.createElement(TabList_1.TabButtonLink, { id: `tab-${tabId}`, role: "tab", "aria-selected": "false", "aria-controls": `panel-${tabId}`, tabIndex: -1, size: size, disabled: disabled, ref: setRef, onKeyDown: onKeyDown, onClick: onClick },
|
|
14
15
|
react_1.default.createElement(LabelWrapper, null,
|
|
15
|
-
icon,
|
|
16
|
+
react_1.default.createElement(UniversalIcon_1.UniversalIcon, { icon: icon, rawContent: iconRawContent }),
|
|
16
17
|
label))));
|
|
17
18
|
}
|
|
18
19
|
const LabelWrapper = styled_components_1.default.div `
|
|
19
20
|
display: flex;
|
|
20
21
|
align-items: center;
|
|
21
22
|
gap: 4px;
|
|
23
|
+
--icon-width: var(--md-tabs-icon-size);
|
|
24
|
+
--icon-height: var(--md-tabs-icon-size);
|
|
22
25
|
`;
|
|
23
26
|
exports.Tab = (0, styled_components_1.default)(TabComponent) ``;
|
|
24
27
|
//# sourceMappingURL=Tab.js.map
|
|
@@ -98,6 +98,8 @@ exports.markdownTabs = (0, styled_components_1.css) `
|
|
|
98
98
|
|
|
99
99
|
--md-tabs-tab-focused-padding: var(--spacing-unit); // @presenter Spacing
|
|
100
100
|
|
|
101
|
+
--md-tabs-icon-size: 16px; // @presenter Spacing
|
|
102
|
+
|
|
101
103
|
// @tokens End
|
|
102
104
|
`;
|
|
103
105
|
//# sourceMappingURL=variables.js.map
|
package/lib/markdoc/tags/card.js
CHANGED