@synerise/ds-progress-bar 1.1.14 → 1.1.16
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 +22 -0
- package/README.md +6 -6
- package/dist/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar.js +50 -45
- package/dist/ProgressBar.styles.d.ts +14 -5
- package/dist/ProgressBar.styles.js +34 -20
- package/dist/ProgressBar.types.d.ts +10 -15
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.16](https://github.com/Synerise/synerise-design/compare/@synerise/ds-progress-bar@1.1.15...@synerise/ds-progress-bar@1.1.16) (2025-09-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fixed regressions ([7280298](https://github.com/Synerise/synerise-design/commit/7280298de410dd67bb858afda6c2367436bbc192))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.1.15](https://github.com/Synerise/synerise-design/compare/@synerise/ds-progress-bar@1.1.14...@synerise/ds-progress-bar@1.1.15) (2025-09-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **progress-bar:** refactor progress bar and remove ant ([3324544](https://github.com/Synerise/synerise-design/commit/33245443d076da967561558ca8506d6ab0d904e5))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [1.1.14](https://github.com/Synerise/synerise-design/compare/@synerise/ds-progress-bar@1.1.13...@synerise/ds-progress-bar@1.1.14) (2025-08-28)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @synerise/ds-progress-bar
|
package/README.md
CHANGED
|
@@ -15,14 +15,14 @@ Progress-Bar UI Component
|
|
|
15
15
|
|
|
16
16
|
| Property | Description | Type | Default |
|
|
17
17
|
| ----------- | --------------------------------------------------------------------- | ------------------------------- | --------- |
|
|
18
|
-
|
|
|
18
|
+
| steps | Number of steps in progress bar | number | - |
|
|
19
19
|
| description | Text of description under progress bar | string | - |
|
|
20
20
|
| percent | Value of progress bar, also visible in label | number | - |
|
|
21
|
-
| thin | Displays a thinner line | boolean |
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
21
|
+
| thin | Displays a thinner line | boolean | `false` |
|
|
22
|
+
| label | Optional label above progress bar | string | - |
|
|
23
|
+
| customColor | Bar color | string | - |
|
|
24
|
+
| width | CSS width property of progress-bar | string | - |
|
|
25
|
+
| inline | set percent value next to progress bar | boolean | `false` |
|
|
26
26
|
|
|
27
27
|
### ProgressTiles
|
|
28
28
|
|
package/dist/ProgressBar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ProgressProps } from './ProgressBar.types';
|
|
3
|
-
declare const ProgressBar: ({
|
|
3
|
+
declare const ProgressBar: ({ description, label, steps, width, customColor, percent, className, thin, containerStyles, inline, ...rest }: ProgressProps) => React.JSX.Element;
|
|
4
4
|
export default ProgressBar;
|
package/dist/ProgressBar.js
CHANGED
|
@@ -1,60 +1,65 @@
|
|
|
1
|
-
var _excluded = ["
|
|
1
|
+
var _excluded = ["description", "label", "steps", "width", "customColor", "percent", "className", "thin", "containerStyles", "inline"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import {
|
|
4
|
+
import React, { useMemo } from 'react';
|
|
5
|
+
import { v4 as uuid } from 'uuid';
|
|
6
6
|
import * as S from './ProgressBar.styles';
|
|
7
|
+
var MAX_PERCENT = 100;
|
|
7
8
|
var ProgressBar = function ProgressBar(_ref) {
|
|
8
|
-
var _ref$
|
|
9
|
-
showLabel = _ref$showLabel === void 0 ? false : _ref$showLabel,
|
|
10
|
-
_ref$description = _ref.description,
|
|
9
|
+
var _ref$description = _ref.description,
|
|
11
10
|
description = _ref$description === void 0 ? '' : _ref$description,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_ref$
|
|
15
|
-
|
|
16
|
-
_ref$
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_ref$
|
|
20
|
-
|
|
11
|
+
label = _ref.label,
|
|
12
|
+
_ref$steps = _ref.steps,
|
|
13
|
+
steps = _ref$steps === void 0 ? 1 : _ref$steps,
|
|
14
|
+
_ref$width = _ref.width,
|
|
15
|
+
width = _ref$width === void 0 ? '100%' : _ref$width,
|
|
16
|
+
_ref$customColor = _ref.customColor,
|
|
17
|
+
customColor = _ref$customColor === void 0 ? '' : _ref$customColor,
|
|
18
|
+
_ref$percent = _ref.percent,
|
|
19
|
+
percent = _ref$percent === void 0 ? 50 : _ref$percent,
|
|
21
20
|
className = _ref.className,
|
|
22
|
-
|
|
23
|
-
thin = _ref
|
|
24
|
-
labelFormatter = _ref.labelFormatter,
|
|
21
|
+
_ref$thin = _ref.thin,
|
|
22
|
+
thin = _ref$thin === void 0 ? false : _ref$thin,
|
|
25
23
|
containerStyles = _ref.containerStyles,
|
|
26
|
-
|
|
27
|
-
_ref$
|
|
28
|
-
maxPercent = _ref$maxPercent === void 0 ? true : _ref$maxPercent,
|
|
24
|
+
_ref$inline = _ref.inline,
|
|
25
|
+
inline = _ref$inline === void 0 ? false : _ref$inline,
|
|
29
26
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
var tiles = useMemo(function () {
|
|
28
|
+
return Array.from({
|
|
29
|
+
length: steps
|
|
30
|
+
}, function () {
|
|
31
|
+
return {
|
|
32
|
+
id: uuid()
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}, [steps]);
|
|
36
|
+
var tileWidthRatio = MAX_PERCENT / steps;
|
|
37
|
+
var currentProgress = percent / tileWidthRatio;
|
|
38
|
+
var tileWidths = Array(Math.floor(currentProgress)).fill(1);
|
|
39
|
+
var lastTileWidth = currentProgress % 1;
|
|
40
|
+
var tilesWidthRatios = [].concat(tileWidths, [lastTileWidth]);
|
|
37
41
|
return /*#__PURE__*/React.createElement(S.Container, _extends({
|
|
38
42
|
className: (className || '') + " progress-bar-container",
|
|
39
43
|
"data-testid": "progress-bar-container",
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"data-testid": "progress-bar-label"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, amount), /*#__PURE__*/React.createElement("span", {
|
|
44
|
+
steps: steps,
|
|
45
|
+
inline: inline
|
|
46
|
+
}, rest), label && !inline && /*#__PURE__*/React.createElement(S.LabelWrapper, null, /*#__PURE__*/React.createElement(S.Label, {
|
|
47
|
+
"data-testid": "progress-bar-label",
|
|
48
|
+
className: "progress-bar-label"
|
|
49
|
+
}, label), /*#__PURE__*/React.createElement("span", {
|
|
47
50
|
"data-testid": "progress-bar-max-percent"
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
}, percent + "%")), /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "progress-div"
|
|
53
|
+
}, tiles.map(function (tile, i) {
|
|
54
|
+
return /*#__PURE__*/React.createElement(S.ProgressWrapper, {
|
|
55
|
+
thin: thin,
|
|
56
|
+
key: "key-" + tile.id,
|
|
57
|
+
width: width
|
|
58
|
+
}, /*#__PURE__*/React.createElement(S.ProgressBar, {
|
|
59
|
+
customColor: customColor,
|
|
60
|
+
width: (tilesWidthRatios[i] || 0) * MAX_PERCENT + "%"
|
|
61
|
+
}));
|
|
62
|
+
})), inline && /*#__PURE__*/React.createElement(S.PercentWrapper, null, percent + "%"), description && !inline && /*#__PURE__*/React.createElement("span", {
|
|
58
63
|
className: "progress-bar-description",
|
|
59
64
|
"data-testid": "progress-bar-description"
|
|
60
65
|
}, description));
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export declare const LabelWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const Label: import("styled-components").StyledComponent<({ id, label, tooltip, tooltipConfig, children, ...htmlAttributes }: import("@synerise/ds-form-field").FormFieldLabelProps) => React.JSX.Element, any, {}, never>;
|
|
3
|
+
export declare const ProgressWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
width: string;
|
|
5
|
+
thin: boolean;
|
|
6
|
+
}, never>;
|
|
7
|
+
export declare const ProgressBar: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
customColor: string;
|
|
9
|
+
width: string;
|
|
10
|
+
}, never>;
|
|
11
|
+
export declare const PercentWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
13
|
+
steps?: number;
|
|
14
|
+
inline?: boolean;
|
|
6
15
|
}, never>;
|
|
@@ -1,28 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
export var
|
|
4
|
-
displayName: "
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { FormFieldLabel } from '@synerise/ds-form-field';
|
|
3
|
+
export var LabelWrapper = styled.div.withConfig({
|
|
4
|
+
displayName: "ProgressBarstyles__LabelWrapper",
|
|
5
5
|
componentId: "sc-1gqovic-0"
|
|
6
|
-
})(["
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export var MaxValue = styled.strong.withConfig({
|
|
10
|
-
displayName: "ProgressBarstyles__MaxValue",
|
|
6
|
+
})(["display:flex;align-items:center;margin-bottom:8px;"]);
|
|
7
|
+
export var Label = styled(FormFieldLabel).withConfig({
|
|
8
|
+
displayName: "ProgressBarstyles__Label",
|
|
11
9
|
componentId: "sc-1gqovic-1"
|
|
12
|
-
})(["
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export var AntdProgressBar = styled(Progress).withConfig({
|
|
16
|
-
displayName: "ProgressBarstyles__AntdProgressBar",
|
|
10
|
+
})(["&&&{margin:0 8px 0 0;align-items:center;}"]);
|
|
11
|
+
export var ProgressWrapper = styled.div.withConfig({
|
|
12
|
+
displayName: "ProgressBarstyles__ProgressWrapper",
|
|
17
13
|
componentId: "sc-1gqovic-2"
|
|
18
|
-
})(["
|
|
19
|
-
return props.
|
|
14
|
+
})(["position:relative;margin-right:2px;width:", ";height:", ";background:", ";"], function (props) {
|
|
15
|
+
return props.width;
|
|
20
16
|
}, function (props) {
|
|
21
|
-
return props.thin ? '
|
|
17
|
+
return props.thin ? '4px' : '6px';
|
|
22
18
|
}, function (props) {
|
|
23
19
|
return props.theme.palette['grey-200'];
|
|
20
|
+
});
|
|
21
|
+
export var ProgressBar = styled.div.withConfig({
|
|
22
|
+
displayName: "ProgressBarstyles__ProgressBar",
|
|
23
|
+
componentId: "sc-1gqovic-3"
|
|
24
|
+
})(["position:absolute;height:100%;width:", ";background-color:", ";"], function (props) {
|
|
25
|
+
return props.width;
|
|
24
26
|
}, function (props) {
|
|
25
|
-
return props.theme.palette['
|
|
26
|
-
}
|
|
27
|
-
|
|
27
|
+
return props.customColor ? props.customColor : props.theme.palette['green-500'];
|
|
28
|
+
});
|
|
29
|
+
export var PercentWrapper = styled.div.withConfig({
|
|
30
|
+
displayName: "ProgressBarstyles__PercentWrapper",
|
|
31
|
+
componentId: "sc-1gqovic-4"
|
|
32
|
+
})(["margin-left:8px;color:", ";font-weight:400;"], function (props) {
|
|
33
|
+
return props.theme.palette['grey-800'];
|
|
34
|
+
});
|
|
35
|
+
export var Container = styled.div.withConfig({
|
|
36
|
+
displayName: "ProgressBarstyles__Container",
|
|
37
|
+
componentId: "sc-1gqovic-5"
|
|
38
|
+
})(["width:100%;display:flex;justify-content:center;flex-direction:", ";.progress-bar-description{margin-top:8px;}.progress-div{display:flex;align-items:center;}", ":last-of-type{border-radius:3px;", ":last-of-type{border-radius:3px;}}", ""], function (props) {
|
|
39
|
+
return props.inline ? 'row' : 'column';
|
|
40
|
+
}, ProgressWrapper, ProgressBar, function (props) {
|
|
41
|
+
return props.steps !== 1 && css(["", ":first-of-type{border-radius:3px 0 0 3px;", ":first-of-type{border-radius:3px 0 0 3px;}}", ":last-of-type{border-radius:0 3px 3px 0;", ":last-of-type{border-radius:0 3px 3px 0;}}"], ProgressWrapper, ProgressBar, ProgressWrapper, ProgressBar);
|
|
28
42
|
});
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import type { ProgressProps as AntProgressProps } from 'antd/lib/progress/progress';
|
|
2
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { type
|
|
4
|
-
export type ProgressProps = WithHTMLAttributes<HTMLDivElement,
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { type WithHTMLAttributes } from '@synerise/ds-utils';
|
|
3
|
+
export type ProgressProps = WithHTMLAttributes<HTMLDivElement, {
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
steps?: number;
|
|
6
|
+
width?: string;
|
|
7
|
+
customColor?: string;
|
|
7
8
|
description?: ReactNode;
|
|
8
|
-
|
|
9
|
+
thin?: boolean;
|
|
10
|
+
percent?: number;
|
|
11
|
+
inline?: boolean;
|
|
9
12
|
/**
|
|
10
13
|
* @deprecated - use style prop
|
|
11
14
|
*/
|
|
12
15
|
containerStyles?: CSSProperties;
|
|
13
|
-
|
|
14
|
-
} & ExactlyOne<{
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated - this property has been renamed to thin to reflect it's functionality
|
|
17
|
-
*/
|
|
18
|
-
thick?: boolean;
|
|
19
|
-
}, {
|
|
20
|
-
thin?: boolean;
|
|
21
|
-
}>>;
|
|
16
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-progress-bar",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"description": "Progress-Bar UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -39,9 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@synerise/ds-core": "*",
|
|
42
|
-
"antd": "4.24.16",
|
|
43
42
|
"react": ">=16.9.0 <= 18.3.1",
|
|
44
43
|
"styled-components": "^5.3.3"
|
|
45
44
|
},
|
|
46
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "7a8206260f1e50bb4b4784081feae944ba780c30"
|
|
47
46
|
}
|