@atlaskit/progress-bar 0.5.7 → 0.5.8
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/CHANGELOG.md +10 -0
- package/dist/cjs/components/progress-bar.js +120 -80
- package/dist/cjs/components/success-progress-bar.js +26 -70
- package/dist/cjs/components/transparent-progress-bar.js +26 -61
- package/dist/cjs/theme.js +8 -39
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/progress-bar.js +112 -54
- package/dist/es2019/components/success-progress-bar.js +23 -32
- package/dist/es2019/components/transparent-progress-bar.js +23 -25
- package/dist/es2019/theme.js +9 -37
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/progress-bar.js +117 -78
- package/dist/esm/components/success-progress-bar.js +26 -66
- package/dist/esm/components/transparent-progress-bar.js +26 -58
- package/dist/esm/theme.js +9 -35
- package/dist/esm/version.json +1 -1
- package/dist/types/components/progress-bar.d.ts +12 -9
- package/dist/types/components/success-progress-bar.d.ts +11 -8
- package/dist/types/components/transparent-progress-bar.d.ts +11 -8
- package/dist/types/theme.d.ts +3 -1
- package/dist/types/types.d.ts +20 -7
- package/package.json +5 -2
- package/report.api.md +80 -0
|
@@ -1,61 +1,119 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
1
|
/** @jsx jsx */
|
|
4
2
|
import React from 'react';
|
|
5
|
-
import { jsx } from '@emotion/core';
|
|
6
|
-
import
|
|
3
|
+
import { css, jsx, keyframes } from '@emotion/core';
|
|
4
|
+
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
5
|
+
import { G300, N40A, N500 } from '@atlaskit/theme/colors';
|
|
7
6
|
import { Theme } from '../theme';
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
css: [tokens.bar, tokens.decreasingBar]
|
|
19
|
-
}));
|
|
7
|
+
const MIN_VALUE = 0;
|
|
8
|
+
const MAX_VALUE = 1;
|
|
9
|
+
const increasingBarAnimation = keyframes({
|
|
10
|
+
from: {
|
|
11
|
+
left: '-5%',
|
|
12
|
+
width: '5%'
|
|
13
|
+
},
|
|
14
|
+
to: {
|
|
15
|
+
left: '130%',
|
|
16
|
+
width: ' 100%'
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
ariaLabel,
|
|
31
|
-
value,
|
|
32
|
-
isIndeterminate,
|
|
33
|
-
theme
|
|
34
|
-
} = this.props;
|
|
35
|
-
const valueParsed = isIndeterminate ? 0 : Math.max(0, Math.min(value, maxValue));
|
|
36
|
-
deprecationWarning('@atlaskit/progress-bar', '`theme` prop', 'If you depend on `theme`, we recommend migrating to one of its variants.');
|
|
37
|
-
return jsx(Theme.Provider, {
|
|
38
|
-
value: theme
|
|
39
|
-
}, jsx(Theme.Consumer, {
|
|
40
|
-
value: value
|
|
41
|
-
}, tokens => jsx("div", {
|
|
42
|
-
css: tokens.container,
|
|
43
|
-
role: "progressbar",
|
|
44
|
-
"aria-label": ariaLabel,
|
|
45
|
-
"aria-valuemin": 0,
|
|
46
|
-
"aria-valuenow": valueParsed,
|
|
47
|
-
"aria-valuemax": maxValue,
|
|
48
|
-
tabIndex: 0,
|
|
49
|
-
"data-testid": "progress-bar"
|
|
50
|
-
}, jsx(Bar, {
|
|
51
|
-
isIndeterminate: isIndeterminate,
|
|
52
|
-
tokens: tokens
|
|
53
|
-
}))));
|
|
18
|
+
});
|
|
19
|
+
const decreasingBarAnimation = keyframes({
|
|
20
|
+
from: {
|
|
21
|
+
left: '-80%',
|
|
22
|
+
width: '80%'
|
|
23
|
+
},
|
|
24
|
+
to: {
|
|
25
|
+
left: '110%',
|
|
26
|
+
width: '10%'
|
|
54
27
|
}
|
|
28
|
+
});
|
|
29
|
+
const containerStyles = css({
|
|
30
|
+
width: `100%`,
|
|
31
|
+
height: 6,
|
|
32
|
+
position: 'relative',
|
|
33
|
+
background: `var(--ds-background-neutral, ${N40A})`,
|
|
34
|
+
borderRadius: 3,
|
|
35
|
+
overflow: 'hidden'
|
|
36
|
+
});
|
|
37
|
+
const containerAppearance = {
|
|
38
|
+
default: css({
|
|
39
|
+
background: `var(--ds-background-neutral, ${N40A})`
|
|
40
|
+
}),
|
|
41
|
+
success: css({
|
|
42
|
+
background: `var(--ds-background-neutral, ${N40A})`
|
|
43
|
+
}),
|
|
44
|
+
inverse: css({
|
|
45
|
+
background: "var(--ds-background-inverse-subtle, rgba(255, 255, 255, 0.5))"
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
const barAppearance = {
|
|
49
|
+
default: css({
|
|
50
|
+
background: `var(--ds-background-neutral-bold, ${N500})`
|
|
51
|
+
}),
|
|
52
|
+
success: css({
|
|
53
|
+
background: `var(--ds-background-success-bold, ${G300})`
|
|
54
|
+
}),
|
|
55
|
+
inverse: css({
|
|
56
|
+
background: "var(--ds-surface, white)"
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
const barStyles = css({
|
|
60
|
+
display: 'block',
|
|
61
|
+
height: 6,
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
borderRadius: 3
|
|
64
|
+
});
|
|
65
|
+
const determinateBarStyles = css({
|
|
66
|
+
transition: 'width 0.2s'
|
|
67
|
+
});
|
|
68
|
+
const increasingBarStyles = css({
|
|
69
|
+
animation: `${increasingBarAnimation} 2s infinite`
|
|
70
|
+
});
|
|
71
|
+
const decreasingBarStyles = css({
|
|
72
|
+
animation: `${decreasingBarAnimation} 2s 0.5s infinite`
|
|
73
|
+
});
|
|
74
|
+
/**
|
|
75
|
+
* __Progress bar__
|
|
76
|
+
*
|
|
77
|
+
* A progress bar displays the status of a given process.
|
|
78
|
+
*
|
|
79
|
+
* - [Examples](https://atlassian.design/components/progress-bar/examples)
|
|
80
|
+
* - [Code](https://atlassian.design/components/progress-bar/code)
|
|
81
|
+
* - [Usage](https://atlassian.design/components/progress-bar/usage)
|
|
82
|
+
*/
|
|
55
83
|
|
|
56
|
-
|
|
84
|
+
const ProgressBar = ({
|
|
85
|
+
appearance = 'default',
|
|
86
|
+
ariaLabel,
|
|
87
|
+
isIndeterminate = false,
|
|
88
|
+
testId = 'progress-bar',
|
|
89
|
+
theme,
|
|
90
|
+
value = 0
|
|
91
|
+
}) => {
|
|
92
|
+
const valueParsed = isIndeterminate ? MIN_VALUE : Math.max(MIN_VALUE, Math.min(value, MAX_VALUE));
|
|
93
|
+
propDeprecationWarning("@atlaskit/progress-bar", 'theme', typeof theme !== undefined, 'https://community.developer.atlassian.com/t/theme-prop-in-atlaskit-progress-bar-is-being-deprecated/56198');
|
|
94
|
+
return jsx(Theme.Provider, {
|
|
95
|
+
value: theme
|
|
96
|
+
}, jsx(Theme.Consumer, {
|
|
97
|
+
value: value
|
|
98
|
+
}, tokens => jsx("div", {
|
|
99
|
+
css: [containerStyles, containerAppearance[appearance], tokens.container],
|
|
100
|
+
role: "progressbar",
|
|
101
|
+
"aria-label": ariaLabel,
|
|
102
|
+
"aria-valuemin": MIN_VALUE,
|
|
103
|
+
"aria-valuenow": valueParsed,
|
|
104
|
+
"aria-valuemax": MAX_VALUE,
|
|
105
|
+
tabIndex: 0,
|
|
106
|
+
"data-testid": testId
|
|
107
|
+
}, isIndeterminate ? jsx(React.Fragment, null, jsx("span", {
|
|
108
|
+
css: [barStyles, barAppearance[appearance], increasingBarStyles, tokens.bar, tokens.increasingBar]
|
|
109
|
+
}), jsx("span", {
|
|
110
|
+
css: [barStyles, barAppearance[appearance], decreasingBarStyles, tokens.bar, tokens.decreasingBar]
|
|
111
|
+
})) : jsx("span", {
|
|
112
|
+
style: {
|
|
113
|
+
width: `${Number(value) * 100}%`
|
|
114
|
+
},
|
|
115
|
+
css: [barStyles, barAppearance[appearance], determinateBarStyles, tokens.bar, tokens.determinateBar]
|
|
116
|
+
}))));
|
|
117
|
+
};
|
|
57
118
|
|
|
58
|
-
|
|
59
|
-
value: 0,
|
|
60
|
-
isIndeterminate: false
|
|
61
|
-
});
|
|
119
|
+
export default ProgressBar;
|
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
1
|
import React from 'react';
|
|
4
|
-
import deprecationWarning from '@atlaskit/ds-lib/deprecation-warning';
|
|
5
|
-
import { G300 } from '@atlaskit/theme/colors';
|
|
6
2
|
import ProgressBar from './progress-bar';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
isIndeterminate
|
|
16
|
-
} = this.props;
|
|
3
|
+
/**
|
|
4
|
+
* __Success progress bar__
|
|
5
|
+
*
|
|
6
|
+
* A success progress bar indicates the completion of a process.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/progress-bar/success-progress-bar/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/progress-bar/success-progress-bar/code)
|
|
10
|
+
*/
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const SuccessProgressBar = ({
|
|
13
|
+
ariaLabel,
|
|
14
|
+
isIndeterminate = false,
|
|
15
|
+
testId,
|
|
16
|
+
value = 0
|
|
17
|
+
}) => {
|
|
18
|
+
return /*#__PURE__*/React.createElement(ProgressBar, {
|
|
19
|
+
appearance: value < 1 || isIndeterminate ? 'default' : 'success',
|
|
20
|
+
value: value,
|
|
21
|
+
isIndeterminate: isIndeterminate,
|
|
22
|
+
ariaLabel: ariaLabel,
|
|
23
|
+
testId: testId
|
|
24
|
+
});
|
|
25
|
+
};
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
bar: { ...theme.bar,
|
|
24
|
-
background: `var(--ds-background-success-bold, ${G300})`
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_defineProperty(SuccessProgressBar, "defaultProps", {
|
|
34
|
-
value: 0,
|
|
35
|
-
isIndeterminate: false
|
|
36
|
-
});
|
|
27
|
+
export default SuccessProgressBar;
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
1
|
import React from 'react';
|
|
4
|
-
import deprecationWarning from '@atlaskit/ds-lib/deprecation-warning';
|
|
5
2
|
import ProgressBar from './progress-bar';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
background: "var(--ds-background-inverse-subtle, rgba(255, 255, 255, 0.5))"
|
|
15
|
-
},
|
|
16
|
-
bar: { ...theme.bar,
|
|
17
|
-
background: "var(--ds-surface, white)"
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
3
|
+
/**
|
|
4
|
+
* __Transparent progress bar__
|
|
5
|
+
*
|
|
6
|
+
* A transparent progress bar is used on bold backgrounds to maintain suitable contrast.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/progress-bar/transparent-progress-bar/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/progress-bar/transparent-progress-bar/code)
|
|
10
|
+
*/
|
|
23
11
|
|
|
24
|
-
|
|
12
|
+
const TransparentProgressBar = ({
|
|
13
|
+
ariaLabel,
|
|
14
|
+
isIndeterminate = false,
|
|
15
|
+
testId,
|
|
16
|
+
value = 0
|
|
17
|
+
}) => {
|
|
18
|
+
return /*#__PURE__*/React.createElement(ProgressBar, {
|
|
19
|
+
appearance: "inverse",
|
|
20
|
+
value: value,
|
|
21
|
+
isIndeterminate: isIndeterminate,
|
|
22
|
+
ariaLabel: ariaLabel,
|
|
23
|
+
testId: testId
|
|
24
|
+
});
|
|
25
|
+
};
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
value: 0,
|
|
28
|
-
isIndeterminate: false
|
|
29
|
-
});
|
|
27
|
+
export default TransparentProgressBar;
|
package/dist/es2019/theme.js
CHANGED
|
@@ -1,42 +1,14 @@
|
|
|
1
|
-
import { keyframes } from '@emotion/core';
|
|
2
|
-
import { N40A, N500 } from '@atlaskit/theme/colors';
|
|
3
1
|
import { createTheme } from '@atlaskit/theme/components';
|
|
4
|
-
|
|
5
|
-
from { left: -5%; width: 5%; }
|
|
6
|
-
to { left: 130%; width: 100%;}
|
|
7
|
-
`;
|
|
8
|
-
const decreasingBarAnimation = keyframes`
|
|
9
|
-
from { left: -80%; width: 80%; }
|
|
10
|
-
to { left: 110%; width: 10%;}
|
|
11
|
-
`;
|
|
2
|
+
|
|
12
3
|
/**
|
|
13
|
-
*
|
|
4
|
+
* Creates the default theme, which can be customised using the `theme` prop
|
|
5
|
+
*
|
|
6
|
+
* @deprecated
|
|
14
7
|
*/
|
|
15
|
-
|
|
16
8
|
export const Theme = createTheme(props => ({
|
|
17
|
-
container: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
position: 'relative',
|
|
23
|
-
width: `100%`
|
|
24
|
-
},
|
|
25
|
-
bar: {
|
|
26
|
-
borderRadius: 3,
|
|
27
|
-
display: 'block',
|
|
28
|
-
height: 6,
|
|
29
|
-
position: 'absolute',
|
|
30
|
-
background: `var(--ds-background-neutral-bold, ${N500})`
|
|
31
|
-
},
|
|
32
|
-
determinateBar: {
|
|
33
|
-
transition: 'width 0.2s',
|
|
34
|
-
width: `${Number(props.value) * 100}%`
|
|
35
|
-
},
|
|
36
|
-
increasingBar: {
|
|
37
|
-
animation: `${increasingBarAnimation} 2s infinite`
|
|
38
|
-
},
|
|
39
|
-
decreasingBar: {
|
|
40
|
-
animation: `${decreasingBarAnimation} 2s 0.5s infinite`
|
|
41
|
-
}
|
|
9
|
+
container: {},
|
|
10
|
+
bar: {},
|
|
11
|
+
determinateBar: {},
|
|
12
|
+
increasingBar: {},
|
|
13
|
+
decreasingBar: {}
|
|
42
14
|
}));
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,87 +1,126 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
|
|
8
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
11
2
|
|
|
12
3
|
/** @jsx jsx */
|
|
13
4
|
import React from 'react';
|
|
14
|
-
import { jsx } from '@emotion/core';
|
|
15
|
-
import
|
|
5
|
+
import { css, jsx, keyframes } from '@emotion/core';
|
|
6
|
+
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
7
|
+
import { G300, N40A, N500 } from '@atlaskit/theme/colors';
|
|
16
8
|
import { Theme } from '../theme';
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
var MIN_VALUE = 0;
|
|
10
|
+
var MAX_VALUE = 1;
|
|
11
|
+
var increasingBarAnimation = keyframes({
|
|
12
|
+
from: {
|
|
13
|
+
left: '-5%',
|
|
14
|
+
width: '5%'
|
|
15
|
+
},
|
|
16
|
+
to: {
|
|
17
|
+
left: '130%',
|
|
18
|
+
width: ' 100%'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
var decreasingBarAnimation = keyframes({
|
|
22
|
+
from: {
|
|
23
|
+
left: '-80%',
|
|
24
|
+
width: '80%'
|
|
25
|
+
},
|
|
26
|
+
to: {
|
|
27
|
+
left: '110%',
|
|
28
|
+
width: '10%'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
var containerStyles = css({
|
|
32
|
+
width: "100%",
|
|
33
|
+
height: 6,
|
|
34
|
+
position: 'relative',
|
|
35
|
+
background: "var(--ds-background-neutral, ".concat(N40A, ")"),
|
|
36
|
+
borderRadius: 3,
|
|
37
|
+
overflow: 'hidden'
|
|
38
|
+
});
|
|
39
|
+
var containerAppearance = {
|
|
40
|
+
default: css({
|
|
41
|
+
background: "var(--ds-background-neutral, ".concat(N40A, ")")
|
|
42
|
+
}),
|
|
43
|
+
success: css({
|
|
44
|
+
background: "var(--ds-background-neutral, ".concat(N40A, ")")
|
|
45
|
+
}),
|
|
46
|
+
inverse: css({
|
|
47
|
+
background: "var(--ds-background-inverse-subtle, rgba(255, 255, 255, 0.5))"
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
var barAppearance = {
|
|
51
|
+
default: css({
|
|
52
|
+
background: "var(--ds-background-neutral-bold, ".concat(N500, ")")
|
|
53
|
+
}),
|
|
54
|
+
success: css({
|
|
55
|
+
background: "var(--ds-background-success-bold, ".concat(G300, ")")
|
|
56
|
+
}),
|
|
57
|
+
inverse: css({
|
|
58
|
+
background: "var(--ds-surface, white)"
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
var barStyles = css({
|
|
62
|
+
display: 'block',
|
|
63
|
+
height: 6,
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
borderRadius: 3
|
|
66
|
+
});
|
|
67
|
+
var determinateBarStyles = css({
|
|
68
|
+
transition: 'width 0.2s'
|
|
69
|
+
});
|
|
70
|
+
var increasingBarStyles = css({
|
|
71
|
+
animation: "".concat(increasingBarAnimation, " 2s infinite")
|
|
72
|
+
});
|
|
73
|
+
var decreasingBarStyles = css({
|
|
74
|
+
animation: "".concat(decreasingBarAnimation, " 2s 0.5s infinite")
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* __Progress bar__
|
|
78
|
+
*
|
|
79
|
+
* A progress bar displays the status of a given process.
|
|
80
|
+
*
|
|
81
|
+
* - [Examples](https://atlassian.design/components/progress-bar/examples)
|
|
82
|
+
* - [Code](https://atlassian.design/components/progress-bar/code)
|
|
83
|
+
* - [Usage](https://atlassian.design/components/progress-bar/usage)
|
|
84
|
+
*/
|
|
22
85
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
86
|
+
var ProgressBar = function ProgressBar(_ref) {
|
|
87
|
+
var _ref$appearance = _ref.appearance,
|
|
88
|
+
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
89
|
+
ariaLabel = _ref.ariaLabel,
|
|
90
|
+
_ref$isIndeterminate = _ref.isIndeterminate,
|
|
91
|
+
isIndeterminate = _ref$isIndeterminate === void 0 ? false : _ref$isIndeterminate,
|
|
92
|
+
_ref$testId = _ref.testId,
|
|
93
|
+
testId = _ref$testId === void 0 ? 'progress-bar' : _ref$testId,
|
|
94
|
+
theme = _ref.theme,
|
|
95
|
+
_ref$value = _ref.value,
|
|
96
|
+
value = _ref$value === void 0 ? 0 : _ref$value;
|
|
97
|
+
var valueParsed = isIndeterminate ? MIN_VALUE : Math.max(MIN_VALUE, Math.min(value, MAX_VALUE));
|
|
98
|
+
propDeprecationWarning("@atlaskit/progress-bar", 'theme', _typeof(theme) !== undefined, 'https://community.developer.atlassian.com/t/theme-prop-in-atlaskit-progress-bar-is-being-deprecated/56198');
|
|
99
|
+
return jsx(Theme.Provider, {
|
|
100
|
+
value: theme
|
|
101
|
+
}, jsx(Theme.Consumer, {
|
|
102
|
+
value: value
|
|
103
|
+
}, function (tokens) {
|
|
104
|
+
return jsx("div", {
|
|
105
|
+
css: [containerStyles, containerAppearance[appearance], tokens.container],
|
|
106
|
+
role: "progressbar",
|
|
107
|
+
"aria-label": ariaLabel,
|
|
108
|
+
"aria-valuemin": MIN_VALUE,
|
|
109
|
+
"aria-valuenow": valueParsed,
|
|
110
|
+
"aria-valuemax": MAX_VALUE,
|
|
111
|
+
tabIndex: 0,
|
|
112
|
+
"data-testid": testId
|
|
113
|
+
}, isIndeterminate ? jsx(React.Fragment, null, jsx("span", {
|
|
114
|
+
css: [barStyles, barAppearance[appearance], increasingBarStyles, tokens.bar, tokens.increasingBar]
|
|
26
115
|
}), jsx("span", {
|
|
27
|
-
css: [tokens.bar, tokens.decreasingBar]
|
|
116
|
+
css: [barStyles, barAppearance[appearance], decreasingBarStyles, tokens.bar, tokens.decreasingBar]
|
|
117
|
+
})) : jsx("span", {
|
|
118
|
+
style: {
|
|
119
|
+
width: "".concat(Number(value) * 100, "%")
|
|
120
|
+
},
|
|
121
|
+
css: [barStyles, barAppearance[appearance], determinateBarStyles, tokens.bar, tokens.determinateBar]
|
|
28
122
|
}));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return jsx("span", {
|
|
32
|
-
css: [tokens.bar, tokens.determinateBar]
|
|
33
|
-
});
|
|
123
|
+
}));
|
|
34
124
|
};
|
|
35
125
|
|
|
36
|
-
|
|
37
|
-
_inherits(ProgressBar, _React$PureComponent);
|
|
38
|
-
|
|
39
|
-
var _super = _createSuper(ProgressBar);
|
|
40
|
-
|
|
41
|
-
function ProgressBar() {
|
|
42
|
-
_classCallCheck(this, ProgressBar);
|
|
43
|
-
|
|
44
|
-
return _super.apply(this, arguments);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_createClass(ProgressBar, [{
|
|
48
|
-
key: "render",
|
|
49
|
-
value: function render() {
|
|
50
|
-
var _this$props = this.props,
|
|
51
|
-
ariaLabel = _this$props.ariaLabel,
|
|
52
|
-
value = _this$props.value,
|
|
53
|
-
isIndeterminate = _this$props.isIndeterminate,
|
|
54
|
-
theme = _this$props.theme;
|
|
55
|
-
var valueParsed = isIndeterminate ? 0 : Math.max(0, Math.min(value, maxValue));
|
|
56
|
-
deprecationWarning('@atlaskit/progress-bar', '`theme` prop', 'If you depend on `theme`, we recommend migrating to one of its variants.');
|
|
57
|
-
return jsx(Theme.Provider, {
|
|
58
|
-
value: theme
|
|
59
|
-
}, jsx(Theme.Consumer, {
|
|
60
|
-
value: value
|
|
61
|
-
}, function (tokens) {
|
|
62
|
-
return jsx("div", {
|
|
63
|
-
css: tokens.container,
|
|
64
|
-
role: "progressbar",
|
|
65
|
-
"aria-label": ariaLabel,
|
|
66
|
-
"aria-valuemin": 0,
|
|
67
|
-
"aria-valuenow": valueParsed,
|
|
68
|
-
"aria-valuemax": maxValue,
|
|
69
|
-
tabIndex: 0,
|
|
70
|
-
"data-testid": "progress-bar"
|
|
71
|
-
}, jsx(Bar, {
|
|
72
|
-
isIndeterminate: isIndeterminate,
|
|
73
|
-
tokens: tokens
|
|
74
|
-
}));
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
}]);
|
|
78
|
-
|
|
79
|
-
return ProgressBar;
|
|
80
|
-
}(React.PureComponent);
|
|
81
|
-
|
|
82
|
-
_defineProperty(ProgressBar, "defaultProps", {
|
|
83
|
-
value: 0,
|
|
84
|
-
isIndeterminate: false
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
export { ProgressBar as default };
|
|
126
|
+
export default ProgressBar;
|
|
@@ -1,68 +1,28 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
|
|
13
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
|
|
15
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
-
|
|
17
1
|
import React from 'react';
|
|
18
|
-
import deprecationWarning from '@atlaskit/ds-lib/deprecation-warning';
|
|
19
|
-
import { G300 } from '@atlaskit/theme/colors';
|
|
20
2
|
import ProgressBar from './progress-bar';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return theme;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return _objectSpread(_objectSpread({}, theme), {}, {
|
|
51
|
-
bar: _objectSpread(_objectSpread({}, theme.bar), {}, {
|
|
52
|
-
background: "var(--ds-background-success-bold, ".concat(G300, ")")
|
|
53
|
-
})
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
58
|
-
}]);
|
|
59
|
-
|
|
60
|
-
return SuccessProgressBar;
|
|
61
|
-
}(React.PureComponent);
|
|
62
|
-
|
|
63
|
-
_defineProperty(SuccessProgressBar, "defaultProps", {
|
|
64
|
-
value: 0,
|
|
65
|
-
isIndeterminate: false
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
export { SuccessProgressBar as default };
|
|
3
|
+
/**
|
|
4
|
+
* __Success progress bar__
|
|
5
|
+
*
|
|
6
|
+
* A success progress bar indicates the completion of a process.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/progress-bar/success-progress-bar/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/progress-bar/success-progress-bar/code)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
var SuccessProgressBar = function SuccessProgressBar(_ref) {
|
|
13
|
+
var ariaLabel = _ref.ariaLabel,
|
|
14
|
+
_ref$isIndeterminate = _ref.isIndeterminate,
|
|
15
|
+
isIndeterminate = _ref$isIndeterminate === void 0 ? false : _ref$isIndeterminate,
|
|
16
|
+
testId = _ref.testId,
|
|
17
|
+
_ref$value = _ref.value,
|
|
18
|
+
value = _ref$value === void 0 ? 0 : _ref$value;
|
|
19
|
+
return /*#__PURE__*/React.createElement(ProgressBar, {
|
|
20
|
+
appearance: value < 1 || isIndeterminate ? 'default' : 'success',
|
|
21
|
+
value: value,
|
|
22
|
+
isIndeterminate: isIndeterminate,
|
|
23
|
+
ariaLabel: ariaLabel,
|
|
24
|
+
testId: testId
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default SuccessProgressBar;
|