@redocly/theme 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) 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/Feedback/Mood.d.ts +2 -2
  4. package/lib/components/Feedback/Mood.js +6 -6
  5. package/lib/components/Feedback/Rating.d.ts +2 -2
  6. package/lib/components/Feedback/Rating.js +6 -6
  7. package/lib/components/Feedback/Scale.d.ts +2 -2
  8. package/lib/components/Feedback/Scale.js +6 -6
  9. package/lib/components/Feedback/Sentiment.d.ts +2 -2
  10. package/lib/components/Feedback/Sentiment.js +6 -6
  11. package/lib/components/Search/SearchDialog.js +8 -8
  12. package/lib/components/Search/SearchFilter.d.ts +3 -2
  13. package/lib/components/Search/SearchFilter.js +2 -2
  14. package/lib/components/Search/SearchFilterField.d.ts +3 -2
  15. package/lib/components/Search/SearchFilterField.js +2 -2
  16. package/lib/components/Search/SearchGroups.d.ts +5 -4
  17. package/lib/components/Search/SearchGroups.js +3 -3
  18. package/lib/components/StatusCode/StatusCode.js +11 -14
  19. package/lib/core/constants/code-walkthrough.d.ts +1 -0
  20. package/lib/core/constants/code-walkthrough.js +5 -0
  21. package/lib/core/constants/index.d.ts +1 -0
  22. package/lib/core/constants/index.js +1 -0
  23. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.d.ts +2 -0
  24. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.js +18 -0
  25. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.d.ts +2 -0
  26. package/lib/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.js +11 -0
  27. package/lib/core/contexts/index.d.ts +2 -0
  28. package/lib/core/contexts/index.js +2 -0
  29. package/lib/core/hooks/__mocks__/search/use-search-filter.d.ts +1 -1
  30. package/lib/core/hooks/__mocks__/search/use-search-filter.js +1 -1
  31. package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.d.ts +10 -0
  32. package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.js +55 -0
  33. package/lib/core/hooks/code-walkthrough/use-code-panel.d.ts +6 -0
  34. package/lib/core/hooks/code-walkthrough/use-code-panel.js +93 -0
  35. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.d.ts +22 -0
  36. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +183 -0
  37. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +16 -0
  38. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +117 -0
  39. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +14 -0
  40. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.js +22 -0
  41. package/lib/core/hooks/index.d.ts +4 -0
  42. package/lib/core/hooks/index.js +4 -0
  43. package/lib/core/hooks/search/use-search-filter.d.ts +2 -2
  44. package/lib/core/hooks/search/use-search-filter.js +5 -5
  45. package/lib/core/styles/global.js +2 -0
  46. package/lib/core/templates/Markdown.d.ts +8 -2
  47. package/lib/core/templates/Markdown.js +5 -2
  48. package/lib/core/types/hooks.d.ts +3 -0
  49. package/lib/core/types/l10n.d.ts +1 -1
  50. package/lib/core/types/search.d.ts +1 -2
  51. package/lib/core/utils/download-code-walkthrough.d.ts +4 -0
  52. package/lib/core/utils/download-code-walkthrough.js +32 -0
  53. package/lib/core/utils/get-code-walkthrough-file-text.d.ts +4 -0
  54. package/lib/core/utils/get-code-walkthrough-file-text.js +22 -0
  55. package/lib/core/utils/get-file-icon.d.ts +2 -0
  56. package/lib/core/utils/get-file-icon.js +31 -0
  57. package/lib/core/utils/index.d.ts +5 -0
  58. package/lib/core/utils/index.js +5 -0
  59. package/lib/core/utils/js-utils.d.ts +30 -0
  60. package/lib/core/utils/js-utils.js +41 -0
  61. package/lib/core/utils/match-code-walkthrough-conditions.d.ts +4 -0
  62. package/lib/core/utils/match-code-walkthrough-conditions.js +23 -0
  63. package/lib/core/utils/replace-inputs-with-value.d.ts +3 -0
  64. package/lib/core/utils/replace-inputs-with-value.js +16 -0
  65. package/lib/icons/DocumentCssIcon/DocumentCssIcon.d.ts +9 -0
  66. package/lib/icons/DocumentCssIcon/DocumentCssIcon.js +23 -0
  67. package/lib/icons/DocumentCssIcon/index.d.ts +1 -0
  68. package/lib/icons/DocumentCssIcon/index.js +6 -0
  69. package/lib/icons/DocumentGraphqlIcon/DocumentGraphqlIcon.d.ts +9 -0
  70. package/lib/icons/DocumentGraphqlIcon/DocumentGraphqlIcon.js +31 -0
  71. package/lib/icons/DocumentGraphqlIcon/index.d.ts +1 -0
  72. package/lib/icons/DocumentGraphqlIcon/index.js +6 -0
  73. package/lib/icons/DocumentHtmlIcon/DocumentHtmlIcon.d.ts +9 -0
  74. package/lib/icons/DocumentHtmlIcon/DocumentHtmlIcon.js +23 -0
  75. package/lib/icons/DocumentHtmlIcon/index.d.ts +1 -0
  76. package/lib/icons/DocumentHtmlIcon/index.js +6 -0
  77. package/lib/icons/DocumentJsIcon/DocumentJsIcon.d.ts +9 -0
  78. package/lib/icons/DocumentJsIcon/DocumentJsIcon.js +23 -0
  79. package/lib/icons/DocumentJsIcon/index.d.ts +1 -0
  80. package/lib/icons/DocumentJsIcon/index.js +6 -0
  81. package/lib/icons/DocumentJsonIcon/DocumentJsonIcon.d.ts +9 -0
  82. package/lib/icons/DocumentJsonIcon/DocumentJsonIcon.js +23 -0
  83. package/lib/icons/DocumentJsonIcon/index.d.ts +1 -0
  84. package/lib/icons/DocumentJsonIcon/index.js +6 -0
  85. package/lib/icons/DocumentMarkdownIcon/DocumentMarkdownIcon.d.ts +9 -0
  86. package/lib/icons/DocumentMarkdownIcon/DocumentMarkdownIcon.js +23 -0
  87. package/lib/icons/DocumentMarkdownIcon/index.d.ts +1 -0
  88. package/lib/icons/DocumentMarkdownIcon/index.js +6 -0
  89. package/lib/icons/DocumentReactIcon/DocumentReactIcon.d.ts +9 -0
  90. package/lib/icons/DocumentReactIcon/DocumentReactIcon.js +23 -0
  91. package/lib/icons/DocumentReactIcon/index.d.ts +1 -0
  92. package/lib/icons/DocumentReactIcon/index.js +6 -0
  93. package/lib/icons/DocumentTsIcon/DocumentTsIcon.d.ts +9 -0
  94. package/lib/icons/DocumentTsIcon/DocumentTsIcon.js +23 -0
  95. package/lib/icons/DocumentTsIcon/index.d.ts +1 -0
  96. package/lib/icons/DocumentTsIcon/index.js +6 -0
  97. package/lib/icons/DocumentYamlIcon/DocumentYamlIcon.d.ts +9 -0
  98. package/lib/icons/DocumentYamlIcon/DocumentYamlIcon.js +23 -0
  99. package/lib/icons/DocumentYamlIcon/index.d.ts +1 -0
  100. package/lib/icons/DocumentYamlIcon/index.js +6 -0
  101. package/lib/index.d.ts +1 -0
  102. package/lib/index.js +1 -0
  103. package/lib/layouts/CodeWalkthroughLayout.d.ts +5 -0
  104. package/lib/layouts/CodeWalkthroughLayout.js +72 -0
  105. package/lib/markdoc/attributes/code-walkthrough-filesets.d.ts +5 -0
  106. package/lib/markdoc/attributes/code-walkthrough-filesets.js +16 -0
  107. package/lib/markdoc/attributes/code-walkthrough-filters.d.ts +5 -0
  108. package/lib/markdoc/attributes/code-walkthrough-filters.js +16 -0
  109. package/lib/markdoc/components/CodeWalkthrough/CodeContainer.d.ts +5 -0
  110. package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +81 -0
  111. package/lib/markdoc/components/CodeWalkthrough/CodeFilters.d.ts +12 -0
  112. package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +58 -0
  113. package/lib/markdoc/components/CodeWalkthrough/CodePanel.d.ts +8 -0
  114. package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +64 -0
  115. package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.d.ts +8 -0
  116. package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +155 -0
  117. package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.d.ts +2 -0
  118. package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +73 -0
  119. package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.d.ts +5 -0
  120. package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +47 -0
  121. package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +12 -0
  122. package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +128 -0
  123. package/lib/markdoc/components/CodeWalkthrough/CodeToggle.d.ts +9 -0
  124. package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +69 -0
  125. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.d.ts +4 -0
  126. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +121 -0
  127. package/lib/markdoc/components/CodeWalkthrough/Input.d.ts +8 -0
  128. package/lib/markdoc/components/CodeWalkthrough/Input.js +99 -0
  129. package/lib/markdoc/components/CodeWalkthrough/variables.d.ts +1 -0
  130. package/lib/markdoc/components/CodeWalkthrough/variables.js +19 -0
  131. package/lib/markdoc/components/default.d.ts +5 -0
  132. package/lib/markdoc/components/default.js +5 -0
  133. package/lib/markdoc/default.js +8 -0
  134. package/lib/markdoc/tags/code-step.d.ts +2 -0
  135. package/lib/markdoc/tags/code-step.js +28 -0
  136. package/lib/markdoc/tags/code-toggle.d.ts +2 -0
  137. package/lib/markdoc/tags/code-toggle.js +40 -0
  138. package/lib/markdoc/tags/code-walkthrough.d.ts +8 -0
  139. package/lib/markdoc/tags/code-walkthrough.js +242 -0
  140. package/lib/markdoc/tags/input.d.ts +2 -0
  141. package/lib/markdoc/tags/input.js +37 -0
  142. package/lib/plugin.d.ts +2 -1
  143. package/lib/plugin.js +2 -4
  144. package/package.json +10 -3
  145. package/src/components/Buttons/CopyButton.tsx +24 -6
  146. package/src/components/Feedback/Mood.tsx +9 -10
  147. package/src/components/Feedback/Rating.tsx +9 -10
  148. package/src/components/Feedback/Scale.tsx +9 -10
  149. package/src/components/Feedback/Sentiment.tsx +9 -10
  150. package/src/components/Search/SearchDialog.tsx +11 -6
  151. package/src/components/Search/SearchFilter.tsx +6 -3
  152. package/src/components/Search/SearchFilterField.tsx +4 -2
  153. package/src/components/Search/SearchGroups.tsx +13 -8
  154. package/src/components/StatusCode/StatusCode.ts +11 -10
  155. package/src/core/constants/code-walkthrough.ts +1 -0
  156. package/src/core/constants/index.ts +1 -0
  157. package/src/core/contexts/CodeWalkthrough/CodeWalkthroughControlsContext.tsx +21 -0
  158. package/src/core/contexts/CodeWalkthrough/CodeWalkthroughStepsContext.tsx +10 -0
  159. package/src/core/contexts/index.ts +2 -0
  160. package/src/core/hooks/__mocks__/search/use-search-filter.ts +1 -1
  161. package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +22 -0
  162. package/src/core/hooks/code-walkthrough/use-code-panel.ts +164 -0
  163. package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +302 -0
  164. package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +165 -0
  165. package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +51 -0
  166. package/src/core/hooks/index.ts +4 -0
  167. package/src/core/hooks/search/use-search-filter.ts +9 -5
  168. package/src/core/styles/global.ts +2 -0
  169. package/src/core/templates/Markdown.tsx +16 -5
  170. package/src/core/types/hooks.ts +3 -0
  171. package/src/core/types/l10n.ts +5 -3
  172. package/src/core/types/search.ts +1 -2
  173. package/src/core/utils/download-code-walkthrough.ts +25 -0
  174. package/src/core/utils/get-code-walkthrough-file-text.ts +32 -0
  175. package/src/core/utils/get-file-icon.ts +35 -0
  176. package/src/core/utils/index.ts +5 -0
  177. package/src/core/utils/js-utils.ts +48 -0
  178. package/src/core/utils/match-code-walkthrough-conditions.ts +29 -0
  179. package/src/core/utils/replace-inputs-with-value.ts +11 -0
  180. package/src/icons/DocumentCssIcon/DocumentCssIcon.tsx +36 -0
  181. package/src/icons/DocumentCssIcon/index.ts +1 -0
  182. package/src/icons/DocumentGraphqlIcon/DocumentGraphqlIcon.tsx +64 -0
  183. package/src/icons/DocumentGraphqlIcon/index.ts +1 -0
  184. package/src/icons/DocumentHtmlIcon/DocumentHtmlIcon.tsx +36 -0
  185. package/src/icons/DocumentHtmlIcon/index.ts +1 -0
  186. package/src/icons/DocumentJsIcon/DocumentJsIcon.tsx +36 -0
  187. package/src/icons/DocumentJsIcon/index.ts +1 -0
  188. package/src/icons/DocumentJsonIcon/DocumentJsonIcon.tsx +36 -0
  189. package/src/icons/DocumentJsonIcon/index.ts +1 -0
  190. package/src/icons/DocumentMarkdownIcon/DocumentMarkdownIcon.tsx +36 -0
  191. package/src/icons/DocumentMarkdownIcon/index.ts +1 -0
  192. package/src/icons/DocumentReactIcon/DocumentReactIcon.tsx +36 -0
  193. package/src/icons/DocumentReactIcon/index.ts +1 -0
  194. package/src/icons/DocumentTsIcon/DocumentTsIcon.tsx +38 -0
  195. package/src/icons/DocumentTsIcon/index.ts +1 -0
  196. package/src/icons/DocumentYamlIcon/DocumentYamlIcon.tsx +36 -0
  197. package/src/icons/DocumentYamlIcon/index.ts +1 -0
  198. package/src/index.ts +1 -0
  199. package/src/layouts/CodeWalkthroughLayout.tsx +78 -0
  200. package/src/markdoc/attributes/code-walkthrough-filesets.ts +9 -0
  201. package/src/markdoc/attributes/code-walkthrough-filters.ts +9 -0
  202. package/src/markdoc/components/CodeWalkthrough/CodeContainer.tsx +76 -0
  203. package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +87 -0
  204. package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +68 -0
  205. package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +192 -0
  206. package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +53 -0
  207. package/src/markdoc/components/CodeWalkthrough/CodePanelToolbar.tsx +31 -0
  208. package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +149 -0
  209. package/src/markdoc/components/CodeWalkthrough/CodeToggle.tsx +63 -0
  210. package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +111 -0
  211. package/src/markdoc/components/CodeWalkthrough/Input.tsx +101 -0
  212. package/src/markdoc/components/CodeWalkthrough/variables.ts +16 -0
  213. package/src/markdoc/components/default.ts +5 -0
  214. package/src/markdoc/default.ts +8 -0
  215. package/src/markdoc/tags/code-step.ts +27 -0
  216. package/src/markdoc/tags/code-toggle.ts +37 -0
  217. package/src/markdoc/tags/code-walkthrough.ts +315 -0
  218. package/src/markdoc/tags/input.ts +35 -0
  219. package/src/plugin.js +2 -2
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { IconProps } from '@redocly/theme/icons/types';
5
+
6
+ import { getCssColorVariable } from '@redocly/theme/core/utils';
7
+
8
+ const Icon = (props: IconProps) => (
9
+ <svg
10
+ width="16"
11
+ height="16"
12
+ viewBox="0 0 16 16"
13
+ fill="none"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ {...props}
16
+ >
17
+ <g id="iconReact">
18
+ <path
19
+ id="Vector"
20
+ d="M7.99992 6.74022C8.68658 6.74022 9.24658 7.30022 9.24658 8.00022C9.24658 8.66689 8.68658 9.23356 7.99992 9.23356C7.31325 9.23356 6.75325 8.66689 6.75325 8.00022C6.75325 7.30022 7.31325 6.74022 7.99992 6.74022ZM4.91325 13.3336C5.33325 13.5869 6.25325 13.2002 7.31325 12.2002C6.96659 11.8069 6.62659 11.3802 6.30658 10.9336C5.76935 10.8821 5.23526 10.802 4.70658 10.6936C4.36659 12.1202 4.49325 13.1002 4.91325 13.3336ZM5.38658 9.50689L5.19325 9.16689C5.11992 9.36022 5.04659 9.55356 4.99992 9.74022C5.17992 9.78022 5.37992 9.81356 5.58659 9.84689L5.38658 9.50689ZM9.74658 9.00022L10.2866 8.00022L9.74658 7.00022C9.54659 6.64689 9.33325 6.33356 9.13992 6.02022C8.77992 6.00022 8.39992 6.00022 7.99992 6.00022C7.59992 6.00022 7.21992 6.00022 6.85992 6.02022C6.66658 6.33356 6.45325 6.64689 6.25325 7.00022L5.71325 8.00022L6.25325 9.00022C6.45325 9.35356 6.66658 9.66689 6.85992 9.98022C7.21992 10.0002 7.59992 10.0002 7.99992 10.0002C8.39992 10.0002 8.77992 10.0002 9.13992 9.98022C9.33325 9.66689 9.54659 9.35356 9.74658 9.00022ZM7.99992 4.52022C7.87325 4.66689 7.73992 4.82022 7.60658 5.00022H8.39325C8.25992 4.82022 8.12659 4.66689 7.99992 4.52022ZM7.99992 11.4802C8.12659 11.3336 8.25992 11.1802 8.39325 11.0002H7.60658C7.73992 11.1802 7.87325 11.3336 7.99992 11.4802ZM11.0799 2.66689C10.6666 2.41356 9.74658 2.80022 8.68658 3.80022C9.03325 4.19356 9.37325 4.62022 9.69325 5.06689C10.2399 5.12022 10.7799 5.20022 11.2933 5.30689C11.6333 3.88022 11.5066 2.90022 11.0799 2.66689ZM10.6133 6.49356L10.8066 6.83356C10.8799 6.64022 10.9533 6.44689 10.9999 6.26022C10.8199 6.22022 10.6199 6.18689 10.4133 6.15356L10.6133 6.49356ZM11.5799 1.79356C12.5599 2.35356 12.6666 3.82689 12.2533 5.54689C13.9466 6.04689 15.1666 6.87356 15.1666 8.00022C15.1666 9.12689 13.9466 9.95356 12.2533 10.4536C12.6666 12.1736 12.5599 13.6469 11.5799 14.2069C10.6066 14.7669 9.27992 14.1269 7.99992 12.9069C6.71992 14.1269 5.39325 14.7669 4.41325 14.2069C3.43992 13.6469 3.33325 12.1736 3.74659 10.4536C2.05325 9.95356 0.833252 9.12689 0.833252 8.00022C0.833252 6.87356 2.05325 6.04689 3.74659 5.54689C3.33325 3.82689 3.43992 2.35356 4.41325 1.79356C5.39325 1.23356 6.71992 1.87356 7.99992 3.09356C9.27992 1.87356 10.6066 1.23356 11.5799 1.79356ZM11.3866 8.00022C11.6133 8.50022 11.8133 9.00022 11.9799 9.50689C13.3799 9.08689 14.1666 8.48689 14.1666 8.00022C14.1666 7.51356 13.3799 6.91356 11.9799 6.49356C11.8133 7.00022 11.6133 7.50022 11.3866 8.00022ZM4.61325 8.00022C4.38659 7.50022 4.18659 7.00022 4.01992 6.49356C2.61992 6.91356 1.83325 7.51356 1.83325 8.00022C1.83325 8.48689 2.61992 9.08689 4.01992 9.50689C4.18659 9.00022 4.38659 8.50022 4.61325 8.00022ZM10.6133 9.50689L10.4133 9.84689C10.6199 9.81356 10.8199 9.78022 10.9999 9.74022C10.9533 9.55356 10.8799 9.36022 10.8066 9.16689L10.6133 9.50689ZM8.68658 12.2002C9.74658 13.2002 10.6666 13.5869 11.0799 13.3336C11.5066 13.1002 11.6333 12.1202 11.2933 10.6936C10.7799 10.8002 10.2399 10.8802 9.69325 10.9336C9.37325 11.3802 9.03325 11.8069 8.68658 12.2002ZM5.38658 6.49356L5.58659 6.15356C5.37992 6.18689 5.17992 6.22022 4.99992 6.26022C5.04659 6.44689 5.11992 6.64022 5.19325 6.83356L5.38658 6.49356ZM7.31325 3.80022C6.25325 2.80022 5.33325 2.41356 4.91325 2.66689C4.49325 2.90022 4.36659 3.88022 4.70658 5.30689C5.23526 5.19842 5.76935 5.1183 6.30658 5.06689C6.62659 4.62022 6.96659 4.19356 7.31325 3.80022Z"
21
+ fill="#3B3C45"
22
+ />
23
+ </g>
24
+ </svg>
25
+ );
26
+
27
+ export const DocumentReactIcon = styled(Icon).attrs(() => ({
28
+ 'data-component-name': 'icons/DocumentReactIcon/DocumentReactIcon',
29
+ }))<IconProps>`
30
+ path {
31
+ fill: ${({ color }) => getCssColorVariable(color)};
32
+ }
33
+
34
+ height: ${({ size }) => size || '16px'};
35
+ width: ${({ size }) => size || '16px'};
36
+ `;
@@ -0,0 +1 @@
1
+ export { DocumentReactIcon } from '@redocly/theme/icons/DocumentReactIcon/DocumentReactIcon';
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { IconProps } from '@redocly/theme/icons/types';
5
+
6
+ import { getCssColorVariable } from '@redocly/theme/core/utils';
7
+
8
+ const Icon = (props: IconProps) => (
9
+ <svg
10
+ width="16"
11
+ height="16"
12
+ viewBox="0 0 16 16"
13
+ fill="none"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ {...props}
16
+ >
17
+ <g id="iconTS">
18
+ <path
19
+ id="Vector"
20
+ fillRule="evenodd"
21
+ clipRule="evenodd"
22
+ d="M1.47192 1.47168V14.5277H14.5279V1.47168H1.47192ZM11.3926 7.81312V7.81331C11.5177 7.81369 11.6601 7.82013 11.7671 7.83174C12.2029 7.87888 12.5423 8.06691 12.831 8.42106C12.9748 8.59747 13.024 8.67465 13.0135 8.70768C13.0067 8.72899 12.9081 8.79965 12.5944 9.00784C12.2863 9.21242 12.1871 9.27369 12.164 9.27369C12.1406 9.27369 12.0919 9.22358 12.0217 9.12736C11.8865 8.94211 11.7485 8.85757 11.5352 8.82938C11.3057 8.79898 11.0999 8.8713 10.9991 9.01779C10.9129 9.14298 10.8999 9.34438 10.9684 9.49075C11.0478 9.66026 11.1914 9.75398 11.7417 9.9953C12.3765 10.2736 12.6982 10.4641 12.9324 10.7006C13.1847 10.9552 13.3125 11.2491 13.3518 11.6649C13.371 11.8676 13.3475 12.1078 13.2896 12.3031C13.1473 12.7819 12.7635 13.1324 12.2009 13.2974C12.0454 13.343 11.9007 13.3702 11.7576 13.3807C11.539 13.3968 11.2263 13.388 11.038 13.3606C10.5617 13.2912 10.0241 13.014 9.75596 12.6998C9.62434 12.5455 9.45631 12.2916 9.45631 12.247C9.45631 12.2254 9.467 12.2132 9.5093 12.1863C9.6348 12.1065 10.3539 11.6955 10.3679 11.6955C10.3763 11.6955 10.4139 11.7397 10.4513 11.7938C10.5361 11.9163 10.7448 12.1268 10.8508 12.1971C10.9374 12.2545 11.0482 12.3005 11.1797 12.3338C11.2551 12.3525 11.2949 12.3559 11.4593 12.3559C11.6272 12.3558 11.6617 12.353 11.7368 12.3328C11.9355 12.2794 12.0906 12.1687 12.1563 12.0335C12.1851 11.9751 12.1857 11.9678 12.1857 11.8261V11.6793L12.1504 11.6092C12.0649 11.4394 11.8805 11.3229 11.2977 11.0705C11.0301 10.9545 10.7022 10.791 10.5742 10.7097C10.2821 10.524 10.0796 10.3118 9.94677 10.052C9.81461 9.79369 9.79493 9.69754 9.79461 9.30909C9.79429 9.00499 9.79378 9.00873 9.85672 8.81465C9.91384 8.63853 10.0308 8.44179 10.1599 8.30458C10.4175 8.03075 10.7939 7.85475 11.1969 7.81974C11.2484 7.81485 11.3174 7.81296 11.3925 7.81318L11.3926 7.81312ZM7.92504 7.87318H7.92517C8.70127 7.87357 9.14616 7.87626 9.1533 7.88074C9.16674 7.88906 9.16844 7.95661 9.16844 8.38768V8.88499L8.394 8.88781L7.61957 8.89062V11.0894C7.61957 12.2988 7.61711 13.2955 7.61375 13.3043C7.60828 13.3191 7.54869 13.3202 7.04479 13.3202H6.482L6.47618 13.2975C6.47244 13.285 6.46968 12.2883 6.46962 11.0826L6.46943 8.8905L5.69503 8.88774L4.92056 8.88493V8.3935C4.92056 8.00374 4.92325 7.89936 4.93365 7.88899C4.94431 7.87802 5.33954 7.8752 7.04252 7.8735C7.37084 7.87318 7.66632 7.87302 7.92504 7.87318Z"
23
+ fill="#3B3C45"
24
+ />
25
+ </g>
26
+ </svg>
27
+ );
28
+
29
+ export const DocumentTsIcon = styled(Icon).attrs(() => ({
30
+ 'data-component-name': 'icons/DocumentTsIcon/DocumentTsIcon',
31
+ }))<IconProps>`
32
+ path {
33
+ fill: ${({ color }) => getCssColorVariable(color)};
34
+ }
35
+
36
+ height: ${({ size }) => size || '16px'};
37
+ width: ${({ size }) => size || '16px'};
38
+ `;
@@ -0,0 +1 @@
1
+ export { DocumentTsIcon } from '@redocly/theme/icons/DocumentTsIcon/DocumentTsIcon';
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { IconProps } from '@redocly/theme/icons/types';
5
+
6
+ import { getCssColorVariable } from '@redocly/theme/core/utils';
7
+
8
+ const Icon = (props: IconProps) => (
9
+ <svg
10
+ width="16"
11
+ height="16"
12
+ viewBox="0 0 16 16"
13
+ fill="none"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ {...props}
16
+ >
17
+ <g id="iconYaml">
18
+ <path
19
+ id="Vector"
20
+ d="M8.66675 5.99967H12.3334L8.66675 2.33301V5.99967ZM4.00008 1.33301H9.33342L13.3334 5.33301V13.333C13.3334 14.0663 12.7334 14.6663 12.0001 14.6663H4.00008C3.26675 14.6663 2.66675 14.0663 2.66675 13.333V2.66634C2.66675 1.93301 3.26675 1.33301 4.00008 1.33301ZM12.0001 11.9997V10.6663H6.00008V11.9997H12.0001ZM9.33342 9.33301V7.99967H4.00008V9.33301H9.33342Z"
21
+ fill="#3B3C45"
22
+ />
23
+ </g>
24
+ </svg>
25
+ );
26
+
27
+ export const DocumentYamlIcon = styled(Icon).attrs(() => ({
28
+ 'data-component-name': 'icons/DocumentYamlIcon/DocumentYamlIcon',
29
+ }))<IconProps>`
30
+ path {
31
+ fill: ${({ color }) => getCssColorVariable(color)};
32
+ }
33
+
34
+ height: ${({ size }) => size || '16px'};
35
+ width: ${({ size }) => size || '16px'};
36
+ `;
@@ -0,0 +1 @@
1
+ export { DocumentYamlIcon } from '@redocly/theme/icons/DocumentYamlIcon/DocumentYamlIcon';
package/src/index.ts CHANGED
@@ -242,6 +242,7 @@ export * from '@redocly/theme/layouts/NotFound';
242
242
  export * from '@redocly/theme/layouts/Forbidden';
243
243
  export * from '@redocly/theme/layouts/OIDCForbidden';
244
244
  export * from '@redocly/theme/layouts/ThreePanelLayout';
245
+ export * from '@redocly/theme/layouts/CodeWalkthroughLayout';
245
246
  /* Markdoc */
246
247
  export * as markdoc from '@redocly/theme/markdoc/default';
247
248
  /* DatePicker */
@@ -0,0 +1,78 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ export type CodeWalkthroughLayoutProps = React.PropsWithChildren<{
5
+ className?: string;
6
+ }>;
7
+
8
+ export function CodeWalkthroughLayout({
9
+ className,
10
+ children,
11
+ }: CodeWalkthroughLayoutProps): JSX.Element {
12
+ return (
13
+ <LayoutWrapper data-component-name="Layout/CodeWalkthroughLayout" className={className}>
14
+ <ContentWrapper>{children}</ContentWrapper>
15
+ </LayoutWrapper>
16
+ );
17
+ }
18
+
19
+ const LayoutWrapper = styled.div.attrs(({ className }) => ({
20
+ className,
21
+ }))`
22
+ display: flex;
23
+ flex: 1;
24
+ width: 100%;
25
+ `;
26
+
27
+ const ContentWrapper = styled.section`
28
+ width: 100%;
29
+ --md-content-font-size: var(--font-size-lg);
30
+ --md-content-line-height: var(--line-height-lg);
31
+ --md-table-font-size: var(--md-content-font-size);
32
+ --md-table-line-height: var(--md-content-line-height);
33
+ --md-tabs-content-font-size: var(--md-content-font-size);
34
+ --md-tabs-content-line-height: var(--md-content-line-height);
35
+
36
+ article {
37
+ padding: var(--spacing-xl) 0;
38
+
39
+ /* Spacing for elements preceding a code walkthrough */
40
+ > :not(.code-walkthrough):has(+ .code-walkthrough) {
41
+ margin-bottom: var(--spacing-xl);
42
+ }
43
+
44
+ /* Spacing for code walkthroughs not at the end */
45
+ > .code-walkthrough:not(:last-child) {
46
+ margin-bottom: var(--spacing-xl);
47
+ }
48
+
49
+ /* Layout constraints for direct children except .code-walkthrough */
50
+ > :not(.code-walkthrough) {
51
+ max-width: var(--md-content-max-width);
52
+ padding-left: 0;
53
+ padding-right: 0;
54
+ margin-left: auto !important;
55
+ margin-right: auto !important;
56
+ }
57
+
58
+ /* Adjust padding for edge cases with .code-walkthrough */
59
+ &:has(.code-walkthrough:first-child) {
60
+ padding-top: 0;
61
+ }
62
+
63
+ &:has(.code-walkthrough:last-child) {
64
+ padding-bottom: 0;
65
+ }
66
+
67
+ /* Full-width styling for all .code-walkthroughs */
68
+ .code-walkthrough {
69
+ max-width: none;
70
+ width: 100%;
71
+ }
72
+
73
+ &:first-child > h1:first-child {
74
+ // disable margin top for h1 on the title heading
75
+ margin-top: 0;
76
+ }
77
+ }
78
+ `;
@@ -0,0 +1,9 @@
1
+ import type { CustomAttributeTypeInterface, ValidationError } from '@markdoc/markdoc';
2
+
3
+ export class CodeWalkthroughFilesets implements CustomAttributeTypeInterface {
4
+ validate(_value: string): ValidationError[] {
5
+ return [];
6
+ }
7
+
8
+ static resolver = 'codeWalkthroughFilesets';
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { CustomAttributeTypeInterface, ValidationError } from '@markdoc/markdoc';
2
+
3
+ export class CodeWalkthroughFilters implements CustomAttributeTypeInterface {
4
+ validate(_value: string): ValidationError[] {
5
+ return [];
6
+ }
7
+
8
+ static resolver = 'codeWalkthroughFilters';
9
+ }
@@ -0,0 +1,76 @@
1
+ import React, { useContext, useRef, useEffect, useState } from 'react';
2
+ import styled, { css } from 'styled-components';
3
+
4
+ import { CodeWalkthroughStepsContext } from '@redocly/theme/core/contexts';
5
+ import { CodeBlockContainer } from '@redocly/theme/components/CodeBlock/CodeBlockContainer';
6
+
7
+ export type CodeContainerProps = {
8
+ highlightedCode: string;
9
+ toolbar: JSX.Element;
10
+ };
11
+
12
+ export function CodeContainer({
13
+ highlightedCode,
14
+ toolbar,
15
+ }: CodeContainerProps): JSX.Element | null {
16
+ const { activeStep } = useContext(CodeWalkthroughStepsContext);
17
+ const [isHovered, setIsHovered] = useState(false);
18
+ const compRef = useRef<HTMLDivElement | null>(null);
19
+
20
+ useEffect(() => {
21
+ // useEffect executed before DOM is updated due to re-render called before "painting" phase.
22
+ setTimeout(() => {
23
+ if (compRef.current) {
24
+ const element = compRef.current.querySelector('span.line.highlighted');
25
+ if (element) {
26
+ element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
27
+ }
28
+ }
29
+ }, 200);
30
+ }, [activeStep]);
31
+
32
+ return (
33
+ <CodeContainerWrapper
34
+ ref={compRef}
35
+ hideCodeColors={!isHovered}
36
+ onMouseEnter={() => setIsHovered(true)}
37
+ onMouseLeave={() => setIsHovered(false)}
38
+ >
39
+ <CodeBlockContainer dangerouslySetInnerHTML={{ __html: highlightedCode }} />
40
+ {toolbar}
41
+ </CodeContainerWrapper>
42
+ );
43
+ }
44
+
45
+ const CodeContainerWrapper = styled.div<{ hideCodeColors?: boolean }>`
46
+ position: relative;
47
+
48
+ display: flex;
49
+ flex-direction: column;
50
+ flex-grow: 1;
51
+ min-height: 0;
52
+
53
+ pre {
54
+ display: grid;
55
+ grid-auto-rows: min-content;
56
+ min-height: 0;
57
+ overflow: scroll;
58
+ margin: 0 !important;
59
+ height: 100%;
60
+ padding-left: 0 !important;
61
+
62
+ span.line::before {
63
+ color: var(--code-panel-line-numbering-color);
64
+ }
65
+ ${({ hideCodeColors }) =>
66
+ hideCodeColors &&
67
+ css`
68
+ .line.greyed-out {
69
+ color: var(--text-color-helper) !important;
70
+ * {
71
+ color: var(--text-color-helper) !important;
72
+ }
73
+ }
74
+ `}
75
+ }
76
+ `;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { CodeWalkthroughFilter } from '@redocly/config';
5
+
6
+ import { Tag } from '@redocly/theme/components/Tag/Tag';
7
+
8
+ export type CodeFilterProps = {
9
+ filters: CodeWalkthroughFilter[];
10
+ getFilterState: (groupId: string) => { value: string; render: boolean } | null;
11
+ handleFilterSelect: (groupId: string, id: string) => void;
12
+ filtersElementRef?: React.RefObject<HTMLDivElement>;
13
+ };
14
+
15
+ export function CodeFilters({
16
+ filters,
17
+ getFilterState,
18
+ handleFilterSelect,
19
+ filtersElementRef,
20
+ }: CodeFilterProps) {
21
+ if (filters.length === 0) {
22
+ return null;
23
+ }
24
+
25
+ return (
26
+ <FilterWrapper ref={filtersElementRef}>
27
+ {filters.map(({ label, items, id }) => {
28
+ return (
29
+ <Filter key={id}>
30
+ {label && <FilterName>{label}:</FilterName>}
31
+ <ButtonsWrapper>
32
+ {items?.map((item) => (
33
+ <TagButton
34
+ size="large"
35
+ borderless
36
+ active={getFilterState(id)?.value === item.value}
37
+ key={item.value}
38
+ onClick={() => handleFilterSelect(id, item.value)}
39
+ >
40
+ {item.value}
41
+ </TagButton>
42
+ ))}
43
+ </ButtonsWrapper>
44
+ </Filter>
45
+ );
46
+ })}
47
+ </FilterWrapper>
48
+ );
49
+ }
50
+
51
+ const Filter = styled.div`
52
+ display: flex;
53
+ align-items: center;
54
+ gap: var(--spacing-xs);
55
+ `;
56
+
57
+ const FilterName = styled.div`
58
+ color: var(--color-text-primary);
59
+ font-size: var(--font-size-base);
60
+ `;
61
+
62
+ const FilterWrapper = styled.div`
63
+ --tag-text-transform: none;
64
+ display: flex;
65
+ flex-direction: row;
66
+ gap: var(--spacing-sm);
67
+ flex-wrap: wrap;
68
+ position: sticky;
69
+
70
+ padding-top: calc(var(--spacing-xs) + var(--spacing-xl));
71
+ padding-right: var(--spacing-xl);
72
+ padding-left: var(--spacing-xl);
73
+ padding-bottom: var(--spacing-xs);
74
+ top: calc(var(--navbar-height));
75
+ background-color: var(--bg-color);
76
+ z-index: 1;
77
+ `;
78
+
79
+ const ButtonsWrapper = styled.div`
80
+ display: flex;
81
+ `;
82
+
83
+ const TagButton = styled(Tag)`
84
+ cursor: pointer;
85
+ padding: 0px var(--spacing-xs);
86
+ margin-right: var(--spacing-xs);
87
+ `;
@@ -0,0 +1,68 @@
1
+ import React, { useContext } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { CodeWalkthroughFile } from '@redocly/config';
5
+
6
+ import { useCodePanel } from '@redocly/theme/core/hooks';
7
+ import { CodeWalkthroughControlsStateContext } from '@redocly/theme/core/contexts';
8
+ import { CodePanelHeader } from '@redocly/theme/markdoc/components/CodeWalkthrough/CodePanelHeader';
9
+ import { CodePanelPreview } from '@redocly/theme/markdoc/components/CodeWalkthrough/CodePanelPreview';
10
+ import { CodeContainer } from '@redocly/theme/markdoc/components/CodeWalkthrough/CodeContainer';
11
+ import { CodePanelToolbar } from '@redocly/theme/markdoc/components/CodeWalkthrough/CodePanelToolbar';
12
+
13
+ export type CodePanelProps = {
14
+ files: CodeWalkthroughFile[];
15
+ downloadAssociatedFiles: CodeWalkthroughFile[];
16
+ preview: React.ReactNode[];
17
+ };
18
+
19
+ export function CodePanel({
20
+ files,
21
+ downloadAssociatedFiles,
22
+ preview,
23
+ }: CodePanelProps): JSX.Element | null {
24
+ const { activeFile, handleTabSwitch, highlightedCode } = useCodePanel(files);
25
+ const { handleDownloadCode } = useContext(CodeWalkthroughControlsStateContext);
26
+
27
+ return (
28
+ <CodePanelWrapper>
29
+ {preview ? (
30
+ <CodePanelPreview>
31
+ {preview.map((element, idx) => (
32
+ <React.Fragment key={idx}>{element}</React.Fragment>
33
+ ))}
34
+ </CodePanelPreview>
35
+ ) : null}
36
+ <CodePanelHeader
37
+ files={files}
38
+ activeTabName={activeFile?.path || ''}
39
+ handleTabSwitch={handleTabSwitch}
40
+ onDownloadCode={() => handleDownloadCode([...files, ...downloadAssociatedFiles])}
41
+ />
42
+ <CodeContainer
43
+ key={activeFile?.path || ''}
44
+ highlightedCode={highlightedCode}
45
+ toolbar={<CodePanelToolbar file={activeFile} />}
46
+ />
47
+ </CodePanelWrapper>
48
+ );
49
+ }
50
+
51
+ const CodePanelWrapper = styled.div`
52
+ display: flex;
53
+ flex-direction: column;
54
+ align-self: flex-start;
55
+
56
+ min-height: 144px;
57
+ min-width: 0;
58
+ height: 100%;
59
+ word-wrap: break-word;
60
+
61
+ background-color: var(--code-panel-bg-color);
62
+ border: 1px solid var(--code-panel-border-color);
63
+ border-radius: var(--code-panel-border-radius);
64
+ --code-block-max-height: calc(100vh - var(--navbar-height) - 2 * var(--spacing-xl));
65
+ height: calc(100vh - var(--navbar-height) - 2 * var(--spacing-xl));
66
+ position: sticky;
67
+ top: calc(var(--navbar-height) + var(--spacing-xl));
68
+ `;
@@ -0,0 +1,192 @@
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
+ import styled, { css } from 'styled-components';
3
+
4
+ import type { CodeWalkthroughFile } from '@redocly/config';
5
+
6
+ import { useThemeHooks } from '@redocly/theme/core/hooks';
7
+ import { getFileIconByExt } from '@redocly/theme/core/utils';
8
+ import { OverflowMenuVerticalIcon } from '@redocly/theme/icons/OverflowMenuVerticalIcon/OverflowMenuVerticalIcon';
9
+ import { Dropdown } from '@redocly/theme/components/Dropdown/Dropdown';
10
+ import { DropdownMenu } from '@redocly/theme/components/Dropdown/DropdownMenu';
11
+ import { DropdownMenuItem } from '@redocly/theme/components/Dropdown/DropdownMenuItem';
12
+ import { DownloadIcon } from '@redocly/theme/icons/DownloadIcon/DownloadIcon';
13
+ import { Button } from '@redocly/theme/components/Button/Button';
14
+
15
+ export type CodePanelHeaderProps = {
16
+ files: CodeWalkthroughFile[];
17
+ handleTabSwitch: (name: string) => void;
18
+ activeTabName: string;
19
+ onDownloadCode: () => void;
20
+ };
21
+
22
+ export function CodePanelHeader({
23
+ files,
24
+ handleTabSwitch,
25
+ activeTabName,
26
+ onDownloadCode,
27
+ }: CodePanelHeaderProps): JSX.Element {
28
+ const { useTranslate } = useThemeHooks();
29
+ const { translate } = useTranslate();
30
+ const tabRefs = useRef<HTMLButtonElement[]>([]);
31
+ const tabsWrapperRef = useRef<HTMLDivElement>(null);
32
+ const [hiddenFiles, setHiddenFiles] = useState<CodeWalkthroughFile[]>([]);
33
+
34
+ useEffect(() => {
35
+ const activeTab = tabRefs.current.find((tab) => tab?.dataset.name === activeTabName);
36
+ if (activeTab) {
37
+ activeTab.scrollIntoView({ block: 'nearest', inline: 'center' });
38
+ }
39
+ }, [activeTabName]);
40
+
41
+ useEffect(() => {
42
+ const calculateHiddenFiles = () => {
43
+ if (!tabsWrapperRef.current) return;
44
+ const { left: wrapperLeft, right: wrapperRight } =
45
+ tabsWrapperRef.current.getBoundingClientRect();
46
+
47
+ const hidden = files.filter((_, i) => {
48
+ const tab = tabRefs.current[i];
49
+ if (!tab) return false;
50
+ const { left: tabLeft, right: tabRight } = tab.getBoundingClientRect();
51
+
52
+ return tabLeft < wrapperLeft || tabRight > wrapperRight;
53
+ });
54
+
55
+ setHiddenFiles(hidden);
56
+ };
57
+
58
+ calculateHiddenFiles();
59
+ window.addEventListener('resize', calculateHiddenFiles);
60
+ return () => window.removeEventListener('resize', calculateHiddenFiles);
61
+ }, [files]);
62
+
63
+ const getFileTypeIcon = useCallback((basename: string) => {
64
+ const extension = basename.split('.').pop()?.toLowerCase() || '';
65
+ return getFileIconByExt(extension);
66
+ }, []);
67
+
68
+ return (
69
+ <CodePanelHeaderWrapper data-component-name="Markdoc/CodeWalkthrough/CodePanelHeader">
70
+ <TabsWrapper ref={tabsWrapperRef}>
71
+ <Tabs>
72
+ {files.map(({ path, basename }, i) => {
73
+ const FileIcon = getFileTypeIcon(basename);
74
+ return (
75
+ <Tab
76
+ ref={(el: HTMLButtonElement) => (tabRefs.current[i] = el)}
77
+ data-name={path}
78
+ active={path === activeTabName}
79
+ key={i}
80
+ onClick={() => handleTabSwitch(path)}
81
+ >
82
+ <FileIcon />
83
+ {basename}
84
+ </Tab>
85
+ );
86
+ })}
87
+ </Tabs>
88
+ <Gradient />
89
+ </TabsWrapper>
90
+
91
+ <ActionBar>
92
+ {hiddenFiles.length ? (
93
+ <Dropdown trigger={<StyledOverflowMenuVerticalIcon size="14px" />} alignment="end">
94
+ <StyledDropdownMenu>
95
+ {hiddenFiles.map(({ path, basename }, i) => {
96
+ const FileIcon = getFileTypeIcon(basename);
97
+ return (
98
+ <DropdownMenuItem
99
+ active={path === activeTabName}
100
+ key={i}
101
+ onAction={() => handleTabSwitch(path)}
102
+ prefix={<FileIcon />}
103
+ content={basename}
104
+ />
105
+ );
106
+ })}
107
+ </StyledDropdownMenu>
108
+ </Dropdown>
109
+ ) : null}
110
+
111
+ <Button variant="text" icon={<DownloadIcon />} onClick={onDownloadCode} size="small">
112
+ {translate('codeWalkthrough.download', 'Download')}
113
+ </Button>
114
+ </ActionBar>
115
+ </CodePanelHeaderWrapper>
116
+ );
117
+ }
118
+
119
+ const CodePanelHeaderWrapper = styled.div`
120
+ display: flex;
121
+ align-items: center;
122
+ justify-content: space-between;
123
+
124
+ padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-sm);
125
+ max-width: 100%;
126
+ `;
127
+
128
+ const TabsWrapper = styled.div`
129
+ display: flex;
130
+ position: relative;
131
+ min-width: 0;
132
+ `;
133
+
134
+ const Gradient = styled.div`
135
+ position: absolute;
136
+ right: 0;
137
+ width: var(--spacing-base);
138
+ height: var(--code-panel-header-height);
139
+ background: var(--bg-raised-gradient);
140
+ `;
141
+
142
+ const Tabs = styled.div`
143
+ display: flex;
144
+ overflow-x: auto;
145
+ padding-right: var(--spacing-base);
146
+
147
+ &::-webkit-scrollbar {
148
+ display: none;
149
+ }
150
+ `;
151
+
152
+ const ActionBar = styled.div`
153
+ display: flex;
154
+ `;
155
+
156
+ const Tab = styled.button<{ active: boolean }>`
157
+ display: inline-flex;
158
+ align-items: center;
159
+ padding: 0 var(--spacing-sm);
160
+ background-color: transparent;
161
+ height: var(--code-panel-header-height);
162
+ border-radius: var(--border-radius);
163
+ cursor: pointer;
164
+ gap: var(--spacing-xs);
165
+ color: var(--text-color-secondary);
166
+ white-space: nowrap;
167
+
168
+ ${({ active }) =>
169
+ active
170
+ ? css`
171
+ color: var(--text-color-primary);
172
+ background-color: var(--tab-bg-color-filled);
173
+ `
174
+ : css`
175
+ &:hover {
176
+ color: var(--text-color-primary);
177
+ }
178
+ `}
179
+ `;
180
+
181
+ // code-walk-todo: figure it our why we could not do it differently
182
+ const StyledDropdownMenu = styled(DropdownMenu)`
183
+ --md-list-left-padding: var(--dropdown-menu-padding);
184
+ `;
185
+
186
+ const StyledOverflowMenuVerticalIcon = styled(OverflowMenuVerticalIcon)`
187
+ && {
188
+ outline: none;
189
+ box-sizing: content-box;
190
+ padding: 5px;
191
+ }
192
+ `;