@redocly/theme 0.37.3 → 0.37.4
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.
|
@@ -31,7 +31,7 @@ const react_1 = __importStar(require("react"));
|
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const CodeBlock_1 = require("../../components/CodeBlock/CodeBlock");
|
|
33
33
|
const helpers_1 = require("./helpers");
|
|
34
|
-
function JsonComponent({ data, expandLevel = 1, className, onCopyClick }) {
|
|
34
|
+
function JsonComponent({ data, expandLevel = 1, className, onCopyClick, title, }) {
|
|
35
35
|
const showFoldingButtons = data && Object.values(data).some((value) => typeof value === 'object' && value !== null);
|
|
36
36
|
const [expandAllSignal, setExpandAllSignal] = react_1.default.useState(undefined);
|
|
37
37
|
const expandAll = () => {
|
|
@@ -49,6 +49,7 @@ function JsonComponent({ data, expandLevel = 1, className, onCopyClick }) {
|
|
|
49
49
|
const source = JSON.stringify(data, null, 2);
|
|
50
50
|
return (react_1.default.createElement(exports.JsonViewerWrap, { "data-testid": "json-viewer", "data-component-name": "JsonViewer/JsonViewer", className: className },
|
|
51
51
|
react_1.default.createElement(CodeBlock_1.CodeBlock, { header: {
|
|
52
|
+
title,
|
|
52
53
|
className: 'code-block-header',
|
|
53
54
|
controls: {
|
|
54
55
|
copy: { data, onClick: onCopyClick, handleOutside: true },
|
|
@@ -678,15 +678,6 @@ const apiReferenceDocs = (0, styled_components_1.css) `
|
|
|
678
678
|
--schema-recursive-bg-color: var(--color-persian-green-6); // @presenter Color
|
|
679
679
|
--schema-recursive-border-color: var(--schema-recursive-bg-color); // @presenter Color
|
|
680
680
|
|
|
681
|
-
/**
|
|
682
|
-
* @tokens GraphQL Docs Reference Schema Non null label
|
|
683
|
-
* @presenter Color
|
|
684
|
-
*/
|
|
685
|
-
|
|
686
|
-
--schema-non-null-text-color: var(--schema-inline-code-text-color);
|
|
687
|
-
--schema-non-null-bg-color: var(--schema-inline-bg-color);
|
|
688
|
-
--schema-non-null-border-color: var(--schema-inline-border-color);
|
|
689
|
-
|
|
690
681
|
/**
|
|
691
682
|
* @tokens API Reference Schema Nested styles
|
|
692
683
|
*/
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import type { CodeBlockControlsProps } from '@redocly/theme/components/CodeBlock/CodeBlockControls';
|
|
5
|
+
|
|
4
6
|
import { CodeBlock } from '@redocly/theme/components/CodeBlock/CodeBlock';
|
|
5
7
|
|
|
6
8
|
import { JsonValue } from './helpers';
|
|
7
9
|
|
|
8
10
|
export type JsonProps = {
|
|
11
|
+
title?: CodeBlockControlsProps['title'];
|
|
9
12
|
data: any;
|
|
10
13
|
className?: string;
|
|
11
14
|
expandLevel: number;
|
|
@@ -13,7 +16,13 @@ export type JsonProps = {
|
|
|
13
16
|
onCopyClick?: () => void;
|
|
14
17
|
};
|
|
15
18
|
|
|
16
|
-
function JsonComponent({
|
|
19
|
+
function JsonComponent({
|
|
20
|
+
data,
|
|
21
|
+
expandLevel = 1,
|
|
22
|
+
className,
|
|
23
|
+
onCopyClick,
|
|
24
|
+
title,
|
|
25
|
+
}: JsonProps): JSX.Element {
|
|
17
26
|
const showFoldingButtons =
|
|
18
27
|
data && Object.values(data).some((value) => typeof value === 'object' && value !== null);
|
|
19
28
|
|
|
@@ -43,6 +52,7 @@ function JsonComponent({ data, expandLevel = 1, className, onCopyClick }: JsonPr
|
|
|
43
52
|
>
|
|
44
53
|
<CodeBlock
|
|
45
54
|
header={{
|
|
55
|
+
title,
|
|
46
56
|
className: 'code-block-header',
|
|
47
57
|
controls: {
|
|
48
58
|
copy: { data, onClick: onCopyClick, handleOutside: true },
|
|
@@ -685,15 +685,6 @@ const apiReferenceDocs = css`
|
|
|
685
685
|
--schema-recursive-bg-color: var(--color-persian-green-6); // @presenter Color
|
|
686
686
|
--schema-recursive-border-color: var(--schema-recursive-bg-color); // @presenter Color
|
|
687
687
|
|
|
688
|
-
/**
|
|
689
|
-
* @tokens GraphQL Docs Reference Schema Non null label
|
|
690
|
-
* @presenter Color
|
|
691
|
-
*/
|
|
692
|
-
|
|
693
|
-
--schema-non-null-text-color: var(--schema-inline-code-text-color);
|
|
694
|
-
--schema-non-null-bg-color: var(--schema-inline-bg-color);
|
|
695
|
-
--schema-non-null-border-color: var(--schema-inline-border-color);
|
|
696
|
-
|
|
697
688
|
/**
|
|
698
689
|
* @tokens API Reference Schema Nested styles
|
|
699
690
|
*/
|