carbon-react 102.22.1 → 103.0.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/lib/components/progress-tracker/progress-tracker-test.stories.js +0 -6
- package/lib/components/progress-tracker/progress-tracker.component.d.ts +1 -3
- package/lib/components/progress-tracker/progress-tracker.component.js +1 -9
- package/lib/components/progress-tracker/progress-tracker.config.d.ts +0 -1
- package/lib/components/progress-tracker/progress-tracker.config.js +2 -4
- package/lib/components/progress-tracker/progress-tracker.d.ts +0 -5
- package/lib/components/progress-tracker/progress-tracker.style.js +30 -32
- package/package.json +1 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export default ProgressTracker;
|
|
2
|
-
declare function ProgressTracker({ size, progress, showDefaultLabels, currentProgressLabel, maxProgressLabel,
|
|
2
|
+
declare function ProgressTracker({ size, progress, showDefaultLabels, currentProgressLabel, maxProgressLabel, orientation, direction, labelsPosition, ...rest }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
size?: string | undefined;
|
|
5
5
|
progress?: number | undefined;
|
|
6
6
|
showDefaultLabels?: boolean | undefined;
|
|
7
7
|
currentProgressLabel: any;
|
|
8
8
|
maxProgressLabel: any;
|
|
9
|
-
variant?: string | undefined;
|
|
10
9
|
orientation?: string | undefined;
|
|
11
10
|
direction?: string | undefined;
|
|
12
11
|
labelsPosition: any;
|
|
@@ -18,7 +17,6 @@ declare namespace ProgressTracker {
|
|
|
18
17
|
const showDefaultLabels: PropTypes.Requireable<boolean>;
|
|
19
18
|
const currentProgressLabel: PropTypes.Requireable<string>;
|
|
20
19
|
const maxProgressLabel: PropTypes.Requireable<string>;
|
|
21
|
-
const variant: PropTypes.Requireable<string>;
|
|
22
20
|
const orientation: PropTypes.Requireable<string>;
|
|
23
21
|
const direction: PropTypes.Requireable<string>;
|
|
24
22
|
const labelsPosition: PropTypes.Requireable<string>;
|
|
@@ -29,7 +29,6 @@ const ProgressTracker = ({
|
|
|
29
29
|
showDefaultLabels = false,
|
|
30
30
|
currentProgressLabel,
|
|
31
31
|
maxProgressLabel,
|
|
32
|
-
variant = "default",
|
|
33
32
|
orientation = "horizontal",
|
|
34
33
|
direction = "up",
|
|
35
34
|
labelsPosition,
|
|
@@ -71,8 +70,7 @@ const ProgressTracker = ({
|
|
|
71
70
|
}, /*#__PURE__*/_react.default.createElement(_progressTracker.InnerBar, {
|
|
72
71
|
isVertical: isVertical,
|
|
73
72
|
size: size,
|
|
74
|
-
progress: progress
|
|
75
|
-
variant: variant
|
|
73
|
+
progress: progress
|
|
76
74
|
})), !prefixLabels && renderValueLabels());
|
|
77
75
|
};
|
|
78
76
|
|
|
@@ -93,12 +91,6 @@ ProgressTracker.propTypes = { ...marginPropTypes,
|
|
|
93
91
|
/** Value to display as the maximum progress limit. */
|
|
94
92
|
maxProgressLabel: _propTypes.default.string,
|
|
95
93
|
|
|
96
|
-
/**
|
|
97
|
-
* Sets the colour of the bar that shows the current progress.
|
|
98
|
-
* The "traffic" variant changes the colour of status bar depending on current progress.
|
|
99
|
-
*/
|
|
100
|
-
variant: _propTypes.default.oneOf(["default", "traffic"]),
|
|
101
|
-
|
|
102
94
|
/** The orientation of the component. */
|
|
103
95
|
orientation: _propTypes.default.oneOf(["horizontal", "vertical"]),
|
|
104
96
|
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.PROGRESS_TRACKER_SIZES = exports.OUTER_TRACKER_LENGTH = void 0;
|
|
7
7
|
const OUTER_TRACKER_LENGTH = "256px";
|
|
8
8
|
exports.OUTER_TRACKER_LENGTH = OUTER_TRACKER_LENGTH;
|
|
9
9
|
const PROGRESS_TRACKER_SIZES = ["small", "medium", "large"];
|
|
10
|
-
exports.PROGRESS_TRACKER_SIZES = PROGRESS_TRACKER_SIZES;
|
|
11
|
-
const PROGRESS_TRACKER_VARIANTS = ["default", "traffic"];
|
|
12
|
-
exports.PROGRESS_TRACKER_VARIANTS = PROGRESS_TRACKER_VARIANTS;
|
|
10
|
+
exports.PROGRESS_TRACKER_SIZES = PROGRESS_TRACKER_SIZES;
|
|
@@ -11,11 +11,6 @@ export interface ProgressBarProps extends MarginProps {
|
|
|
11
11
|
currentProgressLabel?: string;
|
|
12
12
|
/** Value to display as the maximum progress limit. */
|
|
13
13
|
maxProgressLabel?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Sets the colour of the bar that shows the current progress.
|
|
16
|
-
* The "traffic" variant changes the colour of status bar depending on current progress.
|
|
17
|
-
* */
|
|
18
|
-
variant?: "default" | "traffic";
|
|
19
14
|
/** The orientation of the component. */
|
|
20
15
|
orientation?: "horizontal" | "vertical";
|
|
21
16
|
/** The direction the bar should move as progress increases, only applies in vertical orientation. */
|
|
@@ -43,12 +43,11 @@ const StyledProgressBar = _styledComponents.default.span`
|
|
|
43
43
|
${({
|
|
44
44
|
direction,
|
|
45
45
|
isVertical,
|
|
46
|
-
size
|
|
47
|
-
theme
|
|
46
|
+
size
|
|
48
47
|
}) => (0, _styledComponents.css)`
|
|
49
48
|
display: flex;
|
|
50
49
|
position: relative;
|
|
51
|
-
background-color:
|
|
50
|
+
background-color: var(--colorsSemanticNeutral200);
|
|
52
51
|
|
|
53
52
|
${!isVertical && (0, _styledComponents.css)`
|
|
54
53
|
overflow-x: hidden;
|
|
@@ -68,16 +67,12 @@ const StyledProgressBar = _styledComponents.default.span`
|
|
|
68
67
|
`;
|
|
69
68
|
exports.StyledProgressBar = StyledProgressBar;
|
|
70
69
|
const StyledValue = _styledComponents.default.span`
|
|
70
|
+
color: var(--colorsUtilityYin090);
|
|
71
71
|
${({
|
|
72
|
-
isMaxValue
|
|
73
|
-
theme
|
|
72
|
+
isMaxValue
|
|
74
73
|
}) => (0, _styledComponents.css)`
|
|
75
|
-
${isMaxValue && `
|
|
76
|
-
|
|
77
|
-
`}
|
|
78
|
-
${!isMaxValue && `
|
|
79
|
-
font-weight: bold;
|
|
80
|
-
`}
|
|
74
|
+
${isMaxValue && `color: var(--colorsUtilityYin055);`}
|
|
75
|
+
${!isMaxValue && `font-weight: bold;`}
|
|
81
76
|
`}
|
|
82
77
|
`;
|
|
83
78
|
exports.StyledValue = StyledValue;
|
|
@@ -121,13 +116,11 @@ const InnerBar = _styledComponents.default.span`
|
|
|
121
116
|
${({
|
|
122
117
|
isVertical,
|
|
123
118
|
progress,
|
|
124
|
-
size
|
|
125
|
-
theme,
|
|
126
|
-
variant
|
|
119
|
+
size
|
|
127
120
|
}) => (0, _styledComponents.css)`
|
|
128
121
|
position: absolute;
|
|
129
122
|
left: 0;
|
|
130
|
-
background-color: ${getInnerBarColour(
|
|
123
|
+
background-color: ${getInnerBarColour(progress)};
|
|
131
124
|
|
|
132
125
|
${!isVertical && (0, _styledComponents.css)`
|
|
133
126
|
width: calc(${_progressTracker.OUTER_TRACKER_LENGTH} * ${progress / 100});
|
|
@@ -146,44 +139,49 @@ exports.InnerBar = InnerBar;
|
|
|
146
139
|
function getHeight(size) {
|
|
147
140
|
switch (size) {
|
|
148
141
|
case "small":
|
|
149
|
-
return "
|
|
142
|
+
return "var(--sizing050)";
|
|
150
143
|
|
|
151
144
|
case "large":
|
|
152
|
-
return "
|
|
145
|
+
return "var(--sizing200)";
|
|
153
146
|
|
|
154
147
|
default:
|
|
155
|
-
return "
|
|
148
|
+
return "var(--sizing100)";
|
|
156
149
|
}
|
|
157
150
|
}
|
|
158
151
|
|
|
159
|
-
function getInnerBarColour(
|
|
160
|
-
if (progress >= 100) return
|
|
161
|
-
|
|
162
|
-
if (progress < 20) return theme.colors.error;
|
|
163
|
-
return theme.progressTracker.trafficNeutral;
|
|
152
|
+
function getInnerBarColour(progress) {
|
|
153
|
+
if (progress >= 100) return "var(--colorsSemanticPositive500)";
|
|
154
|
+
return "var(--colorsSemanticNeutral500)";
|
|
164
155
|
}
|
|
165
156
|
|
|
166
157
|
StyledProgressTracker.defaultProps = {
|
|
167
158
|
theme: _base.default
|
|
168
159
|
};
|
|
169
160
|
StyledProgressBar.defaultProps = {
|
|
170
|
-
|
|
161
|
+
size: "medium"
|
|
162
|
+
};
|
|
163
|
+
InnerBar.defaultProps = {
|
|
164
|
+
progress: 0,
|
|
171
165
|
size: "medium"
|
|
172
166
|
};
|
|
173
167
|
InnerBar.propTypes = {
|
|
174
168
|
size: _propTypes.default.oneOf(_progressTracker.PROGRESS_TRACKER_SIZES),
|
|
175
169
|
progress: _propTypes.default.number,
|
|
176
|
-
|
|
170
|
+
isVertical: _propTypes.default.bool
|
|
177
171
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
size: "medium",
|
|
182
|
-
variant: "default"
|
|
172
|
+
StyledProgressTracker.propTypes = {
|
|
173
|
+
theme: _propTypes.default.object,
|
|
174
|
+
isVertical: _propTypes.default.bool
|
|
183
175
|
};
|
|
184
|
-
|
|
185
|
-
|
|
176
|
+
StyledValuesLabel.propTypes = {
|
|
177
|
+
isVertical: _propTypes.default.bool,
|
|
178
|
+
position: _propTypes.default.oneOf(["top", "bottom", "left", "right"])
|
|
179
|
+
};
|
|
180
|
+
StyledValue.propTypes = {
|
|
181
|
+
isMaxValue: _propTypes.default.bool
|
|
186
182
|
};
|
|
187
183
|
StyledProgressBar.propTypes = {
|
|
184
|
+
direction: _propTypes.default.oneOf(["up", "down"]),
|
|
185
|
+
isVertical: _propTypes.default.bool,
|
|
188
186
|
size: _propTypes.default.oneOf(_progressTracker.PROGRESS_TRACKER_SIZES)
|
|
189
187
|
};
|