@redocly/theme 0.6.3-beta.1 → 0.6.4

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.
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { FlattenSimpleInterpolation } from 'styled-components';
3
- export declare type ButtonSize = 'small' | 'medium' | 'large' | 'xlarge' | string;
4
- export declare type ButtonColor = 'primary' | 'secondary' | 'default' | string;
5
- export declare type ButtonVariant = 'outlined' | 'contained';
3
+ export type ButtonSize = 'small' | 'medium' | 'large' | 'xlarge' | string;
4
+ export type ButtonColor = 'primary' | 'secondary' | 'default' | string;
5
+ export type ButtonVariant = 'outlined' | 'contained';
6
6
  export interface ButtonProps {
7
7
  color?: ButtonColor;
8
8
  disabled?: boolean;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare type CodeSampleProps = {
2
+ export type CodeSampleProps = {
3
3
  language: string;
4
4
  highlighted: string;
5
5
  rawContent: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare type DetailsProps = {
2
+ type DetailsProps = {
3
3
  summary: string;
4
4
  };
5
5
  export declare function Details({ summary, children }: React.PropsWithChildren<DetailsProps>): JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare type MarkdownLayoutProps = {
2
+ type MarkdownLayoutProps = {
3
3
  tableOfContent: React.ReactNode;
4
4
  markdownWrapper: React.ReactNode;
5
5
  editPage?: {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type MermaidProps = {
2
+ type MermaidProps = {
3
3
  diagramHtml: string;
4
4
  };
5
5
  export declare function Mermaid({ diagramHtml }: MermaidProps): JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type TabProps = {
2
+ type TabProps = {
3
3
  activeTab: string;
4
4
  label: string;
5
5
  onClick: (e: string) => void;
@@ -1,5 +1,5 @@
1
1
  import type { PropsWithChildren } from 'react';
2
- declare type TabsProps = PropsWithChildren<{
2
+ type TabsProps = PropsWithChildren<{
3
3
  children: {
4
4
  props: {
5
5
  label: string;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { LogoConfig } from '@theme/types/portal';
3
- export declare type NavbarLogoProps = {
3
+ export type NavbarLogoProps = {
4
4
  logo: Pick<LogoConfig, 'image' | 'link' | 'altText'>;
5
5
  };
6
6
  export declare function NavbarLogo({ logo }: NavbarLogoProps): JSX.Element | null;
@@ -7,12 +7,12 @@ exports.ArrowBack = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const Arrow = ({ className }) => (react_1.default.createElement("span", { "data-component-name": "Sidebar/ArrowBack" },
10
- react_1.default.createElement("svg", { fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 10", width: "10px", height: "10px", className: className },
10
+ react_1.default.createElement("svg", { fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 10", width: "12px", height: "10px", className: className },
11
11
  react_1.default.createElement("path", { d: "M2.414 5l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L2.414 5z" }),
12
12
  react_1.default.createElement("path", { d: "M2 5a1 1 0 011-1h8a1 1 0 110 2H3a1 1 0 01-1-1z" }))));
13
13
  exports.ArrowBack = (0, styled_components_1.default)(Arrow) `
14
14
  fill: var(--sidebar-back-button-icon-color);
15
- margin-right: calc(var(--sidebar-spacing-unit));
15
+ margin-right: calc(var(--sidebar-spacing-unit) * 1.5);
16
16
 
17
17
  background-image: var(--sidebar-back-button-icon);
18
18
  background-repeat: no-repeat;
@@ -2,10 +2,6 @@ import React from 'react';
2
2
  interface SidebarLayoutProps {
3
3
  versions: React.ReactNode;
4
4
  menu: React.ReactNode;
5
- backLink?: {
6
- label: string;
7
- slug: string;
8
- };
9
5
  }
10
- export declare function SidebarLayout({ versions, menu, backLink, }: SidebarLayoutProps): JSX.Element | null;
6
+ export declare function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null;
11
7
  export {};
@@ -12,9 +12,7 @@ const MobileSidebarButton_1 = require("../Sidebar/MobileSidebarButton");
12
12
  const MenuContainer_1 = require("../Sidebar/MenuContainer");
13
13
  const SidebarSearch_1 = require("../Search/SidebarSearch");
14
14
  const useThemeConfig_1 = require("../hooks/useThemeConfig");
15
- const ArrowBack_1 = require("../Sidebar/ArrowBack");
16
- const Link_1 = require("../mocks/Link");
17
- function SidebarLayout({ versions, menu, backLink, }) {
15
+ function SidebarLayout({ versions, menu }) {
18
16
  const [isOpen, setIsOpen] = (0, useMobileMenu_1.useMobileMenu)();
19
17
  const toggleMenu = () => setIsOpen(!isOpen);
20
18
  const { search, sidebar } = (0, useThemeConfig_1.useThemeConfig)();
@@ -25,32 +23,9 @@ function SidebarLayout({ versions, menu, backLink, }) {
25
23
  react_1.default.createElement(MobileSidebarButton_1.MobileSidebarButton, { opened: isOpen, onClick: toggleMenu }),
26
24
  !(search === null || search === void 0 ? void 0 : search.hide) && (search === null || search === void 0 ? void 0 : search.placement) === 'sidebar' ? react_1.default.createElement(SidebarSearch_1.SidebarSearch, null) : null,
27
25
  react_1.default.createElement(Sidebar_1.Sidebar, { animate: true, opened: isOpen },
28
- (backLink && (react_1.default.createElement(BackLinkWrapper, null,
29
- react_1.default.createElement(Link_1.Link, { to: backLink.slug },
30
- react_1.default.createElement(ArrowBack_1.ArrowBack, null),
31
- "Back to ",
32
- backLink.label)))) ||
33
- null,
34
26
  versions,
35
27
  react_1.default.createElement(MenuContainer_1.MenuContainer, null, menu))));
36
28
  }
37
29
  exports.SidebarLayout = SidebarLayout;
38
- const BackLinkWrapper = styled_components_1.default.div `
39
- padding: var(--sidebar-offset-top) var(--sidebar-item-padding-horizontal)
40
- var(--sidebar-item-padding-horizontal)
41
- calc(var(--sidebar-offset-left) + var(--sidebar-item-padding-horizontal));
42
-
43
- a {
44
- color: var(--sidebar-back-button-text-color);
45
- font-size: var(--sidebar-back-button-font-size);
46
- font-family: var(--sidebar-back-button-font-family);
47
- text-decoration: none;
48
- &:hover {
49
- color: var(--sidebar-back-button-hover-text-color);
50
- }
51
- }
52
-
53
- border-bottom: 1px solid var(--sidebar-border-color);
54
- `;
55
30
  const Wrapper = styled_components_1.default.div ``;
56
31
  //# sourceMappingURL=SidebarLayout.js.map
@@ -17,7 +17,7 @@ export interface Sample {
17
17
  lang: string;
18
18
  label?: string;
19
19
  }
20
- export declare type UnstableExternalCodeSample = Sample & {
20
+ export type UnstableExternalCodeSample = Sample & {
21
21
  get: (source: ExternalSource) => string;
22
22
  };
23
23
  export interface ExternalSource {
package/lib/config.d.ts CHANGED
@@ -640,8 +640,8 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
640
640
  openapi?: {} | undefined;
641
641
  graphql?: {} | undefined;
642
642
  }>>;
643
- export declare type ThemeConfig = z.infer<typeof ThemeConfig>;
644
- export declare type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | 'links' | 'scripts'> & {
643
+ export type ThemeConfig = z.infer<typeof ThemeConfig>;
644
+ export type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | 'links' | 'scripts'> & {
645
645
  navbar?: any;
646
646
  footer?: any;
647
647
  auth?: {
@@ -202,7 +202,7 @@ const headingsTypography = (0, styled_components_1.css) `
202
202
  --h2-font-weight: var(--heading-font-weight); // @presenter FontWeight
203
203
  --h2-font-size: 28px; // @presenter FontSize
204
204
  --h2-line-height: 28px; // @presenter LineHeight
205
- --h2-margin-top: var(--heading-margin-top); // @presenter Spacing
205
+ --h2-margin-top: 0; // @presenter Spacing
206
206
  --h2-margin-bottom: var(--heading-margin-bottom); // @presenter Spacing
207
207
  --h2-text-color: var(--heading-text-color); // @presenter Color
208
208
 
@@ -512,7 +512,7 @@ const sidebar = (0, styled_components_1.css) `
512
512
  --sidebar-back-button-font-family: var(--sidebar-item-font-family);
513
513
  --sidebar-back-button-font-size: var(--sidebar-item-font-size);
514
514
  --sidebar-back-button-transform: inherit;
515
- --sidebar-back-button-text-color: var(--link-text-color);
515
+ --sidebar-back-button-text-color: var(--sidebar-item-text-color);
516
516
  --sidebar-back-button-background-color: transparent;
517
517
  --sidebar-back-button-hover-text-color: var(--sidebar-item-active-color);
518
518
  --sidebar-back-button-hover-background-color: transparent;
@@ -1,2 +1,2 @@
1
- export declare type UseActiveHeadingReturnType = string | undefined;
1
+ export type UseActiveHeadingReturnType = string | undefined;
2
2
  export declare function useActiveHeading(contentElement: HTMLDivElement | null, displayedHeaders: Array<string | undefined>): UseActiveHeadingReturnType;
@@ -1,3 +1,3 @@
1
1
  import type { Location } from 'history';
2
- export declare type UseActiveSectionIdReturnType = string;
2
+ export type UseActiveSectionIdReturnType = string;
3
3
  export declare function useActiveSectionId(location: Location, hasOverviewPage?: boolean): UseActiveSectionIdReturnType;
@@ -28,9 +28,6 @@ function useActiveSectionId(location, hasOverviewPage = false) {
28
28
  if (hasOverviewPage) {
29
29
  setItemId('');
30
30
  }
31
- else {
32
- setItemId((sections[0] && sections[0].getAttribute('data-section-id')) || '');
33
- }
34
31
  }, 150), [navbarHeight, hasOverviewPage]);
35
32
  (0, react_1.useEffect)(() => {
36
33
  window.addEventListener('scroll', scrollListener, { capture: false });
@@ -1,4 +1,4 @@
1
- export declare type UseControlReturnType = {
1
+ export type UseControlReturnType = {
2
2
  isOpened: boolean;
3
3
  handleOpen: () => void;
4
4
  handleClose: () => void;
@@ -1,3 +1,3 @@
1
1
  import type { Location } from 'history';
2
- export declare type UseNavbarHeightReturnType = number;
2
+ export type UseNavbarHeightReturnType = number;
3
3
  export declare function useNavbarHeight(location: Location): UseNavbarHeightReturnType;
@@ -1 +1 @@
1
- export declare type ResolvedNavLinkItem = any;
1
+ export type ResolvedNavLinkItem = any;
@@ -1,3 +1,3 @@
1
- export declare type ActiveItem<T> = T;
2
- export declare type SearchDocument = any;
3
- export declare type OperationParameter = any;
1
+ export type ActiveItem<T> = T;
2
+ export type SearchDocument = any;
3
+ export type OperationParameter = any;
@@ -1,4 +1,4 @@
1
- export declare type DefaultThemeUIConfig = {
1
+ export type DefaultThemeUIConfig = {
2
2
  lastUpdatedBlock?: {
3
3
  hide?: boolean;
4
4
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { Version } from '@theme/types/portal';
3
- declare type DropdownProps = {
3
+ type DropdownProps = {
4
4
  items: Version[];
5
5
  activeItem: Version;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { Component } from 'react';
2
2
  import type { CSSProperties } from 'react';
3
- declare type TextAlign = 'left' | 'right' | 'center' | 'justify';
3
+ type TextAlign = 'left' | 'right' | 'center' | 'justify';
4
4
  export interface TileProps {
5
5
  header?: string;
6
6
  icon?: string;
@@ -1,4 +1,4 @@
1
- declare type JsonValue = JSON | Record<string, unknown>;
1
+ type JsonValue = JSON | Record<string, unknown>;
2
2
  export declare function jsonToHTML(json: JsonValue, maxExpandLevel: number, startLine?: number): string;
3
3
  export declare function getLines(json: JsonValue, maxExpandLevel: number): string;
4
4
  export {};
@@ -1,4 +1,4 @@
1
- export declare type MediaQueries = {
1
+ export type MediaQueries = {
2
2
  print: string;
3
3
  small: string;
4
4
  medium: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.6.3-beta.1",
3
+ "version": "0.6.4",
4
4
  "description": "Shared UI components",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -12,7 +12,7 @@
12
12
  "./config": "./lib/config.js",
13
13
  ".": "./lib/index.js",
14
14
  "./Sidebar/*": "./lib/Sidebar/*.js",
15
- "./*": "./lib/*/index.js",
15
+ "./*": "./lib/index.js",
16
16
  "./src/": "./src/"
17
17
  },
18
18
  "scripts": {
@@ -7,7 +7,7 @@ const Arrow = ({ className }: { className?: string }): JSX.Element => (
7
7
  fill="none"
8
8
  xmlns="http://www.w3.org/2000/svg"
9
9
  viewBox="0 0 12 10"
10
- width="10px"
10
+ width="12px"
11
11
  height="10px"
12
12
  className={className}
13
13
  >
@@ -19,7 +19,7 @@ const Arrow = ({ className }: { className?: string }): JSX.Element => (
19
19
 
20
20
  export const ArrowBack = styled(Arrow)`
21
21
  fill: var(--sidebar-back-button-icon-color);
22
- margin-right: calc(var(--sidebar-spacing-unit));
22
+ margin-right: calc(var(--sidebar-spacing-unit) * 1.5);
23
23
 
24
24
  background-image: var(--sidebar-back-button-icon);
25
25
  background-repeat: no-repeat;
@@ -7,23 +7,13 @@ import { MobileSidebarButton } from '@theme/Sidebar/MobileSidebarButton';
7
7
  import { MenuContainer } from '@theme/Sidebar/MenuContainer';
8
8
  import { SidebarSearch } from '@theme/Search/SidebarSearch';
9
9
  import { useThemeConfig } from '@theme/hooks/useThemeConfig';
10
- import { ArrowBack } from '@theme/Sidebar/ArrowBack';
11
- import { Link } from '@portal/Link';
12
10
 
13
11
  interface SidebarLayoutProps {
14
12
  versions: React.ReactNode;
15
13
  menu: React.ReactNode;
16
- backLink?: {
17
- label: string;
18
- slug: string;
19
- };
20
14
  }
21
15
 
22
- export function SidebarLayout({
23
- versions,
24
- menu,
25
- backLink,
26
- }: SidebarLayoutProps): JSX.Element | null {
16
+ export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null {
27
17
  const [isOpen, setIsOpen] = useMobileMenu();
28
18
  const toggleMenu = () => setIsOpen(!isOpen);
29
19
  const { search, sidebar } = useThemeConfig();
@@ -38,15 +28,6 @@ export function SidebarLayout({
38
28
 
39
29
  {!search?.hide && search?.placement === 'sidebar' ? <SidebarSearch /> : null}
40
30
  <Sidebar animate={true} opened={isOpen}>
41
- {(backLink && (
42
- <BackLinkWrapper>
43
- <Link to={backLink.slug}>
44
- <ArrowBack />
45
- Back to {backLink.label}
46
- </Link>
47
- </BackLinkWrapper>
48
- )) ||
49
- null}
50
31
  {versions}
51
32
  <MenuContainer>{menu}</MenuContainer>
52
33
  </Sidebar>
@@ -54,22 +35,4 @@ export function SidebarLayout({
54
35
  );
55
36
  }
56
37
 
57
- const BackLinkWrapper = styled.div`
58
- padding: var(--sidebar-offset-top) var(--sidebar-item-padding-horizontal)
59
- var(--sidebar-item-padding-horizontal)
60
- calc(var(--sidebar-offset-left) + var(--sidebar-item-padding-horizontal));
61
-
62
- a {
63
- color: var(--sidebar-back-button-text-color);
64
- font-size: var(--sidebar-back-button-font-size);
65
- font-family: var(--sidebar-back-button-font-family);
66
- text-decoration: none;
67
- &:hover {
68
- color: var(--sidebar-back-button-hover-text-color);
69
- }
70
- }
71
-
72
- border-bottom: 1px solid var(--sidebar-border-color);
73
- `;
74
-
75
38
  const Wrapper = styled.div``;
@@ -204,7 +204,7 @@ const headingsTypography = css`
204
204
  --h2-font-weight: var(--heading-font-weight); // @presenter FontWeight
205
205
  --h2-font-size: 28px; // @presenter FontSize
206
206
  --h2-line-height: 28px; // @presenter LineHeight
207
- --h2-margin-top: var(--heading-margin-top); // @presenter Spacing
207
+ --h2-margin-top: 0; // @presenter Spacing
208
208
  --h2-margin-bottom: var(--heading-margin-bottom); // @presenter Spacing
209
209
  --h2-text-color: var(--heading-text-color); // @presenter Color
210
210
 
@@ -517,7 +517,7 @@ const sidebar = css`
517
517
  --sidebar-back-button-font-family: var(--sidebar-item-font-family);
518
518
  --sidebar-back-button-font-size: var(--sidebar-item-font-size);
519
519
  --sidebar-back-button-transform: inherit;
520
- --sidebar-back-button-text-color: var(--link-text-color);
520
+ --sidebar-back-button-text-color: var(--sidebar-item-text-color);
521
521
  --sidebar-back-button-background-color: transparent;
522
522
  --sidebar-back-button-hover-text-color: var(--sidebar-item-active-color);
523
523
  --sidebar-back-button-hover-background-color: transparent;
@@ -32,8 +32,6 @@ export function useActiveSectionId(
32
32
  }
33
33
  if (hasOverviewPage) {
34
34
  setItemId('');
35
- } else {
36
- setItemId((sections[0] && sections[0].getAttribute('data-section-id')) || '');
37
35
  }
38
36
  }, 150),
39
37
  [navbarHeight, hasOverviewPage],