@redocly/theme 0.33.2 → 0.74.2-pingfed.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.
- package/lib/components/Button/Button.js +1 -1
- package/lib/components/CodeBlock/CodeBlock.d.ts +2 -1
- package/lib/components/CodeBlock/CodeBlock.js +3 -3
- package/lib/components/CodeBlock/CodeBlockContainer.d.ts +1 -0
- package/lib/components/CodeBlock/CodeBlockContainer.js +1 -1
- package/lib/components/CopyButton/CopyButton.js +1 -1
- package/lib/components/Markdown/Admonition.js +1 -1
- package/lib/components/Select/Select.js +1 -0
- package/lib/config.d.ts +129 -1
- package/lib/config.js +24 -0
- package/lib/hooks/useThemeConfig.js +3 -1
- package/package.json +3 -3
- package/src/components/Button/Button.tsx +5 -1
- package/src/components/CodeBlock/CodeBlock.tsx +10 -1
- package/src/components/CodeBlock/CodeBlockContainer.tsx +7 -2
- package/src/components/CopyButton/CopyButton.tsx +1 -0
- package/src/components/Markdown/Admonition.tsx +1 -1
- package/src/components/Select/Select.tsx +1 -0
- package/src/config.ts +30 -1
- package/src/hooks/useThemeConfig.ts +2 -0
|
@@ -148,7 +148,7 @@ const ButtonComponent = (props) => {
|
|
|
148
148
|
props.icon ? react_1.default.createElement(StyledIcon, null, props.icon) : null,
|
|
149
149
|
props.children));
|
|
150
150
|
if (props.to) {
|
|
151
|
-
return react_1.default.createElement(StyledButtonLink, { to: props.to }, button);
|
|
151
|
+
return (react_1.default.createElement(StyledButtonLink, { to: props.to, onClick: props.onClick }, button));
|
|
152
152
|
}
|
|
153
153
|
else {
|
|
154
154
|
return button;
|
|
@@ -15,6 +15,7 @@ export interface CodeBlockProps {
|
|
|
15
15
|
codeBlockRef?: (instance: HTMLPreElement | null) => void;
|
|
16
16
|
codeBlockMaxHeight?: string;
|
|
17
17
|
hideCodeColors?: boolean;
|
|
18
|
+
wrapContents?: boolean;
|
|
18
19
|
}
|
|
19
20
|
export interface Sample {
|
|
20
21
|
lang: string;
|
|
@@ -37,4 +38,4 @@ export interface ExternalSource {
|
|
|
37
38
|
properties?: any;
|
|
38
39
|
operation?: any;
|
|
39
40
|
}
|
|
40
|
-
export declare function CodeBlock({ lang, source, externalSource, header, dataTestId, codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, hideCodeColors, }: CodeBlockProps): JSX.Element;
|
|
41
|
+
export declare function CodeBlock({ lang, source, externalSource, header, dataTestId, codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, hideCodeColors, wrapContents, }: CodeBlockProps): JSX.Element;
|
|
@@ -32,7 +32,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
32
32
|
const utils_1 = require("../../utils");
|
|
33
33
|
const Feedback_1 = require("../../components/Feedback");
|
|
34
34
|
const CodeBlock_1 = require("../../components/CodeBlock");
|
|
35
|
-
function CodeBlock({ lang, source, externalSource, header, dataTestId = 'source-code', codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, hideCodeColors, }) {
|
|
35
|
+
function CodeBlock({ lang, source, externalSource, header, dataTestId = 'source-code', codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, hideCodeColors, wrapContents = false, }) {
|
|
36
36
|
var _a;
|
|
37
37
|
const [sourceCode, setSourceCode] = (0, react_1.useState)(source !== null && source !== void 0 ? source : '');
|
|
38
38
|
const highlightedCode = highlightedHtml || (0, utils_1.highlight)(sourceCode, lang);
|
|
@@ -48,7 +48,7 @@ function CodeBlock({ lang, source, externalSource, header, dataTestId = 'source-
|
|
|
48
48
|
}, [source, externalSource]);
|
|
49
49
|
const { reportDialog, reportButton } = (0, Feedback_1.useReportDialog)();
|
|
50
50
|
const controls = Object.assign(Object.assign({}, header === null || header === void 0 ? void 0 : header.controls), { report: ((_a = header === null || header === void 0 ? void 0 : header.controls) === null || _a === void 0 ? void 0 : _a.report)
|
|
51
|
-
? Object.assign(Object.assign({}, header.controls.report), { props: reportButton.props }) : { props: reportButton.props } });
|
|
51
|
+
? Object.assign(Object.assign({}, header.controls.report), { props: Object.assign(Object.assign({}, reportButton.props), header.controls.report.props) }) : { props: reportButton.props } });
|
|
52
52
|
if (controls.copy && !controls.copy.handleOutside) {
|
|
53
53
|
controls.copy.data = sourceCode;
|
|
54
54
|
}
|
|
@@ -59,7 +59,7 @@ function CodeBlock({ lang, source, externalSource, header, dataTestId = 'source-
|
|
|
59
59
|
__html: withLineNumbers
|
|
60
60
|
? (0, utils_1.addLineNumbers)(highlightedCode, startLineNumber)
|
|
61
61
|
: highlightedCode,
|
|
62
|
-
}, "data-cy": dataTestId, hideCodeColors: hideCodeColors, maxHeight: codeBlockMaxHeight, withControls: true }),
|
|
62
|
+
}, "data-cy": dataTestId, hideCodeColors: hideCodeColors, maxHeight: codeBlockMaxHeight, withControls: true, wrapContents: wrapContents }),
|
|
63
63
|
reportDialog.visible && (react_1.default.createElement(Feedback_1.ReportDialog, Object.assign({}, reportDialog.props, { location: sourceCode, lang: lang }))))));
|
|
64
64
|
}
|
|
65
65
|
exports.CodeBlock = CodeBlock;
|
|
@@ -40,7 +40,7 @@ exports.CodeBlockContainer = styled_components_1.default.pre.attrs(({ className
|
|
|
40
40
|
background-color: var(--code-block-background-color);
|
|
41
41
|
color: var(--code-block-text-color);
|
|
42
42
|
font-size: var(--code-block-font-size);
|
|
43
|
-
white-space: var(--code-wrap, pre);
|
|
43
|
+
white-space: ${({ wrapContents }) => (wrapContents ? 'pre-wrap' : 'var(--code-wrap, pre)')};
|
|
44
44
|
max-height: ${({ maxHeight }) => maxHeight ? maxHeight : 'var(--code-block-max-height, 600px);'};
|
|
45
45
|
word-break: var(--code-block-word-break, initial);
|
|
46
46
|
|
|
@@ -47,7 +47,7 @@ function CopyButtonComponent({ data, type = 'icon', toasterPlacement = 'top', to
|
|
|
47
47
|
onCopyClick === null || onCopyClick === void 0 ? void 0 : onCopyClick();
|
|
48
48
|
};
|
|
49
49
|
return (react_1.default.createElement(Tooltip_1.Tooltip, { className: "copy-button", tip: translate('theme.codeSnippet.copy.buttonText', toasterText || 'Copied!'), isOpen: tooltip.isOpened, placement: toasterPlacement },
|
|
50
|
-
react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { onClick: () => copy(toasterDuration), "data-cy": dataTestId, asIcon: type === 'icon', title: translate('theme.codeSnippet.copy.tooltipText', tooltipText || 'Copy to clipboard'), "data-testid": dataTestId }, type === 'icon' ? (react_1.default.createElement(icons_1.CopyIcon, null)) : (translate('theme.codeSnippet.copy.toasterText', buttonText || 'Copy')))));
|
|
50
|
+
react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { onClick: () => copy(toasterDuration), type: "button", "data-cy": dataTestId, asIcon: type === 'icon', title: translate('theme.codeSnippet.copy.tooltipText', tooltipText || 'Copy to clipboard'), "data-testid": dataTestId }, type === 'icon' ? (react_1.default.createElement(icons_1.CopyIcon, null)) : (translate('theme.codeSnippet.copy.toasterText', buttonText || 'Copy')))));
|
|
51
51
|
}
|
|
52
52
|
exports.CopyButton = (0, react_1.memo)(CopyButtonComponent);
|
|
53
53
|
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -39,7 +39,7 @@ const TextContainer = styled_components_1.default.div `
|
|
|
39
39
|
display: flex;
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
gap: var(--spacing-unit);
|
|
42
|
-
|
|
42
|
+
flex: 1;
|
|
43
43
|
`;
|
|
44
44
|
const Heading = styled_components_1.default.div `
|
|
45
45
|
letter-spacing: var(--admonition-heading-letter-spacing);
|
package/lib/config.d.ts
CHANGED
|
@@ -192,6 +192,34 @@ declare const gtmAnalyticsConfigSchema: {
|
|
|
192
192
|
readonly additionalProperties: false;
|
|
193
193
|
readonly required: readonly ["trackingId"];
|
|
194
194
|
};
|
|
195
|
+
declare const productGoogleAnalyticsConfigSchema: {
|
|
196
|
+
readonly type: "object";
|
|
197
|
+
readonly properties: {
|
|
198
|
+
readonly includeInDevelopment: {
|
|
199
|
+
readonly type: "boolean";
|
|
200
|
+
};
|
|
201
|
+
readonly trackingId: {
|
|
202
|
+
readonly type: "string";
|
|
203
|
+
};
|
|
204
|
+
readonly conversionId: {
|
|
205
|
+
readonly type: "string";
|
|
206
|
+
};
|
|
207
|
+
readonly floodlightId: {
|
|
208
|
+
readonly type: "string";
|
|
209
|
+
};
|
|
210
|
+
readonly optimizeId: {
|
|
211
|
+
readonly type: "string";
|
|
212
|
+
};
|
|
213
|
+
readonly exclude: {
|
|
214
|
+
readonly type: "array";
|
|
215
|
+
readonly items: {
|
|
216
|
+
readonly type: "string";
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
readonly additionalProperties: false;
|
|
221
|
+
readonly required: readonly ["trackingId"];
|
|
222
|
+
};
|
|
195
223
|
declare const googleAnalyticsConfigSchema: {
|
|
196
224
|
readonly type: "object";
|
|
197
225
|
readonly properties: {
|
|
@@ -228,6 +256,37 @@ declare const googleAnalyticsConfigSchema: {
|
|
|
228
256
|
readonly cookieExpires: {
|
|
229
257
|
readonly type: "number";
|
|
230
258
|
};
|
|
259
|
+
readonly trackers: {
|
|
260
|
+
readonly type: "object";
|
|
261
|
+
readonly additionalProperties: {
|
|
262
|
+
readonly type: "object";
|
|
263
|
+
readonly properties: {
|
|
264
|
+
readonly includeInDevelopment: {
|
|
265
|
+
readonly type: "boolean";
|
|
266
|
+
};
|
|
267
|
+
readonly trackingId: {
|
|
268
|
+
readonly type: "string";
|
|
269
|
+
};
|
|
270
|
+
readonly conversionId: {
|
|
271
|
+
readonly type: "string";
|
|
272
|
+
};
|
|
273
|
+
readonly floodlightId: {
|
|
274
|
+
readonly type: "string";
|
|
275
|
+
};
|
|
276
|
+
readonly optimizeId: {
|
|
277
|
+
readonly type: "string";
|
|
278
|
+
};
|
|
279
|
+
readonly exclude: {
|
|
280
|
+
readonly type: "array";
|
|
281
|
+
readonly items: {
|
|
282
|
+
readonly type: "string";
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
readonly additionalProperties: false;
|
|
287
|
+
readonly required: readonly ["trackingId"];
|
|
288
|
+
};
|
|
289
|
+
};
|
|
231
290
|
};
|
|
232
291
|
readonly additionalProperties: false;
|
|
233
292
|
readonly required: readonly ["trackingId"];
|
|
@@ -1585,6 +1644,37 @@ export declare const themeConfigSchema: {
|
|
|
1585
1644
|
readonly cookieExpires: {
|
|
1586
1645
|
readonly type: "number";
|
|
1587
1646
|
};
|
|
1647
|
+
readonly trackers: {
|
|
1648
|
+
readonly type: "object";
|
|
1649
|
+
readonly additionalProperties: {
|
|
1650
|
+
readonly type: "object";
|
|
1651
|
+
readonly properties: {
|
|
1652
|
+
readonly includeInDevelopment: {
|
|
1653
|
+
readonly type: "boolean";
|
|
1654
|
+
};
|
|
1655
|
+
readonly trackingId: {
|
|
1656
|
+
readonly type: "string";
|
|
1657
|
+
};
|
|
1658
|
+
readonly conversionId: {
|
|
1659
|
+
readonly type: "string";
|
|
1660
|
+
};
|
|
1661
|
+
readonly floodlightId: {
|
|
1662
|
+
readonly type: "string";
|
|
1663
|
+
};
|
|
1664
|
+
readonly optimizeId: {
|
|
1665
|
+
readonly type: "string";
|
|
1666
|
+
};
|
|
1667
|
+
readonly exclude: {
|
|
1668
|
+
readonly type: "array";
|
|
1669
|
+
readonly items: {
|
|
1670
|
+
readonly type: "string";
|
|
1671
|
+
};
|
|
1672
|
+
};
|
|
1673
|
+
};
|
|
1674
|
+
readonly additionalProperties: false;
|
|
1675
|
+
readonly required: readonly ["trackingId"];
|
|
1676
|
+
};
|
|
1677
|
+
};
|
|
1588
1678
|
};
|
|
1589
1679
|
readonly additionalProperties: false;
|
|
1590
1680
|
readonly required: readonly ["trackingId"];
|
|
@@ -2393,6 +2483,39 @@ export declare const productThemeOverrideSchema: {
|
|
|
2393
2483
|
readonly additionalProperties: false;
|
|
2394
2484
|
readonly default: {};
|
|
2395
2485
|
};
|
|
2486
|
+
readonly analytics: {
|
|
2487
|
+
readonly type: "object";
|
|
2488
|
+
readonly properties: {
|
|
2489
|
+
readonly ga: {
|
|
2490
|
+
readonly type: "object";
|
|
2491
|
+
readonly properties: {
|
|
2492
|
+
readonly includeInDevelopment: {
|
|
2493
|
+
readonly type: "boolean";
|
|
2494
|
+
};
|
|
2495
|
+
readonly trackingId: {
|
|
2496
|
+
readonly type: "string";
|
|
2497
|
+
};
|
|
2498
|
+
readonly conversionId: {
|
|
2499
|
+
readonly type: "string";
|
|
2500
|
+
};
|
|
2501
|
+
readonly floodlightId: {
|
|
2502
|
+
readonly type: "string";
|
|
2503
|
+
};
|
|
2504
|
+
readonly optimizeId: {
|
|
2505
|
+
readonly type: "string";
|
|
2506
|
+
};
|
|
2507
|
+
readonly exclude: {
|
|
2508
|
+
readonly type: "array";
|
|
2509
|
+
readonly items: {
|
|
2510
|
+
readonly type: "string";
|
|
2511
|
+
};
|
|
2512
|
+
};
|
|
2513
|
+
};
|
|
2514
|
+
readonly additionalProperties: false;
|
|
2515
|
+
readonly required: readonly ["trackingId"];
|
|
2516
|
+
};
|
|
2517
|
+
};
|
|
2518
|
+
};
|
|
2396
2519
|
};
|
|
2397
2520
|
readonly additionalProperties: true;
|
|
2398
2521
|
readonly default: {};
|
|
@@ -2420,7 +2543,12 @@ export type ThemeUIConfig = ThemeConfig & {
|
|
|
2420
2543
|
};
|
|
2421
2544
|
};
|
|
2422
2545
|
export type ProductConfig = FromSchema<typeof productConfigSchema>;
|
|
2423
|
-
export type
|
|
2546
|
+
export type ProductGoogleAnalyticsConfig = FromSchema<typeof productGoogleAnalyticsConfigSchema>;
|
|
2547
|
+
export type ProductThemeOverrideConfig = Pick<ThemeUIConfig, 'logo' | 'navbar' | 'footer' | 'sidebar' | 'search' | 'codeSnippet' | 'breadcrumbs'> & {
|
|
2548
|
+
analytics?: {
|
|
2549
|
+
ga?: ProductGoogleAnalyticsConfig;
|
|
2550
|
+
};
|
|
2551
|
+
};
|
|
2424
2552
|
export type ProductUiConfig = ProductConfig & {
|
|
2425
2553
|
slug: string;
|
|
2426
2554
|
link: string;
|
package/lib/config.js
CHANGED
|
@@ -173,6 +173,19 @@ const gtmAnalyticsConfigSchema = {
|
|
|
173
173
|
additionalProperties: false,
|
|
174
174
|
required: ['trackingId'],
|
|
175
175
|
};
|
|
176
|
+
const productGoogleAnalyticsConfigSchema = {
|
|
177
|
+
type: 'object',
|
|
178
|
+
properties: {
|
|
179
|
+
includeInDevelopment: { type: 'boolean' },
|
|
180
|
+
trackingId: { type: 'string' },
|
|
181
|
+
conversionId: { type: 'string' },
|
|
182
|
+
floodlightId: { type: 'string' },
|
|
183
|
+
optimizeId: { type: 'string' },
|
|
184
|
+
exclude: { type: 'array', items: { type: 'string' } },
|
|
185
|
+
},
|
|
186
|
+
additionalProperties: false,
|
|
187
|
+
required: ['trackingId'],
|
|
188
|
+
};
|
|
176
189
|
const googleAnalyticsConfigSchema = {
|
|
177
190
|
type: 'object',
|
|
178
191
|
properties: {
|
|
@@ -186,6 +199,11 @@ const googleAnalyticsConfigSchema = {
|
|
|
186
199
|
optimizeId: { type: 'string' },
|
|
187
200
|
anonymizeIp: { type: 'boolean' },
|
|
188
201
|
cookieExpires: { type: 'number' },
|
|
202
|
+
// All enabled tracking configs
|
|
203
|
+
trackers: {
|
|
204
|
+
type: 'object',
|
|
205
|
+
additionalProperties: productGoogleAnalyticsConfigSchema,
|
|
206
|
+
},
|
|
189
207
|
},
|
|
190
208
|
additionalProperties: false,
|
|
191
209
|
required: ['trackingId'],
|
|
@@ -607,6 +625,12 @@ exports.productThemeOverrideSchema = {
|
|
|
607
625
|
search: exports.themeConfigSchema.properties.search,
|
|
608
626
|
codeSnippet: exports.themeConfigSchema.properties.codeSnippet,
|
|
609
627
|
breadcrumbs: exports.themeConfigSchema.properties.breadcrumbs,
|
|
628
|
+
analytics: {
|
|
629
|
+
type: 'object',
|
|
630
|
+
properties: {
|
|
631
|
+
ga: productGoogleAnalyticsConfigSchema,
|
|
632
|
+
},
|
|
633
|
+
},
|
|
610
634
|
},
|
|
611
635
|
additionalProperties: true,
|
|
612
636
|
default: {},
|
|
@@ -8,7 +8,9 @@ function useThemeConfig(useProductConfig = true) {
|
|
|
8
8
|
const themeConfig = (0, react_1.useContext)(exports.ThemeConfigContext) || {};
|
|
9
9
|
const currentProduct = (0, hooks_1.useCurrentProduct)();
|
|
10
10
|
const mergedTheme = useProductConfig && (currentProduct === null || currentProduct === void 0 ? void 0 : currentProduct.themeOverride)
|
|
11
|
-
? Object.assign(Object.assign({}, themeConfig), currentProduct.themeOverride)
|
|
11
|
+
? Object.assign(Object.assign(Object.assign({}, themeConfig), currentProduct.themeOverride), {
|
|
12
|
+
// Do not override analytics config from product
|
|
13
|
+
analytics: themeConfig.analytics }) : themeConfig;
|
|
12
14
|
return mergedTheme;
|
|
13
15
|
}
|
|
14
16
|
exports.useThemeConfig = useThemeConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.74.2-pingfed.1",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"prismjs": "^1.28.0",
|
|
24
24
|
"react": "^17.0.0 || ^18.0.0",
|
|
25
25
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
26
|
-
"react-router-dom": "^6.
|
|
26
|
+
"react-router-dom": "^6.21.1",
|
|
27
27
|
"styled-components": "^4.1.1 || ^5.3.11",
|
|
28
28
|
"styled-system": "^5.1.5"
|
|
29
29
|
},
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"lodash.throttle": "4.1.1",
|
|
66
66
|
"npm-run-all": "4.1.5",
|
|
67
67
|
"react-refresh": "0.14.0",
|
|
68
|
-
"react-router-dom": "6.
|
|
68
|
+
"react-router-dom": "6.21.1",
|
|
69
69
|
"storybook": "7.6.4",
|
|
70
70
|
"storybook-addon-pseudo-states": "2.1.2",
|
|
71
71
|
"storybook-design-token": "3.0.0-beta.6",
|
|
@@ -161,7 +161,11 @@ const ButtonComponent: React.FC<ButtonProps> = (props) => {
|
|
|
161
161
|
);
|
|
162
162
|
|
|
163
163
|
if (props.to) {
|
|
164
|
-
return
|
|
164
|
+
return (
|
|
165
|
+
<StyledButtonLink to={props.to} onClick={props.onClick}>
|
|
166
|
+
{button}
|
|
167
|
+
</StyledButtonLink>
|
|
168
|
+
);
|
|
165
169
|
} else {
|
|
166
170
|
return button;
|
|
167
171
|
}
|
|
@@ -22,6 +22,7 @@ export interface CodeBlockProps {
|
|
|
22
22
|
codeBlockRef?: (instance: HTMLPreElement | null) => void;
|
|
23
23
|
codeBlockMaxHeight?: string;
|
|
24
24
|
hideCodeColors?: boolean;
|
|
25
|
+
wrapContents?: boolean;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export interface Sample {
|
|
@@ -61,6 +62,7 @@ export function CodeBlock({
|
|
|
61
62
|
codeBlockMaxHeight,
|
|
62
63
|
tabs,
|
|
63
64
|
hideCodeColors,
|
|
65
|
+
wrapContents = false,
|
|
64
66
|
}: CodeBlockProps): JSX.Element {
|
|
65
67
|
const [sourceCode, setSourceCode] = useState<string>(source ?? '');
|
|
66
68
|
|
|
@@ -80,7 +82,13 @@ export function CodeBlock({
|
|
|
80
82
|
const controls = {
|
|
81
83
|
...header?.controls,
|
|
82
84
|
report: header?.controls?.report
|
|
83
|
-
? {
|
|
85
|
+
? {
|
|
86
|
+
...header.controls.report,
|
|
87
|
+
props: {
|
|
88
|
+
...reportButton.props,
|
|
89
|
+
...header.controls.report.props,
|
|
90
|
+
},
|
|
91
|
+
}
|
|
84
92
|
: { props: reportButton.props },
|
|
85
93
|
};
|
|
86
94
|
|
|
@@ -109,6 +117,7 @@ export function CodeBlock({
|
|
|
109
117
|
hideCodeColors={hideCodeColors}
|
|
110
118
|
maxHeight={codeBlockMaxHeight}
|
|
111
119
|
withControls={true}
|
|
120
|
+
wrapContents={wrapContents}
|
|
112
121
|
/>
|
|
113
122
|
{reportDialog.visible && (
|
|
114
123
|
<ReportDialog
|
|
@@ -5,7 +5,12 @@ import { generateCodeBlockTokens } from '@theme/utils';
|
|
|
5
5
|
export const CodeBlockContainer = styled.pre.attrs<{ className?: string }>(({ className }) => ({
|
|
6
6
|
'data-component-name': 'CodeBlock/CodeBlockContainer',
|
|
7
7
|
className,
|
|
8
|
-
}))<{
|
|
8
|
+
}))<{
|
|
9
|
+
withControls?: boolean;
|
|
10
|
+
maxHeight?: string;
|
|
11
|
+
hideCodeColors?: boolean;
|
|
12
|
+
wrapContents?: boolean;
|
|
13
|
+
}>`
|
|
9
14
|
&& {
|
|
10
15
|
overflow-x: auto;
|
|
11
16
|
font-family: var(--code-block-font-family);
|
|
@@ -16,7 +21,7 @@ export const CodeBlockContainer = styled.pre.attrs<{ className?: string }>(({ cl
|
|
|
16
21
|
background-color: var(--code-block-background-color);
|
|
17
22
|
color: var(--code-block-text-color);
|
|
18
23
|
font-size: var(--code-block-font-size);
|
|
19
|
-
white-space: var(--code-wrap, pre);
|
|
24
|
+
white-space: ${({ wrapContents }) => (wrapContents ? 'pre-wrap' : 'var(--code-wrap, pre)')};
|
|
20
25
|
max-height: ${({ maxHeight }) =>
|
|
21
26
|
maxHeight ? maxHeight : 'var(--code-block-max-height, 600px);'};
|
|
22
27
|
word-break: var(--code-block-word-break, initial);
|
|
@@ -60,6 +60,7 @@ function CopyButtonComponent({
|
|
|
60
60
|
>
|
|
61
61
|
<CodeBlockControlButton
|
|
62
62
|
onClick={() => copy(toasterDuration)}
|
|
63
|
+
type="button"
|
|
63
64
|
data-cy={dataTestId}
|
|
64
65
|
asIcon={type === 'icon'}
|
|
65
66
|
title={translate('theme.codeSnippet.copy.tooltipText', tooltipText || 'Copy to clipboard')}
|
|
@@ -175,6 +175,7 @@ export const SelectListItem = styled.li<{ selected: boolean }>`
|
|
|
175
175
|
padding: var(--select-list-item-vertical-padding) var(--select-list-item-horizontal-padding);
|
|
176
176
|
overflow: hidden;
|
|
177
177
|
text-overflow: ellipsis;
|
|
178
|
+
display: block;
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
:hover {
|
package/src/config.ts
CHANGED
|
@@ -196,6 +196,21 @@ const gtmAnalyticsConfigSchema = {
|
|
|
196
196
|
required: ['trackingId'],
|
|
197
197
|
} as const;
|
|
198
198
|
|
|
199
|
+
const productGoogleAnalyticsConfigSchema = {
|
|
200
|
+
type: 'object',
|
|
201
|
+
properties: {
|
|
202
|
+
includeInDevelopment: { type: 'boolean' },
|
|
203
|
+
trackingId: { type: 'string' },
|
|
204
|
+
|
|
205
|
+
conversionId: { type: 'string' },
|
|
206
|
+
floodlightId: { type: 'string' },
|
|
207
|
+
optimizeId: { type: 'string' },
|
|
208
|
+
exclude: { type: 'array', items: { type: 'string' } },
|
|
209
|
+
},
|
|
210
|
+
additionalProperties: false,
|
|
211
|
+
required: ['trackingId'],
|
|
212
|
+
} as const;
|
|
213
|
+
|
|
199
214
|
const googleAnalyticsConfigSchema = {
|
|
200
215
|
type: 'object',
|
|
201
216
|
properties: {
|
|
@@ -212,6 +227,12 @@ const googleAnalyticsConfigSchema = {
|
|
|
212
227
|
optimizeId: { type: 'string' },
|
|
213
228
|
anonymizeIp: { type: 'boolean' },
|
|
214
229
|
cookieExpires: { type: 'number' },
|
|
230
|
+
|
|
231
|
+
// All enabled tracking configs
|
|
232
|
+
trackers: {
|
|
233
|
+
type: 'object',
|
|
234
|
+
additionalProperties: productGoogleAnalyticsConfigSchema,
|
|
235
|
+
},
|
|
215
236
|
},
|
|
216
237
|
additionalProperties: false,
|
|
217
238
|
required: ['trackingId'],
|
|
@@ -698,6 +719,12 @@ export const productThemeOverrideSchema = {
|
|
|
698
719
|
search: themeConfigSchema.properties.search,
|
|
699
720
|
codeSnippet: themeConfigSchema.properties.codeSnippet,
|
|
700
721
|
breadcrumbs: themeConfigSchema.properties.breadcrumbs,
|
|
722
|
+
analytics: {
|
|
723
|
+
type: 'object',
|
|
724
|
+
properties: {
|
|
725
|
+
ga: productGoogleAnalyticsConfigSchema,
|
|
726
|
+
},
|
|
727
|
+
},
|
|
701
728
|
},
|
|
702
729
|
additionalProperties: true,
|
|
703
730
|
default: {},
|
|
@@ -729,10 +756,12 @@ export type ThemeUIConfig = ThemeConfig & {
|
|
|
729
756
|
};
|
|
730
757
|
|
|
731
758
|
export type ProductConfig = FromSchema<typeof productConfigSchema>;
|
|
759
|
+
|
|
760
|
+
export type ProductGoogleAnalyticsConfig = FromSchema<typeof productGoogleAnalyticsConfigSchema>;
|
|
732
761
|
export type ProductThemeOverrideConfig = Pick<
|
|
733
762
|
ThemeUIConfig,
|
|
734
763
|
'logo' | 'navbar' | 'footer' | 'sidebar' | 'search' | 'codeSnippet' | 'breadcrumbs'
|
|
735
|
-
|
|
764
|
+
> & { analytics?: { ga?: ProductGoogleAnalyticsConfig } };
|
|
736
765
|
export type ProductUiConfig = ProductConfig & {
|
|
737
766
|
slug: string;
|
|
738
767
|
link: string;
|