@redocly/theme 0.47.0 → 0.47.1

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 (188) hide show
  1. package/lib/components/Buttons/CopyButton.d.ts +8 -3
  2. package/lib/components/Buttons/CopyButton.js +4 -3
  3. package/lib/components/StatusCode/StatusCode.js +11 -14
  4. package/lib/core/constants/code-walkthrough.d.ts +1 -0
  5. package/lib/core/constants/code-walkthrough.js +5 -0
  6. package/lib/core/constants/index.d.ts +1 -0
  7. package/lib/core/constants/index.js +1 -0
  8. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.d.ts +2 -0
  9. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.js +18 -0
  10. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.d.ts +2 -0
  11. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.js +11 -0
  12. package/lib/core/contexts/index.d.ts +2 -0
  13. package/lib/core/contexts/index.js +2 -0
  14. package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.d.ts +10 -0
  15. package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.js +55 -0
  16. package/lib/core/hooks/code-walkthrough/use-code-panel.d.ts +6 -0
  17. package/lib/core/hooks/code-walkthrough/use-code-panel.js +93 -0
  18. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.d.ts +22 -0
  19. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +183 -0
  20. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +16 -0
  21. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +117 -0
  22. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +14 -0
  23. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.js +22 -0
  24. package/lib/core/hooks/index.d.ts +4 -0
  25. package/lib/core/hooks/index.js +4 -0
  26. package/lib/core/styles/global.js +2 -0
  27. package/lib/core/templates/Markdown.d.ts +8 -2
  28. package/lib/core/templates/Markdown.js +5 -2
  29. package/lib/core/types/hooks.d.ts +2 -0
  30. package/lib/core/types/l10n.d.ts +1 -1
  31. package/lib/core/utils/download-code-walkthrough.d.ts +4 -0
  32. package/lib/core/utils/download-code-walkthrough.js +32 -0
  33. package/lib/core/utils/get-code-walkthrough-file-text.d.ts +4 -0
  34. package/lib/core/utils/get-code-walkthrough-file-text.js +22 -0
  35. package/lib/core/utils/get-file-icon.d.ts +2 -0
  36. package/lib/core/utils/get-file-icon.js +31 -0
  37. package/lib/core/utils/index.d.ts +5 -0
  38. package/lib/core/utils/index.js +5 -0
  39. package/lib/core/utils/js-utils.d.ts +30 -0
  40. package/lib/core/utils/js-utils.js +41 -0
  41. package/lib/core/utils/match-code-walkthrough-conditions.d.ts +4 -0
  42. package/lib/core/utils/match-code-walkthrough-conditions.js +23 -0
  43. package/lib/core/utils/replace-inputs-with-value.d.ts +3 -0
  44. package/lib/core/utils/replace-inputs-with-value.js +16 -0
  45. package/lib/icons/DocumentCssIcon/DocumentCssIcon.d.ts +9 -0
  46. package/lib/icons/DocumentCssIcon/DocumentCssIcon.js +23 -0
  47. package/lib/icons/DocumentCssIcon/index.d.ts +1 -0
  48. package/lib/icons/DocumentCssIcon/index.js +6 -0
  49. package/lib/icons/DocumentGraphqlIcon/DocumentGraphqlIcon.d.ts +9 -0
  50. package/lib/icons/DocumentGraphqlIcon/DocumentGraphqlIcon.js +31 -0
  51. package/lib/icons/DocumentGraphqlIcon/index.d.ts +1 -0
  52. package/lib/icons/DocumentGraphqlIcon/index.js +6 -0
  53. package/lib/icons/DocumentHtmlIcon/DocumentHtmlIcon.d.ts +9 -0
  54. package/lib/icons/DocumentHtmlIcon/DocumentHtmlIcon.js +23 -0
  55. package/lib/icons/DocumentHtmlIcon/index.d.ts +1 -0
  56. package/lib/icons/DocumentHtmlIcon/index.js +6 -0
  57. package/lib/icons/DocumentJsIcon/DocumentJsIcon.d.ts +9 -0
  58. package/lib/icons/DocumentJsIcon/DocumentJsIcon.js +23 -0
  59. package/lib/icons/DocumentJsIcon/index.d.ts +1 -0
  60. package/lib/icons/DocumentJsIcon/index.js +6 -0
  61. package/lib/icons/DocumentJsonIcon/DocumentJsonIcon.d.ts +9 -0
  62. package/lib/icons/DocumentJsonIcon/DocumentJsonIcon.js +23 -0
  63. package/lib/icons/DocumentJsonIcon/index.d.ts +1 -0
  64. package/lib/icons/DocumentJsonIcon/index.js +6 -0
  65. package/lib/icons/DocumentMarkdownIcon/DocumentMarkdownIcon.d.ts +9 -0
  66. package/lib/icons/DocumentMarkdownIcon/DocumentMarkdownIcon.js +23 -0
  67. package/lib/icons/DocumentMarkdownIcon/index.d.ts +1 -0
  68. package/lib/icons/DocumentMarkdownIcon/index.js +6 -0
  69. package/lib/icons/DocumentReactIcon/DocumentReactIcon.d.ts +9 -0
  70. package/lib/icons/DocumentReactIcon/DocumentReactIcon.js +23 -0
  71. package/lib/icons/DocumentReactIcon/index.d.ts +1 -0
  72. package/lib/icons/DocumentReactIcon/index.js +6 -0
  73. package/lib/icons/DocumentTsIcon/DocumentTsIcon.d.ts +9 -0
  74. package/lib/icons/DocumentTsIcon/DocumentTsIcon.js +23 -0
  75. package/lib/icons/DocumentTsIcon/index.d.ts +1 -0
  76. package/lib/icons/DocumentTsIcon/index.js +6 -0
  77. package/lib/icons/DocumentYamlIcon/DocumentYamlIcon.d.ts +9 -0
  78. package/lib/icons/DocumentYamlIcon/DocumentYamlIcon.js +23 -0
  79. package/lib/icons/DocumentYamlIcon/index.d.ts +1 -0
  80. package/lib/icons/DocumentYamlIcon/index.js +6 -0
  81. package/lib/index.d.ts +1 -0
  82. package/lib/index.js +1 -0
  83. package/lib/layouts/CodeWalkthroughLayout.d.ts +5 -0
  84. package/lib/layouts/CodeWalkthroughLayout.js +72 -0
  85. package/lib/markdoc/attributes/code-walkthrough-filesets.d.ts +5 -0
  86. package/lib/markdoc/attributes/code-walkthrough-filesets.js +16 -0
  87. package/lib/markdoc/attributes/code-walkthrough-filters.d.ts +5 -0
  88. package/lib/markdoc/attributes/code-walkthrough-filters.js +16 -0
  89. package/lib/markdoc/components/CodeWalkthrough/CodeContainer.d.ts +5 -0
  90. package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +81 -0
  91. package/lib/markdoc/components/CodeWalkthrough/CodeFilters.d.ts +12 -0
  92. package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +58 -0
  93. package/lib/markdoc/components/CodeWalkthrough/CodePanel.d.ts +8 -0
  94. package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +64 -0
  95. package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.d.ts +8 -0
  96. package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +155 -0
  97. package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.d.ts +2 -0
  98. package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +73 -0
  99. package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.d.ts +5 -0
  100. package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +47 -0
  101. package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +12 -0
  102. package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +128 -0
  103. package/lib/markdoc/components/CodeWalkthrough/CodeToggle.d.ts +9 -0
  104. package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +69 -0
  105. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.d.ts +4 -0
  106. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +121 -0
  107. package/lib/markdoc/components/CodeWalkthrough/Input.d.ts +8 -0
  108. package/lib/markdoc/components/CodeWalkthrough/Input.js +99 -0
  109. package/lib/markdoc/components/CodeWalkthrough/variables.d.ts +1 -0
  110. package/lib/markdoc/components/CodeWalkthrough/variables.js +19 -0
  111. package/lib/markdoc/components/default.d.ts +5 -0
  112. package/lib/markdoc/components/default.js +5 -0
  113. package/lib/markdoc/default.js +8 -0
  114. package/lib/markdoc/tags/code-step.d.ts +2 -0
  115. package/lib/markdoc/tags/code-step.js +28 -0
  116. package/lib/markdoc/tags/code-toggle.d.ts +2 -0
  117. package/lib/markdoc/tags/code-toggle.js +40 -0
  118. package/lib/markdoc/tags/code-walkthrough.d.ts +8 -0
  119. package/lib/markdoc/tags/code-walkthrough.js +242 -0
  120. package/lib/markdoc/tags/input.d.ts +2 -0
  121. package/lib/markdoc/tags/input.js +37 -0
  122. package/lib/plugin.d.ts +2 -1
  123. package/lib/plugin.js +2 -4
  124. package/package.json +9 -2
  125. package/src/components/Buttons/CopyButton.tsx +24 -6
  126. package/src/components/StatusCode/StatusCode.ts +11 -10
  127. package/src/core/constants/code-walkthrough.ts +1 -0
  128. package/src/core/constants/index.ts +1 -0
  129. package/src/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.tsx +21 -0
  130. package/src/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.tsx +10 -0
  131. package/src/core/contexts/index.ts +2 -0
  132. package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +22 -0
  133. package/src/core/hooks/code-walkthrough/use-code-panel.ts +164 -0
  134. package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +302 -0
  135. package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +165 -0
  136. package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +51 -0
  137. package/src/core/hooks/index.ts +4 -0
  138. package/src/core/styles/global.ts +2 -0
  139. package/src/core/templates/Markdown.tsx +16 -5
  140. package/src/core/types/hooks.ts +2 -0
  141. package/src/core/types/l10n.ts +3 -1
  142. package/src/core/utils/download-code-walkthrough.ts +25 -0
  143. package/src/core/utils/get-code-walkthrough-file-text.ts +32 -0
  144. package/src/core/utils/get-file-icon.ts +35 -0
  145. package/src/core/utils/index.ts +5 -0
  146. package/src/core/utils/js-utils.ts +48 -0
  147. package/src/core/utils/match-code-walkthrough-conditions.ts +29 -0
  148. package/src/core/utils/replace-inputs-with-value.ts +11 -0
  149. package/src/icons/DocumentCssIcon/DocumentCssIcon.tsx +36 -0
  150. package/src/icons/DocumentCssIcon/index.ts +1 -0
  151. package/src/icons/DocumentGraphqlIcon/DocumentGraphqlIcon.tsx +64 -0
  152. package/src/icons/DocumentGraphqlIcon/index.ts +1 -0
  153. package/src/icons/DocumentHtmlIcon/DocumentHtmlIcon.tsx +36 -0
  154. package/src/icons/DocumentHtmlIcon/index.ts +1 -0
  155. package/src/icons/DocumentJsIcon/DocumentJsIcon.tsx +36 -0
  156. package/src/icons/DocumentJsIcon/index.ts +1 -0
  157. package/src/icons/DocumentJsonIcon/DocumentJsonIcon.tsx +36 -0
  158. package/src/icons/DocumentJsonIcon/index.ts +1 -0
  159. package/src/icons/DocumentMarkdownIcon/DocumentMarkdownIcon.tsx +36 -0
  160. package/src/icons/DocumentMarkdownIcon/index.ts +1 -0
  161. package/src/icons/DocumentReactIcon/DocumentReactIcon.tsx +36 -0
  162. package/src/icons/DocumentReactIcon/index.ts +1 -0
  163. package/src/icons/DocumentTsIcon/DocumentTsIcon.tsx +38 -0
  164. package/src/icons/DocumentTsIcon/index.ts +1 -0
  165. package/src/icons/DocumentYamlIcon/DocumentYamlIcon.tsx +36 -0
  166. package/src/icons/DocumentYamlIcon/index.ts +1 -0
  167. package/src/index.ts +1 -0
  168. package/src/layouts/CodeWalkthroughLayout.tsx +78 -0
  169. package/src/markdoc/attributes/code-walkthrough-filesets.ts +9 -0
  170. package/src/markdoc/attributes/code-walkthrough-filters.ts +9 -0
  171. package/src/markdoc/components/CodeWalkthrough/CodeContainer.tsx +76 -0
  172. package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +87 -0
  173. package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +68 -0
  174. package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +192 -0
  175. package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +53 -0
  176. package/src/markdoc/components/CodeWalkthrough/CodePanelToolbar.tsx +31 -0
  177. package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +149 -0
  178. package/src/markdoc/components/CodeWalkthrough/CodeToggle.tsx +63 -0
  179. package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +111 -0
  180. package/src/markdoc/components/CodeWalkthrough/Input.tsx +101 -0
  181. package/src/markdoc/components/CodeWalkthrough/variables.ts +16 -0
  182. package/src/markdoc/components/default.ts +5 -0
  183. package/src/markdoc/default.ts +8 -0
  184. package/src/markdoc/tags/code-step.ts +27 -0
  185. package/src/markdoc/tags/code-toggle.ts +37 -0
  186. package/src/markdoc/tags/code-walkthrough.ts +315 -0
  187. package/src/markdoc/tags/input.ts +35 -0
  188. package/src/plugin.js +2 -2
@@ -0,0 +1,81 @@
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.CodeContainer = CodeContainer;
27
+ const react_1 = __importStar(require("react"));
28
+ const styled_components_1 = __importStar(require("styled-components"));
29
+ const contexts_1 = require("../../../core/contexts");
30
+ const CodeBlockContainer_1 = require("../../../components/CodeBlock/CodeBlockContainer");
31
+ function CodeContainer({ highlightedCode, toolbar, }) {
32
+ const { activeStep } = (0, react_1.useContext)(contexts_1.CodeWalkthroughStepsContext);
33
+ const [isHovered, setIsHovered] = (0, react_1.useState)(false);
34
+ const compRef = (0, react_1.useRef)(null);
35
+ (0, react_1.useEffect)(() => {
36
+ // useEffect executed before DOM is updated due to re-render called before "painting" phase.
37
+ setTimeout(() => {
38
+ if (compRef.current) {
39
+ const element = compRef.current.querySelector('span.line.highlighted');
40
+ if (element) {
41
+ element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
42
+ }
43
+ }
44
+ }, 200);
45
+ }, [activeStep]);
46
+ return (react_1.default.createElement(CodeContainerWrapper, { ref: compRef, hideCodeColors: !isHovered, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) },
47
+ react_1.default.createElement(CodeBlockContainer_1.CodeBlockContainer, { dangerouslySetInnerHTML: { __html: highlightedCode } }),
48
+ toolbar));
49
+ }
50
+ const CodeContainerWrapper = styled_components_1.default.div `
51
+ position: relative;
52
+
53
+ display: flex;
54
+ flex-direction: column;
55
+ flex-grow: 1;
56
+ min-height: 0;
57
+
58
+ pre {
59
+ display: grid;
60
+ grid-auto-rows: min-content;
61
+ min-height: 0;
62
+ overflow: scroll;
63
+ margin: 0 !important;
64
+ height: 100%;
65
+ padding-left: 0 !important;
66
+
67
+ span.line::before {
68
+ color: var(--code-panel-line-numbering-color);
69
+ }
70
+ ${({ hideCodeColors }) => hideCodeColors &&
71
+ (0, styled_components_1.css) `
72
+ .line.greyed-out {
73
+ color: var(--text-color-helper) !important;
74
+ * {
75
+ color: var(--text-color-helper) !important;
76
+ }
77
+ }
78
+ `}
79
+ }
80
+ `;
81
+ //# sourceMappingURL=CodeContainer.js.map
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { CodeWalkthroughFilter } from '@redocly/config';
3
+ export type CodeFilterProps = {
4
+ filters: CodeWalkthroughFilter[];
5
+ getFilterState: (groupId: string) => {
6
+ value: string;
7
+ render: boolean;
8
+ } | null;
9
+ handleFilterSelect: (groupId: string, id: string) => void;
10
+ filtersElementRef?: React.RefObject<HTMLDivElement>;
11
+ };
12
+ export declare function CodeFilters({ filters, getFilterState, handleFilterSelect, filtersElementRef, }: CodeFilterProps): React.JSX.Element | null;
@@ -0,0 +1,58 @@
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.CodeFilters = CodeFilters;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const Tag_1 = require("../../../components/Tag/Tag");
10
+ function CodeFilters({ filters, getFilterState, handleFilterSelect, filtersElementRef, }) {
11
+ if (filters.length === 0) {
12
+ return null;
13
+ }
14
+ return (react_1.default.createElement(FilterWrapper, { ref: filtersElementRef }, filters.map(({ label, items, id }) => {
15
+ return (react_1.default.createElement(Filter, { key: id },
16
+ label && react_1.default.createElement(FilterName, null,
17
+ label,
18
+ ":"),
19
+ react_1.default.createElement(ButtonsWrapper, null, items === null || items === void 0 ? void 0 : items.map((item) => {
20
+ var _a;
21
+ return (react_1.default.createElement(TagButton, { size: "large", borderless: true, active: ((_a = getFilterState(id)) === null || _a === void 0 ? void 0 : _a.value) === item.value, key: item.value, onClick: () => handleFilterSelect(id, item.value) }, item.value));
22
+ }))));
23
+ })));
24
+ }
25
+ const Filter = styled_components_1.default.div `
26
+ display: flex;
27
+ align-items: center;
28
+ gap: var(--spacing-xs);
29
+ `;
30
+ const FilterName = styled_components_1.default.div `
31
+ color: var(--color-text-primary);
32
+ font-size: var(--font-size-base);
33
+ `;
34
+ const FilterWrapper = styled_components_1.default.div `
35
+ --tag-text-transform: none;
36
+ display: flex;
37
+ flex-direction: row;
38
+ gap: var(--spacing-sm);
39
+ flex-wrap: wrap;
40
+ position: sticky;
41
+
42
+ padding-top: calc(var(--spacing-xs) + var(--spacing-xl));
43
+ padding-right: var(--spacing-xl);
44
+ padding-left: var(--spacing-xl);
45
+ padding-bottom: var(--spacing-xs);
46
+ top: calc(var(--navbar-height));
47
+ background-color: var(--bg-color);
48
+ z-index: 1;
49
+ `;
50
+ const ButtonsWrapper = styled_components_1.default.div `
51
+ display: flex;
52
+ `;
53
+ const TagButton = (0, styled_components_1.default)(Tag_1.Tag) `
54
+ cursor: pointer;
55
+ padding: 0px var(--spacing-xs);
56
+ margin-right: var(--spacing-xs);
57
+ `;
58
+ //# sourceMappingURL=CodeFilters.js.map
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { CodeWalkthroughFile } from '@redocly/config';
3
+ export type CodePanelProps = {
4
+ files: CodeWalkthroughFile[];
5
+ downloadAssociatedFiles: CodeWalkthroughFile[];
6
+ preview: React.ReactNode[];
7
+ };
8
+ export declare function CodePanel({ files, downloadAssociatedFiles, preview, }: CodePanelProps): JSX.Element | null;
@@ -0,0 +1,64 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.CodePanel = CodePanel;
30
+ const react_1 = __importStar(require("react"));
31
+ const styled_components_1 = __importDefault(require("styled-components"));
32
+ const hooks_1 = require("../../../core/hooks");
33
+ const contexts_1 = require("../../../core/contexts");
34
+ const CodePanelHeader_1 = require("../../../markdoc/components/CodeWalkthrough/CodePanelHeader");
35
+ const CodePanelPreview_1 = require("../../../markdoc/components/CodeWalkthrough/CodePanelPreview");
36
+ const CodeContainer_1 = require("../../../markdoc/components/CodeWalkthrough/CodeContainer");
37
+ const CodePanelToolbar_1 = require("../../../markdoc/components/CodeWalkthrough/CodePanelToolbar");
38
+ function CodePanel({ files, downloadAssociatedFiles, preview, }) {
39
+ const { activeFile, handleTabSwitch, highlightedCode } = (0, hooks_1.useCodePanel)(files);
40
+ const { handleDownloadCode } = (0, react_1.useContext)(contexts_1.CodeWalkthroughControlsStateContext);
41
+ return (react_1.default.createElement(CodePanelWrapper, null,
42
+ preview ? (react_1.default.createElement(CodePanelPreview_1.CodePanelPreview, null, preview.map((element, idx) => (react_1.default.createElement(react_1.default.Fragment, { key: idx }, element))))) : null,
43
+ react_1.default.createElement(CodePanelHeader_1.CodePanelHeader, { files: files, activeTabName: (activeFile === null || activeFile === void 0 ? void 0 : activeFile.path) || '', handleTabSwitch: handleTabSwitch, onDownloadCode: () => handleDownloadCode([...files, ...downloadAssociatedFiles]) }),
44
+ react_1.default.createElement(CodeContainer_1.CodeContainer, { key: (activeFile === null || activeFile === void 0 ? void 0 : activeFile.path) || '', highlightedCode: highlightedCode, toolbar: react_1.default.createElement(CodePanelToolbar_1.CodePanelToolbar, { file: activeFile }) })));
45
+ }
46
+ const CodePanelWrapper = styled_components_1.default.div `
47
+ display: flex;
48
+ flex-direction: column;
49
+ align-self: flex-start;
50
+
51
+ min-height: 144px;
52
+ min-width: 0;
53
+ height: 100%;
54
+ word-wrap: break-word;
55
+
56
+ background-color: var(--code-panel-bg-color);
57
+ border: 1px solid var(--code-panel-border-color);
58
+ border-radius: var(--code-panel-border-radius);
59
+ --code-block-max-height: calc(100vh - var(--navbar-height) - 2 * var(--spacing-xl));
60
+ height: calc(100vh - var(--navbar-height) - 2 * var(--spacing-xl));
61
+ position: sticky;
62
+ top: calc(var(--navbar-height) + var(--spacing-xl));
63
+ `;
64
+ //# sourceMappingURL=CodePanel.js.map
@@ -0,0 +1,8 @@
1
+ import type { CodeWalkthroughFile } from '@redocly/config';
2
+ export type CodePanelHeaderProps = {
3
+ files: CodeWalkthroughFile[];
4
+ handleTabSwitch: (name: string) => void;
5
+ activeTabName: string;
6
+ onDownloadCode: () => void;
7
+ };
8
+ export declare function CodePanelHeader({ files, handleTabSwitch, activeTabName, onDownloadCode, }: CodePanelHeaderProps): JSX.Element;
@@ -0,0 +1,155 @@
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.CodePanelHeader = CodePanelHeader;
27
+ const react_1 = __importStar(require("react"));
28
+ const styled_components_1 = __importStar(require("styled-components"));
29
+ const hooks_1 = require("../../../core/hooks");
30
+ const utils_1 = require("../../../core/utils");
31
+ const OverflowMenuVerticalIcon_1 = require("../../../icons/OverflowMenuVerticalIcon/OverflowMenuVerticalIcon");
32
+ const Dropdown_1 = require("../../../components/Dropdown/Dropdown");
33
+ const DropdownMenu_1 = require("../../../components/Dropdown/DropdownMenu");
34
+ const DropdownMenuItem_1 = require("../../../components/Dropdown/DropdownMenuItem");
35
+ const DownloadIcon_1 = require("../../../icons/DownloadIcon/DownloadIcon");
36
+ const Button_1 = require("../../../components/Button/Button");
37
+ function CodePanelHeader({ files, handleTabSwitch, activeTabName, onDownloadCode, }) {
38
+ const { useTranslate } = (0, hooks_1.useThemeHooks)();
39
+ const { translate } = useTranslate();
40
+ const tabRefs = (0, react_1.useRef)([]);
41
+ const tabsWrapperRef = (0, react_1.useRef)(null);
42
+ const [hiddenFiles, setHiddenFiles] = (0, react_1.useState)([]);
43
+ (0, react_1.useEffect)(() => {
44
+ const activeTab = tabRefs.current.find((tab) => (tab === null || tab === void 0 ? void 0 : tab.dataset.name) === activeTabName);
45
+ if (activeTab) {
46
+ activeTab.scrollIntoView({ block: 'nearest', inline: 'center' });
47
+ }
48
+ }, [activeTabName]);
49
+ (0, react_1.useEffect)(() => {
50
+ const calculateHiddenFiles = () => {
51
+ if (!tabsWrapperRef.current)
52
+ return;
53
+ const { left: wrapperLeft, right: wrapperRight } = tabsWrapperRef.current.getBoundingClientRect();
54
+ const hidden = files.filter((_, i) => {
55
+ const tab = tabRefs.current[i];
56
+ if (!tab)
57
+ return false;
58
+ const { left: tabLeft, right: tabRight } = tab.getBoundingClientRect();
59
+ return tabLeft < wrapperLeft || tabRight > wrapperRight;
60
+ });
61
+ setHiddenFiles(hidden);
62
+ };
63
+ calculateHiddenFiles();
64
+ window.addEventListener('resize', calculateHiddenFiles);
65
+ return () => window.removeEventListener('resize', calculateHiddenFiles);
66
+ }, [files]);
67
+ const getFileTypeIcon = (0, react_1.useCallback)((basename) => {
68
+ var _a;
69
+ const extension = ((_a = basename.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
70
+ return (0, utils_1.getFileIconByExt)(extension);
71
+ }, []);
72
+ return (react_1.default.createElement(CodePanelHeaderWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodePanelHeader" },
73
+ react_1.default.createElement(TabsWrapper, { ref: tabsWrapperRef },
74
+ react_1.default.createElement(Tabs, null, files.map(({ path, basename }, i) => {
75
+ const FileIcon = getFileTypeIcon(basename);
76
+ return (react_1.default.createElement(Tab, { ref: (el) => (tabRefs.current[i] = el), "data-name": path, active: path === activeTabName, key: i, onClick: () => handleTabSwitch(path) },
77
+ react_1.default.createElement(FileIcon, null),
78
+ basename));
79
+ })),
80
+ react_1.default.createElement(Gradient, null)),
81
+ react_1.default.createElement(ActionBar, null,
82
+ hiddenFiles.length ? (react_1.default.createElement(Dropdown_1.Dropdown, { trigger: react_1.default.createElement(StyledOverflowMenuVerticalIcon, { size: "14px" }), alignment: "end" },
83
+ react_1.default.createElement(StyledDropdownMenu, null, hiddenFiles.map(({ path, basename }, i) => {
84
+ const FileIcon = getFileTypeIcon(basename);
85
+ return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { active: path === activeTabName, key: i, onAction: () => handleTabSwitch(path), prefix: react_1.default.createElement(FileIcon, null), content: basename }));
86
+ })))) : null,
87
+ react_1.default.createElement(Button_1.Button, { variant: "text", icon: react_1.default.createElement(DownloadIcon_1.DownloadIcon, null), onClick: onDownloadCode, size: "small" }, translate('codeWalkthrough.download', 'Download')))));
88
+ }
89
+ const CodePanelHeaderWrapper = styled_components_1.default.div `
90
+ display: flex;
91
+ align-items: center;
92
+ justify-content: space-between;
93
+
94
+ padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-sm);
95
+ max-width: 100%;
96
+ `;
97
+ const TabsWrapper = styled_components_1.default.div `
98
+ display: flex;
99
+ position: relative;
100
+ min-width: 0;
101
+ `;
102
+ const Gradient = styled_components_1.default.div `
103
+ position: absolute;
104
+ right: 0;
105
+ width: var(--spacing-base);
106
+ height: var(--code-panel-header-height);
107
+ background: var(--bg-raised-gradient);
108
+ `;
109
+ const Tabs = styled_components_1.default.div `
110
+ display: flex;
111
+ overflow-x: auto;
112
+ padding-right: var(--spacing-base);
113
+
114
+ &::-webkit-scrollbar {
115
+ display: none;
116
+ }
117
+ `;
118
+ const ActionBar = styled_components_1.default.div `
119
+ display: flex;
120
+ `;
121
+ const Tab = styled_components_1.default.button `
122
+ display: inline-flex;
123
+ align-items: center;
124
+ padding: 0 var(--spacing-sm);
125
+ background-color: transparent;
126
+ height: var(--code-panel-header-height);
127
+ border-radius: var(--border-radius);
128
+ cursor: pointer;
129
+ gap: var(--spacing-xs);
130
+ color: var(--text-color-secondary);
131
+ white-space: nowrap;
132
+
133
+ ${({ active }) => active
134
+ ? (0, styled_components_1.css) `
135
+ color: var(--text-color-primary);
136
+ background-color: var(--tab-bg-color-filled);
137
+ `
138
+ : (0, styled_components_1.css) `
139
+ &:hover {
140
+ color: var(--text-color-primary);
141
+ }
142
+ `}
143
+ `;
144
+ // code-walk-todo: figure it our why we could not do it differently
145
+ const StyledDropdownMenu = (0, styled_components_1.default)(DropdownMenu_1.DropdownMenu) `
146
+ --md-list-left-padding: var(--dropdown-menu-padding);
147
+ `;
148
+ const StyledOverflowMenuVerticalIcon = (0, styled_components_1.default)(OverflowMenuVerticalIcon_1.OverflowMenuVerticalIcon) `
149
+ && {
150
+ outline: none;
151
+ box-sizing: content-box;
152
+ padding: 5px;
153
+ }
154
+ `;
155
+ //# sourceMappingURL=CodePanelHeader.js.map
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export declare function CodePanelPreview({ children }: PropsWithChildren): JSX.Element;
@@ -0,0 +1,73 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.CodePanelPreview = CodePanelPreview;
30
+ const react_1 = __importStar(require("react"));
31
+ const styled_components_1 = __importDefault(require("styled-components"));
32
+ const hooks_1 = require("../../../core/hooks");
33
+ const ChevronUpIcon_1 = require("../../../icons/ChevronUpIcon/ChevronUpIcon");
34
+ const ChevronDownIcon_1 = require("../../../icons/ChevronDownIcon/ChevronDownIcon");
35
+ function CodePanelPreview({ children }) {
36
+ const [isOpen, setIsOpen] = (0, react_1.useState)(false);
37
+ const { useTranslate } = (0, hooks_1.useThemeHooks)();
38
+ const { translate } = useTranslate();
39
+ return (react_1.default.createElement(CodePanelPreviewWrapper, null,
40
+ react_1.default.createElement(PreviewDropdown, { onClick: () => setIsOpen(!isOpen) },
41
+ translate('codeWalkthrough.preview', 'Preview'),
42
+ isOpen ? react_1.default.createElement(ChevronUpIcon_1.ChevronUpIcon, null) : react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, null)),
43
+ react_1.default.createElement(PreviewContentWrapper, { isOpen: isOpen }, children)));
44
+ }
45
+ const CodePanelPreviewWrapper = styled_components_1.default.div `
46
+ width: 100%;
47
+ padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-sm);
48
+ border-bottom: 1px solid var(--border-color-secondary);
49
+ `;
50
+ const PreviewDropdown = styled_components_1.default.div `
51
+ display: flex;
52
+ align-items: center;
53
+
54
+ gap: (--spacing-xxs);
55
+
56
+ user-select: none;
57
+
58
+ font-size: var(--font-size-base);
59
+ cursor: pointer;
60
+ `;
61
+ const PreviewContentWrapper = styled_components_1.default.div `
62
+ display: ${({ isOpen }) => (isOpen ? 'grid' : 'none')};
63
+ place-items: center;
64
+
65
+ margin: auto 0;
66
+
67
+ max-height: 50vh;
68
+ width: 100%;
69
+ max-width: 100%;
70
+
71
+ overflow: auto;
72
+ `;
73
+ //# sourceMappingURL=CodePanelPreview.js.map
@@ -0,0 +1,5 @@
1
+ import type { CodeWalkthroughFile } from '@redocly/config';
2
+ export type CodeToolbarProps = {
3
+ file: CodeWalkthroughFile;
4
+ };
5
+ export declare function CodePanelToolbar({ file }: CodeToolbarProps): JSX.Element;
@@ -0,0 +1,47 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.CodePanelToolbar = CodePanelToolbar;
30
+ const react_1 = __importStar(require("react"));
31
+ const styled_components_1 = __importDefault(require("styled-components"));
32
+ const contexts_1 = require("../../../core/contexts");
33
+ const CopyButton_1 = require("../../../components/Buttons/CopyButton");
34
+ function CodePanelToolbar({ file }) {
35
+ const { getFileText } = (0, react_1.useContext)(contexts_1.CodeWalkthroughControlsStateContext);
36
+ const fileContent = getFileText(file);
37
+ return (react_1.default.createElement(CodeToolbarWrapper, null,
38
+ react_1.default.createElement(CopyButton_1.CopyButton, { data: fileContent, type: "compound", variant: "secondary", size: "medium" })));
39
+ }
40
+ const CodeToolbarWrapper = styled_components_1.default.div `
41
+ display: flex;
42
+ position: absolute;
43
+ bottom: var(--spacing-sm);
44
+ right: var(--spacing-sm);
45
+ gap: var(--spacing-xs);
46
+ `;
47
+ //# sourceMappingURL=CodePanelToolbar.js.map
@@ -0,0 +1,12 @@
1
+ import React, { type PropsWithChildren } from 'react';
2
+ import type { WithConditions } from '@redocly/config';
3
+ export type CodeStepProps = WithConditions<{
4
+ id: string;
5
+ stepKey: number;
6
+ heading?: string;
7
+ }>;
8
+ export declare function CodeStep({ id, heading, stepKey, when, unless, children, }: PropsWithChildren<CodeStepProps>): React.JSX.Element | null;
9
+ export declare const StepWrapper: import("styled-components").StyledComponent<"div", any, {
10
+ isActive: boolean;
11
+ scrollMarginTop: number;
12
+ }, never>;
@@ -0,0 +1,128 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.StepWrapper = void 0;
30
+ exports.CodeStep = CodeStep;
31
+ const react_1 = __importStar(require("react"));
32
+ const styled_components_1 = __importDefault(require("styled-components"));
33
+ const contexts_1 = require("../../../core/contexts");
34
+ function CodeStep({ id, heading, stepKey, when, unless, children, }) {
35
+ const compRef = (0, react_1.useRef)(null);
36
+ const { areConditionsMet } = (0, react_1.useContext)(contexts_1.CodeWalkthroughControlsStateContext);
37
+ const { activeStep, setActiveStep, register, unregister, lockObserver, filtersElementRef } = (0, react_1.useContext)(contexts_1.CodeWalkthroughStepsContext);
38
+ const isActive = activeStep === id;
39
+ const [scrollMarginTop, setScrollMarginTop] = (0, react_1.useState)(0);
40
+ const handleActivateStep = () => {
41
+ if (lockObserver) {
42
+ lockObserver.current = true;
43
+ if (compRef.current) {
44
+ compRef.current.scrollIntoView({ behavior: 'smooth', block: 'start' });
45
+ }
46
+ setActiveStep(id);
47
+ setTimeout(() => {
48
+ lockObserver.current = false;
49
+ }, 1000);
50
+ }
51
+ };
52
+ (0, react_1.useEffect)(() => {
53
+ // If the step is active during first render, scroll to it
54
+ // This is to ensure that the step is visible when the page is loaded
55
+ if (isActive) {
56
+ handleActivateStep();
57
+ }
58
+ // Ignore dependency array because we only need to run this once
59
+ // eslint-disable-next-line react-hooks/exhaustive-deps
60
+ }, []);
61
+ (0, react_1.useEffect)(() => {
62
+ var _a, _b;
63
+ const currentCompRef = compRef.current;
64
+ if (currentCompRef) {
65
+ currentCompRef
66
+ .querySelectorAll('a, button, input, textarea, select, [tabindex]')
67
+ .forEach((el) => {
68
+ el.setAttribute('tabindex', '-1');
69
+ });
70
+ register(currentCompRef);
71
+ }
72
+ const filtersElementHeight = ((_a = filtersElementRef === null || filtersElementRef === void 0 ? void 0 : filtersElementRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0;
73
+ const navbarHeight = ((_b = document.querySelector('nav')) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0;
74
+ setScrollMarginTop(filtersElementHeight + navbarHeight);
75
+ return () => {
76
+ if (currentCompRef) {
77
+ unregister(currentCompRef);
78
+ }
79
+ };
80
+ }, [activeStep, register, unregister, filtersElementRef]);
81
+ if (!areConditionsMet({ when, unless })) {
82
+ return null;
83
+ }
84
+ return (react_1.default.createElement(exports.StepWrapper, { ref: compRef, isActive: isActive, scrollMarginTop: scrollMarginTop, "data-step-key": stepKey, "data-step-active": isActive, onClick: handleActivateStep, onFocus: handleActivateStep, tabIndex: 0 },
85
+ react_1.default.createElement(StepContent, { isActive: isActive },
86
+ heading ? react_1.default.createElement(StepHeading, null, heading) : null,
87
+ children)));
88
+ }
89
+ const StepContent = styled_components_1.default.div `
90
+ margin: var(--spacing-xs) 0px var(--spacing-xs) calc(var(--spacing-unit) * 3.5);
91
+ padding: var(--spacing-md) var(--spacing-lg);
92
+ background: ${({ isActive }) => (isActive ? 'var(--layer-color)' : 'none')};
93
+ border-radius: var(--border-radius);
94
+
95
+ &:hover {
96
+ background-color: ${({ isActive }) => isActive ? 'var(--code-step-bg-active-hover)' : 'var(--code-step-bg-hover)'};
97
+ }
98
+ `;
99
+ const StepHeading = styled_components_1.default.p `
100
+ font-weight: var(--font-weight-semibold);
101
+ `;
102
+ exports.StepWrapper = styled_components_1.default.div `
103
+ position: relative;
104
+ scroll-margin-top: ${({ scrollMarginTop }) => scrollMarginTop}px;
105
+
106
+ &::before {
107
+ content: '';
108
+ position: absolute;
109
+ width: 6px;
110
+ height: 100%;
111
+ background-color: ${({ isActive }) => isActive ? 'var(--code-step-vertical-line-bg-active)' : 'none'};
112
+ border-radius: var(--border-radius-lg);
113
+ }
114
+ &:hover::before {
115
+ background-color: ${({ isActive }) => isActive
116
+ ? 'var(--code-step-vertical-line-bg-active)'
117
+ : 'var(--code-step-vertical-line-bg-hover)'};
118
+ }
119
+
120
+ &:hover::before {
121
+ width: ${({ isActive }) => (isActive ? '8px' : '6px')};
122
+ }
123
+
124
+ &:hover ${StepContent} {
125
+ background-color: ${({ isActive }) => isActive ? 'var(--code-step-bg-active-hover)' : 'var(--code-step-bg-hover)'};
126
+ }
127
+ `;
128
+ //# sourceMappingURL=CodeStep.js.map