@redocly/theme 0.59.0-next.5 → 0.59.0-next.7

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.
@@ -25,6 +25,7 @@ const InfoBarWrapper = styled_components_1.default.div `
25
25
  transition: all 0.2s ease-in-out;
26
26
  height: 100%;
27
27
  padding: var(--catalog-card-gap);
28
+ margin-bottom: var(--spacing-xs);
28
29
 
29
30
  ${({ hoverEffect }) => hoverEffect &&
30
31
  `
@@ -14,6 +14,7 @@ const HierarchyIcon_1 = require("../../icons/HierarchyIcon/HierarchyIcon");
14
14
  const Image_1 = require("../../components/Image/Image");
15
15
  const core_1 = require("../../core");
16
16
  const NoteIcon_1 = require("../../icons/NoteIcon/NoteIcon");
17
+ const CubeIcon_1 = require("../../icons/CubeIcon/CubeIcon");
17
18
  const getIconColor = (entityType) => `var(--catalog-entity-icon-color-${entityType})`;
18
19
  const getEntityIcon = ({ entityType, defaultColor, forceColor, entitiesCatalogConfig, }) => {
19
20
  var _a, _b;
@@ -34,7 +35,7 @@ const getEntityIcon = ({ entityType, defaultColor, forceColor, entitiesCatalogCo
34
35
  if ((iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.src) || (iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.srcSet)) {
35
36
  return (react_1.default.createElement(Image_1.Image, { src: iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.src, srcSet: iconConfig === null || iconConfig === void 0 ? void 0 : iconConfig.srcSet, alt: `${entityType} icon`, width: "16", height: "16" }));
36
37
  }
37
- return react_1.default.createElement(CodeIcon_1.CodeIcon, { color: "var(--catalog-entity-icon-color)" }); // @TODO: add default icon
38
+ return react_1.default.createElement(CubeIcon_1.CubeIcon, { color: "var(--catalog-entity-icon-color)" });
38
39
  };
39
40
  function CatalogEntityIcon({ entityType, defaultColor = false, forceColor, }) {
40
41
  const themeConfig = (0, core_1.useThemeConfig)();
@@ -99,7 +99,7 @@ exports.catalog = (0, styled_components_1.css) `
99
99
  /**
100
100
  * @tokens Catalog entity icon
101
101
  */
102
- --catalog-entity-icon-color: var(--color-primary-base);
102
+ --catalog-entity-icon-color: var(--color-persian-green-8);
103
103
  --catalog-entity-border-color: var(--border-color-secondary);
104
104
  --catalog-entity-bg-color: var(--bg-color-tonal);
105
105
 
@@ -71,7 +71,7 @@ function useNestedMenu({ item, labelRef, nestedMenuRef }) {
71
71
  }
72
72
  const [firstChild] = item.items;
73
73
  if (!isExpanded && item.selectFirstItemOnExpand && firstChild.link) {
74
- yield (0, load_and_navigate_1.loadAndNavigate)({ navigate, to: firstChild.link });
74
+ yield (0, load_and_navigate_1.loadAndNavigate)({ navigate, to: (0, urls_1.withPathPrefix)(firstChild.link) });
75
75
  }
76
76
  setIsExpanded(!isExpanded);
77
77
  }), [item, isExpanded, navigate, location.pathname, setIsExpanded]);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useProductPicker = useProductPicker;
4
4
  const react_router_dom_1 = require("react-router-dom");
5
5
  const use_theme_hooks_1 = require("./use-theme-hooks");
6
+ const utils_1 = require("../utils");
6
7
  function useProductPicker() {
7
8
  const { useCurrentProduct, useProducts, useTelemetry, useLoadAndNavigate } = (0, use_theme_hooks_1.useThemeHooks)();
8
9
  const currentProduct = useCurrentProduct();
@@ -14,7 +15,7 @@ function useProductPicker() {
14
15
  if (!product)
15
16
  return;
16
17
  telemetry.sendProductPickedMessage({ product: product.slug });
17
- loadAndNavigate({ navigate, to: product.link });
18
+ loadAndNavigate({ navigate, to: (0, utils_1.withPathPrefix)(product.link) });
18
19
  }
19
20
  return {
20
21
  currentProduct,
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { IconProps } from '../../icons/types';
3
+ export declare const CubeIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
4
+ 'data-component-name': string;
5
+ } & {
6
+ color?: string;
7
+ size?: string;
8
+ className?: string;
9
+ } & React.SVGProps<SVGSVGElement>, "data-component-name">;
@@ -0,0 +1,17 @@
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.CubeIcon = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor" }, props),
10
+ react_1.default.createElement("path", { d: "M14.252 4.06812L8.25195 0.568119C8.17548 0.523507 8.08853 0.5 8 0.5C7.91147 0.5 7.82452 0.523507 7.74805 0.568119L1.74805 4.06812C1.67257 4.11215 1.60994 4.1752 1.56642 4.25099C1.5229 4.32677 1.5 4.41263 1.5 4.50002V11.5C1.5 11.5874 1.5229 11.6733 1.56642 11.7491C1.60994 11.8248 1.67257 11.8879 1.74805 11.9319L7.74805 15.4319C7.82452 15.4765 7.91147 15.5 8 15.5C8.08853 15.5 8.17548 15.4765 8.25195 15.4319L14.252 11.9319C14.3274 11.8879 14.3901 11.8248 14.4336 11.7491C14.4771 11.6733 14.5 11.5874 14.5 11.5V4.50002C14.5 4.41263 14.4771 4.32677 14.4336 4.25099C14.3901 4.1752 14.3274 4.11215 14.252 4.06812ZM8 1.57887L13.0078 4.50002L8 7.42117L2.9922 4.50002L8 1.57887ZM2.5 5.37062L7.5 8.28712V14.1294L2.5 11.2129V5.37062ZM8.5 14.1294V8.28712L13.5 5.37062V11.2129L8.5 14.1294Z", fill: "currentColor" })));
11
+ exports.CubeIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
12
+ 'data-component-name': 'icons/CubeIcon/CubeIcon',
13
+ })) `
14
+ height: ${({ size }) => size || '16px'};
15
+ width: ${({ size }) => size || '16px'};
16
+ `;
17
+ //# sourceMappingURL=CubeIcon.js.map
@@ -43,6 +43,7 @@ const ContentWrapper = styled_components_1.default.div `
43
43
  flex-direction: column;
44
44
  flex-shrink: 1;
45
45
  gap: var(--card-content-gap);
46
+ width: 100%;
46
47
  `;
47
48
  const Title = styled_components_1.default.h3 `
48
49
  margin: var(--card-title-margin);
@@ -82,28 +83,6 @@ const Body = styled_components_1.default.div `
82
83
  > *:last-child {
83
84
  margin-bottom: 0;
84
85
  }
85
-
86
- /* Icon link styles */
87
- & a {
88
- display: inline-flex;
89
- align-items: center;
90
- line-height: 1;
91
-
92
- & svg {
93
- width: 1.2em;
94
- height: 1.2em;
95
- margin-right: 0.25em;
96
- vertical-align: middle;
97
-
98
- & g {
99
- fill: var(--link-color-primary);
100
- }
101
- }
102
- }
103
-
104
- & a:visited > span > svg > g {
105
- fill: var(--link-color-visited);
106
- }
107
86
  `;
108
87
  const CardWrapper = styled_components_1.default.div.attrs(({ $isCardLink, $variant }) => ({
109
88
  className: getCardWrapperClass($isCardLink, $variant),
@@ -149,12 +128,6 @@ const CardWrapper = styled_components_1.default.div.attrs(({ $isCardLink, $varia
149
128
  }
150
129
  }
151
130
  }
152
-
153
- && ul {
154
- list-style: none;
155
- padding-left: 0;
156
- margin: var(--spacing-xs) 0;
157
- }
158
131
  `;
159
132
  const getCardWrapperClass = ($isCardLink, $variant) => {
160
133
  let classes = [];
@@ -54,7 +54,6 @@ exports.card = {
54
54
  },
55
55
  to: { type: String, resolver: 'link' },
56
56
  },
57
- children: ['paragraph', 'tag', 'list'],
58
57
  },
59
58
  tagName: 'card',
60
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.59.0-next.5",
3
+ "version": "0.59.0-next.7",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -41,6 +41,7 @@ const InfoBarWrapper = styled.div<{ hoverEffect: boolean }>`
41
41
  transition: all 0.2s ease-in-out;
42
42
  height: 100%;
43
43
  padding: var(--catalog-card-gap);
44
+ margin-bottom: var(--spacing-xs);
44
45
 
45
46
  ${({ hoverEffect }) =>
46
47
  hoverEffect &&
@@ -11,6 +11,7 @@ import { HierarchyIcon } from '@redocly/theme/icons/HierarchyIcon/HierarchyIcon'
11
11
  import { Image } from '@redocly/theme/components/Image/Image';
12
12
  import { PREDEFINED_ENTITY_TYPES, useThemeConfig } from '@redocly/theme/core';
13
13
  import { NoteIcon } from '@redocly/theme/icons/NoteIcon/NoteIcon';
14
+ import { CubeIcon } from '@redocly/theme/icons/CubeIcon/CubeIcon';
14
15
 
15
16
  export type CatalogEntityIconProps = {
16
17
  entityType: string;
@@ -59,7 +60,7 @@ const getEntityIcon = ({
59
60
  );
60
61
  }
61
62
 
62
- return <CodeIcon color="var(--catalog-entity-icon-color)" />; // @TODO: add default icon
63
+ return <CubeIcon color="var(--catalog-entity-icon-color)" />;
63
64
  };
64
65
 
65
66
  export function CatalogEntityIcon({
@@ -97,7 +97,7 @@ export const catalog = css`
97
97
  /**
98
98
  * @tokens Catalog entity icon
99
99
  */
100
- --catalog-entity-icon-color: var(--color-primary-base);
100
+ --catalog-entity-icon-color: var(--color-persian-green-8);
101
101
  --catalog-entity-border-color: var(--border-color-secondary);
102
102
  --catalog-entity-bg-color: var(--bg-color-tonal);
103
103
 
@@ -6,7 +6,7 @@ import type { MenuItemProps } from '../../types/sidebar';
6
6
  import { useMenuItemExpanded } from './use-menu-item-expanded';
7
7
  import { useCollapse } from './use-collapse';
8
8
  import { loadAndNavigate } from '../../utils/load-and-navigate';
9
- import { withoutPathPrefix } from '../../utils/urls';
9
+ import { withoutPathPrefix, withPathPrefix } from '../../utils/urls';
10
10
 
11
11
  type NestedMenuProps = MenuItemProps & {
12
12
  labelRef?: React.RefObject<HTMLElement | null>;
@@ -78,7 +78,7 @@ export function useNestedMenu({ item, labelRef, nestedMenuRef }: NestedMenuProps
78
78
 
79
79
  const [firstChild] = item.items;
80
80
  if (!isExpanded && item.selectFirstItemOnExpand && firstChild.link) {
81
- await loadAndNavigate({ navigate, to: firstChild.link });
81
+ await loadAndNavigate({ navigate, to: withPathPrefix(firstChild.link) });
82
82
  }
83
83
  setIsExpanded(!isExpanded);
84
84
  }, [item, isExpanded, navigate, location.pathname, setIsExpanded]);
@@ -1,6 +1,7 @@
1
1
  import { useNavigate } from 'react-router-dom';
2
2
 
3
3
  import { useThemeHooks } from './use-theme-hooks';
4
+ import { withPathPrefix } from '../utils';
4
5
 
5
6
  export function useProductPicker() {
6
7
  const { useCurrentProduct, useProducts, useTelemetry, useLoadAndNavigate } = useThemeHooks();
@@ -12,7 +13,7 @@ export function useProductPicker() {
12
13
  function setProduct(product: typeof currentProduct) {
13
14
  if (!product) return;
14
15
  telemetry.sendProductPickedMessage({ product: product.slug });
15
- loadAndNavigate({ navigate, to: product.link });
16
+ loadAndNavigate({ navigate, to: withPathPrefix(product.link) });
16
17
  }
17
18
  return {
18
19
  currentProduct,
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { IconProps } from '@redocly/theme/icons/types';
5
+
6
+ const Icon = (props: IconProps) => (
7
+ <svg
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ width="16"
10
+ height="16"
11
+ viewBox="0 0 16 16"
12
+ fill="currentColor"
13
+ {...props}
14
+ >
15
+ <path
16
+ d="M14.252 4.06812L8.25195 0.568119C8.17548 0.523507 8.08853 0.5 8 0.5C7.91147 0.5 7.82452 0.523507 7.74805 0.568119L1.74805 4.06812C1.67257 4.11215 1.60994 4.1752 1.56642 4.25099C1.5229 4.32677 1.5 4.41263 1.5 4.50002V11.5C1.5 11.5874 1.5229 11.6733 1.56642 11.7491C1.60994 11.8248 1.67257 11.8879 1.74805 11.9319L7.74805 15.4319C7.82452 15.4765 7.91147 15.5 8 15.5C8.08853 15.5 8.17548 15.4765 8.25195 15.4319L14.252 11.9319C14.3274 11.8879 14.3901 11.8248 14.4336 11.7491C14.4771 11.6733 14.5 11.5874 14.5 11.5V4.50002C14.5 4.41263 14.4771 4.32677 14.4336 4.25099C14.3901 4.1752 14.3274 4.11215 14.252 4.06812ZM8 1.57887L13.0078 4.50002L8 7.42117L2.9922 4.50002L8 1.57887ZM2.5 5.37062L7.5 8.28712V14.1294L2.5 11.2129V5.37062ZM8.5 14.1294V8.28712L13.5 5.37062V11.2129L8.5 14.1294Z"
17
+ fill="currentColor"
18
+ />
19
+ </svg>
20
+ );
21
+
22
+ export const CubeIcon = styled(Icon).attrs(() => ({
23
+ 'data-component-name': 'icons/CubeIcon/CubeIcon',
24
+ }))<IconProps>`
25
+ height: ${({ size }) => size || '16px'};
26
+ width: ${({ size }) => size || '16px'};
27
+ `;
@@ -103,6 +103,7 @@ const ContentWrapper = styled.div`
103
103
  flex-direction: column;
104
104
  flex-shrink: 1;
105
105
  gap: var(--card-content-gap);
106
+ width: 100%;
106
107
  `;
107
108
 
108
109
  const Title = styled.h3<{ $isCardLink: boolean; $justifyContent: string }>`
@@ -146,28 +147,6 @@ const Body = styled.div<{ $lineClamp?: number }>`
146
147
  > *:last-child {
147
148
  margin-bottom: 0;
148
149
  }
149
-
150
- /* Icon link styles */
151
- & a {
152
- display: inline-flex;
153
- align-items: center;
154
- line-height: 1;
155
-
156
- & svg {
157
- width: 1.2em;
158
- height: 1.2em;
159
- margin-right: 0.25em;
160
- vertical-align: middle;
161
-
162
- & g {
163
- fill: var(--link-color-primary);
164
- }
165
- }
166
- }
167
-
168
- & a:visited > span > svg > g {
169
- fill: var(--link-color-visited);
170
- }
171
150
  `;
172
151
 
173
152
  const CardWrapper = styled.div.attrs<{
@@ -222,12 +201,6 @@ const CardWrapper = styled.div.attrs<{
222
201
  }
223
202
  }
224
203
  }
225
-
226
- && ul {
227
- list-style: none;
228
- padding-left: 0;
229
- margin: var(--spacing-xs) 0;
230
- }
231
204
  `;
232
205
 
233
206
  const getCardWrapperClass = ($isCardLink: boolean, $variant?: string) => {
@@ -54,7 +54,6 @@ export const card: MarkdocSchemaWrapper = {
54
54
  },
55
55
  to: { type: String, resolver: 'link' },
56
56
  },
57
- children: ['paragraph', 'tag', 'list'],
58
57
  },
59
58
  tagName: 'card',
60
59
  };