carbon-react 110.10.2 → 110.11.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.
- package/esm/components/link-preview/link-preview.style.js +4 -3
- package/esm/components/preview/__internal__/preview-placeholder.component.d.ts +10 -0
- package/esm/components/preview/__internal__/preview-placeholder.component.js +29 -0
- package/esm/components/preview/__internal__/preview-placeholder.style.d.ts +7 -0
- package/esm/components/preview/__internal__/preview-placeholder.style.js +22 -0
- package/esm/components/preview/index.d.ts +2 -1
- package/esm/components/preview/preview.component.d.ts +10 -0
- package/esm/components/preview/preview.component.js +180 -60
- package/esm/components/preview/preview.style.d.ts +2 -0
- package/esm/components/preview/preview.style.js +5 -21
- package/esm/components/progress-tracker/progress-tracker.component.js +4 -3
- package/esm/components/tabs/tabs.d.ts +1 -1
- package/lib/components/link-preview/link-preview.style.js +5 -3
- package/lib/components/preview/__internal__/preview-placeholder.component.d.ts +10 -0
- package/lib/components/preview/__internal__/preview-placeholder.component.js +42 -0
- package/lib/components/preview/__internal__/preview-placeholder.style.d.ts +7 -0
- package/lib/components/preview/__internal__/preview-placeholder.style.js +35 -0
- package/lib/components/preview/index.d.ts +2 -1
- package/lib/components/preview/preview.component.d.ts +10 -0
- package/lib/components/preview/preview.component.js +181 -67
- package/lib/components/preview/preview.style.d.ts +2 -0
- package/lib/components/preview/preview.style.js +3 -26
- package/lib/components/progress-tracker/progress-tracker.component.js +4 -3
- package/lib/components/tabs/tabs.d.ts +1 -1
- package/package.json +1 -1
- package/esm/components/preview/preview.d.ts +0 -19
- package/lib/components/preview/preview.d.ts +0 -19
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import
|
|
2
|
+
import { StyledPreview } from "../preview/preview.style";
|
|
3
|
+
import { StyledPreviewPlaceholder } from "../preview/__internal__/preview-placeholder.style";
|
|
3
4
|
const StyledLinkPreview = styled.a`
|
|
4
5
|
display: flex;
|
|
5
6
|
margin: 8px;
|
|
@@ -43,11 +44,11 @@ const StyledPreviewWrapper = styled.div`
|
|
|
43
44
|
}
|
|
44
45
|
`}
|
|
45
46
|
|
|
46
|
-
${
|
|
47
|
+
${StyledPreviewPlaceholder}:first-of-type {
|
|
47
48
|
margin-top: 8px;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
${
|
|
51
|
+
${StyledPreviewPlaceholder}:not(:first-of-type) {
|
|
51
52
|
margin-top: 16px;
|
|
52
53
|
}
|
|
53
54
|
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StyledPreviewPlaceholderProps } from "./preview-placeholder.style";
|
|
3
|
+
export interface PreviewPlaceholderProps extends StyledPreviewPlaceholderProps {
|
|
4
|
+
index: number;
|
|
5
|
+
/** The number of lines to render. */
|
|
6
|
+
lines: number;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const PreviewPlaceholder: ({ height, index, lines, width, ...props }: PreviewPlaceholderProps) => JSX.Element;
|
|
10
|
+
export default PreviewPlaceholder;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
|
|
6
|
+
import { StyledPreviewPlaceholder } from "./preview-placeholder.style";
|
|
7
|
+
|
|
8
|
+
const PreviewPlaceholder = ({
|
|
9
|
+
height,
|
|
10
|
+
index,
|
|
11
|
+
lines,
|
|
12
|
+
width,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const isLastLine = lines > 1 && lines === index;
|
|
16
|
+
return /*#__PURE__*/React.createElement(StyledPreviewPlaceholder, _extends({
|
|
17
|
+
height: height,
|
|
18
|
+
width: !width && isLastLine ? "80%" : width
|
|
19
|
+
}, tagComponent("preview", props)));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
PreviewPlaceholder.propTypes = {
|
|
23
|
+
"height": PropTypes.string,
|
|
24
|
+
"index": PropTypes.number.isRequired,
|
|
25
|
+
"lines": PropTypes.number.isRequired,
|
|
26
|
+
"loading": PropTypes.bool,
|
|
27
|
+
"width": PropTypes.string
|
|
28
|
+
};
|
|
29
|
+
export default PreviewPlaceholder;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface StyledPreviewPlaceholderProps {
|
|
2
|
+
/** A custom height to be applied to the component. */
|
|
3
|
+
height?: string;
|
|
4
|
+
/** A custom width */
|
|
5
|
+
width?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const StyledPreviewPlaceholder: import("styled-components").StyledComponent<"span", any, StyledPreviewPlaceholderProps, never>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import styled, { keyframes } from "styled-components";
|
|
2
|
+
const shimmer = keyframes`
|
|
3
|
+
0% { opacity:0.1 }
|
|
4
|
+
70% { opacity:0.6 }
|
|
5
|
+
100% { opacity:0.1 }
|
|
6
|
+
`;
|
|
7
|
+
export const StyledPreviewPlaceholder = styled.span`
|
|
8
|
+
animation: ${shimmer} 2s ease infinite;
|
|
9
|
+
background: var(--colorsUtilityMajor150);
|
|
10
|
+
display: block;
|
|
11
|
+
height: ${({
|
|
12
|
+
height
|
|
13
|
+
}) => height || "15px"};
|
|
14
|
+
opacity: 0.6;
|
|
15
|
+
width: ${({
|
|
16
|
+
width
|
|
17
|
+
}) => width || "100%"};
|
|
18
|
+
|
|
19
|
+
& + & {
|
|
20
|
+
margin-top: 3px;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./preview";
|
|
1
|
+
export { default } from "./preview.component";
|
|
2
|
+
export type { PreviewProps } from "./preview.component";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { PreviewPlaceholderProps } from "./__internal__/preview-placeholder.component";
|
|
4
|
+
export interface PreviewProps extends Partial<Omit<PreviewPlaceholderProps, "index">>, MarginProps {
|
|
5
|
+
/** Children content to render in the component. */
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const Preview: ({ children, loading, lines, ...props }: PreviewProps) => JSX.Element;
|
|
10
|
+
export default Preview;
|
|
@@ -2,76 +2,196 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import PreviewStyle, { StyledPreview } from "./preview.style";
|
|
5
|
+
import PreviewPlaceholder from "./__internal__/preview-placeholder.component";
|
|
6
|
+
import { StyledPreview } from "./preview.style";
|
|
8
7
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
9
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
10
8
|
|
|
11
|
-
const Preview =
|
|
9
|
+
const Preview = ({
|
|
10
|
+
children,
|
|
11
|
+
loading,
|
|
12
|
+
lines = 1,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
12
15
|
const marginProps = filterStyledSystemMarginProps(props);
|
|
16
|
+
const hasPlaceholder = loading === undefined ? !children : loading;
|
|
13
17
|
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
18
|
+
if (hasPlaceholder) {
|
|
19
|
+
const placeholders = [];
|
|
16
20
|
|
|
17
|
-
for (let i = 1; i <=
|
|
18
|
-
|
|
21
|
+
for (let i = 1; i <= lines; i++) {
|
|
22
|
+
placeholders.push( /*#__PURE__*/React.createElement(PreviewPlaceholder, _extends({
|
|
23
|
+
key: i,
|
|
24
|
+
index: i,
|
|
25
|
+
lines: lines
|
|
26
|
+
}, props)));
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
return /*#__PURE__*/React.createElement(StyledPreview, marginProps,
|
|
29
|
+
return /*#__PURE__*/React.createElement(StyledPreview, marginProps, placeholders);
|
|
22
30
|
}
|
|
23
31
|
|
|
24
|
-
return /*#__PURE__*/React.createElement(StyledPreview, marginProps,
|
|
32
|
+
return /*#__PURE__*/React.createElement(StyledPreview, marginProps, children);
|
|
25
33
|
};
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
35
|
+
Preview.propTypes = {
|
|
36
|
+
"children": PropTypes.node,
|
|
37
|
+
"height": PropTypes.string,
|
|
38
|
+
"lines": PropTypes.number,
|
|
39
|
+
"loading": PropTypes.bool,
|
|
40
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
41
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
42
|
+
"description": PropTypes.string,
|
|
43
|
+
"toString": PropTypes.func.isRequired,
|
|
44
|
+
"valueOf": PropTypes.func.isRequired
|
|
45
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
46
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
47
|
+
"description": PropTypes.string,
|
|
48
|
+
"toString": PropTypes.func.isRequired,
|
|
49
|
+
"valueOf": PropTypes.func.isRequired
|
|
50
|
+
}), PropTypes.string]),
|
|
51
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
52
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
53
|
+
"description": PropTypes.string,
|
|
54
|
+
"toString": PropTypes.func.isRequired,
|
|
55
|
+
"valueOf": PropTypes.func.isRequired
|
|
56
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
57
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
58
|
+
"description": PropTypes.string,
|
|
59
|
+
"toString": PropTypes.func.isRequired,
|
|
60
|
+
"valueOf": PropTypes.func.isRequired
|
|
61
|
+
}), PropTypes.string]),
|
|
62
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
63
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
64
|
+
"description": PropTypes.string,
|
|
65
|
+
"toString": PropTypes.func.isRequired,
|
|
66
|
+
"valueOf": PropTypes.func.isRequired
|
|
67
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
68
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
69
|
+
"description": PropTypes.string,
|
|
70
|
+
"toString": PropTypes.func.isRequired,
|
|
71
|
+
"valueOf": PropTypes.func.isRequired
|
|
72
|
+
}), PropTypes.string]),
|
|
73
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
74
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
75
|
+
"description": PropTypes.string,
|
|
76
|
+
"toString": PropTypes.func.isRequired,
|
|
77
|
+
"valueOf": PropTypes.func.isRequired
|
|
78
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
79
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
80
|
+
"description": PropTypes.string,
|
|
81
|
+
"toString": PropTypes.func.isRequired,
|
|
82
|
+
"valueOf": PropTypes.func.isRequired
|
|
83
|
+
}), PropTypes.string]),
|
|
84
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
85
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
86
|
+
"description": PropTypes.string,
|
|
87
|
+
"toString": PropTypes.func.isRequired,
|
|
88
|
+
"valueOf": PropTypes.func.isRequired
|
|
89
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
90
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
91
|
+
"description": PropTypes.string,
|
|
92
|
+
"toString": PropTypes.func.isRequired,
|
|
93
|
+
"valueOf": PropTypes.func.isRequired
|
|
94
|
+
}), PropTypes.string]),
|
|
95
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
96
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
97
|
+
"description": PropTypes.string,
|
|
98
|
+
"toString": PropTypes.func.isRequired,
|
|
99
|
+
"valueOf": PropTypes.func.isRequired
|
|
100
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
101
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
102
|
+
"description": PropTypes.string,
|
|
103
|
+
"toString": PropTypes.func.isRequired,
|
|
104
|
+
"valueOf": PropTypes.func.isRequired
|
|
105
|
+
}), PropTypes.string]),
|
|
106
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
107
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
108
|
+
"description": PropTypes.string,
|
|
109
|
+
"toString": PropTypes.func.isRequired,
|
|
110
|
+
"valueOf": PropTypes.func.isRequired
|
|
111
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
112
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
113
|
+
"description": PropTypes.string,
|
|
114
|
+
"toString": PropTypes.func.isRequired,
|
|
115
|
+
"valueOf": PropTypes.func.isRequired
|
|
116
|
+
}), PropTypes.string]),
|
|
117
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
118
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
119
|
+
"description": PropTypes.string,
|
|
120
|
+
"toString": PropTypes.func.isRequired,
|
|
121
|
+
"valueOf": PropTypes.func.isRequired
|
|
122
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
123
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
124
|
+
"description": PropTypes.string,
|
|
125
|
+
"toString": PropTypes.func.isRequired,
|
|
126
|
+
"valueOf": PropTypes.func.isRequired
|
|
127
|
+
}), PropTypes.string]),
|
|
128
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
129
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
130
|
+
"description": PropTypes.string,
|
|
131
|
+
"toString": PropTypes.func.isRequired,
|
|
132
|
+
"valueOf": PropTypes.func.isRequired
|
|
133
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
134
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
135
|
+
"description": PropTypes.string,
|
|
136
|
+
"toString": PropTypes.func.isRequired,
|
|
137
|
+
"valueOf": PropTypes.func.isRequired
|
|
138
|
+
}), PropTypes.string]),
|
|
139
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
140
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
141
|
+
"description": PropTypes.string,
|
|
142
|
+
"toString": PropTypes.func.isRequired,
|
|
143
|
+
"valueOf": PropTypes.func.isRequired
|
|
144
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
145
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
146
|
+
"description": PropTypes.string,
|
|
147
|
+
"toString": PropTypes.func.isRequired,
|
|
148
|
+
"valueOf": PropTypes.func.isRequired
|
|
149
|
+
}), PropTypes.string]),
|
|
150
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
151
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
152
|
+
"description": PropTypes.string,
|
|
153
|
+
"toString": PropTypes.func.isRequired,
|
|
154
|
+
"valueOf": PropTypes.func.isRequired
|
|
155
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
156
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
157
|
+
"description": PropTypes.string,
|
|
158
|
+
"toString": PropTypes.func.isRequired,
|
|
159
|
+
"valueOf": PropTypes.func.isRequired
|
|
160
|
+
}), PropTypes.string]),
|
|
161
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
162
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
163
|
+
"description": PropTypes.string,
|
|
164
|
+
"toString": PropTypes.func.isRequired,
|
|
165
|
+
"valueOf": PropTypes.func.isRequired
|
|
166
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
167
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
168
|
+
"description": PropTypes.string,
|
|
169
|
+
"toString": PropTypes.func.isRequired,
|
|
170
|
+
"valueOf": PropTypes.func.isRequired
|
|
171
|
+
}), PropTypes.string]),
|
|
172
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
173
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
174
|
+
"description": PropTypes.string,
|
|
175
|
+
"toString": PropTypes.func.isRequired,
|
|
176
|
+
"valueOf": PropTypes.func.isRequired
|
|
177
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
178
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
179
|
+
"description": PropTypes.string,
|
|
180
|
+
"toString": PropTypes.func.isRequired,
|
|
181
|
+
"valueOf": PropTypes.func.isRequired
|
|
182
|
+
}), PropTypes.string]),
|
|
183
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
184
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
185
|
+
"description": PropTypes.string,
|
|
186
|
+
"toString": PropTypes.func.isRequired,
|
|
187
|
+
"valueOf": PropTypes.func.isRequired
|
|
188
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
189
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
190
|
+
"description": PropTypes.string,
|
|
191
|
+
"toString": PropTypes.func.isRequired,
|
|
192
|
+
"valueOf": PropTypes.func.isRequired
|
|
193
|
+
}), PropTypes.string]),
|
|
194
|
+
"width": PropTypes.string
|
|
76
195
|
};
|
|
196
|
+
export { Preview };
|
|
77
197
|
export default Preview;
|
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
import styled
|
|
1
|
+
import styled from "styled-components";
|
|
2
2
|
import { margin } from "styled-system";
|
|
3
3
|
import baseTheme from "../../style/themes/base";
|
|
4
|
-
const
|
|
5
|
-
0% { opacity:0.1 }
|
|
6
|
-
70% { opacity:0.6 }
|
|
7
|
-
100% { opacity:0.1 }
|
|
8
|
-
`;
|
|
9
|
-
const PreviewStyle = styled.span`
|
|
10
|
-
animation: ${shimmer} 2s ease infinite;
|
|
11
|
-
background: var(--colorsUtilityMajor150);
|
|
12
|
-
display: block;
|
|
13
|
-
height: 15px;
|
|
14
|
-
opacity: 0.6;
|
|
15
|
-
width: 100%;
|
|
16
|
-
|
|
17
|
-
& + & {
|
|
18
|
-
margin-top: 3px;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
export const StyledPreview = styled.div`
|
|
4
|
+
const StyledPreview = styled.div`
|
|
22
5
|
${margin}
|
|
23
6
|
`;
|
|
24
7
|
StyledPreview.defaultProps = {
|
|
25
8
|
theme: baseTheme
|
|
26
|
-
};
|
|
27
|
-
|
|
9
|
+
}; // eslint-disable-next-line import/prefer-default-export
|
|
10
|
+
|
|
11
|
+
export { StyledPreview };
|
|
@@ -13,8 +13,8 @@ const ProgressTracker = ({
|
|
|
13
13
|
"aria-label": ariaLabel = "progress tracker",
|
|
14
14
|
"aria-describedby": ariaDescribedBy,
|
|
15
15
|
"aria-valuenow": ariaValueNow,
|
|
16
|
-
"aria-valuemin": ariaValueMin,
|
|
17
|
-
"aria-valuemax": ariaValueMax,
|
|
16
|
+
"aria-valuemin": ariaValueMin = 0,
|
|
17
|
+
"aria-valuemax": ariaValueMax = 100,
|
|
18
18
|
"aria-valuetext": ariaValueText,
|
|
19
19
|
size = "medium",
|
|
20
20
|
length = "256px",
|
|
@@ -68,6 +68,7 @@ const ProgressTracker = ({
|
|
|
68
68
|
}, label(maxProgressLabel, "100%"))));
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
const defaultValueNow = ariaValueMin + (ariaValueMax - ariaValueMin) * progress / 100;
|
|
71
72
|
return /*#__PURE__*/React.createElement(StyledProgressTracker, _extends({
|
|
72
73
|
size: size,
|
|
73
74
|
length: length,
|
|
@@ -76,7 +77,7 @@ const ProgressTracker = ({
|
|
|
76
77
|
role: "progressbar",
|
|
77
78
|
"aria-label": ariaLabel,
|
|
78
79
|
"aria-describedby": ariaDescribedBy,
|
|
79
|
-
"aria-valuenow": ariaValueNow,
|
|
80
|
+
"aria-valuenow": ariaValueNow === undefined ? defaultValueNow : ariaValueNow,
|
|
80
81
|
"aria-valuemin": ariaValueMin,
|
|
81
82
|
"aria-valuemax": ariaValueMax,
|
|
82
83
|
"aria-valuetext": ariaValueText
|
|
@@ -7,7 +7,9 @@ exports.StyledUrl = exports.StyledDescription = exports.StyledTitle = exports.St
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
10
|
-
var _preview =
|
|
10
|
+
var _preview = require("../preview/preview.style");
|
|
11
|
+
|
|
12
|
+
var _previewPlaceholder = require("../preview/__internal__/preview-placeholder.style");
|
|
11
13
|
|
|
12
14
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
13
15
|
|
|
@@ -58,11 +60,11 @@ const StyledPreviewWrapper = _styledComponents.default.div`
|
|
|
58
60
|
}
|
|
59
61
|
`}
|
|
60
62
|
|
|
61
|
-
${
|
|
63
|
+
${_previewPlaceholder.StyledPreviewPlaceholder}:first-of-type {
|
|
62
64
|
margin-top: 8px;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
${
|
|
67
|
+
${_previewPlaceholder.StyledPreviewPlaceholder}:not(:first-of-type) {
|
|
66
68
|
margin-top: 16px;
|
|
67
69
|
}
|
|
68
70
|
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StyledPreviewPlaceholderProps } from "./preview-placeholder.style";
|
|
3
|
+
export interface PreviewPlaceholderProps extends StyledPreviewPlaceholderProps {
|
|
4
|
+
index: number;
|
|
5
|
+
/** The number of lines to render. */
|
|
6
|
+
lines: number;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const PreviewPlaceholder: ({ height, index, lines, width, ...props }: PreviewPlaceholderProps) => JSX.Element;
|
|
10
|
+
export default PreviewPlaceholder;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _tags = _interopRequireDefault(require("../../../__internal__/utils/helpers/tags/tags"));
|
|
13
|
+
|
|
14
|
+
var _previewPlaceholder = require("./preview-placeholder.style");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
20
|
+
const PreviewPlaceholder = ({
|
|
21
|
+
height,
|
|
22
|
+
index,
|
|
23
|
+
lines,
|
|
24
|
+
width,
|
|
25
|
+
...props
|
|
26
|
+
}) => {
|
|
27
|
+
const isLastLine = lines > 1 && lines === index;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_previewPlaceholder.StyledPreviewPlaceholder, _extends({
|
|
29
|
+
height: height,
|
|
30
|
+
width: !width && isLastLine ? "80%" : width
|
|
31
|
+
}, (0, _tags.default)("preview", props)));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
PreviewPlaceholder.propTypes = {
|
|
35
|
+
"height": _propTypes.default.string,
|
|
36
|
+
"index": _propTypes.default.number.isRequired,
|
|
37
|
+
"lines": _propTypes.default.number.isRequired,
|
|
38
|
+
"loading": _propTypes.default.bool,
|
|
39
|
+
"width": _propTypes.default.string
|
|
40
|
+
};
|
|
41
|
+
var _default = PreviewPlaceholder;
|
|
42
|
+
exports.default = _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface StyledPreviewPlaceholderProps {
|
|
2
|
+
/** A custom height to be applied to the component. */
|
|
3
|
+
height?: string;
|
|
4
|
+
/** A custom width */
|
|
5
|
+
width?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const StyledPreviewPlaceholder: import("styled-components").StyledComponent<"span", any, StyledPreviewPlaceholderProps, never>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledPreviewPlaceholder = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
11
|
+
|
|
12
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
|
|
14
|
+
const shimmer = (0, _styledComponents.keyframes)`
|
|
15
|
+
0% { opacity:0.1 }
|
|
16
|
+
70% { opacity:0.6 }
|
|
17
|
+
100% { opacity:0.1 }
|
|
18
|
+
`;
|
|
19
|
+
const StyledPreviewPlaceholder = _styledComponents.default.span`
|
|
20
|
+
animation: ${shimmer} 2s ease infinite;
|
|
21
|
+
background: var(--colorsUtilityMajor150);
|
|
22
|
+
display: block;
|
|
23
|
+
height: ${({
|
|
24
|
+
height
|
|
25
|
+
}) => height || "15px"};
|
|
26
|
+
opacity: 0.6;
|
|
27
|
+
width: ${({
|
|
28
|
+
width
|
|
29
|
+
}) => width || "100%"};
|
|
30
|
+
|
|
31
|
+
& + & {
|
|
32
|
+
margin-top: 3px;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
exports.StyledPreviewPlaceholder = StyledPreviewPlaceholder;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./preview";
|
|
1
|
+
export { default } from "./preview.component";
|
|
2
|
+
export type { PreviewProps } from "./preview.component";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { PreviewPlaceholderProps } from "./__internal__/preview-placeholder.component";
|
|
4
|
+
export interface PreviewProps extends Partial<Omit<PreviewPlaceholderProps, "index">>, MarginProps {
|
|
5
|
+
/** Children content to render in the component. */
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const Preview: ({ children, loading, lines, ...props }: PreviewProps) => JSX.Element;
|
|
10
|
+
export default Preview;
|
|
@@ -3,95 +3,209 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.Preview = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _previewPlaceholder = _interopRequireDefault(require("./__internal__/preview-placeholder.component"));
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _preview = _interopRequireWildcard(require("./preview.style"));
|
|
14
|
+
var _preview = require("./preview.style");
|
|
17
15
|
|
|
18
16
|
var _utils = require("../../style/utils");
|
|
19
17
|
|
|
20
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
21
|
-
|
|
22
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
19
|
|
|
26
20
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
21
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
const Preview = ({
|
|
23
|
+
children,
|
|
24
|
+
loading,
|
|
25
|
+
lines = 1,
|
|
26
|
+
...props
|
|
27
|
+
}) => {
|
|
31
28
|
const marginProps = (0, _utils.filterStyledSystemMarginProps)(props);
|
|
29
|
+
const hasPlaceholder = loading === undefined ? !children : loading;
|
|
32
30
|
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
31
|
+
if (hasPlaceholder) {
|
|
32
|
+
const placeholders = [];
|
|
35
33
|
|
|
36
|
-
for (let i = 1; i <=
|
|
37
|
-
|
|
34
|
+
for (let i = 1; i <= lines; i++) {
|
|
35
|
+
placeholders.push( /*#__PURE__*/_react.default.createElement(_previewPlaceholder.default, _extends({
|
|
36
|
+
key: i,
|
|
37
|
+
index: i,
|
|
38
|
+
lines: lines
|
|
39
|
+
}, props)));
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
return /*#__PURE__*/_react.default.createElement(_preview.StyledPreview, marginProps,
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_preview.StyledPreview, marginProps, placeholders);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
return /*#__PURE__*/_react.default.createElement(_preview.StyledPreview, marginProps,
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_preview.StyledPreview, marginProps, children);
|
|
44
46
|
};
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
48
|
+
exports.Preview = Preview;
|
|
49
|
+
Preview.propTypes = {
|
|
50
|
+
"children": _propTypes.default.node,
|
|
51
|
+
"height": _propTypes.default.string,
|
|
52
|
+
"lines": _propTypes.default.number,
|
|
53
|
+
"loading": _propTypes.default.bool,
|
|
54
|
+
"m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
55
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
56
|
+
"description": _propTypes.default.string,
|
|
57
|
+
"toString": _propTypes.default.func.isRequired,
|
|
58
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
59
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
60
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
61
|
+
"description": _propTypes.default.string,
|
|
62
|
+
"toString": _propTypes.default.func.isRequired,
|
|
63
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
64
|
+
}), _propTypes.default.string]),
|
|
65
|
+
"margin": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
66
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
67
|
+
"description": _propTypes.default.string,
|
|
68
|
+
"toString": _propTypes.default.func.isRequired,
|
|
69
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
70
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
71
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
72
|
+
"description": _propTypes.default.string,
|
|
73
|
+
"toString": _propTypes.default.func.isRequired,
|
|
74
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
75
|
+
}), _propTypes.default.string]),
|
|
76
|
+
"marginBottom": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
77
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
78
|
+
"description": _propTypes.default.string,
|
|
79
|
+
"toString": _propTypes.default.func.isRequired,
|
|
80
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
81
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
82
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
83
|
+
"description": _propTypes.default.string,
|
|
84
|
+
"toString": _propTypes.default.func.isRequired,
|
|
85
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
86
|
+
}), _propTypes.default.string]),
|
|
87
|
+
"marginLeft": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
88
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
89
|
+
"description": _propTypes.default.string,
|
|
90
|
+
"toString": _propTypes.default.func.isRequired,
|
|
91
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
92
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
93
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
94
|
+
"description": _propTypes.default.string,
|
|
95
|
+
"toString": _propTypes.default.func.isRequired,
|
|
96
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
97
|
+
}), _propTypes.default.string]),
|
|
98
|
+
"marginRight": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
99
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
100
|
+
"description": _propTypes.default.string,
|
|
101
|
+
"toString": _propTypes.default.func.isRequired,
|
|
102
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
103
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
104
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
105
|
+
"description": _propTypes.default.string,
|
|
106
|
+
"toString": _propTypes.default.func.isRequired,
|
|
107
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
108
|
+
}), _propTypes.default.string]),
|
|
109
|
+
"marginTop": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
110
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
111
|
+
"description": _propTypes.default.string,
|
|
112
|
+
"toString": _propTypes.default.func.isRequired,
|
|
113
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
114
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
115
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
116
|
+
"description": _propTypes.default.string,
|
|
117
|
+
"toString": _propTypes.default.func.isRequired,
|
|
118
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
119
|
+
}), _propTypes.default.string]),
|
|
120
|
+
"marginX": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
121
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
122
|
+
"description": _propTypes.default.string,
|
|
123
|
+
"toString": _propTypes.default.func.isRequired,
|
|
124
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
125
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
126
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
127
|
+
"description": _propTypes.default.string,
|
|
128
|
+
"toString": _propTypes.default.func.isRequired,
|
|
129
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
130
|
+
}), _propTypes.default.string]),
|
|
131
|
+
"marginY": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
132
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
133
|
+
"description": _propTypes.default.string,
|
|
134
|
+
"toString": _propTypes.default.func.isRequired,
|
|
135
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
136
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
137
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
138
|
+
"description": _propTypes.default.string,
|
|
139
|
+
"toString": _propTypes.default.func.isRequired,
|
|
140
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
141
|
+
}), _propTypes.default.string]),
|
|
142
|
+
"mb": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
143
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
144
|
+
"description": _propTypes.default.string,
|
|
145
|
+
"toString": _propTypes.default.func.isRequired,
|
|
146
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
147
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
148
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
149
|
+
"description": _propTypes.default.string,
|
|
150
|
+
"toString": _propTypes.default.func.isRequired,
|
|
151
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
152
|
+
}), _propTypes.default.string]),
|
|
153
|
+
"ml": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
154
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
155
|
+
"description": _propTypes.default.string,
|
|
156
|
+
"toString": _propTypes.default.func.isRequired,
|
|
157
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
158
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
159
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
160
|
+
"description": _propTypes.default.string,
|
|
161
|
+
"toString": _propTypes.default.func.isRequired,
|
|
162
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
163
|
+
}), _propTypes.default.string]),
|
|
164
|
+
"mr": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
165
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
166
|
+
"description": _propTypes.default.string,
|
|
167
|
+
"toString": _propTypes.default.func.isRequired,
|
|
168
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
169
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
170
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
171
|
+
"description": _propTypes.default.string,
|
|
172
|
+
"toString": _propTypes.default.func.isRequired,
|
|
173
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
174
|
+
}), _propTypes.default.string]),
|
|
175
|
+
"mt": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
176
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
177
|
+
"description": _propTypes.default.string,
|
|
178
|
+
"toString": _propTypes.default.func.isRequired,
|
|
179
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
180
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
181
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
182
|
+
"description": _propTypes.default.string,
|
|
183
|
+
"toString": _propTypes.default.func.isRequired,
|
|
184
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
185
|
+
}), _propTypes.default.string]),
|
|
186
|
+
"mx": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
187
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
188
|
+
"description": _propTypes.default.string,
|
|
189
|
+
"toString": _propTypes.default.func.isRequired,
|
|
190
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
191
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
192
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
193
|
+
"description": _propTypes.default.string,
|
|
194
|
+
"toString": _propTypes.default.func.isRequired,
|
|
195
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
196
|
+
}), _propTypes.default.string]),
|
|
197
|
+
"my": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
198
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
199
|
+
"description": _propTypes.default.string,
|
|
200
|
+
"toString": _propTypes.default.func.isRequired,
|
|
201
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
202
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
203
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
204
|
+
"description": _propTypes.default.string,
|
|
205
|
+
"toString": _propTypes.default.func.isRequired,
|
|
206
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
207
|
+
}), _propTypes.default.string]),
|
|
208
|
+
"width": _propTypes.default.string
|
|
95
209
|
};
|
|
96
210
|
var _default = Preview;
|
|
97
211
|
exports.default = _default;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.StyledPreview = void 0;
|
|
7
7
|
|
|
8
|
-
var _styledComponents =
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
|
|
10
10
|
var _styledSystem = require("styled-system");
|
|
11
11
|
|
|
@@ -13,33 +13,10 @@ var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
const shimmer = (0, _styledComponents.keyframes)`
|
|
21
|
-
0% { opacity:0.1 }
|
|
22
|
-
70% { opacity:0.6 }
|
|
23
|
-
100% { opacity:0.1 }
|
|
24
|
-
`;
|
|
25
|
-
const PreviewStyle = _styledComponents.default.span`
|
|
26
|
-
animation: ${shimmer} 2s ease infinite;
|
|
27
|
-
background: var(--colorsUtilityMajor150);
|
|
28
|
-
display: block;
|
|
29
|
-
height: 15px;
|
|
30
|
-
opacity: 0.6;
|
|
31
|
-
width: 100%;
|
|
32
|
-
|
|
33
|
-
& + & {
|
|
34
|
-
margin-top: 3px;
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
16
|
const StyledPreview = _styledComponents.default.div`
|
|
38
17
|
${_styledSystem.margin}
|
|
39
18
|
`;
|
|
40
19
|
exports.StyledPreview = StyledPreview;
|
|
41
20
|
StyledPreview.defaultProps = {
|
|
42
21
|
theme: _base.default
|
|
43
|
-
};
|
|
44
|
-
var _default = PreviewStyle;
|
|
45
|
-
exports.default = _default;
|
|
22
|
+
}; // eslint-disable-next-line import/prefer-default-export
|
|
@@ -33,8 +33,8 @@ const ProgressTracker = ({
|
|
|
33
33
|
"aria-label": ariaLabel = "progress tracker",
|
|
34
34
|
"aria-describedby": ariaDescribedBy,
|
|
35
35
|
"aria-valuenow": ariaValueNow,
|
|
36
|
-
"aria-valuemin": ariaValueMin,
|
|
37
|
-
"aria-valuemax": ariaValueMax,
|
|
36
|
+
"aria-valuemin": ariaValueMin = 0,
|
|
37
|
+
"aria-valuemax": ariaValueMax = 100,
|
|
38
38
|
"aria-valuetext": ariaValueText,
|
|
39
39
|
size = "medium",
|
|
40
40
|
length = "256px",
|
|
@@ -88,6 +88,7 @@ const ProgressTracker = ({
|
|
|
88
88
|
}, label(maxProgressLabel, "100%"))));
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
+
const defaultValueNow = ariaValueMin + (ariaValueMax - ariaValueMin) * progress / 100;
|
|
91
92
|
return /*#__PURE__*/_react.default.createElement(_progressTracker.StyledProgressTracker, _extends({
|
|
92
93
|
size: size,
|
|
93
94
|
length: length,
|
|
@@ -96,7 +97,7 @@ const ProgressTracker = ({
|
|
|
96
97
|
role: "progressbar",
|
|
97
98
|
"aria-label": ariaLabel,
|
|
98
99
|
"aria-describedby": ariaDescribedBy,
|
|
99
|
-
"aria-valuenow": ariaValueNow,
|
|
100
|
+
"aria-valuenow": ariaValueNow === undefined ? defaultValueNow : ariaValueNow,
|
|
100
101
|
"aria-valuemin": ariaValueMin,
|
|
101
102
|
"aria-valuemax": ariaValueMax,
|
|
102
103
|
"aria-valuetext": ariaValueText
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { MarginProps } from "styled-system";
|
|
3
|
-
|
|
4
|
-
export interface PreviewProps extends MarginProps {
|
|
5
|
-
/** A custom height to be applied to the component. */
|
|
6
|
-
height?: string;
|
|
7
|
-
/** The number of lines to render. */
|
|
8
|
-
lines?: number;
|
|
9
|
-
/* Provides more control over when in a loading state. */
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
/** A custom width */
|
|
12
|
-
width?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare function Preview(
|
|
16
|
-
props: React.PropsWithChildren<PreviewProps>
|
|
17
|
-
): JSX.Element;
|
|
18
|
-
|
|
19
|
-
export default Preview;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { MarginProps } from "styled-system";
|
|
3
|
-
|
|
4
|
-
export interface PreviewProps extends MarginProps {
|
|
5
|
-
/** A custom height to be applied to the component. */
|
|
6
|
-
height?: string;
|
|
7
|
-
/** The number of lines to render. */
|
|
8
|
-
lines?: number;
|
|
9
|
-
/* Provides more control over when in a loading state. */
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
/** A custom width */
|
|
12
|
-
width?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare function Preview(
|
|
16
|
-
props: React.PropsWithChildren<PreviewProps>
|
|
17
|
-
): JSX.Element;
|
|
18
|
-
|
|
19
|
-
export default Preview;
|