@synerise/ds-progress-bar 0.7.18 → 0.9.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/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
+ # [0.9.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-progress-bar@0.8.0...@synerise/ds-progress-bar@0.9.0) (2025-01-08)
7
+
8
+
9
+ ### Features
10
+
11
+ * **progress-bar:** stacked multivalue progressbar ([ad14272](https://github.com/Synerise/synerise-design/commit/ad14272c2c1bcbd359544b97402ef95fb611e451))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.8.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-progress-bar@0.7.18...@synerise/ds-progress-bar@0.8.0) (2024-12-18)
18
+
19
+
20
+ ### Features
21
+
22
+ * **progress-bar:** description type expand to ReactNode ([cb3671f](https://github.com/Synerise/synerise-design/commit/cb3671f2299f1b6c2eb5a255d02a7402071e21bc))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [0.7.18](https://github.com/Synerise/synerise-design/compare/@synerise/ds-progress-bar@0.7.17...@synerise/ds-progress-bar@0.7.18) (2024-12-16)
7
29
 
8
30
  **Note:** Version bump only for package @synerise/ds-progress-bar
package/README.md CHANGED
@@ -11,7 +11,7 @@ Progress-Bar UI Component
11
11
 
12
12
  ## API
13
13
 
14
- #### Props
14
+ ### ProgressBar
15
15
 
16
16
  | Property | Description | Type | Default |
17
17
  | ----------- | --------------------------------------------------------------------- | ------------------------------- | --------- |
@@ -22,3 +22,27 @@ Progress-Bar UI Component
22
22
  | type | Type of progress bar | `line` / `circle` / `dashboard` | `line` |
23
23
  | strokeLine | To set the style of the progress linecap | `round` / `square` | `round` |
24
24
  | strokeColor | Color of progress bar | string | `#76dc25` |
25
+
26
+ ### ProgressTiles
27
+
28
+ | Property | Description | Type | Default |
29
+ |-----------|---------------------------------------------------------|-----------|---------|
30
+ | tileWidth | width of each tile (with unit) | string | - |
31
+ | colors | Array of colors for each tile - defines number of tiles | string[] | - |
32
+ | percent | Value of progress to display colored | number | - |
33
+ | label | Optional label above progress bar | ReactNode | - |
34
+
35
+
36
+ ### Multivalue
37
+
38
+ | Property | Description | Type | Default |
39
+ |-------------|-----------------------------------------------------------------------------|-----------------|---------|
40
+ | values | Values for each bar | ProgressValue[] | - |
41
+ | stackedBars | Drives how bars are rendered - side by side or stacked on top of each other | boolean | true |
42
+
43
+
44
+ ### ProgressValue
45
+ | Property | Description | Type | Default |
46
+ |----------|----------------------------------|--------|---------|
47
+ | percent | Value to display (length of bar) | number | - |
48
+ | color | Bar color | string | - |
@@ -2,4 +2,6 @@ export declare const Multivalue: import("styled-components").StyledComponent<"di
2
2
  color: string;
3
3
  percent: number;
4
4
  }, never>;
5
- export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const Container: import("styled-components").StyledComponent<"div", any, {
6
+ stackedBars: boolean;
7
+ }, never>;
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components';
1
+ import styled, { css } from 'styled-components';
2
2
  export var Multivalue = styled.div.withConfig({
3
3
  displayName: "MultiValuestyles__Multivalue",
4
4
  componentId: "sc-145qx7z-0"
@@ -10,4 +10,6 @@ export var Multivalue = styled.div.withConfig({
10
10
  export var Container = styled.div.withConfig({
11
11
  displayName: "MultiValuestyles__Container",
12
12
  componentId: "sc-145qx7z-1"
13
- })(["position:relative;height:16px;width:100%;padding-top:11px;flex-wrap:wrap;justify-content:flex-start;", ":not(:first-child){border-top-right-radius:0px;border-bottom-right-radius:0px;border-right:2px solid white;}"], Multivalue);
13
+ })(["position:relative;height:16px;width:100%;padding-top:11px;", ""], function (props) {
14
+ return props.stackedBars ? css(["", ":not(:first-child){border-top-right-radius:0px;border-bottom-right-radius:0px;border-right:2px solid white;}"], Multivalue) : css(["justify-content:flex-start;display:flex;gap:2px;", "{border-radius:0;&:first-child{border-top-left-radius:6px;border-bottom-left-radius:6px;}&:last-child{border-top-right-radius:6px;border-bottom-right-radius:6px;}}"], Multivalue);
15
+ });
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { MultivalueProps } from './Multivalue.types';
3
- declare const Multivalue: React.FC<MultivalueProps>;
3
+ declare const Multivalue: ({ values, stackedBars, ...htmlAttributes }: MultivalueProps) => React.JSX.Element;
4
4
  export default Multivalue;
@@ -1,16 +1,26 @@
1
- import React from 'react';
1
+ var _excluded = ["values", "stackedBars"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
+ import React, { useMemo } from 'react';
2
5
  import * as S from './MultiValue.styles';
3
6
  var normalizePercent = function normalizePercent(value) {
4
7
  if (value < 0) return 0;
5
8
  if (value > 100) return 100;
6
9
  return value;
7
10
  };
8
- var Multivalue = function Multivalue(props) {
9
- var values = props.values;
10
- var sortedByPercent = values.sort(function (a, b) {
11
- return b.percent - a.percent;
12
- });
13
- return /*#__PURE__*/React.createElement(S.Container, null, sortedByPercent.map(function (val, index) {
11
+ var Multivalue = function Multivalue(_ref) {
12
+ var values = _ref.values,
13
+ _ref$stackedBars = _ref.stackedBars,
14
+ stackedBars = _ref$stackedBars === void 0 ? true : _ref$stackedBars,
15
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
16
+ var finalValues = useMemo(function () {
17
+ return stackedBars ? values.sort(function (a, b) {
18
+ return b.percent - a.percent;
19
+ }) : values;
20
+ }, [stackedBars, values]);
21
+ return /*#__PURE__*/React.createElement(S.Container, _extends({
22
+ stackedBars: stackedBars
23
+ }, htmlAttributes), finalValues.map(function (val, index) {
14
24
  return /*#__PURE__*/React.createElement(S.Multivalue, {
15
25
  // eslint-disable-next-line react/no-array-index-key
16
26
  key: val.color + "-" + val.percent + "-" + index,
@@ -1,6 +1,8 @@
1
- export type MultivalueProps = {
1
+ import { WithHTMLAttributes } from "@synerise/ds-utils";
2
+ export type MultivalueProps = WithHTMLAttributes<HTMLDivElement, {
2
3
  values: ProgressValue[];
3
- };
4
+ stackedBars?: boolean;
5
+ }>;
4
6
  export type ProgressValue = {
5
7
  percent: number;
6
8
  color: string;
@@ -1,5 +1,13 @@
1
+ /// <reference types="react" />
1
2
  import Progress from 'antd/lib/progress';
2
- import { ProgressProps } from './ProgressBar.types';
3
3
  export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export declare const MaxValue: import("styled-components").StyledComponent<"strong", any, {}, never>;
5
- export declare const AntdProgressBar: import("styled-components").StyledComponent<typeof Progress, any, ProgressProps, never>;
5
+ export declare const AntdProgressBar: import("styled-components").StyledComponent<typeof Progress, any, import("antd/lib/progress").ProgressProps & {
6
+ amount?: number | undefined;
7
+ showLabel?: boolean | undefined;
8
+ description?: import("react").ReactNode;
9
+ thick?: boolean | undefined;
10
+ labelFormatter?: ((amount?: string | number | undefined, percent?: string | number | undefined) => import("react").ReactNode) | undefined;
11
+ containerStyles?: import("react").CSSProperties | undefined;
12
+ maxPercent?: boolean | undefined;
13
+ }, never>;
@@ -1,11 +1,11 @@
1
- /// <reference types="react" />
2
- import { ProgressProps as AntProgressProps } from 'antd/lib/progress/progress';
3
- export interface ProgressProps extends AntProgressProps {
1
+ import type { ReactNode, CSSProperties } from 'react';
2
+ import type { ProgressProps as AntProgressProps } from 'antd/lib/progress/progress';
3
+ export type ProgressProps = AntProgressProps & {
4
4
  amount?: number;
5
5
  showLabel?: boolean;
6
- description?: string;
6
+ description?: ReactNode;
7
7
  thick?: boolean;
8
- labelFormatter?: (amount?: string | number, percent?: string | number) => React.ReactNode;
9
- containerStyles?: React.CSSProperties;
8
+ labelFormatter?: (amount?: string | number, percent?: string | number) => ReactNode;
9
+ containerStyles?: CSSProperties;
10
10
  maxPercent?: boolean;
11
- }
11
+ };
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ProgressTilesProps } from './ProgressTiles.types';
3
- export declare const ProgressTiles: React.FC<ProgressTilesProps>;
3
+ export declare const ProgressTiles: ({ colors, label, tileWidth, percent }: ProgressTilesProps) => React.JSX.Element;
4
4
  export default ProgressTiles;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { Label } from '@synerise/ds-typography';
3
3
  import * as S from './ProgressTiles.styles';
4
4
  var MAX_PERCENT = 100;
@@ -7,7 +7,7 @@ export var ProgressTiles = function ProgressTiles(_ref) {
7
7
  label = _ref.label,
8
8
  tileWidth = _ref.tileWidth,
9
9
  percent = _ref.percent;
10
- var getTilesConfig = React.useCallback(function () {
10
+ var getTilesConfig = useCallback(function () {
11
11
  var TILES_COUNT = colors.length;
12
12
  var tileWidthRatio = MAX_PERCENT / TILES_COUNT;
13
13
  var currentProgress = percent / tileWidthRatio;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import type { ReactNode } from 'react';
2
2
  export type ProgressTilesProps = {
3
3
  tileWidth: string;
4
4
  colors: string[];
5
5
  percent: number;
6
- label?: React.ReactNode;
6
+ label?: ReactNode;
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-progress-bar",
3
- "version": "0.7.18",
3
+ "version": "0.9.0",
4
4
  "description": "Progress-Bar UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -43,5 +43,5 @@
43
43
  "react": ">=16.9.0 <= 17.0.2",
44
44
  "styled-components": "5.0.1"
45
45
  },
46
- "gitHead": "d1f15a1187417faf8e625758d6b3aa4db58c0ecf"
46
+ "gitHead": "632aecfabe674713d4dd0dad0a581fefc55ccf82"
47
47
  }