@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 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
- | amount | Number visibile in progress bar label | number | - |
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
- | showLabel | Shows label above progress bar, label contains amount and percentage. | boolean | `false` |
23
- | type | Type of progress bar | `line` / `circle` / `dashboard` | `line` |
24
- | strokeLine | To set the style of the progress linecap | `round` / `square` | `round` |
25
- | strokeColor | Color of progress bar | string | `#76dc25` |
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
 
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { type ProgressProps } from './ProgressBar.types';
3
- declare const ProgressBar: ({ showLabel, description, amount, percent, type, status, strokeColor, strokeLinecap, className, thick, thin, labelFormatter, containerStyles, style, maxPercent, ...rest }: ProgressProps) => React.JSX.Element;
3
+ declare const ProgressBar: ({ description, label, steps, width, customColor, percent, className, thin, containerStyles, inline, ...rest }: ProgressProps) => React.JSX.Element;
4
4
  export default ProgressBar;
@@ -1,60 +1,65 @@
1
- var _excluded = ["showLabel", "description", "amount", "percent", "type", "status", "strokeColor", "strokeLinecap", "className", "thick", "thin", "labelFormatter", "containerStyles", "style", "maxPercent"];
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 { useTheme } from '@synerise/ds-core';
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$showLabel = _ref.showLabel,
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
- amount = _ref.amount,
13
- percent = _ref.percent,
14
- _ref$type = _ref.type,
15
- type = _ref$type === void 0 ? 'line' : _ref$type,
16
- _ref$status = _ref.status,
17
- status = _ref$status === void 0 ? 'normal' : _ref$status,
18
- strokeColor = _ref.strokeColor,
19
- _ref$strokeLinecap = _ref.strokeLinecap,
20
- strokeLinecap = _ref$strokeLinecap === void 0 ? 'round' : _ref$strokeLinecap,
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
- thick = _ref.thick,
23
- thin = _ref.thin,
24
- labelFormatter = _ref.labelFormatter,
21
+ _ref$thin = _ref.thin,
22
+ thin = _ref$thin === void 0 ? false : _ref$thin,
25
23
  containerStyles = _ref.containerStyles,
26
- style = _ref.style,
27
- _ref$maxPercent = _ref.maxPercent,
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 theme = useTheme();
31
- var maxBorderWidth = function maxBorderWidth() {
32
- if (percent === 100) {
33
- return maxPercent;
34
- }
35
- return false;
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
- style: _extends({}, containerStyles, style)
41
- }, rest), showLabel && (labelFormatter ? labelFormatter(amount, percent) : /*#__PURE__*/React.createElement("span", {
42
- className: "progress-bar-label",
43
- "data-testid": "progress-bar-label"
44
- }, /*#__PURE__*/React.createElement(S.MaxValue, {
45
- "data-testid": "progress-bar-max-value"
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
- }, " (" + percent + "%)"))), /*#__PURE__*/React.createElement(S.AntdProgressBar, {
49
- percent: percent,
50
- maxPercent: maxBorderWidth(),
51
- type: type,
52
- thin: thin || thick,
53
- status: status,
54
- strokeColor: strokeColor || theme.palette['green-500'],
55
- strokeLinecap: strokeLinecap,
56
- showInfo: false
57
- }), description && /*#__PURE__*/React.createElement("span", {
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 Container: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export declare const MaxValue: import("styled-components").StyledComponent<"strong", any, {}, never>;
3
- export declare const AntdProgressBar: import("styled-components").StyledComponent<import("react").FC<import("antd/lib/progress").ProgressProps>, any, {
4
- thin?: boolean;
5
- maxPercent?: boolean;
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 Progress from 'antd/lib/progress';
2
- import styled from 'styled-components';
3
- export var Container = styled.div.withConfig({
4
- displayName: "ProgressBarstyles__Container",
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
- })(["&&{width:100%;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;color:", ";.ant-progress{margin:14px 0;}}"], function (props) {
7
- return props.theme.palette['grey-500'];
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
- })(["font-weight:500;color:", ";"], function (props) {
13
- return props.theme.palette['grey-800'];
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
- })(["&.ant-progress-line{width:100%;height:", ";margin-top:", ";margin:14px 0;border-radius:3px;color:", ";overflow:hidden;box-sizing:content-box;.ant-progress-outer{display:flex;}.ant-progress-inner{width:100%;}.ant-progress-outer,.ant-progress-inner{background:", ";}.ant-progress-outer,.ant-progress-inner,.ant-progress-bg{height:6px !important;}.ant-progress-bg:first-child{border-top-right-radius:0px;border-bottom-right-radius:0px;border-right:", ";}}"], function (props) {
19
- return props.thin ? '3px' : '6px';
14
+ })(["position:relative;margin-right:2px;width:", ";height:", ";background:", ";"], function (props) {
15
+ return props.width;
20
16
  }, function (props) {
21
- return props.thin ? '3px' : '0px';
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['grey-100'];
26
- }, function (props) {
27
- return props.maxPercent ? "0px" : "2px solid " + props.theme.palette.white;
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 ExactlyOne, type WithHTMLAttributes } from '@synerise/ds-utils';
4
- export type ProgressProps = WithHTMLAttributes<HTMLDivElement, Pick<AntProgressProps, 'percent' | 'type' | 'status' | 'strokeColor' | 'strokeLinecap'> & {
5
- amount?: number;
6
- showLabel?: boolean;
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
- labelFormatter?: (amount?: string | number, percent?: string | number) => ReactNode;
9
+ thin?: boolean;
10
+ percent?: number;
11
+ inline?: boolean;
9
12
  /**
10
13
  * @deprecated - use style prop
11
14
  */
12
15
  containerStyles?: CSSProperties;
13
- maxPercent?: boolean;
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.14",
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": "5f5d424cf8c7fa89e231c36a45f5ab3e4cfac8e7"
45
+ "gitHead": "7a8206260f1e50bb4b4784081feae944ba780c30"
47
46
  }