@redocly/theme 0.7.4 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/lib/Catalog/Catalog.d.ts +8 -0
  2. package/lib/Catalog/Catalog.js +167 -0
  3. package/lib/Catalog/CatalogCard.d.ts +5 -0
  4. package/lib/Catalog/CatalogCard.js +113 -0
  5. package/lib/Catalog/Filter.d.ts +5 -0
  6. package/lib/Catalog/Filter.js +88 -0
  7. package/lib/Catalog/Tags.d.ts +4 -0
  8. package/lib/Catalog/Tags.js +32 -0
  9. package/lib/Feedback/ReportDialog.d.ts +3 -0
  10. package/lib/Feedback/ReportDialog.js +66 -0
  11. package/lib/Feedback/index.d.ts +2 -0
  12. package/lib/Feedback/index.js +5 -1
  13. package/lib/Feedback/types.d.ts +5 -3
  14. package/lib/Feedback/useReportDialog.d.ts +7 -0
  15. package/lib/Feedback/useReportDialog.js +28 -0
  16. package/lib/Markdown/CodeSample/CodeSample.js +5 -38
  17. package/lib/Sidebar/ArrowBack.js +2 -2
  18. package/lib/Sidebar/MenuGroup.js +1 -1
  19. package/lib/Sidebar/Sidebar.d.ts +1 -0
  20. package/lib/Sidebar/Sidebar.js +5 -2
  21. package/lib/Sidebar/SidebarLayout.d.ts +6 -1
  22. package/lib/Sidebar/SidebarLayout.js +27 -2
  23. package/lib/TableOfContent/TableOfContent.js +1 -1
  24. package/lib/config.js +2 -2
  25. package/lib/globalStyle.js +13 -11
  26. package/lib/hooks/useActiveHeading.js +2 -7
  27. package/lib/hooks/useActiveSectionId.js +1 -1
  28. package/lib/hooks/useMobileMenu.js +1 -1
  29. package/lib/mocks/hooks/index.d.ts +4 -0
  30. package/lib/mocks/hooks/index.js +9 -1
  31. package/lib/ui/Checkbox.d.ts +1 -0
  32. package/lib/ui/Checkbox.js +70 -0
  33. package/lib/ui/Highlight.d.ts +5 -0
  34. package/lib/ui/Highlight.js +63 -0
  35. package/lib/ui/Jumbotron.js +2 -2
  36. package/lib/ui/darkColors.js +4 -2
  37. package/package.json +6 -8
  38. package/src/Catalog/Catalog.tsx +198 -0
  39. package/src/Catalog/CatalogCard.tsx +95 -0
  40. package/src/Catalog/Filter.tsx +103 -0
  41. package/src/Catalog/Tags.tsx +36 -0
  42. package/src/Feedback/ReportDialog.tsx +51 -0
  43. package/src/Feedback/index.ts +2 -0
  44. package/src/Feedback/types.ts +5 -3
  45. package/src/Feedback/useReportDialog.ts +34 -0
  46. package/src/Markdown/CodeSample/CodeSample.tsx +7 -50
  47. package/src/Sidebar/ArrowBack.tsx +2 -2
  48. package/src/Sidebar/MenuGroup.tsx +1 -1
  49. package/src/Sidebar/Sidebar.tsx +6 -2
  50. package/src/Sidebar/SidebarLayout.tsx +41 -2
  51. package/src/TableOfContent/TableOfContent.tsx +1 -1
  52. package/src/config.ts +2 -2
  53. package/src/globalStyle.ts +13 -11
  54. package/src/hooks/useActiveHeading.ts +3 -12
  55. package/src/hooks/useActiveSectionId.ts +1 -1
  56. package/src/hooks/useMobileMenu.ts +2 -2
  57. package/src/mocks/hooks/index.ts +10 -1
  58. package/src/types/portal/src/shared/types/catalog.d.ts +55 -0
  59. package/src/ui/Checkbox.tsx +64 -0
  60. package/src/ui/Highlight.tsx +48 -0
  61. package/src/ui/Jumbotron.tsx +2 -2
  62. package/src/ui/darkColors.tsx +4 -2
  63. package/lib/hooks/useReportDialog.d.ts +0 -1
  64. package/lib/hooks/useReportDialog.js +0 -16
  65. package/src/hooks/useReportDialog.ts +0 -14
@@ -64,7 +64,7 @@ const MenuWrapper = styled_components_1.default.div `
64
64
  padding-left: var(--sidebar-item-nested-offset);
65
65
  overflow: hidden;
66
66
  ${(props) => props.isExpanded
67
- ? `max-height: 9999px;
67
+ ? `max-height: 99999px;
68
68
  transition: max-height .8s cubic-bezier(0.5, 0, 1, 0) 0s;`
69
69
  : `max-height: 0px;
70
70
  transition: max-height .8s cubic-bezier(0, 1, 0, 1) -.1s;`};
@@ -1,4 +1,5 @@
1
1
  interface SidebarProps {
2
+ isNavbar: boolean;
2
3
  opened?: boolean;
3
4
  animate?: boolean;
4
5
  }
@@ -18,13 +18,16 @@ exports.Sidebar = styled_components_1.default.aside.attrs(() => ({
18
18
  font-size: var(--sidebar-item-font-size);
19
19
  font-family: var(--sidebar-item-font-family);
20
20
  color: var(--sidebar-item-text-color);
21
- top: var(--navbar-height);
22
- height: calc(100vh - var(--navbar-height));
23
21
  display: flex;
24
22
  flex-direction: column;
25
23
  width: 100%;
26
24
  -webkit-font-smoothing: antialiased;
27
25
 
26
+ ${({ isNavbar }) => `
27
+ top: ${isNavbar ? 'var(--navbar-height)' : '0'};
28
+ height: calc(100vh ${isNavbar ? '- var(--navbar-height)' : ''});
29
+ `};
30
+
28
31
  ${({ opened, animate }) => `
29
32
  opacity: ${opened ? '1' : '0'};
30
33
  pointer-events: ${opened ? 'auto' : 'none'};
@@ -2,6 +2,11 @@ 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
+ isNavbar: boolean;
5
10
  }
6
- export declare function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null;
11
+ export declare function SidebarLayout({ versions, menu, backLink, isNavbar, }: SidebarLayoutProps): JSX.Element | null;
7
12
  export {};
@@ -12,7 +12,9 @@ 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
- function SidebarLayout({ versions, menu }) {
15
+ const ArrowBack_1 = require("../Sidebar/ArrowBack");
16
+ const Link_1 = require("../mocks/Link");
17
+ function SidebarLayout({ versions, menu, backLink, isNavbar, }) {
16
18
  const [isOpen, setIsOpen] = (0, useMobileMenu_1.useMobileMenu)();
17
19
  const toggleMenu = () => setIsOpen(!isOpen);
18
20
  const { search, sidebar } = (0, useThemeConfig_1.useThemeConfig)();
@@ -22,10 +24,33 @@ function SidebarLayout({ versions, menu }) {
22
24
  return (react_1.default.createElement(Wrapper, { "data-component-name": "Sidebar/SidebarLayout" },
23
25
  react_1.default.createElement(MobileSidebarButton_1.MobileSidebarButton, { opened: isOpen, onClick: toggleMenu }),
24
26
  !(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,
25
- react_1.default.createElement(Sidebar_1.Sidebar, { animate: true, opened: isOpen },
27
+ react_1.default.createElement(Sidebar_1.Sidebar, { animate: true, opened: isOpen, isNavbar: isNavbar },
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,
26
34
  versions,
27
35
  react_1.default.createElement(MenuContainer_1.MenuContainer, null, menu))));
28
36
  }
29
37
  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
+ `;
30
55
  const Wrapper = styled_components_1.default.div ``;
31
56
  //# sourceMappingURL=SidebarLayout.js.map
@@ -104,6 +104,6 @@ const TableOfContentItems = styled_components_1.default.div `
104
104
  max-height: calc(100vh - var(--navbar-height) - var(--toc-offset-top));
105
105
  border-left: 1px solid var(--toc-border-color);
106
106
  overflow-y: auto;
107
- width: var(--toc-width); ;
107
+ width: var(--toc-width);
108
108
  `;
109
109
  //# sourceMappingURL=TableOfContent.js.map
package/lib/config.js CHANGED
@@ -123,7 +123,7 @@ exports.ThemeConfig = zod_1.z
123
123
  .object({
124
124
  buttonText: zod_1.z.string().default('Copy').optional(),
125
125
  tooltipText: zod_1.z.string().default('Copy to clipboard').optional(),
126
- toasterText: zod_1.z.string().default('Copied').optional(),
126
+ toasterText: zod_1.z.string().default('Copied!').optional(),
127
127
  toasterDuration: zod_1.z.number().default(1500).optional(),
128
128
  })
129
129
  .extend(HideConfig.shape)
@@ -136,7 +136,7 @@ exports.ThemeConfig = zod_1.z
136
136
  })
137
137
  .extend(HideConfig.shape)
138
138
  .optional()
139
- .default({}),
139
+ .default({ hide: true }),
140
140
  })
141
141
  .strict()
142
142
  .default({})
@@ -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: 0; // @presenter Spacing
205
+ --h2-margin-top: var(--heading-margin-top); // @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(--sidebar-item-text-color);
515
+ --sidebar-back-button-text-color: var(--link-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;
@@ -1687,7 +1687,7 @@ const inputs = (0, styled_components_1.css) `
1687
1687
  --input-border: none; // @presenter Border
1688
1688
  --input-border-radius: var(--border-radius); // @presenter BorderRadius
1689
1689
  --input-font-size: var(--font-size-base); // @presenter FontSize
1690
- --input-font-family: var(--code-font-family); // @presenter FontFamily
1690
+ --input-font-family: var(--font-family-base); // @presenter FontFamily
1691
1691
  --input-line-height: 1.15em; // @presenter LineHeight
1692
1692
  --input-padding: 8px;
1693
1693
 
@@ -1697,6 +1697,8 @@ const inputs = (0, styled_components_1.css) `
1697
1697
  --input-focus-text-color: var(--text-color-inverse); // @presenter Color
1698
1698
  --input-placeholder-text-color: var(--text-color-inverse); // @presenter Color
1699
1699
 
1700
+ --checkbox-backround-color: var(--background-color);
1701
+ --checkbox-checked-backround-color: var(--color-primary-500);
1700
1702
  // @tokens End
1701
1703
  `;
1702
1704
  const markdown = (0, styled_components_1.css) `
@@ -1899,7 +1901,7 @@ const pages = (0, styled_components_1.css) `
1899
1901
 
1900
1902
  --page-404-font-family: var(--font-family-base); // @presenter FontFamily
1901
1903
 
1902
- --page-404-header-text-color: #000;
1904
+ --page-404-header-text-color: #000;
1903
1905
  --page-404-header-font-size: 14em; // @presenter FontSize
1904
1906
  --page-404-header-font-weight: 600; // @presenter FontWeight
1905
1907
  --page-404-header-line-height: 1.2; // @presenter LineHeight
@@ -1919,30 +1921,30 @@ const pages = (0, styled_components_1.css) `
1919
1921
  * @tokens 403 Page
1920
1922
  * @presenter Color
1921
1923
  */
1922
-
1924
+
1923
1925
  --page-403-font-family: var(--font-family-base); // @presenter FontFamily
1924
-
1926
+
1925
1927
  --page-403-header-text-color: #000;
1926
1928
  --page-403-header-font-size: 14em; // @presenter FontSize
1927
1929
  --page-403-header-font-weight: 600; // @presenter FontWeight
1928
1930
  --page-403-header-line-height: 1.2; // @presenter LineHeight
1929
1931
  --page-403-header-margin: 0; // @presenter Spacing
1930
-
1932
+
1931
1933
  --page-403-description-text-color: #000;
1932
1934
  --page-403-description-font-size: 2em; // @presenter FontSize
1933
1935
  --page-403-description-font-weight: 400; // @presenter FontWeight
1934
1936
  --page-403-description-line-height: 1; // @presenter LineHeight
1935
1937
  --page-403-description-margin: 0; // @presenter Spacing
1936
-
1938
+
1937
1939
  --page-403-button-margin: 4em; // @presenter Spacing
1938
-
1940
+
1939
1941
  // @tokens End
1940
1942
  `;
1941
1943
  const modal = (0, styled_components_1.css) `
1942
- body:has([id='modal']) {
1944
+ body:has(.modal) {
1943
1945
  overflow: hidden;
1944
1946
  }
1945
-
1947
+
1946
1948
  --modal-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.6);
1947
1949
  --modal-overlay-background-color: rgba(206, 206, 206, 0.49);
1948
1950
  --modal-background-color: var(--background-color);
@@ -7,7 +7,7 @@ function useActiveHeading(contentElement, displayedHeaders) {
7
7
  const [heading, setHeading] = (0, react_1.useState)(displayedHeaders.length > 1 ? displayedHeaders[0] : undefined);
8
8
  const [headingElements, setHeadingElements] = (0, react_1.useState)([]);
9
9
  const headingElementsRef = (0, react_1.useRef)({});
10
- const history = (0, react_router_dom_1.useHistory)();
10
+ const location = (0, react_router_dom_1.useLocation)();
11
11
  const getVisibleHeadings = () => {
12
12
  const visibleHeadings = [];
13
13
  for (const key in headingElementsRef.current) {
@@ -56,12 +56,7 @@ function useActiveHeading(contentElement, displayedHeaders) {
56
56
  return;
57
57
  }
58
58
  setHeadingElements(findHeaders(contentElement));
59
- const unlisten = history.listen(() => {
60
- setHeadingElements(findHeaders(contentElement));
61
- });
62
- return () => unlisten();
63
- // eslint-disable-next-line react-hooks/exhaustive-deps
64
- }, [contentElement]);
59
+ }, [contentElement, location]);
65
60
  (0, react_1.useEffect)(() => {
66
61
  if (!(headingElements === null || headingElements === void 0 ? void 0 : headingElements.length)) {
67
62
  return;
@@ -33,7 +33,7 @@ function useActiveSectionId(location, hasOverviewPage = false) {
33
33
  window.addEventListener('scroll', scrollListener, { capture: false });
34
34
  setTimeout(() => {
35
35
  scrollListener();
36
- }, 0);
36
+ }, 10);
37
37
  return () => {
38
38
  window.removeEventListener('scroll', scrollListener);
39
39
  };
@@ -4,7 +4,7 @@ exports.useMobileMenu = void 0;
4
4
  const react_1 = require("react");
5
5
  const react_router_dom_1 = require("react-router-dom");
6
6
  function useMobileMenu(initialState = false) {
7
- const { location } = (0, react_router_dom_1.useHistory)();
7
+ const location = (0, react_router_dom_1.useLocation)();
8
8
  const [isOpen, setIsOpen] = (0, react_1.useState)(initialState);
9
9
  (0, react_1.useEffect)(() => setIsOpen(false), [location.pathname]);
10
10
  return [isOpen, setIsOpen];
@@ -1,4 +1,6 @@
1
1
  import type { ThemeUIConfig } from '../../config';
2
+ import type { ResolvedNavItem } from '@theme/types/portal';
3
+ import type { CatalogConfig, FilteredCatalog } from '@theme/types/portal/src/shared/types/catalog';
2
4
  interface PageLink {
3
5
  label: string;
4
6
  link: string;
@@ -9,4 +11,6 @@ export declare function useSidebarSiblingsData(): {
9
11
  nextPage: PageLink | null;
10
12
  prevPage: PageLink | null;
11
13
  };
14
+ export declare function usePageSharedData<T = unknown>(_id: string): T;
15
+ export declare function useCatalog(_items: ResolvedNavItem[], _config: CatalogConfig): FilteredCatalog;
12
16
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSidebarSiblingsData = exports.useThemeConfig = void 0;
3
+ exports.useCatalog = exports.usePageSharedData = exports.useSidebarSiblingsData = exports.useThemeConfig = void 0;
4
4
  function useThemeConfig() {
5
5
  return {
6
6
  search: {
@@ -61,4 +61,12 @@ function useSidebarSiblingsData() {
61
61
  };
62
62
  }
63
63
  exports.useSidebarSiblingsData = useSidebarSiblingsData;
64
+ function usePageSharedData(_id) {
65
+ throw new Error('Mock not implemented yet.');
66
+ }
67
+ exports.usePageSharedData = usePageSharedData;
68
+ function useCatalog(_items, _config) {
69
+ throw new Error('Mock not implemented yet.');
70
+ }
71
+ exports.useCatalog = useCatalog;
64
72
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export declare const Checkbox: import("styled-components").StyledComponent<"input", any, {}, never>;
@@ -0,0 +1,70 @@
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.Checkbox = void 0;
7
+ const styled_components_1 = __importDefault(require("styled-components"));
8
+ exports.Checkbox = styled_components_1.default.input `
9
+ position: absolute;
10
+ opacity: 0;
11
+
12
+ & + label {
13
+ position: relative;
14
+ cursor: pointer;
15
+ padding: 0;
16
+ display: flex;
17
+
18
+ div {
19
+ margin-top: 1px;
20
+ }
21
+ p {
22
+ line-height: 1.2;
23
+ }
24
+
25
+ &::before {
26
+ content: '';
27
+ margin-right: 10px;
28
+ display: inline-block;
29
+ vertical-align: top;
30
+ width: 18px;
31
+ height: 18px;
32
+ background: var(--checkbox-backround-color);
33
+ border: 1px solid rgba(0, 0, 0, 0.23);
34
+ border-radius: 2px;
35
+ flex-shrink: 0;
36
+ }
37
+ }
38
+
39
+ &:focus + label:before {
40
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
41
+ }
42
+
43
+ &:checked + label {
44
+ &::before {
45
+ background: var(--checkbox-checked-backround-color);
46
+ }
47
+ &::after {
48
+ content: '';
49
+ position: absolute;
50
+ left: 5px;
51
+ top: 10px;
52
+ background: var(--checkbox-backround-color);
53
+ width: 2px;
54
+ height: 2px;
55
+ box-shadow: 2px 0 0 white, 4px 0 0 white, 4px -2px 0 white, 4px -4px 0 white, 4px -6px 0 white,
56
+ 4px -8px 0 white;
57
+ transform: rotate(45deg);
58
+ }
59
+ }
60
+
61
+ &:disabled + label {
62
+ color: #b8b8b8;
63
+ cursor: auto;
64
+ &::before {
65
+ box-shadow: none;
66
+ background: #ddd;
67
+ }
68
+ }
69
+ `;
70
+ //# sourceMappingURL=Checkbox.js.map
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export declare const HighlightContext: React.Context<string[]>;
3
+ export declare function Highlight(props: {
4
+ children: React.ReactChildren | string;
5
+ }): JSX.Element;
@@ -0,0 +1,63 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Highlight = exports.HighlightContext = void 0;
27
+ const React = __importStar(require("react"));
28
+ const highlight_words_core_1 = require("highlight-words-core");
29
+ exports.HighlightContext = React.createContext([]);
30
+ function Highlight(props) {
31
+ const { children } = props;
32
+ const searchWords = React.useContext(exports.HighlightContext);
33
+ if (!searchWords.length) {
34
+ return React.createElement(React.Fragment, null, "children") || null;
35
+ }
36
+ function highlight(str, childIdx = 0) {
37
+ const chunks = (0, highlight_words_core_1.findAll)({
38
+ searchWords,
39
+ textToHighlight: str,
40
+ });
41
+ return (React.createElement(React.Fragment, { key: childIdx }, chunks.map((chunk, idx) => {
42
+ const { end, highlight, start } = chunk;
43
+ const text = str.substr(start, end - start);
44
+ if (highlight) {
45
+ return React.createElement("mark", { key: idx }, text);
46
+ }
47
+ else {
48
+ return text;
49
+ }
50
+ })));
51
+ }
52
+ if (typeof children === 'string') {
53
+ return highlight(children);
54
+ }
55
+ else if (Array.isArray(children)) {
56
+ return (React.createElement(React.Fragment, null, children.map((child, idx) => typeof children === 'string' ? highlight(child, idx) : child || null)));
57
+ }
58
+ else {
59
+ return React.createElement(React.Fragment, null, "children") || null;
60
+ }
61
+ }
62
+ exports.Highlight = Highlight;
63
+ //# sourceMappingURL=Highlight.js.map
@@ -14,8 +14,8 @@ exports.Jumbotron = (0, styled_components_1.default)(Background_1.Background).at
14
14
  flex-direction: column;
15
15
  padding-top: ${({ pt }) => pt || '0'};
16
16
  padding-bottom: ${({ pb }) => pb || '8em'};
17
- padding-left: ${({ pl }) => pl || '0'};
18
- padding-right: ${({ pr }) => pr || '0'};
17
+ padding-left: ${({ pl }) => pl || '1rem'};
18
+ padding-right: ${({ pr }) => pr || '1rem'};
19
19
  ${({ bgColor }) => bgColor && `background: ${bgColor}`};
20
20
  ${({ bgImage, bgColor }) => bgImage &&
21
21
  `
@@ -62,12 +62,14 @@ exports.darkMode = (0, styled_components_1.css) `
62
62
  --tooltip-text-color: #fff;
63
63
  --md-table-head-background-color: var(--color-secondary-300);
64
64
  --md-tabs-hover-tab-border-color: var(--color-secondary-500);
65
- --wide-tile-background-color: #000000;
66
- --thin-tile-background-color: #000000;
65
+ --thin-tile-background-color: #1d242d;
66
+ --wide-tile-background-color: #1d242d;
67
67
  --page-404-header-text-color: #fff;
68
68
  --page-404-description-text-color: #fff;
69
69
  --page-403-header-text-color: #fff;
70
70
  --page-403-description-text-color: #fff;
71
+ --checkbox-backround-color: var(--color-secondary-900);
72
+ --checkbox-checked-backround-color: var(--color-primary-400);
71
73
 
72
74
  background-color: var(--background-color);
73
75
  color: var(--text-color);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "Shared UI components lib",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -39,8 +39,7 @@
39
39
  "prismjs": "^1.28.0",
40
40
  "react": "^17.0.2",
41
41
  "react-dom": "^17.0.2",
42
- "react-router": "^5.3.0",
43
- "react-router-dom": "^5.3.0",
42
+ "react-router-dom": "^6.4.4",
44
43
  "styled-components": "^5.3.6",
45
44
  "styled-system": "^5.1.5",
46
45
  "zod": ">=3.19.1"
@@ -63,6 +62,7 @@
63
62
  "@testing-library/react": "^12.1.4",
64
63
  "@testing-library/react-hooks": "^8.0.1",
65
64
  "@testing-library/user-event": "^13.5.0",
65
+ "@types/highlight-words-core": "^1.2.1",
66
66
  "@types/jest": "^29.2.1",
67
67
  "@types/jest-when": "^3.5.2",
68
68
  "@types/lodash.throttle": "^4.1.7",
@@ -70,8 +70,6 @@
70
70
  "@types/prismjs": "^1.26.0",
71
71
  "@types/react": "^17.0.43",
72
72
  "@types/react-dom": "^17.0.14",
73
- "@types/react-router-dom": "^5.3.3",
74
- "@types/react-router": "^5.1.20",
75
73
  "@types/styled-components": "^5.1.26",
76
74
  "@types/styled-system": "^5.1.13",
77
75
  "@typescript-eslint/eslint-plugin": "^5.23.0",
@@ -86,8 +84,7 @@
86
84
  "lodash.throttle": "^4.1.1",
87
85
  "npm-run-all": "^4.1.5",
88
86
  "react-refresh": "^0.14.0",
89
- "react-router": "^5.3.0",
90
- "react-router-dom": "^5.3.0",
87
+ "react-router-dom": "^6.4.4",
91
88
  "storybook-addon-pseudo-states": "^1.15.1",
92
89
  "storybook-design-token": "^2.7.1",
93
90
  "styled-components": "^5.3.6",
@@ -103,7 +100,8 @@
103
100
  },
104
101
  "dependencies": {
105
102
  "hotkeys-js": "^3.10.1",
106
- "timeago.js": "^4.0.2"
103
+ "timeago.js": "^4.0.2",
104
+ "highlight-words-core": "^1.2.2"
107
105
  },
108
106
  "nx": {
109
107
  "namedInputs": {