@bundle-stats/ui 4.16.0-beta.3 → 4.16.0-beta.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.
- package/lib/components/preview-source/preview-source.js +8 -5
- package/lib/components/preview-source/preview-source.js.map +1 -1
- package/lib/components/preview-source/preview-source.module.css +12 -0
- package/lib/css/variables.css +4 -0
- package/lib/ui/dialog/dialog.module.css +3 -3
- package/lib/ui/skeleton/skeleton.module.css +3 -3
- package/lib-esm/components/preview-source/preview-source.js +8 -5
- package/lib-esm/components/preview-source/preview-source.js.map +1 -1
- package/lib-esm/components/preview-source/preview-source.module.css +12 -0
- package/lib-esm/css/variables.css +4 -0
- package/lib-esm/ui/dialog/dialog.module.css +3 -3
- package/lib-esm/ui/skeleton/skeleton.module.css +3 -3
- package/package.json +3 -3
- package/src/components/preview-source/preview-source.module.css +12 -0
- package/src/components/preview-source/preview-source.stories.tsx +6 -0
- package/src/components/preview-source/preview-source.tsx +30 -19
- package/src/css/variables.css +4 -0
- package/src/ui/dialog/dialog.module.css +3 -3
- package/src/ui/skeleton/skeleton.module.css +3 -3
- package/types/components/preview-source/preview-source.d.ts +2 -1
|
@@ -12,14 +12,17 @@ const control_group_1 = require("../../ui/control-group");
|
|
|
12
12
|
const tooltip_1 = require("../../ui/tooltip");
|
|
13
13
|
const textarea_1 = require("../../ui/textarea");
|
|
14
14
|
const preview_source_module_css_1 = __importDefault(require("./preview-source.module.css"));
|
|
15
|
+
const DEFAULT_ROWS = 10;
|
|
15
16
|
const PreviewSource = (props) => {
|
|
16
|
-
const { className = '', source, download = false, ...restProps } = props;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const { className = '', source, rows = DEFAULT_ROWS, download = false, ...restProps } = props;
|
|
18
|
+
const isEmpty = !source;
|
|
19
|
+
const rootClassName = (0, classnames_1.default)(preview_source_module_css_1.default.root, className, isEmpty && preview_source_module_css_1.default.isEmpty);
|
|
20
|
+
return (react_1.default.createElement("div", { className: rootClassName, ...restProps },
|
|
21
|
+
source && (react_1.default.createElement(control_group_1.ControlGroup, { className: preview_source_module_css_1.default.toolbar },
|
|
19
22
|
react_1.default.createElement(copy_to_clipboard_1.CopyToClipboard, { outline: true, size: "small", text: source }),
|
|
20
23
|
download && (react_1.default.createElement(tooltip_1.Tooltip, { title: `Download ${download}`, className: preview_source_module_css_1.default.downloadTooltip },
|
|
21
|
-
react_1.default.createElement(button_1.Button, { outline: true, rightGlyph: button_1.BUTTON_GLYPHS.DOWNLOAD, size: "small", as: "a", href: `data:application/json,${encodeURIComponent(source)}`, download: download })))),
|
|
22
|
-
react_1.default.createElement(textarea_1.Textarea, { previewSource: true, readOnly: true, rows:
|
|
24
|
+
react_1.default.createElement(button_1.Button, { outline: true, rightGlyph: button_1.BUTTON_GLYPHS.DOWNLOAD, size: "small", as: "a", href: `data:application/json,${encodeURIComponent(source)}`, download: download }))))),
|
|
25
|
+
react_1.default.createElement(textarea_1.Textarea, { previewSource: true, readOnly: true, rows: rows, className: preview_source_module_css_1.default.content }, source)));
|
|
23
26
|
};
|
|
24
27
|
exports.PreviewSource = PreviewSource;
|
|
25
28
|
//# sourceMappingURL=preview-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-source.js","sourceRoot":"","sources":["../../../src/components/preview-source/preview-source.tsx"],"names":[],"mappings":";;;;;;AACA,kDAA0B;AAC1B,4DAA4B;AAE5B,4CAAwD;AACxD,kEAA6D;AAC7D,0DAAsD;AACtD,8CAA2C;AAC3C,gDAA6C;AAC7C,4FAA8C;
|
|
1
|
+
{"version":3,"file":"preview-source.js","sourceRoot":"","sources":["../../../src/components/preview-source/preview-source.tsx"],"names":[],"mappings":";;;;;;AACA,kDAA0B;AAC1B,4DAA4B;AAE5B,4CAAwD;AACxD,kEAA6D;AAC7D,0DAAsD;AACtD,8CAA2C;AAC3C,gDAA6C;AAC7C,4FAA8C;AAE9C,MAAM,YAAY,GAAG,EAAE,CAAC;AAgBjB,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAE,EAAE;IACzD,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,YAAY,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE9F,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC;IACxB,MAAM,aAAa,GAAG,IAAA,oBAAE,EAAC,mCAAG,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,IAAI,mCAAG,CAAC,OAAO,CAAC,CAAC;IAEtE,OAAO,CACL,uCAAK,SAAS,EAAE,aAAa,KAAM,SAAS;QACzC,MAAM,IAAI,CACT,8BAAC,4BAAY,IAAC,SAAS,EAAE,mCAAG,CAAC,OAAO;YAClC,8BAAC,mCAAe,IAAC,OAAO,QAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAE,MAAM,GAAI;YACrD,QAAQ,IAAI,CACX,8BAAC,iBAAO,IAAC,KAAK,EAAE,YAAY,QAAQ,EAAE,EAAE,SAAS,EAAE,mCAAG,CAAC,eAAe;gBACpE,8BAAC,eAAM,IACL,OAAO,QACP,UAAU,EAAE,sBAAa,CAAC,QAAQ,EAClC,IAAI,EAAC,OAAO,EACZ,EAAE,EAAC,GAAG,EACN,IAAI,EAAE,yBAAyB,kBAAkB,CAAC,MAAM,CAAC,EAAE,EAC3D,QAAQ,EAAE,QAAQ,GAClB,CACM,CACX,CACY,CAChB;QACD,8BAAC,mBAAQ,IAAC,aAAa,QAAC,QAAQ,QAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,mCAAG,CAAC,OAAO,IAChE,MAAM,CACE,CACP,CACP,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,aAAa,iBA8BxB"}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
z-index: 2;
|
|
8
8
|
top: var(--space-xsmall);
|
|
9
9
|
right: var(--space-xsmall);
|
|
10
|
+
background: var(--color-background);
|
|
11
|
+
border-radius: var(--radius-medium);
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
/** fix control group with nested components */
|
|
@@ -21,8 +23,18 @@
|
|
|
21
23
|
box-shadow: none;
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
/** Source content */
|
|
24
27
|
.content {
|
|
25
28
|
position: relative;
|
|
26
29
|
z-index: 1;
|
|
27
30
|
height: 100%;
|
|
31
|
+
background: var(--color-highlight);
|
|
32
|
+
color: var(--color-text);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Empty / loading state */
|
|
36
|
+
.isEmpty .content {
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
background: var(--skeleton-block-background);
|
|
39
|
+
opacity: var(--skeleton-opacity);
|
|
28
40
|
}
|
package/lib/css/variables.css
CHANGED
|
@@ -201,6 +201,10 @@
|
|
|
201
201
|
|
|
202
202
|
--outline-hover: 0 0 0 var(--space-xxxsmall) var(--color-highlight);
|
|
203
203
|
|
|
204
|
+
--skeleton-inline-background: linear-gradient(transparent 10%, currentColor 10.1%, currentColor 89.9%, transparent 90%);
|
|
205
|
+
--skeleton-block-background: currentColor;
|
|
206
|
+
--skeleton-opacity: 0.06;
|
|
207
|
+
|
|
204
208
|
/** Layout */
|
|
205
209
|
--max-width: 88rem;
|
|
206
210
|
--entry-info-width: 64rem;
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
|
|
62
62
|
/** Width variation */
|
|
63
63
|
.width--narrow {
|
|
64
|
-
max-width:
|
|
64
|
+
max-width: 360px;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.width--medium {
|
|
68
|
-
max-width:
|
|
68
|
+
max-width: 640px;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.width--wide {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.width--extra-wide {
|
|
76
|
-
max-width: var(--max-width);
|
|
76
|
+
max-width: calc(var(--max-width) + 2 * var(--space-medium));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/** Center variation */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
background:
|
|
3
|
-
opacity:
|
|
2
|
+
background: var(--skeleton-inline-background);
|
|
3
|
+
opacity: var(--skeleton-opacity);
|
|
4
4
|
pointer-events: none;
|
|
5
5
|
min-width: 6em;
|
|
6
6
|
border-radius: var(--radius-medium);
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.block {
|
|
17
|
-
background:
|
|
17
|
+
background: var(--skeleton-block-background);
|
|
18
18
|
}
|
|
@@ -6,13 +6,16 @@ import { ControlGroup } from '../../ui/control-group';
|
|
|
6
6
|
import { Tooltip } from '../../ui/tooltip';
|
|
7
7
|
import { Textarea } from '../../ui/textarea';
|
|
8
8
|
import css from './preview-source.module.css';
|
|
9
|
+
const DEFAULT_ROWS = 10;
|
|
9
10
|
export const PreviewSource = (props) => {
|
|
10
|
-
const { className = '', source, download = false, ...restProps } = props;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const { className = '', source, rows = DEFAULT_ROWS, download = false, ...restProps } = props;
|
|
12
|
+
const isEmpty = !source;
|
|
13
|
+
const rootClassName = cx(css.root, className, isEmpty && css.isEmpty);
|
|
14
|
+
return (React.createElement("div", { className: rootClassName, ...restProps },
|
|
15
|
+
source && (React.createElement(ControlGroup, { className: css.toolbar },
|
|
13
16
|
React.createElement(CopyToClipboard, { outline: true, size: "small", text: source }),
|
|
14
17
|
download && (React.createElement(Tooltip, { title: `Download ${download}`, className: css.downloadTooltip },
|
|
15
|
-
React.createElement(Button, { outline: true, rightGlyph: BUTTON_GLYPHS.DOWNLOAD, size: "small", as: "a", href: `data:application/json,${encodeURIComponent(source)}`, download: download })))),
|
|
16
|
-
React.createElement(Textarea, { previewSource: true, readOnly: true, rows:
|
|
18
|
+
React.createElement(Button, { outline: true, rightGlyph: BUTTON_GLYPHS.DOWNLOAD, size: "small", as: "a", href: `data:application/json,${encodeURIComponent(source)}`, download: download }))))),
|
|
19
|
+
React.createElement(Textarea, { previewSource: true, readOnly: true, rows: rows, className: css.content }, source)));
|
|
17
20
|
};
|
|
18
21
|
//# sourceMappingURL=preview-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-source.js","sourceRoot":"","sources":["../../../src/components/preview-source/preview-source.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,GAAG,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"preview-source.js","sourceRoot":"","sources":["../../../src/components/preview-source/preview-source.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,GAAG,MAAM,6BAA6B,CAAC;AAE9C,MAAM,YAAY,GAAG,EAAE,CAAC;AAgBxB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAE,EAAE;IACzD,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,YAAY,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE9F,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC;IACxB,MAAM,aAAa,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAEtE,OAAO,CACL,6BAAK,SAAS,EAAE,aAAa,KAAM,SAAS;QACzC,MAAM,IAAI,CACT,oBAAC,YAAY,IAAC,SAAS,EAAE,GAAG,CAAC,OAAO;YAClC,oBAAC,eAAe,IAAC,OAAO,QAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAE,MAAM,GAAI;YACrD,QAAQ,IAAI,CACX,oBAAC,OAAO,IAAC,KAAK,EAAE,YAAY,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,eAAe;gBACpE,oBAAC,MAAM,IACL,OAAO,QACP,UAAU,EAAE,aAAa,CAAC,QAAQ,EAClC,IAAI,EAAC,OAAO,EACZ,EAAE,EAAC,GAAG,EACN,IAAI,EAAE,yBAAyB,kBAAkB,CAAC,MAAM,CAAC,EAAE,EAC3D,QAAQ,EAAE,QAAQ,GAClB,CACM,CACX,CACY,CAChB;QACD,oBAAC,QAAQ,IAAC,aAAa,QAAC,QAAQ,QAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,OAAO,IAChE,MAAM,CACE,CACP,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
z-index: 2;
|
|
8
8
|
top: var(--space-xsmall);
|
|
9
9
|
right: var(--space-xsmall);
|
|
10
|
+
background: var(--color-background);
|
|
11
|
+
border-radius: var(--radius-medium);
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
/** fix control group with nested components */
|
|
@@ -21,8 +23,18 @@
|
|
|
21
23
|
box-shadow: none;
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
/** Source content */
|
|
24
27
|
.content {
|
|
25
28
|
position: relative;
|
|
26
29
|
z-index: 1;
|
|
27
30
|
height: 100%;
|
|
31
|
+
background: var(--color-highlight);
|
|
32
|
+
color: var(--color-text);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Empty / loading state */
|
|
36
|
+
.isEmpty .content {
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
background: var(--skeleton-block-background);
|
|
39
|
+
opacity: var(--skeleton-opacity);
|
|
28
40
|
}
|
|
@@ -201,6 +201,10 @@
|
|
|
201
201
|
|
|
202
202
|
--outline-hover: 0 0 0 var(--space-xxxsmall) var(--color-highlight);
|
|
203
203
|
|
|
204
|
+
--skeleton-inline-background: linear-gradient(transparent 10%, currentColor 10.1%, currentColor 89.9%, transparent 90%);
|
|
205
|
+
--skeleton-block-background: currentColor;
|
|
206
|
+
--skeleton-opacity: 0.06;
|
|
207
|
+
|
|
204
208
|
/** Layout */
|
|
205
209
|
--max-width: 88rem;
|
|
206
210
|
--entry-info-width: 64rem;
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
|
|
62
62
|
/** Width variation */
|
|
63
63
|
.width--narrow {
|
|
64
|
-
max-width:
|
|
64
|
+
max-width: 360px;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.width--medium {
|
|
68
|
-
max-width:
|
|
68
|
+
max-width: 640px;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.width--wide {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.width--extra-wide {
|
|
76
|
-
max-width: var(--max-width);
|
|
76
|
+
max-width: calc(var(--max-width) + 2 * var(--space-medium));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/** Center variation */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
background:
|
|
3
|
-
opacity:
|
|
2
|
+
background: var(--skeleton-inline-background);
|
|
3
|
+
opacity: var(--skeleton-opacity);
|
|
4
4
|
pointer-events: none;
|
|
5
5
|
min-width: 6em;
|
|
6
6
|
border-radius: var(--radius-medium);
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.block {
|
|
17
|
-
background:
|
|
17
|
+
background: var(--skeleton-block-background);
|
|
18
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "4.16.0-beta.
|
|
3
|
+
"version": "4.16.0-beta.4",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"react-router-dom": "^5.0.0"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@bundle-stats/utils": "^4.16.0-beta.
|
|
77
|
+
"@bundle-stats/utils": "^4.16.0-beta.4",
|
|
78
78
|
"ariakit": "2.0.0-next.44",
|
|
79
79
|
"d3": "7.9.0",
|
|
80
80
|
"modern-css-reset": "1.4.0",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"snarkdown": "2.0.0",
|
|
83
83
|
"use-query-params": "2.2.1"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "13a47480528282f6f9c2b31bd59c826f61d2828d"
|
|
86
86
|
}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
z-index: 2;
|
|
8
8
|
top: var(--space-xsmall);
|
|
9
9
|
right: var(--space-xsmall);
|
|
10
|
+
background: var(--color-background);
|
|
11
|
+
border-radius: var(--radius-medium);
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
/** fix control group with nested components */
|
|
@@ -21,8 +23,18 @@
|
|
|
21
23
|
box-shadow: none;
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
/** Source content */
|
|
24
27
|
.content {
|
|
25
28
|
position: relative;
|
|
26
29
|
z-index: 1;
|
|
27
30
|
height: 100%;
|
|
31
|
+
background: var(--color-highlight);
|
|
32
|
+
color: var(--color-text);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Empty / loading state */
|
|
36
|
+
.isEmpty .content {
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
background: var(--skeleton-block-background);
|
|
39
|
+
opacity: var(--skeleton-opacity);
|
|
28
40
|
}
|
|
@@ -9,8 +9,14 @@ import { Tooltip } from '../../ui/tooltip';
|
|
|
9
9
|
import { Textarea } from '../../ui/textarea';
|
|
10
10
|
import css from './preview-source.module.css';
|
|
11
11
|
|
|
12
|
+
const DEFAULT_ROWS = 10;
|
|
13
|
+
|
|
12
14
|
type PreviewSourceProps = {
|
|
13
|
-
source
|
|
15
|
+
source?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Textarea rows
|
|
18
|
+
*/
|
|
19
|
+
rows?: number;
|
|
14
20
|
/**
|
|
15
21
|
* Link download attribute
|
|
16
22
|
* @example
|
|
@@ -20,26 +26,31 @@ type PreviewSourceProps = {
|
|
|
20
26
|
} & ComponentProps<'div'>;
|
|
21
27
|
|
|
22
28
|
export const PreviewSource = (props: PreviewSourceProps) => {
|
|
23
|
-
const { className = '', source, download = false, ...restProps } = props;
|
|
29
|
+
const { className = '', source, rows = DEFAULT_ROWS, download = false, ...restProps } = props;
|
|
30
|
+
|
|
31
|
+
const isEmpty = !source;
|
|
32
|
+
const rootClassName = cx(css.root, className, isEmpty && css.isEmpty);
|
|
24
33
|
|
|
25
34
|
return (
|
|
26
|
-
<div className={
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
<div className={rootClassName} {...restProps}>
|
|
36
|
+
{source && (
|
|
37
|
+
<ControlGroup className={css.toolbar}>
|
|
38
|
+
<CopyToClipboard outline size="small" text={source} />
|
|
39
|
+
{download && (
|
|
40
|
+
<Tooltip title={`Download ${download}`} className={css.downloadTooltip}>
|
|
41
|
+
<Button
|
|
42
|
+
outline
|
|
43
|
+
rightGlyph={BUTTON_GLYPHS.DOWNLOAD}
|
|
44
|
+
size="small"
|
|
45
|
+
as="a"
|
|
46
|
+
href={`data:application/json,${encodeURIComponent(source)}`}
|
|
47
|
+
download={download}
|
|
48
|
+
/>
|
|
49
|
+
</Tooltip>
|
|
50
|
+
)}
|
|
51
|
+
</ControlGroup>
|
|
52
|
+
)}
|
|
53
|
+
<Textarea previewSource readOnly rows={rows} className={css.content}>
|
|
43
54
|
{source}
|
|
44
55
|
</Textarea>
|
|
45
56
|
</div>
|
package/src/css/variables.css
CHANGED
|
@@ -201,6 +201,10 @@
|
|
|
201
201
|
|
|
202
202
|
--outline-hover: 0 0 0 var(--space-xxxsmall) var(--color-highlight);
|
|
203
203
|
|
|
204
|
+
--skeleton-inline-background: linear-gradient(transparent 10%, currentColor 10.1%, currentColor 89.9%, transparent 90%);
|
|
205
|
+
--skeleton-block-background: currentColor;
|
|
206
|
+
--skeleton-opacity: 0.06;
|
|
207
|
+
|
|
204
208
|
/** Layout */
|
|
205
209
|
--max-width: 88rem;
|
|
206
210
|
--entry-info-width: 64rem;
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
|
|
62
62
|
/** Width variation */
|
|
63
63
|
.width--narrow {
|
|
64
|
-
max-width:
|
|
64
|
+
max-width: 360px;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.width--medium {
|
|
68
|
-
max-width:
|
|
68
|
+
max-width: 640px;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.width--wide {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.width--extra-wide {
|
|
76
|
-
max-width: var(--max-width);
|
|
76
|
+
max-width: calc(var(--max-width) + 2 * var(--space-medium));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/** Center variation */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
background:
|
|
3
|
-
opacity:
|
|
2
|
+
background: var(--skeleton-inline-background);
|
|
3
|
+
opacity: var(--skeleton-opacity);
|
|
4
4
|
pointer-events: none;
|
|
5
5
|
min-width: 6em;
|
|
6
6
|
border-radius: var(--radius-medium);
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.block {
|
|
17
|
-
background:
|
|
17
|
+
background: var(--skeleton-block-background);
|
|
18
18
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
type PreviewSourceProps = {
|
|
4
|
-
source
|
|
4
|
+
source?: string;
|
|
5
|
+
rows?: number;
|
|
5
6
|
download?: string;
|
|
6
7
|
} & ComponentProps<'div'>;
|
|
7
8
|
export declare const PreviewSource: (props: PreviewSourceProps) => React.JSX.Element;
|