@redocly/theme 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) 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 +8 -41
  17. package/lib/Sidebar/ArrowBack.js +2 -2
  18. package/lib/Sidebar/SidebarLayout.d.ts +5 -1
  19. package/lib/Sidebar/SidebarLayout.js +26 -1
  20. package/lib/config.d.ts +90 -82
  21. package/lib/config.js +24 -18
  22. package/lib/globalStyle.js +12 -10
  23. package/lib/mocks/hooks/index.d.ts +4 -0
  24. package/lib/mocks/hooks/index.js +16 -6
  25. package/lib/ui/Checkbox.d.ts +1 -0
  26. package/lib/ui/Checkbox.js +70 -0
  27. package/lib/ui/Highlight.d.ts +5 -0
  28. package/lib/ui/Highlight.js +63 -0
  29. package/lib/ui/darkColors.js +4 -2
  30. package/package.json +4 -2
  31. package/src/Catalog/Catalog.tsx +198 -0
  32. package/src/Catalog/CatalogCard.tsx +95 -0
  33. package/src/Catalog/Filter.tsx +103 -0
  34. package/src/Catalog/Tags.tsx +36 -0
  35. package/src/Feedback/ReportDialog.tsx +51 -0
  36. package/src/Feedback/index.ts +2 -0
  37. package/src/Feedback/types.ts +5 -3
  38. package/src/Feedback/useReportDialog.ts +34 -0
  39. package/src/Markdown/CodeSample/CodeSample.tsx +11 -57
  40. package/src/Sidebar/ArrowBack.tsx +2 -2
  41. package/src/Sidebar/SidebarLayout.tsx +38 -1
  42. package/src/config.ts +24 -18
  43. package/src/globalStyle.ts +12 -10
  44. package/src/mocks/hooks/index.ts +17 -6
  45. package/src/types/portal/src/shared/types/catalog.d.ts +55 -0
  46. package/src/ui/Checkbox.tsx +64 -0
  47. package/src/ui/Highlight.tsx +48 -0
  48. package/src/ui/darkColors.tsx +4 -2
  49. package/lib/hooks/useReportDialog.d.ts +0 -1
  50. package/lib/hooks/useReportDialog.js +0 -16
  51. package/src/hooks/useReportDialog.ts +0 -14
@@ -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: "12px", 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: "10px", 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) * 1.5);
15
+ margin-right: calc(var(--sidebar-spacing-unit));
16
16
 
17
17
  background-image: var(--sidebar-back-button-icon);
18
18
  background-repeat: no-repeat;
@@ -2,6 +2,10 @@ 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
+ };
5
9
  }
6
- export declare function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null;
10
+ export declare function SidebarLayout({ versions, menu, backLink, }: SidebarLayoutProps): JSX.Element | null;
7
11
  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, }) {
16
18
  const [isOpen, setIsOpen] = (0, useMobileMenu_1.useMobileMenu)();
17
19
  const toggleMenu = () => setIsOpen(!isOpen);
18
20
  const { search, sidebar } = (0, useThemeConfig_1.useThemeConfig)();
@@ -23,9 +25,32 @@ function SidebarLayout({ versions, menu }) {
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
27
  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,
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
package/lib/config.d.ts CHANGED
@@ -312,6 +312,68 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
312
312
  text?: string | undefined;
313
313
  } | undefined;
314
314
  }>>>;
315
+ codeSnippet: z.ZodOptional<z.ZodDefault<z.ZodObject<{
316
+ copy: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
317
+ buttonText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
318
+ tooltipText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
319
+ toasterText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
320
+ toasterDuration: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
321
+ }, {
322
+ hide: z.ZodOptional<z.ZodBoolean>;
323
+ }>, "strip", z.ZodTypeAny, {
324
+ hide?: boolean | undefined;
325
+ buttonText?: string | undefined;
326
+ tooltipText?: string | undefined;
327
+ toasterText?: string | undefined;
328
+ toasterDuration?: number | undefined;
329
+ }, {
330
+ hide?: boolean | undefined;
331
+ buttonText?: string | undefined;
332
+ tooltipText?: string | undefined;
333
+ toasterText?: string | undefined;
334
+ toasterDuration?: number | undefined;
335
+ }>>>;
336
+ report: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
337
+ tooltipText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
338
+ label: z.ZodOptional<z.ZodString>;
339
+ }, {
340
+ hide: z.ZodOptional<z.ZodBoolean>;
341
+ }>, "strip", z.ZodTypeAny, {
342
+ hide?: boolean | undefined;
343
+ tooltipText?: string | undefined;
344
+ label?: string | undefined;
345
+ }, {
346
+ hide?: boolean | undefined;
347
+ tooltipText?: string | undefined;
348
+ label?: string | undefined;
349
+ }>>>;
350
+ }, "strict", z.ZodTypeAny, {
351
+ copy: {
352
+ hide?: boolean | undefined;
353
+ buttonText?: string | undefined;
354
+ tooltipText?: string | undefined;
355
+ toasterText?: string | undefined;
356
+ toasterDuration?: number | undefined;
357
+ };
358
+ report: {
359
+ hide?: boolean | undefined;
360
+ tooltipText?: string | undefined;
361
+ label?: string | undefined;
362
+ };
363
+ }, {
364
+ copy?: {
365
+ hide?: boolean | undefined;
366
+ buttonText?: string | undefined;
367
+ tooltipText?: string | undefined;
368
+ toasterText?: string | undefined;
369
+ toasterDuration?: number | undefined;
370
+ } | undefined;
371
+ report?: {
372
+ hide?: boolean | undefined;
373
+ tooltipText?: string | undefined;
374
+ label?: string | undefined;
375
+ } | undefined;
376
+ }>>>;
315
377
  markdown: z.ZodOptional<z.ZodDefault<z.ZodObject<{
316
378
  frontMatterKeysToResolve: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
317
379
  lastUpdatedBlock: z.ZodOptional<z.ZodDefault<z.ZodObject<z.extendShape<{
@@ -359,40 +421,6 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
359
421
  baseUrl?: string | undefined;
360
422
  icon?: string | undefined;
361
423
  }>>>;
362
- copyCodeSnippet: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
363
- buttonText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
364
- tooltipText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
365
- toasterText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
366
- toasterDuration: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
367
- }, {
368
- hide: z.ZodOptional<z.ZodBoolean>;
369
- }>, "strip", z.ZodTypeAny, {
370
- hide?: boolean | undefined;
371
- buttonText?: string | undefined;
372
- tooltipText?: string | undefined;
373
- toasterText?: string | undefined;
374
- toasterDuration?: number | undefined;
375
- }, {
376
- hide?: boolean | undefined;
377
- buttonText?: string | undefined;
378
- tooltipText?: string | undefined;
379
- toasterText?: string | undefined;
380
- toasterDuration?: number | undefined;
381
- }>>>;
382
- reportCodeSnippet: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
383
- tooltipText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
384
- label: z.ZodOptional<z.ZodString>;
385
- }, {
386
- hide: z.ZodOptional<z.ZodBoolean>;
387
- }>, "strip", z.ZodTypeAny, {
388
- hide?: boolean | undefined;
389
- tooltipText?: string | undefined;
390
- label?: string | undefined;
391
- }, {
392
- hide?: boolean | undefined;
393
- tooltipText?: string | undefined;
394
- label?: string | undefined;
395
- }>>>;
396
424
  }, "strict", z.ZodTypeAny, {
397
425
  frontMatterKeysToResolve?: string[] | undefined;
398
426
  lastUpdatedBlock?: {
@@ -411,18 +439,6 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
411
439
  header?: string | undefined;
412
440
  depth?: number | undefined;
413
441
  };
414
- copyCodeSnippet: {
415
- hide?: boolean | undefined;
416
- buttonText?: string | undefined;
417
- tooltipText?: string | undefined;
418
- toasterText?: string | undefined;
419
- toasterDuration?: number | undefined;
420
- };
421
- reportCodeSnippet: {
422
- hide?: boolean | undefined;
423
- tooltipText?: string | undefined;
424
- label?: string | undefined;
425
- };
426
442
  }, {
427
443
  frontMatterKeysToResolve?: string[] | undefined;
428
444
  lastUpdatedBlock?: {
@@ -441,18 +457,6 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
441
457
  baseUrl?: string | undefined;
442
458
  icon?: string | undefined;
443
459
  } | undefined;
444
- copyCodeSnippet?: {
445
- hide?: boolean | undefined;
446
- buttonText?: string | undefined;
447
- tooltipText?: string | undefined;
448
- toasterText?: string | undefined;
449
- toasterDuration?: number | undefined;
450
- } | undefined;
451
- reportCodeSnippet?: {
452
- hide?: boolean | undefined;
453
- tooltipText?: string | undefined;
454
- label?: string | undefined;
455
- } | undefined;
456
460
  }>>>;
457
461
  openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
458
462
  graphql: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
@@ -549,6 +553,20 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
549
553
  placement?: string | undefined;
550
554
  shortcuts?: string[] | undefined;
551
555
  } | undefined;
556
+ codeSnippet?: {
557
+ copy: {
558
+ hide?: boolean | undefined;
559
+ buttonText?: string | undefined;
560
+ tooltipText?: string | undefined;
561
+ toasterText?: string | undefined;
562
+ toasterDuration?: number | undefined;
563
+ };
564
+ report: {
565
+ hide?: boolean | undefined;
566
+ tooltipText?: string | undefined;
567
+ label?: string | undefined;
568
+ };
569
+ } | undefined;
552
570
  markdown?: {
553
571
  frontMatterKeysToResolve?: string[] | undefined;
554
572
  lastUpdatedBlock?: {
@@ -567,18 +585,6 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
567
585
  header?: string | undefined;
568
586
  depth?: number | undefined;
569
587
  };
570
- copyCodeSnippet: {
571
- hide?: boolean | undefined;
572
- buttonText?: string | undefined;
573
- tooltipText?: string | undefined;
574
- toasterText?: string | undefined;
575
- toasterDuration?: number | undefined;
576
- };
577
- reportCodeSnippet: {
578
- hide?: boolean | undefined;
579
- tooltipText?: string | undefined;
580
- label?: string | undefined;
581
- };
582
588
  } | undefined;
583
589
  openapi?: {} | undefined;
584
590
  graphql?: {} | undefined;
@@ -694,6 +700,20 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
694
700
  text?: string | undefined;
695
701
  } | undefined;
696
702
  } | undefined;
703
+ codeSnippet?: {
704
+ copy?: {
705
+ hide?: boolean | undefined;
706
+ buttonText?: string | undefined;
707
+ tooltipText?: string | undefined;
708
+ toasterText?: string | undefined;
709
+ toasterDuration?: number | undefined;
710
+ } | undefined;
711
+ report?: {
712
+ hide?: boolean | undefined;
713
+ tooltipText?: string | undefined;
714
+ label?: string | undefined;
715
+ } | undefined;
716
+ } | undefined;
697
717
  markdown?: {
698
718
  frontMatterKeysToResolve?: string[] | undefined;
699
719
  lastUpdatedBlock?: {
@@ -712,18 +732,6 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
712
732
  baseUrl?: string | undefined;
713
733
  icon?: string | undefined;
714
734
  } | undefined;
715
- copyCodeSnippet?: {
716
- hide?: boolean | undefined;
717
- buttonText?: string | undefined;
718
- tooltipText?: string | undefined;
719
- toasterText?: string | undefined;
720
- toasterDuration?: number | undefined;
721
- } | undefined;
722
- reportCodeSnippet?: {
723
- hide?: boolean | undefined;
724
- tooltipText?: string | undefined;
725
- label?: string | undefined;
726
- } | undefined;
727
735
  } | undefined;
728
736
  openapi?: {} | undefined;
729
737
  graphql?: {} | undefined;
package/lib/config.js CHANGED
@@ -117,6 +117,30 @@ exports.ThemeConfig = zod_1.z
117
117
  .strict()
118
118
  .optional()
119
119
  .default({}),
120
+ codeSnippet: zod_1.z
121
+ .object({
122
+ copy: zod_1.z
123
+ .object({
124
+ buttonText: zod_1.z.string().default('Copy').optional(),
125
+ tooltipText: zod_1.z.string().default('Copy to clipboard').optional(),
126
+ toasterText: zod_1.z.string().default('Copied!').optional(),
127
+ toasterDuration: zod_1.z.number().default(1500).optional(),
128
+ })
129
+ .extend(HideConfig.shape)
130
+ .optional()
131
+ .default({}),
132
+ report: zod_1.z
133
+ .object({
134
+ tooltipText: zod_1.z.string().default('Report a problem').optional(),
135
+ label: zod_1.z.string().optional(),
136
+ })
137
+ .extend(HideConfig.shape)
138
+ .optional()
139
+ .default({ hide: true }),
140
+ })
141
+ .strict()
142
+ .default({})
143
+ .optional(),
120
144
  markdown: zod_1.z
121
145
  .object({
122
146
  frontMatterKeysToResolve: zod_1.z.array(zod_1.z.string()).default(['image', 'links']).optional(),
@@ -145,24 +169,6 @@ exports.ThemeConfig = zod_1.z
145
169
  .extend(HideConfig.shape)
146
170
  .default({})
147
171
  .optional(),
148
- copyCodeSnippet: zod_1.z
149
- .object({
150
- buttonText: zod_1.z.string().default('Copy').optional(),
151
- tooltipText: zod_1.z.string().default('Copy to clipboard').optional(),
152
- toasterText: zod_1.z.string().default('Copied').optional(),
153
- toasterDuration: zod_1.z.number().default(1500).optional(),
154
- })
155
- .extend(HideConfig.shape)
156
- .optional()
157
- .default({}),
158
- reportCodeSnippet: zod_1.z
159
- .object({
160
- tooltipText: zod_1.z.string().default('Report a problem').optional(),
161
- label: zod_1.z.string().optional(),
162
- })
163
- .extend(HideConfig.shape)
164
- .optional()
165
- .default({ hide: true }), // TODO: temporary disabled
166
172
  })
167
173
  .strict()
168
174
  .default({})
@@ -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);
@@ -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: {
@@ -8,20 +8,22 @@ function useThemeConfig() {
8
8
  placement: 'navbar',
9
9
  shortcuts: ['ctrl+f', 'cmd+k', '/'],
10
10
  },
11
- markdown: {
12
- toc: { depth: 3, header: 'Table of contents', hide: false },
13
- lastUpdatedBlock: { hide: false, format: 'timeago', locale: 'en-US' },
14
- copyCodeSnippet: {
11
+ codeSnippet: {
12
+ copy: {
15
13
  hide: false,
16
14
  buttonText: 'Copy',
17
15
  tooltipText: 'Copy to clipboard',
18
16
  toasterText: 'Copied',
19
17
  toasterDuration: 1500,
20
18
  },
21
- reportCodeSnippet: {
19
+ report: {
22
20
  hide: false,
23
21
  tooltipText: 'Report a problem',
24
22
  },
23
+ },
24
+ markdown: {
25
+ toc: { depth: 3, header: 'Table of contents', hide: false },
26
+ lastUpdatedBlock: { hide: false, format: 'timeago', locale: 'en-US' },
25
27
  editPage: {
26
28
  baseUrl: '',
27
29
  text: 'Edit this page',
@@ -59,4 +61,12 @@ function useSidebarSiblingsData() {
59
61
  };
60
62
  }
61
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;
62
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
@@ -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.3",
3
+ "version": "0.7.5",
4
4
  "description": "Shared UI components lib",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -63,6 +63,7 @@
63
63
  "@testing-library/react": "^12.1.4",
64
64
  "@testing-library/react-hooks": "^8.0.1",
65
65
  "@testing-library/user-event": "^13.5.0",
66
+ "@types/highlight-words-core": "^1.2.1",
66
67
  "@types/jest": "^29.2.1",
67
68
  "@types/jest-when": "^3.5.2",
68
69
  "@types/lodash.throttle": "^4.1.7",
@@ -103,7 +104,8 @@
103
104
  },
104
105
  "dependencies": {
105
106
  "hotkeys-js": "^3.10.1",
106
- "timeago.js": "^4.0.2"
107
+ "timeago.js": "^4.0.2",
108
+ "highlight-words-core": "^1.2.2"
107
109
  },
108
110
  "nx": {
109
111
  "namedInputs": {