@redocly/theme 0.16.0 → 0.17.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 (117) hide show
  1. package/lib/components/CodeBlock/CodeBlock.d.ts +29 -1
  2. package/lib/components/CodeBlock/CodeBlock.js +56 -94
  3. package/lib/components/CodeBlock/CodeBlockContainer.d.ts +3 -0
  4. package/lib/components/CodeBlock/CodeBlockContainer.js +120 -0
  5. package/lib/components/CodeBlock/CodeBlockControlButton.d.ts +5 -0
  6. package/lib/components/CodeBlock/CodeBlockControlButton.js +63 -0
  7. package/lib/components/CodeBlock/CodeBlockControls.d.ts +33 -0
  8. package/lib/components/CodeBlock/CodeBlockControls.js +56 -0
  9. package/lib/components/CodeBlock/index.d.ts +3 -0
  10. package/lib/components/CodeBlock/index.js +3 -0
  11. package/lib/components/CopyButton/CopyButton.d.ts +12 -3
  12. package/lib/components/CopyButton/CopyButton.js +30 -26
  13. package/lib/components/CopyButton/index.d.ts +0 -1
  14. package/lib/components/CopyButton/index.js +0 -1
  15. package/lib/components/Feedback/useReportDialog.d.ts +12 -6
  16. package/lib/components/Feedback/useReportDialog.js +13 -5
  17. package/lib/components/JsonViewer/JsonViewer.d.ts +0 -1
  18. package/lib/components/JsonViewer/JsonViewer.js +100 -119
  19. package/lib/components/Markdown/MarkdownWrapper.d.ts +5 -1
  20. package/lib/components/Markdown/MarkdownWrapper.js +59 -53
  21. package/lib/components/Menu/MobileMenu.js +2 -2
  22. package/lib/components/Menu/MobileMenuGroup.js +1 -1
  23. package/lib/components/Panel/PanelHeader.js +0 -1
  24. package/lib/components/Tooltip/Tooltip.js +2 -0
  25. package/lib/components/index.d.ts +0 -3
  26. package/lib/components/index.js +0 -3
  27. package/lib/config.d.ts +526 -24
  28. package/lib/config.js +150 -4
  29. package/lib/globalStyle.js +50 -7
  30. package/lib/icons/ArrowIcon/ArrowIcon.d.ts +3 -3
  31. package/lib/icons/ArrowIcon/ArrowIcon.js +33 -6
  32. package/lib/icons/CollapseIcon/CollapseIcon.d.ts +7 -0
  33. package/lib/icons/CollapseIcon/CollapseIcon.js +22 -0
  34. package/lib/icons/CollapseIcon/index.d.ts +1 -0
  35. package/lib/{components/SourceCode → icons/CollapseIcon}/index.js +1 -1
  36. package/lib/icons/CopyIcon/CopyIcon.d.ts +7 -0
  37. package/lib/icons/CopyIcon/CopyIcon.js +17 -0
  38. package/lib/icons/CopyIcon/index.d.ts +1 -0
  39. package/lib/{components/CodeSample → icons/CopyIcon}/index.js +1 -1
  40. package/lib/icons/DeselectIcon/DeselectIcon.d.ts +7 -0
  41. package/lib/icons/DeselectIcon/DeselectIcon.js +19 -0
  42. package/lib/icons/DeselectIcon/index.d.ts +1 -0
  43. package/lib/{components/SamplesPanelControls → icons/DeselectIcon}/index.js +1 -1
  44. package/lib/icons/ExpandIcon/ExpandIcon.d.ts +5 -6
  45. package/lib/icons/ExpandIcon/ExpandIcon.js +10 -19
  46. package/lib/icons/FileIcon/FileIcon.d.ts +7 -0
  47. package/lib/icons/FileIcon/FileIcon.js +17 -0
  48. package/lib/icons/FileIcon/index.d.ts +1 -0
  49. package/lib/icons/FileIcon/index.js +18 -0
  50. package/lib/icons/ReportIcon/ReportIcon.d.ts +7 -0
  51. package/lib/icons/ReportIcon/ReportIcon.js +19 -0
  52. package/lib/icons/ReportIcon/index.d.ts +1 -0
  53. package/lib/icons/ReportIcon/index.js +18 -0
  54. package/lib/icons/SelectIcon/SelectIcon.d.ts +7 -0
  55. package/lib/icons/SelectIcon/SelectIcon.js +19 -0
  56. package/lib/icons/SelectIcon/index.d.ts +1 -0
  57. package/lib/icons/SelectIcon/index.js +18 -0
  58. package/lib/icons/index.d.ts +7 -1
  59. package/lib/icons/index.js +7 -1
  60. package/lib/layouts/Forbidden.js +2 -2
  61. package/lib/ui/darkColors.js +4 -4
  62. package/lib/utils/highlight.d.ts +1 -0
  63. package/lib/utils/highlight.js +1 -0
  64. package/package.json +2 -2
  65. package/src/components/CodeBlock/CodeBlock.tsx +100 -0
  66. package/src/components/CodeBlock/{CodeBlock.ts → CodeBlockContainer.tsx} +23 -6
  67. package/src/components/CodeBlock/CodeBlockControlButton.tsx +38 -0
  68. package/src/components/CodeBlock/CodeBlockControls.tsx +182 -0
  69. package/src/components/CodeBlock/index.ts +3 -0
  70. package/src/components/CopyButton/CopyButton.tsx +71 -19
  71. package/src/components/CopyButton/index.ts +0 -1
  72. package/src/components/Feedback/useReportDialog.ts +24 -14
  73. package/src/components/JsonViewer/JsonViewer.tsx +112 -142
  74. package/src/components/Markdown/MarkdownWrapper.tsx +65 -54
  75. package/src/components/Menu/MobileMenu.tsx +3 -3
  76. package/src/components/Menu/MobileMenuGroup.tsx +4 -2
  77. package/src/components/Panel/PanelHeader.ts +0 -1
  78. package/src/components/Tooltip/Tooltip.tsx +2 -0
  79. package/src/components/index.ts +0 -3
  80. package/src/config.ts +168 -8
  81. package/src/globalStyle.ts +50 -7
  82. package/src/icons/ArrowIcon/ArrowIcon.tsx +37 -14
  83. package/src/icons/CollapseIcon/CollapseIcon.tsx +40 -0
  84. package/src/icons/CollapseIcon/index.tsx +1 -0
  85. package/src/icons/CopyIcon/CopyIcon.tsx +26 -0
  86. package/src/icons/CopyIcon/index.ts +1 -0
  87. package/src/icons/DeselectIcon/DeselectIcon.tsx +28 -0
  88. package/src/icons/DeselectIcon/index.ts +1 -0
  89. package/src/icons/ExpandIcon/ExpandIcon.tsx +28 -34
  90. package/src/icons/FileIcon/FileIcon.tsx +29 -0
  91. package/src/icons/FileIcon/index.ts +1 -0
  92. package/src/icons/ReportIcon/ReportIcon.tsx +36 -0
  93. package/src/icons/ReportIcon/index.ts +1 -0
  94. package/src/icons/SelectIcon/SelectIcon.tsx +31 -0
  95. package/src/icons/SelectIcon/index.ts +1 -0
  96. package/src/icons/index.ts +7 -1
  97. package/src/layouts/Forbidden.tsx +1 -1
  98. package/src/ui/darkColors.tsx +4 -4
  99. package/src/utils/highlight.ts +1 -0
  100. package/lib/components/CodeSample/CodeSample.d.ts +0 -10
  101. package/lib/components/CodeSample/CodeSample.js +0 -226
  102. package/lib/components/CodeSample/index.d.ts +0 -1
  103. package/lib/components/CopyButton/CopyButtonWrapper.d.ts +0 -11
  104. package/lib/components/CopyButton/CopyButtonWrapper.js +0 -53
  105. package/lib/components/SamplesPanelControls/SamplesPanelControls.d.ts +0 -4
  106. package/lib/components/SamplesPanelControls/SamplesPanelControls.js +0 -76
  107. package/lib/components/SamplesPanelControls/index.d.ts +0 -1
  108. package/lib/components/SourceCode/SourceCode.d.ts +0 -33
  109. package/lib/components/SourceCode/SourceCode.js +0 -60
  110. package/lib/components/SourceCode/index.d.ts +0 -1
  111. package/src/components/CodeSample/CodeSample.tsx +0 -257
  112. package/src/components/CodeSample/index.ts +0 -1
  113. package/src/components/CopyButton/CopyButtonWrapper.tsx +0 -55
  114. package/src/components/SamplesPanelControls/SamplesPanelControls.ts +0 -76
  115. package/src/components/SamplesPanelControls/index.ts +0 -1
  116. package/src/components/SourceCode/SourceCode.tsx +0 -128
  117. package/src/components/SourceCode/index.ts +0 -1
@@ -2,18 +2,26 @@ import { useState } from 'react';
2
2
 
3
3
  import type { ReportDialogProps } from '@theme/components/Feedback/types';
4
4
  import { useTranslate } from '@portal/hooks';
5
+ import { useThemeConfig } from '@theme/hooks';
5
6
 
6
- type ReportSettings = {
7
- hide?: boolean;
8
- label?: string;
9
- tooltipText?: string;
10
- };
7
+ export interface ReportButtonProps {
8
+ onClick: () => void;
9
+ buttonText: string;
10
+ tooltip: string;
11
+ visible: boolean;
12
+ }
13
+ interface ReportComponentsProps {
14
+ visible?: boolean;
15
+ props: Partial<ReportDialogProps> | ReportButtonProps;
16
+ }
11
17
 
12
- export function useReportDialog(reportSettings: ReportSettings): Record<string, any> {
18
+ export function useReportDialog(): Record<string, ReportComponentsProps> {
19
+ const { codeSnippet: { report = {} } = {} } = useThemeConfig();
13
20
  const [isReportDialogShown, setIsReportDialogShown] = useState(false);
14
- const isReportButtonShown = reportSettings.hide === false; // TODO: report temporary disabled by default
21
+ const isReportButtonShown = report?.hide === false; // TODO: report temporary disabled by default
15
22
  const { translate } = useTranslate();
16
23
  const translationKeys = {
24
+ buttonText: 'theme.codeSnippet.report.buttonText',
17
25
  tooltipText: 'theme.codeSnippet.report.tooltipText',
18
26
  label: 'theme.codeSnippet.report.label',
19
27
  };
@@ -24,20 +32,22 @@ export function useReportDialog(reportSettings: ReportSettings): Record<string,
24
32
  const hideReportDialog = () => {
25
33
  setIsReportDialogShown(false);
26
34
  };
27
- const reportButtonProps = {
35
+ const reportButtonProps: ReportButtonProps = {
28
36
  onClick: showReportDialog,
29
- title: translate(translationKeys.tooltipText, reportSettings.tooltipText || 'Report a problem'),
37
+ buttonText: translate(translationKeys.buttonText, 'Report'),
38
+ tooltip: translate(translationKeys.tooltipText, 'Report a problem'),
39
+ visible: isReportButtonShown,
30
40
  };
31
41
  const reportDialogProps: Partial<ReportDialogProps> = {
32
42
  settings: {
33
- label: translate(
34
- translationKeys.label,
35
- reportSettings.label || 'What is wrong with this code?',
36
- ),
43
+ label: translate(translationKeys.label, 'What is wrong with this code?'),
37
44
  },
38
45
  onSubmit: hideReportDialog,
39
46
  onCancel: hideReportDialog,
40
47
  };
41
48
 
42
- return { isReportDialogShown, isReportButtonShown, reportButtonProps, reportDialogProps };
49
+ return {
50
+ reportDialog: { visible: isReportDialogShown, props: reportDialogProps },
51
+ reportButton: { props: reportButtonProps },
52
+ };
43
53
  }
@@ -1,10 +1,6 @@
1
1
  import React, { memo, useRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
- import type { ReactElement } from 'react';
5
-
6
- import { CopyButtonWrapper } from '@theme/components/CopyButton';
7
- import { SampleControls, SamplesControlButton } from '@theme/components/SamplesPanelControls';
8
4
  import { jsonToHTML } from '@theme/utils';
9
5
  import { useMount, useUnmount } from '@theme/hooks';
10
6
  import { CodeBlock } from '@theme/components/CodeBlock';
@@ -26,7 +22,7 @@ function JsonComponent({
26
22
  startLineNumber,
27
23
  onCopyClick,
28
24
  }: JsonProps): JSX.Element {
29
- const node = useRef<HTMLDivElement | null>(null);
25
+ const node = useRef<HTMLPreElement | null>(null);
30
26
 
31
27
  useMount(() => {
32
28
  node?.current?.addEventListener('click', clickListener);
@@ -36,6 +32,13 @@ function JsonComponent({
36
32
  node?.current?.removeEventListener('click', clickListener);
37
33
  });
38
34
 
35
+ const setRef = (instance?: HTMLPreElement | null) => {
36
+ if (instance) node.current = instance;
37
+ };
38
+
39
+ const showFoldingButtons =
40
+ data && Object.values(data).some((value) => typeof value === 'object' && value !== null);
41
+
39
42
  const expandAll = () => {
40
43
  const elements = node?.current?.getElementsByClassName('collapsible');
41
44
  for (const collapsed of Array.prototype.slice.call(elements)) {
@@ -76,40 +79,25 @@ function JsonComponent({
76
79
  collapseElement(event.target as HTMLElement);
77
80
  };
78
81
 
79
- const renderInner = ({ renderCopyButton }: { renderCopyButton: () => ReactElement }) => {
80
- const showFoldingButtons =
81
- data && Object.values(data).some((value) => typeof value === 'object' && value !== null);
82
-
83
- return (
84
- <JsonViewerWrap data-cy="json-viewer">
85
- <SampleControls data-cy="buttons">
86
- {renderCopyButton()}
87
- {showFoldingButtons && (
88
- <>
89
- <SamplesControlButton onClick={expandAll} data-cy="expand-all">
90
- Expand all
91
- </SamplesControlButton>
92
- <SamplesControlButton onClick={collapseAll} data-cy="collapse-all">
93
- Collapse all
94
- </SamplesControlButton>
95
- </>
96
- )}
97
- </SampleControls>
98
- <StyledCodeBlock
99
- className={withLineNumbers ? `${className} line-numbers` : className}
100
- ref={node}
101
- dangerouslySetInnerHTML={{
102
- __html: jsonToHTML(data, jsonSampleExpandLevel, startLineNumber),
103
- }}
104
- />
105
- </JsonViewerWrap>
106
- );
107
- };
108
-
109
82
  return (
110
- <CopyButtonWrapper data-cy="copy-button" data={data} onCopyClick={onCopyClick}>
111
- {renderInner}
112
- </CopyButtonWrapper>
83
+ <JsonViewerWrap
84
+ data-cy="json-viewer"
85
+ data-component-name="JsonViewer/JsonViewer"
86
+ className={className}
87
+ >
88
+ <CodeBlock
89
+ header={{
90
+ controls: {
91
+ copy: { data, onClick: onCopyClick, handleOutside: true },
92
+ expand: showFoldingButtons ? { onClick: expandAll } : undefined,
93
+ collapse: showFoldingButtons ? { onClick: collapseAll } : undefined,
94
+ },
95
+ }}
96
+ codeBlockRef={setRef}
97
+ withLineNumbers={withLineNumbers}
98
+ highlightedHtml={jsonToHTML(data, jsonSampleExpandLevel, startLineNumber)}
99
+ />
100
+ </JsonViewerWrap>
113
101
  );
114
102
  }
115
103
 
@@ -125,113 +113,109 @@ export const JsonViewer = styled(Json).attrs(() => ({
125
113
  border: none;
126
114
  }
127
115
 
128
- contain: content;
129
- overflow-x: auto;
130
- position: relative;
131
- padding: 10px;
132
- border-radius: var(--border-radius);
133
- background-color: var(--panel-samples-code-block-background-color);
134
- color: var(--text-color-inverse);
135
- font-size: var(--code-font-size);
136
- font-family: var(--code-font-family);
137
- white-space: var(--code-wrap, pre);
138
-
139
- &.line-numbers {
140
- padding: 20px 20px 20px 3em;
141
-
142
- *[data-line]:not(.collapsed *[data-line]) {
143
- &:before {
144
- content: attr(data-line);
145
- position: absolute;
146
- left: 0;
147
- min-width: 2em;
148
- text-align: right;
149
- pointer-events: none;
150
- user-select: none;
151
- padding: 0 0.5em;
152
- font-size: 13px;
116
+ pre {
117
+ contain: content;
118
+ overflow-x: auto;
119
+ position: relative;
120
+ border-radius: 0 0 var(--border-radius) var(--border-radius);
121
+
122
+ &.line-numbers {
123
+ padding: 20px 20px 20px 3em;
124
+
125
+ *[data-line]:not(.collapsed *[data-line]) {
126
+ &:before {
127
+ content: attr(data-line);
128
+ position: absolute;
129
+ left: 0;
130
+ min-width: 2em;
131
+ text-align: right;
132
+ pointer-events: none;
133
+ user-select: none;
134
+ padding: 0 0.5em;
135
+ font-size: 13px;
136
+ }
153
137
  }
154
138
  }
155
- }
156
139
 
157
- .callback-function {
158
- color: gray;
159
- }
140
+ .callback-function {
141
+ color: gray;
142
+ }
160
143
 
161
- .ellipsis:after {
162
- content: ' … ';
163
- }
144
+ .ellipsis:after {
145
+ content: ' … ';
146
+ }
164
147
 
165
- .collapsible {
166
- padding-left: 2ch;
167
- display: inline-block;
168
- }
148
+ .collapsible {
149
+ padding-left: 2ch;
150
+ display: inline-block;
151
+ }
169
152
 
170
- .hoverable {
171
- padding: 1px 2px;
172
- display: inline-block;
173
- }
153
+ .hoverable {
154
+ padding: 1px 2px;
155
+ display: inline-block;
156
+ }
174
157
 
175
- .collapsed {
176
- white-space: nowrap;
158
+ .collapsed {
159
+ white-space: nowrap;
177
160
 
178
- & > .collapser:after {
179
- content: '+';
161
+ & > .collapser:after {
162
+ content: '+';
163
+ }
180
164
  }
181
- }
182
-
183
- .hovered {
184
- background-color: rgba(235, 238, 249, 1);
185
- }
186
165
 
187
- .collapser {
188
- --size: 15px;
189
- --margin-right: 3px;
190
-
191
- display: inline-block;
192
- background-color: transparent;
193
- border: 0;
194
- padding: 1px;
195
- color: #fff;
196
- width: var(--size);
197
- height: var(--size);
198
- margin-left: calc((var(--size) + var(--margin-right)) * -1);
199
- margin-right: var(--margin-right);
200
- cursor: pointer;
201
- user-select: none;
202
- -webkit-user-select: none;
203
- font-family: var(--code-font-family);
204
- font-size: var(--code-font-size);
205
-
206
- &:after {
207
- content: '-';
208
- display: flex;
209
- align-items: center;
210
- justify-content: center;
211
- height: 100%;
212
- width: 100%;
166
+ .hovered {
167
+ background-color: rgba(235, 238, 249, 1);
213
168
  }
214
169
 
215
- &:focus {
216
- outline: #fff dotted 1px;
170
+ .collapser {
171
+ --size: 15px;
172
+ --margin-right: 3px;
173
+
174
+ display: inline-block;
175
+ background-color: transparent;
176
+ border: 0;
177
+ padding: 1px;
178
+ color: #fff;
179
+ width: var(--size);
180
+ height: var(--size);
181
+ margin-left: calc((var(--size) + var(--margin-right)) * -1);
182
+ margin-right: var(--margin-right);
183
+ cursor: pointer;
184
+ user-select: none;
185
+ -webkit-user-select: none;
186
+ font-family: var(--code-font-family);
187
+ font-size: var(--code-font-size);
188
+
189
+ &:after {
190
+ content: '-';
191
+ display: flex;
192
+ align-items: center;
193
+ justify-content: center;
194
+ height: 100%;
195
+ width: 100%;
196
+ }
197
+
198
+ &:focus {
199
+ outline: #fff dotted 1px;
200
+ }
217
201
  }
218
- }
219
202
 
220
- .selected {
221
- outline-width: 1px;
222
- outline-style: dotted;
223
- }
203
+ .selected {
204
+ outline-width: 1px;
205
+ outline-style: dotted;
206
+ }
224
207
 
225
- .collapsed > .collapsible {
226
- display: none;
227
- }
208
+ .collapsed > .collapsible {
209
+ display: none;
210
+ }
228
211
 
229
- .ellipsis {
230
- display: none;
231
- }
212
+ .ellipsis {
213
+ display: none;
214
+ }
232
215
 
233
- .collapsed > .ellipsis {
234
- display: inline;
216
+ .collapsed > .ellipsis {
217
+ display: inline;
218
+ }
235
219
  }
236
220
  `;
237
221
 
@@ -239,18 +223,4 @@ export const JsonViewerWrap = styled.div`
239
223
  display: flex;
240
224
  flex-direction: column;
241
225
  flex: 1;
242
-
243
- &:hover > ${SampleControls} {
244
- opacity: 1;
245
- }
246
- `;
247
-
248
- export const StyledCodeBlock = styled(CodeBlock)`
249
- flex: 1;
250
-
251
- code {
252
- font-family: var(--code-font-family);
253
- font-size: 14px;
254
- line-height: 18px;
255
- }
256
226
  `;
@@ -84,6 +84,29 @@ export const baseTable = css`
84
84
  }
85
85
  `;
86
86
 
87
+ export const linksCss = css`
88
+ a:not([role='button']) {
89
+ text-decoration: var(--link-decoration);
90
+ color: var(--link-text-color);
91
+ font-weight: var(--link-font-weight);
92
+
93
+ &:visited {
94
+ color: var(--link-visited-text-color);
95
+ text-decoration: var(--link-visited-decoration);
96
+ }
97
+
98
+ &:hover {
99
+ text-decoration: var(--link-hover-decoration);
100
+ color: var(--link-hover-text-color);
101
+ }
102
+
103
+ &:focus {
104
+ color: var(--link-active-text-color);
105
+ text-decoration: var(--link-active-decoration);
106
+ }
107
+ }
108
+ `;
109
+
87
110
  // TODO: Can users specify another className or we should hardcode it?
88
111
  export function headingAnchor(className = 'anchor'): FlattenSimpleInterpolation {
89
112
  return css`
@@ -117,10 +140,12 @@ export function headingAnchor(className = 'anchor'): FlattenSimpleInterpolation
117
140
  `;
118
141
  }
119
142
 
120
- export const MarkdownWrapper = styled.main.attrs<{ className?: string }>(({ className }) => ({
143
+ export const MarkdownWrapper = styled.main.attrs<{
144
+ className?: string;
145
+ }>(({ className }) => ({
121
146
  'data-component-name': 'Markdown/MarkdownWrapper',
122
147
  className,
123
- }))`
148
+ }))<{ compact?: boolean; inline?: boolean }>`
124
149
  font-weight: var(--font-weight-regular);
125
150
  padding: 0;
126
151
 
@@ -129,26 +154,26 @@ export const MarkdownWrapper = styled.main.attrs<{ className?: string }>(({ clas
129
154
  font-family: var(--font-family-base);
130
155
  line-height: var(--line-height-base);
131
156
 
132
- a:not([role='button']) {
133
- text-decoration: var(--link-decoration);
134
- color: var(--link-text-color);
135
- font-weight: var(--link-font-weight);
136
-
137
- &:visited {
138
- color: var(--link-visited-text-color);
139
- text-decoration: var(--link-visited-decoration);
140
- }
157
+ ${({ compact }) =>
158
+ compact &&
159
+ css`
160
+ p:first-child {
161
+ margin-top: 0;
162
+ }
163
+ p:last-child {
164
+ margin-bottom: 0;
165
+ }
166
+ `}
141
167
 
142
- &:hover {
143
- text-decoration: var(--link-hover-decoration);
144
- color: var(--link-hover-text-color);
145
- }
168
+ ${({ inline }) =>
169
+ inline &&
170
+ css`
171
+ p {
172
+ display: inline-block;
173
+ }
174
+ `}
146
175
 
147
- &:focus {
148
- color: var(--link-active-text-color);
149
- text-decoration: var(--link-active-decoration);
150
- }
151
- }
176
+ ${linksCss}
152
177
 
153
178
  img {
154
179
  max-width: 100%;
@@ -200,40 +225,6 @@ export const MarkdownWrapper = styled.main.attrs<{ className?: string }>(({ clas
200
225
 
201
226
  ${baseTable};
202
227
 
203
- .code-snippets-tabs {
204
- .snippets-tabs-headers {
205
- font-size: 0.9em;
206
-
207
- font-family: var(--heading-font-family);
208
-
209
- .tab-header {
210
- text-align: center;
211
- padding: 0.2em 0.5em;
212
- display: inline-block;
213
- cursor: pointer;
214
- color: var(--text-color-secondary);
215
-
216
- &.active {
217
- color: var(--heading-text-color);
218
- font-weight: var(--font-weight-bold);
219
- }
220
- }
221
- }
222
-
223
- .tab-content {
224
- margin-top: 4px;
225
- display: none;
226
-
227
- pre {
228
- margin-top: 0;
229
- }
230
-
231
- &.active {
232
- display: block;
233
- }
234
- }
235
- }
236
-
237
228
  p {
238
229
  margin: var(--md-paragraph-margin-vertical) var(--md-paragraph-margin-horizontal);
239
230
 
@@ -318,6 +309,26 @@ export const MarkdownWrapper = styled.main.attrs<{ className?: string }>(({ clas
318
309
  font-family: var(--code-font-family);
319
310
  }
320
311
 
312
+ pre {
313
+ white-space: var(--code-wrap, pre);
314
+ background-color: var(--code-block-background-color);
315
+ font-family: var(--code-block-font-family);
316
+ color: var(--code-block-text-color);
317
+ padding: calc(var(--spacing-unit) * 2);
318
+ overflow-x: auto;
319
+ line-height: normal;
320
+ border-radius: var(--code-block-border-radius);
321
+ border: 1px solid var(--code-block-border-color);
322
+
323
+ code {
324
+ background-color: transparent;
325
+ color: inherit;
326
+ font-size: inherit;
327
+ font-family: inherit;
328
+ border: none;
329
+ }
330
+ }
331
+
321
332
  blockquote {
322
333
  margin: var(--md-blockquote-margin-vertical) var(--md-blockquote-margin-horizontal);
323
334
  padding: var(--md-blockquote-padding-vertical) var(--md-blockquote-padding-horizontal);
@@ -10,7 +10,7 @@ import type { ItemState } from '@portal/Sidebar/types';
10
10
  import { MobileUserProfile } from '@theme/components/Navbar/MobileUserProfile';
11
11
  import { getPathnameForLocale } from '@portal/utils';
12
12
  import { useI18nConfig, useTranslate } from '@portal/hooks';
13
- import { ExpandIcon } from '@theme/icons';
13
+ import { ArrowIcon } from '@theme/icons';
14
14
 
15
15
  interface MobileMenuProps {
16
16
  navItems: ResolvedNavItem[];
@@ -88,7 +88,7 @@ export function MobileMenu({
88
88
  data-component-name="Menu/ControlButton"
89
89
  onClick={() => setMenuLevel(MenuLevel.NAVBAR)}
90
90
  >
91
- <ExpandIcon direction="left" />
91
+ <ArrowIcon direction="left" weight="thin" />
92
92
  <ControlButtonLabel paddingDirection="left">
93
93
  {translate(translationKeys.mainMenu, 'Main Menu')}
94
94
  </ControlButtonLabel>
@@ -102,7 +102,7 @@ export function MobileMenu({
102
102
  <ControlButtonLabel paddingDirection="right">
103
103
  {translate(translationKeys.previous, 'Previous')}
104
104
  </ControlButtonLabel>
105
- <ExpandIcon direction="right" />
105
+ <ArrowIcon direction="right" weight="thin" />
106
106
  </ControlButton>
107
107
  )}
108
108
  </ButtonsSection>
@@ -6,7 +6,7 @@ import { MenuItemLabel } from '@theme/components/Menu/MenuItemLabel';
6
6
  import { SeparatorLine } from '@theme/components/Separator/SeparatorLine';
7
7
  import type { ItemState } from '@theme/components/Sidebar/types';
8
8
  import { useTranslate } from '@portal/hooks';
9
- import { ExpandIcon } from '@theme/icons';
9
+ import { ArrowIcon } from '@theme/icons';
10
10
 
11
11
  interface MenuGroupProps {
12
12
  item: ItemState;
@@ -29,7 +29,9 @@ export function MobileMenuGroup({
29
29
  <LabelContainer>
30
30
  <Label>{translate(item.labelTranslationKey, item.label)}</Label>
31
31
  </LabelContainer>
32
- {!!item.items.length && <ExpandIcon direction={isExpanded ? 'down' : 'right'} />}
32
+ {!!item.items.length && (
33
+ <ArrowIcon direction={isExpanded ? 'down' : 'right'} weight="thin" />
34
+ )}
33
35
  </MenuGroupLabel>
34
36
  </MenuLinkItem>
35
37
  <MenuWrapper isExpanded={isExpanded}>{children}</MenuWrapper>
@@ -13,7 +13,6 @@ export const PanelHeader = styled.div.attrs<{ className?: string }>(({ className
13
13
  className,
14
14
  }))<PanelHeaderProps>`
15
15
  position: relative;
16
- z-index: 1;
17
16
  display: flex;
18
17
  align-items: center;
19
18
  justify-content: space-between;
@@ -178,6 +178,8 @@ const TooltipBody = styled.span<
178
178
 
179
179
  font-size: 13px;
180
180
 
181
+ z-index: var(--z-index-overlay);
182
+
181
183
  &::after {
182
184
  position: absolute;
183
185
 
@@ -13,9 +13,7 @@ export * from './CodeBlock';
13
13
  export * from './OpenApiDocs/hooks/OpenApiFooter';
14
14
  export * from './OpenApiDocs/hooks/OpenApiHeader';
15
15
  export * from './OpenApiDocs/hooks/OpenApiTryItSecurityPanel';
16
- export * from './SamplesPanelControls';
17
16
  export * from './Tooltip';
18
- export * from './SourceCode';
19
17
  export * from './Panel';
20
18
  export * from './Feedback';
21
19
  export * from './OperationBadge';
@@ -28,7 +26,6 @@ export * from './OpenApiDocs';
28
26
  export * from './SidebarActions';
29
27
  export * from './Filter';
30
28
  export * from './Tags';
31
- export * from './CodeSample';
32
29
  export * from './Tabs';
33
30
  export * from './Menu';
34
31
  export * from './Separator';