@redocly/theme 0.51.0-next.2 → 0.51.0-next.3

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/components/Catalog/Catalog.js +2 -26
  2. package/lib/components/Catalog/CatalogVirtualizedGroups.d.ts +11 -0
  3. package/lib/components/Catalog/CatalogVirtualizedGroups.js +125 -0
  4. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +38 -9
  5. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +11 -9
  6. package/lib/core/hooks/index.d.ts +1 -0
  7. package/lib/core/hooks/index.js +1 -0
  8. package/lib/core/hooks/use-element-size.d.ts +7 -0
  9. package/lib/core/hooks/use-element-size.js +51 -0
  10. package/lib/icons/CheckboxFilledIcon/CheckboxFilledIcon.d.ts +9 -0
  11. package/lib/icons/CheckboxFilledIcon/CheckboxFilledIcon.js +22 -0
  12. package/lib/icons/DataRefineryIcon/DataRefineryIcon.d.ts +9 -0
  13. package/lib/icons/DataRefineryIcon/DataRefineryIcon.js +24 -0
  14. package/lib/icons/DraggableIcon/DraggableIcon.d.ts +9 -0
  15. package/lib/icons/DraggableIcon/DraggableIcon.js +27 -0
  16. package/lib/icons/FlowIcon/FlowIcon.d.ts +9 -0
  17. package/lib/icons/FlowIcon/FlowIcon.js +22 -0
  18. package/lib/icons/PlaylistIcon/PlaylistIcon.d.ts +9 -0
  19. package/lib/icons/PlaylistIcon/PlaylistIcon.js +24 -0
  20. package/lib/icons/SettingsCogIcon/SettingsCogIcon.d.ts +9 -0
  21. package/lib/icons/SettingsCogIcon/SettingsCogIcon.js +25 -0
  22. package/lib/icons/TaskViewIcon/TaskViewIcon.d.ts +9 -0
  23. package/lib/icons/TaskViewIcon/TaskViewIcon.js +24 -0
  24. package/lib/icons/WarningAltFilled/WarningAltFilled.d.ts +9 -0
  25. package/lib/icons/WarningAltFilled/WarningAltFilled.js +23 -0
  26. package/lib/icons/WarningAltFilledIcon/WarningAltFilledIcon.d.ts +9 -0
  27. package/lib/icons/WarningAltFilledIcon/WarningAltFilledIcon.js +23 -0
  28. package/lib/icons/WorkflowAutomationIcon/WorkflowAutomationIcon.d.ts +9 -0
  29. package/lib/icons/WorkflowAutomationIcon/WorkflowAutomationIcon.js +24 -0
  30. package/lib/index.d.ts +11 -0
  31. package/lib/index.js +11 -0
  32. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +2 -28
  33. package/package.json +2 -1
  34. package/src/components/Catalog/Catalog.tsx +3 -37
  35. package/src/components/Catalog/CatalogVirtualizedGroups.tsx +152 -0
  36. package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +50 -10
  37. package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +12 -9
  38. package/src/core/hooks/index.ts +1 -0
  39. package/src/core/hooks/use-element-size.ts +61 -0
  40. package/src/icons/CheckboxFilledIcon/CheckboxFilledIcon.tsx +23 -0
  41. package/src/icons/DataRefineryIcon/DataRefineryIcon.tsx +34 -0
  42. package/src/icons/DraggableIcon/DraggableIcon.tsx +28 -0
  43. package/src/icons/FlowIcon/FlowIcon.tsx +26 -0
  44. package/src/icons/PlaylistIcon/PlaylistIcon.tsx +25 -0
  45. package/src/icons/SettingsCogIcon/SettingsCogIcon.tsx +32 -0
  46. package/src/icons/TaskViewIcon/TaskViewIcon.tsx +34 -0
  47. package/src/icons/WarningAltFilled/WarningAltFilled.tsx +24 -0
  48. package/src/icons/WarningAltFilledIcon/WarningAltFilledIcon.tsx +24 -0
  49. package/src/icons/WorkflowAutomationIcon/WorkflowAutomationIcon.tsx +34 -0
  50. package/src/index.ts +11 -0
  51. package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +2 -5
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { IconProps } from '../../icons/types';
3
+ export declare const TaskViewIcon: 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,24 @@
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.TaskViewIcon = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const utils_1 = require("../../core/utils");
10
+ const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "none" }, props),
11
+ react_1.default.createElement("path", { d: "M9.625 11.375C10.1082 11.375 10.5 10.9832 10.5 10.5C10.5 10.0168 10.1082 9.625 9.625 9.625C9.14175 9.625 8.75 10.0168 8.75 10.5C8.75 10.9832 9.14175 11.375 9.625 11.375Z", fill: "#3B3C45" }),
12
+ react_1.default.createElement("path", { d: "M13.0274 10.2718C12.757 9.58322 12.2906 8.98906 11.6858 8.563C11.081 8.13695 10.3644 7.89773 9.625 7.875C8.88555 7.89773 8.16903 8.13695 7.56424 8.563C6.95944 8.98906 6.49296 9.58322 6.22261 10.2718L6.125 10.5L6.22261 10.7282C6.49296 11.4168 6.95944 12.0109 7.56424 12.437C8.16903 12.863 8.88555 13.1023 9.625 13.125C10.3644 13.1023 11.081 12.863 11.6858 12.437C12.2906 12.0109 12.757 11.4168 13.0274 10.7282L13.125 10.5L13.0274 10.2718ZM9.625 12.25C9.27888 12.25 8.94054 12.1474 8.65275 11.9551C8.36497 11.7628 8.14066 11.4895 8.00821 11.1697C7.87576 10.8499 7.8411 10.4981 7.90863 10.1586C7.97615 9.81913 8.14282 9.50731 8.38756 9.26256C8.63231 9.01782 8.94413 8.85115 9.28359 8.78363C9.62306 8.7161 9.97493 8.75076 10.2947 8.88321C10.6145 9.01566 10.8878 9.23997 11.0801 9.52775C11.2724 9.81554 11.375 10.1539 11.375 10.5C11.3745 10.964 11.1899 11.4088 10.8619 11.7369C10.5338 12.0649 10.089 12.2495 9.625 12.25Z", fill: "#3B3C45" }),
13
+ react_1.default.createElement("path", { d: "M5.25 12.25H3.0625V3.0625H4.375V4.375H9.625V3.0625H10.9375V7H11.8125V3.0625C11.8125 2.83044 11.7203 2.60788 11.5562 2.44378C11.3921 2.27969 11.1696 2.1875 10.9375 2.1875H9.625V1.75C9.625 1.51794 9.53281 1.29538 9.36872 1.13128C9.20462 0.967187 8.98206 0.875 8.75 0.875H5.25C5.01794 0.875 4.79538 0.967187 4.63128 1.13128C4.46719 1.29538 4.375 1.51794 4.375 1.75V2.1875H3.0625C2.83044 2.1875 2.60788 2.27969 2.44378 2.44378C2.27969 2.60788 2.1875 2.83044 2.1875 3.0625V12.25C2.1875 12.4821 2.27969 12.7046 2.44378 12.8687C2.60788 13.0328 2.83044 13.125 3.0625 13.125H5.25V12.25ZM5.25 1.75H8.75V3.5H5.25V1.75Z", fill: "#3B3C45" })));
14
+ exports.TaskViewIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
15
+ 'data-component-name': 'icons/TaskViewIcon/TaskViewIcon',
16
+ })) `
17
+ path {
18
+ fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
19
+ }
20
+
21
+ height: ${({ size }) => size || '16px'};
22
+ width: ${({ size }) => size || '16px'};
23
+ `;
24
+ //# sourceMappingURL=TaskViewIcon.js.map
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { IconProps } from '../../icons/types';
3
+ export declare const WarningAltFilled: 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,23 @@
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.WarningAltFilled = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const utils_1 = require("../../core/utils");
10
+ const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
11
+ react_1.default.createElement("path", { d: "M8.001 3.08571H7.999L2.32435 13.9983L2.3253 14H13.6747L13.6757 13.9983L8.001 3.08571ZM7.4375 6.00001H8.5625V10.5H7.4375V6.00001ZM8 13C7.85167 13 7.70666 12.956 7.58333 12.8736C7.45999 12.7912 7.36386 12.6741 7.30709 12.537C7.25033 12.4 7.23548 12.2492 7.26441 12.1037C7.29335 11.9582 7.36478 11.8246 7.46967 11.7197C7.57456 11.6148 7.7082 11.5434 7.85369 11.5144C7.99917 11.4855 8.14997 11.5003 8.28702 11.5571C8.42406 11.6139 8.54119 11.71 8.62361 11.8333C8.70602 11.9567 8.75 12.1017 8.75 12.25C8.75 12.4489 8.67099 12.6397 8.53033 12.7803C8.38968 12.921 8.19892 13 8 13Z" }),
12
+ react_1.default.createElement("path", { d: "M14.5 15H1.5C1.4141 15 1.32965 14.9779 1.25478 14.9357C1.17992 14.8936 1.11718 14.8329 1.0726 14.7595C1.02802 14.686 1.00311 14.6024 1.00027 14.5165C0.997436 14.4307 1.01677 14.3455 1.0564 14.2693L7.5564 1.76931C7.59862 1.68812 7.66231 1.62008 7.74053 1.5726C7.81875 1.52511 7.9085 1.5 8 1.5C8.09151 1.5 8.18126 1.52511 8.25948 1.5726C8.3377 1.62008 8.40138 1.68812 8.4436 1.76931L14.9436 14.2693C14.9832 14.3455 15.0026 14.4307 14.9997 14.5165C14.9969 14.6024 14.972 14.686 14.9274 14.7595C14.8828 14.8329 14.8201 14.8936 14.7452 14.9357C14.6704 14.9779 14.5859 15 14.5 15ZM2.3253 14H13.6747L13.6757 13.9983L8.001 3.08571H7.999L2.32435 13.9983L2.3253 14Z" })));
13
+ exports.WarningAltFilled = (0, styled_components_1.default)(Icon).attrs(() => ({
14
+ 'data-component-name': 'icons/WarningAltFilled/WarningAltFilled',
15
+ })) `
16
+ path {
17
+ fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
18
+ }
19
+
20
+ height: ${({ size }) => size || '16px'};
21
+ width: ${({ size }) => size || '16px'};
22
+ `;
23
+ //# sourceMappingURL=WarningAltFilled.js.map
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { IconProps } from '../../icons/types';
3
+ export declare const WarningAltFilledIcon: 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,23 @@
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.WarningAltFilledIcon = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const utils_1 = require("../../core/utils");
10
+ const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" }, props),
11
+ react_1.default.createElement("path", { d: "M8.001 2.83571H7.999L2.32435 13.7483L2.3253 13.75H13.6747L13.6757 13.7483L8.001 2.83571ZM7.4375 5.75001H8.5625V10.25H7.4375V5.75001ZM8 12.75C7.85167 12.75 7.70666 12.706 7.58333 12.6236C7.45999 12.5412 7.36386 12.4241 7.30709 12.287C7.25033 12.15 7.23548 11.9992 7.26441 11.8537C7.29335 11.7082 7.36478 11.5746 7.46967 11.4697C7.57456 11.3648 7.7082 11.2934 7.85369 11.2644C7.99917 11.2355 8.14997 11.2503 8.28702 11.3071C8.42406 11.3639 8.54119 11.46 8.62361 11.5833C8.70602 11.7067 8.75 11.8517 8.75 12C8.75 12.1989 8.67099 12.3897 8.53033 12.5303C8.38968 12.671 8.19892 12.75 8 12.75Z" }),
12
+ react_1.default.createElement("path", { d: "M14.5 14.75H1.5C1.4141 14.75 1.32965 14.7279 1.25478 14.6857C1.17992 14.6436 1.11718 14.5829 1.0726 14.5095C1.02802 14.436 1.00311 14.3524 1.00027 14.2665C0.997436 14.1807 1.01677 14.0955 1.0564 14.0193L7.5564 1.51931C7.59862 1.43812 7.66231 1.37008 7.74053 1.3226C7.81875 1.27511 7.9085 1.25 8 1.25C8.09151 1.25 8.18126 1.27511 8.25948 1.3226C8.3377 1.37008 8.40138 1.43812 8.4436 1.51931L14.9436 14.0193C14.9832 14.0955 15.0026 14.1807 14.9997 14.2665C14.9969 14.3524 14.972 14.436 14.9274 14.5095C14.8828 14.5829 14.8201 14.6436 14.7452 14.6857C14.6704 14.7279 14.5859 14.75 14.5 14.75ZM2.3253 13.75H13.6747L13.6757 13.7483L8.001 2.83571H7.999L2.32435 13.7483L2.3253 13.75Z" })));
13
+ exports.WarningAltFilledIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
14
+ 'data-component-name': 'icons/WarningAltFilledIcon/WarningAltFilledIcon',
15
+ })) `
16
+ path {
17
+ fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
18
+ }
19
+
20
+ height: ${({ size }) => size || '16px'};
21
+ width: ${({ size }) => size || '16px'};
22
+ `;
23
+ //# sourceMappingURL=WarningAltFilledIcon.js.map
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { IconProps } from '../../icons/types';
3
+ export declare const WorkflowAutomationIcon: 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,24 @@
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.WorkflowAutomationIcon = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const utils_1 = require("../../core/utils");
10
+ const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "none" }, props),
11
+ react_1.default.createElement("path", { d: "M7 11.8125C5.425 11.8125 3.89375 11.025 2.975 9.625H5.25V8.75H1.75V12.25H2.625V10.6312C3.71875 11.9437 5.29375 12.6875 7 12.6875V11.8125Z", fill: "#1A1C21" }),
12
+ react_1.default.createElement("path", { d: "M13.5625 10.0625V9.1875H12.6438C12.6 8.925 12.4688 8.6625 12.3375 8.4L12.9938 7.74375L12.3812 7.13125L11.725 7.7875C11.5062 7.65625 11.2437 7.525 10.9375 7.48125V6.5625H10.0625V7.48125C9.8 7.525 9.5375 7.65625 9.275 7.7875L8.61875 7.13125L8.00625 7.74375L8.6625 8.4C8.53125 8.61875 8.4 8.88125 8.35625 9.1875H7.4375V10.0625H8.35625C8.4 10.325 8.53125 10.5875 8.6625 10.85L8.00625 11.5062L8.61875 12.1188L9.275 11.4625C9.49375 11.5938 9.75625 11.725 10.0625 11.7688V12.6875H10.9375V11.7688C11.2 11.725 11.4625 11.5938 11.725 11.4625L12.3812 12.1188L12.9938 11.5062L12.3375 10.85C12.4688 10.6312 12.6 10.3687 12.6438 10.0625H13.5625ZM10.5 10.9375C9.75625 10.9375 9.1875 10.3687 9.1875 9.625C9.1875 8.88125 9.75625 8.3125 10.5 8.3125C11.2437 8.3125 11.8125 8.88125 11.8125 9.625C11.8125 10.3687 11.2437 10.9375 10.5 10.9375Z", fill: "#1A1C21" }),
13
+ react_1.default.createElement("path", { d: "M8.75 4.375H11.025C9.58125 2.14375 6.60625 1.53125 4.375 2.975C3.01875 3.85 2.1875 5.38125 2.1875 7H1.3125C1.3125 3.85 3.85 1.3125 7 1.3125C8.70625 1.3125 10.2812 2.05625 11.375 3.36875V1.75H12.25V5.25H8.75V4.375Z", fill: "#1A1C21" })));
14
+ exports.WorkflowAutomationIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
15
+ 'data-component-name': 'icons/WorkflowAutomationIcon/WorkflowAutomationIcon',
16
+ })) `
17
+ path {
18
+ fill: ${({ color }) => (0, utils_1.getCssColorVariable)(color)};
19
+ }
20
+
21
+ height: ${({ size }) => size || '16px'};
22
+ width: ${({ size }) => size || '16px'};
23
+ `;
24
+ //# sourceMappingURL=WorkflowAutomationIcon.js.map
package/lib/index.d.ts CHANGED
@@ -102,6 +102,7 @@ export * from './components/Catalog/CatalogCard';
102
102
  export * from './components/Catalog/CatalogActions';
103
103
  export * from './components/Catalog/CatalogHighlight';
104
104
  export * from './components/Catalog/CatalogInfoBlock';
105
+ export * from './components/Catalog/CatalogVirtualizedGroups';
105
106
  export * from './components/Product/Product';
106
107
  export * from './components/Product/ProductPicker';
107
108
  export * from './components/StatusCode/StatusCode';
@@ -212,7 +213,17 @@ export * from './icons/CharacterIcon/CharacterIcon';
212
213
  export * from './icons/FileIcon/FileIcon';
213
214
  export * from './icons/ExportIcon/ExportIcon';
214
215
  export * from './icons/CertificateIcon/CertificateIcon';
216
+ export * from './icons/PlaylistIcon/PlaylistIcon';
217
+ export * from './icons/WorkflowAutomationIcon/WorkflowAutomationIcon';
218
+ export * from './icons/TaskViewIcon/TaskViewIcon';
219
+ export * from './icons/DataRefineryIcon/DataRefineryIcon';
220
+ export * from './icons/FlowIcon/FlowIcon';
221
+ export * from './icons/DraggableIcon/DraggableIcon';
222
+ export * from './icons/WarningAltFilledIcon/WarningAltFilledIcon';
215
223
  export * from './icons/ErrorFilledIcon/ErrorFilledIcon';
224
+ export * from './icons/SettingsCogIcon/SettingsCogIcon';
225
+ export * from './icons/CheckboxFilledIcon/CheckboxFilledIcon';
226
+ export * from './icons/WarningAltFilled/WarningAltFilled';
216
227
  export * from './layouts/RootLayout';
217
228
  export * from './layouts/PageLayout';
218
229
  export * from './layouts/NotFound';
package/lib/index.js CHANGED
@@ -150,6 +150,7 @@ __exportStar(require("./components/Catalog/CatalogCard"), exports);
150
150
  __exportStar(require("./components/Catalog/CatalogActions"), exports);
151
151
  __exportStar(require("./components/Catalog/CatalogHighlight"), exports);
152
152
  __exportStar(require("./components/Catalog/CatalogInfoBlock"), exports);
153
+ __exportStar(require("./components/Catalog/CatalogVirtualizedGroups"), exports);
153
154
  /* Product */
154
155
  __exportStar(require("./components/Product/Product"), exports);
155
156
  __exportStar(require("./components/Product/ProductPicker"), exports);
@@ -264,7 +265,17 @@ __exportStar(require("./icons/CharacterIcon/CharacterIcon"), exports);
264
265
  __exportStar(require("./icons/FileIcon/FileIcon"), exports);
265
266
  __exportStar(require("./icons/ExportIcon/ExportIcon"), exports);
266
267
  __exportStar(require("./icons/CertificateIcon/CertificateIcon"), exports);
268
+ __exportStar(require("./icons/PlaylistIcon/PlaylistIcon"), exports);
269
+ __exportStar(require("./icons/WorkflowAutomationIcon/WorkflowAutomationIcon"), exports);
270
+ __exportStar(require("./icons/TaskViewIcon/TaskViewIcon"), exports);
271
+ __exportStar(require("./icons/DataRefineryIcon/DataRefineryIcon"), exports);
272
+ __exportStar(require("./icons/FlowIcon/FlowIcon"), exports);
273
+ __exportStar(require("./icons/DraggableIcon/DraggableIcon"), exports);
274
+ __exportStar(require("./icons/WarningAltFilledIcon/WarningAltFilledIcon"), exports);
267
275
  __exportStar(require("./icons/ErrorFilledIcon/ErrorFilledIcon"), exports);
276
+ __exportStar(require("./icons/SettingsCogIcon/SettingsCogIcon"), exports);
277
+ __exportStar(require("./icons/CheckboxFilledIcon/CheckboxFilledIcon"), exports);
278
+ __exportStar(require("./icons/WarningAltFilled/WarningAltFilled"), exports);
268
279
  /* Layouts */
269
280
  __exportStar(require("./layouts/RootLayout"), exports);
270
281
  __exportStar(require("./layouts/PageLayout"), exports);
@@ -1,27 +1,4 @@
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 __rest = (this && this.__rest) || function (s, e) {
26
3
  var t = {};
27
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -38,7 +15,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
15
  };
39
16
  Object.defineProperty(exports, "__esModule", { value: true });
40
17
  exports.CodeWalkthrough = CodeWalkthrough;
41
- const react_1 = __importStar(require("react"));
18
+ const react_1 = __importDefault(require("react"));
42
19
  const styled_components_1 = __importDefault(require("styled-components"));
43
20
  const contexts_1 = require("../../../core/contexts");
44
21
  const CodePanel_1 = require("../../../markdoc/components/CodeWalkthrough/CodePanel");
@@ -46,10 +23,7 @@ const hooks_1 = require("../../../core/hooks");
46
23
  const CodeFilters_1 = require("../../../markdoc/components/CodeWalkthrough/CodeFilters");
47
24
  function CodeWalkthrough(_a) {
48
25
  var { children, steps, preview } = _a, attributes = __rest(_a, ["children", "steps", "preview"]);
49
- // Steps are being modified causing the observer to be recreated in the useCodeWalkthrough hook
50
- // This is a workaround to prevent the observer from being recreated
51
- const [initialSteps] = (0, react_1.useState)([...steps]);
52
- const { controlsState, stepsState, files, downloadAssociatedFiles } = (0, hooks_1.useCodeWalkthrough)(initialSteps, attributes);
26
+ const { controlsState, stepsState, files, downloadAssociatedFiles } = (0, hooks_1.useCodeWalkthrough)(steps, attributes);
53
27
  const { activeFilters, getControlState, changeControlState } = controlsState;
54
28
  const { filtersElementRef } = stepsState;
55
29
  return (react_1.default.createElement(contexts_1.CodeWalkthroughStepsContext.Provider, { value: stepsState },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.51.0-next.2",
3
+ "version": "0.51.0-next.3",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -87,6 +87,7 @@
87
87
  "timeago.js": "4.0.2",
88
88
  "i18next": "22.4.15",
89
89
  "nprogress": "0.2.0",
90
+ "@tanstack/react-virtual": "3.13.0",
90
91
  "@redocly/config": "0.21.0"
91
92
  },
92
93
  "scripts": {
@@ -6,13 +6,12 @@ import type { CatalogConfig } from '@redocly/theme/config';
6
6
  import { breakpoints } from '@redocly/theme/core/utils';
7
7
  import { useThemeHooks, useModalScrollLock } from '@redocly/theme/core/hooks';
8
8
  import { H2 } from '@redocly/theme/components/Typography/H2';
9
- import { CatalogCard } from '@redocly/theme/components/Catalog/CatalogCard';
10
9
  import { FilterContent } from '@redocly/theme/components/Filter/FilterContent';
11
10
  import { FilterPopover } from '@redocly/theme/components/Filter/FilterPopover';
12
11
  import { HighlightContext } from '@redocly/theme/components/Catalog/CatalogHighlight';
13
12
  import { CatalogActions } from '@redocly/theme/components/Catalog/CatalogActions';
14
13
  import { Sidebar } from '@redocly/theme/components/Sidebar/Sidebar';
15
- import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
14
+ import { CatalogVirtualizedGroups } from '@redocly/theme/components/Catalog/CatalogVirtualizedGroups';
16
15
 
17
16
  export type CatalogProps = {
18
17
  pageProps: {
@@ -73,40 +72,14 @@ export default function Catalog(props: CatalogProps): JSX.Element {
73
72
  </CatalogDescription>
74
73
  ) : null}
75
74
  </CatalogPageDescriptionWrapper>
76
- {groups.map((group) => (
77
- <React.Fragment key={group.title}>
78
- <CatalogSeparator data-testid="catalog-separator">
79
- <CatalogSeparatorLabel>{group.title}</CatalogSeparatorLabel>
80
- <CounterTag borderless>{group.items.length}</CounterTag>
81
- </CatalogSeparator>
82
- <CatalogCards>
83
- {group.items.map((item) => (
84
- <CatalogCard item={item} key={item.link} />
85
- ))}
86
- </CatalogCards>
87
- </React.Fragment>
88
- ))}
75
+
76
+ <CatalogVirtualizedGroups groups={groups} />
89
77
  </CatalogPageContent>
90
78
  </CatalogPageWrapper>
91
79
  </HighlightContext.Provider>
92
80
  );
93
81
  }
94
82
 
95
- const CatalogSeparator = styled.div`
96
- display: flex;
97
- align-items: center;
98
- color: var(--catalog-separator-color);
99
- font-size: var(--catalog-separator-font-size);
100
- font-weight: var(--catalog-separator-font-weight);
101
- border-top: 1px solid var(--catalog-separator-border-color);
102
- margin: var(--catalog-separator-margin);
103
- padding: var(--catalog-separator-padding);
104
- `;
105
-
106
- const CatalogSeparatorLabel = styled.div`
107
- margin: var(--catalog-separator-label-margin);
108
- `;
109
-
110
83
  export const CatalogPageContent = styled.main`
111
84
  flex: 1;
112
85
  width: 90%;
@@ -118,13 +91,6 @@ export const CatalogPageContent = styled.main`
118
91
  }
119
92
  `;
120
93
 
121
- const CatalogCards = styled.div`
122
- display: grid;
123
- grid-template-columns: repeat(auto-fill, minmax(var(--api-catalog-card-min-width), 1fr));
124
- gap: 32px;
125
- margin: var(--catalog-cards-group-margin);
126
- `;
127
-
128
94
  export const CatalogTitle = styled(H2)`
129
95
  color: var(--catalog-title-text-color);
130
96
  font-weight: var(--catalog-title-font-weight);
@@ -0,0 +1,152 @@
1
+ import React, { useEffect, useMemo, useRef, useState, useCallback } from 'react';
2
+ import { useWindowVirtualizer } from '@tanstack/react-virtual';
3
+ import styled from 'styled-components';
4
+
5
+ import { CatalogItem } from '@redocly/theme/core/types';
6
+ import { useElementSize } from '@redocly/theme/core/hooks/use-element-size';
7
+ import { CatalogCard } from '@redocly/theme/components/Catalog/CatalogCard';
8
+ import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
9
+
10
+ const GAP_SIZE = 32;
11
+ const CARD_MIN_WIDTH_VAR = '--api-catalog-card-min-width';
12
+
13
+ type Group = {
14
+ title: string;
15
+ items: CatalogItem[];
16
+ };
17
+
18
+ type VirtualRowData =
19
+ | { type: 'header'; groupTitle: string; groupCount: number; key: string }
20
+ | { type: 'cardRow'; groupTitle: string; items: CatalogItem[]; key: string };
21
+
22
+ type CatalogVirtualizedGroupsProps = {
23
+ groups: Group[];
24
+ };
25
+
26
+ export function CatalogVirtualizedGroups({ groups }: CatalogVirtualizedGroupsProps) {
27
+ const parentRef = useRef<HTMLDivElement>(null);
28
+ const [isClient, setIsClient] = useState(typeof window !== 'undefined');
29
+ const { width } = useElementSize(parentRef);
30
+
31
+ useEffect(() => {
32
+ setIsClient(true);
33
+ }, []);
34
+
35
+ const columnCount = useMemo(() => {
36
+ if (!isClient) return 1;
37
+ const cardMinWidth = parseInt(
38
+ getComputedStyle(document.documentElement).getPropertyValue(CARD_MIN_WIDTH_VAR),
39
+ 10,
40
+ );
41
+ return Math.max(1, Math.floor((width + GAP_SIZE) / (cardMinWidth + GAP_SIZE)));
42
+ }, [width, isClient]);
43
+
44
+ const flatRows: VirtualRowData[] = useMemo(() => {
45
+ const rows: VirtualRowData[] = [];
46
+ groups.forEach((group) => {
47
+ rows.push({
48
+ type: 'header',
49
+ groupTitle: group.title,
50
+ groupCount: group.items.length,
51
+ key: `header-${group.title}`,
52
+ });
53
+ const numRows = Math.ceil(group.items.length / columnCount);
54
+ for (let rowIndex = 0; rowIndex < numRows; rowIndex++) {
55
+ const startIndex = rowIndex * columnCount;
56
+ const rowItems = group.items.slice(startIndex, startIndex + columnCount);
57
+ rows.push({
58
+ type: 'cardRow',
59
+ groupTitle: group.title,
60
+ items: rowItems,
61
+ key: `${group.title}-row-${rowIndex}`,
62
+ });
63
+ }
64
+ });
65
+ return rows;
66
+ }, [groups, columnCount]);
67
+
68
+ const estimateSize = useCallback(
69
+ (index: number) => {
70
+ const row = flatRows[index];
71
+ return row.type === 'header' ? 50 : 250;
72
+ },
73
+ [flatRows],
74
+ );
75
+
76
+ const virtualizer = useWindowVirtualizer({
77
+ count: flatRows.length,
78
+ estimateSize,
79
+ overscan: 5,
80
+ initialOffset: parentRef.current?.offsetTop ?? 0,
81
+ });
82
+
83
+ return (
84
+ <div ref={parentRef}>
85
+ <div
86
+ style={{
87
+ position: 'relative',
88
+ height: isClient ? `${virtualizer.getTotalSize()}px` : 'auto',
89
+ }}
90
+ >
91
+ {isClient &&
92
+ virtualizer.getVirtualItems().map((virtualRow) => {
93
+ const rowData = flatRows[virtualRow.index];
94
+ if (rowData.type === 'header') {
95
+ return (
96
+ <HeaderRow
97
+ key={rowData.key}
98
+ ref={virtualizer.measureElement}
99
+ data-index={virtualRow.index}
100
+ style={{ transform: `translateY(${virtualRow.start}px)` }}
101
+ >
102
+ <CatalogSeparatorLabel>{rowData.groupTitle}</CatalogSeparatorLabel>
103
+ <CounterTag borderless>{rowData.groupCount}</CounterTag>
104
+ </HeaderRow>
105
+ );
106
+ }
107
+
108
+ return (
109
+ <VirtualRow
110
+ key={rowData.key}
111
+ ref={virtualizer.measureElement}
112
+ data-index={virtualRow.index}
113
+ style={{ transform: `translateY(${virtualRow.start}px)` }}
114
+ >
115
+ {rowData.items.map((item) => (
116
+ <CatalogCard key={item.link} item={item} />
117
+ ))}
118
+ </VirtualRow>
119
+ );
120
+ })}
121
+ </div>
122
+ </div>
123
+ );
124
+ }
125
+
126
+ const VirtualRow = styled.div`
127
+ position: absolute;
128
+ left: 0;
129
+ width: 100%;
130
+ display: grid;
131
+ grid-template-columns: repeat(auto-fill, minmax(var(${CARD_MIN_WIDTH_VAR}), 1fr));
132
+ gap: ${GAP_SIZE}px;
133
+ padding-bottom: 32px;
134
+ `;
135
+
136
+ const HeaderRow = styled.div`
137
+ position: absolute;
138
+ left: 0;
139
+ width: 100%;
140
+ display: flex;
141
+ align-items: center;
142
+ padding: var(--catalog-separator-padding);
143
+ border-top: 1px solid var(--catalog-separator-border-color);
144
+ padding-bottom: calc(4px * 4);
145
+ color: var(--catalog-separator-color);
146
+ font-size: var(--catalog-separator-font-size);
147
+ font-weight: var(--catalog-separator-font-weight);
148
+ `;
149
+
150
+ const CatalogSeparatorLabel = styled.div`
151
+ margin: var(--catalog-separator-label-margin);
152
+ `;
@@ -1,4 +1,4 @@
1
- import { useState, useEffect, useMemo } from 'react';
1
+ import { useState, useEffect, useMemo, useRef } from 'react';
2
2
  import { useLocation, useNavigate } from 'react-router-dom';
3
3
 
4
4
  import type {
@@ -52,11 +52,15 @@ export function useCodeWalkthroughControls(
52
52
  const navigate = useNavigate();
53
53
  const searchParams = useMemo(() => new URLSearchParams(location.search), [location.search]);
54
54
 
55
- const [controlsState, setControlsState] = useState(() => {
56
- const initialState: CodeWalkthroughControlsState = {};
55
+ const filtersRef = useRef(filters);
56
+ const inputsRef = useRef(inputs);
57
+ const togglesRef = useRef(toggles);
58
+
59
+ const getInitialState = () => {
60
+ const state: CodeWalkthroughControlsState = {};
57
61
 
58
62
  for (const [id, toggle] of Object.entries(toggles)) {
59
- initialState[id] = {
63
+ state[id] = {
60
64
  ...toggle,
61
65
  render: true,
62
66
  type: 'toggle',
@@ -65,7 +69,7 @@ export function useCodeWalkthroughControls(
65
69
  }
66
70
 
67
71
  for (const [id, input] of Object.entries(inputs)) {
68
- initialState[id] = {
72
+ state[id] = {
69
73
  ...input,
70
74
  render: true,
71
75
  type: 'input',
@@ -75,7 +79,7 @@ export function useCodeWalkthroughControls(
75
79
 
76
80
  for (const [id, filter] of Object.entries(filters)) {
77
81
  const defaultValue = filter?.items?.[0]?.value || '';
78
- initialState[id] = {
82
+ state[id] = {
79
83
  ...filter,
80
84
  render: true,
81
85
  type: 'filter',
@@ -83,8 +87,43 @@ export function useCodeWalkthroughControls(
83
87
  };
84
88
  }
85
89
 
86
- return initialState;
87
- });
90
+ return state;
91
+ };
92
+
93
+ const [controlsState, setControlsState] = useState(getInitialState);
94
+
95
+ useEffect(() => {
96
+ const sameProps = [
97
+ JSON.stringify(filters) === JSON.stringify(filtersRef.current),
98
+ JSON.stringify(inputs) === JSON.stringify(inputsRef.current),
99
+ JSON.stringify(toggles) === JSON.stringify(togglesRef.current),
100
+ ];
101
+
102
+ if (sameProps.every(Boolean)) {
103
+ return;
104
+ }
105
+
106
+ filtersRef.current = filters;
107
+ inputsRef.current = inputs;
108
+ togglesRef.current = toggles;
109
+
110
+ const newState = getInitialState();
111
+
112
+ // Preserve existing values where control type hasn't changed
113
+ Object.entries(newState).forEach(([id, control]) => {
114
+ const existingControl = controlsState[id];
115
+ if (existingControl && existingControl.type === control.type) {
116
+ // @ts-ignore
117
+ newState[id] = {
118
+ ...control,
119
+ value: existingControl.value,
120
+ };
121
+ }
122
+ });
123
+
124
+ setControlsState(newState);
125
+ // eslint-disable-next-line react-hooks/exhaustive-deps
126
+ }, [filters, inputs, toggles, enableDeepLink]);
88
127
 
89
128
  const changeControlState = (id: string, value: string | boolean) => {
90
129
  setControlsState((prev) => {
@@ -220,7 +259,8 @@ export function useCodeWalkthroughControls(
220
259
  getFileText,
221
260
  populateInputsWithValue,
222
261
  };
223
- }, [filters, controlsState]);
262
+ // eslint-disable-next-line react-hooks/exhaustive-deps
263
+ }, [controlsState]);
224
264
 
225
265
  /**
226
266
  * Update the URL search params with the current state of the filters and inputs
@@ -245,7 +285,7 @@ export function useCodeWalkthroughControls(
245
285
  navigate({ search: newSearch });
246
286
  // Ignore searchParams in dependency array to avoid infinite re-renders
247
287
  // eslint-disable-next-line react-hooks/exhaustive-deps
248
- }, [filters, controlsState, navigate, location]);
288
+ }, [controlsState, navigate, location]);
249
289
 
250
290
  return {
251
291
  changeControlState,