@synerise/ds-progress-bar 0.8.0 → 0.9.1
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 +19 -0
- package/README.md +25 -1
- package/dist/Multivalue/MultiValue.styles.d.ts +3 -1
- package/dist/Multivalue/MultiValue.styles.js +4 -2
- package/dist/Multivalue/Multivalue.d.ts +1 -1
- package/dist/Multivalue/Multivalue.js +17 -7
- package/dist/Multivalue/Multivalue.types.d.ts +4 -2
- package/dist/ProgressTiles/ProgressTiles.d.ts +1 -1
- package/dist/ProgressTiles/ProgressTiles.js +2 -2
- package/dist/ProgressTiles/ProgressTiles.types.d.ts +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-progress-bar@0.9.0...@synerise/ds-progress-bar@0.9.1) (2025-01-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-progress-bar
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [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)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **progress-bar:** stacked multivalue progressbar ([ad14272](https://github.com/Synerise/synerise-design/commit/ad14272c2c1bcbd359544b97402ef95fb611e451))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [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)
|
|
7
26
|
|
|
8
27
|
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Progress-Bar UI Component
|
|
|
11
11
|
|
|
12
12
|
## API
|
|
13
13
|
|
|
14
|
-
|
|
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, {
|
|
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;
|
|
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.
|
|
3
|
+
declare const Multivalue: ({ values, stackedBars, ...htmlAttributes }: MultivalueProps) => React.JSX.Element;
|
|
4
4
|
export default Multivalue;
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
|
|
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(
|
|
9
|
-
var values =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProgressTilesProps } from './ProgressTiles.types';
|
|
3
|
-
export declare const ProgressTiles: React.
|
|
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 =
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-progress-bar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Progress-Bar UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-typography": "^0.16.
|
|
37
|
+
"@synerise/ds-typography": "^0.16.11",
|
|
38
38
|
"@synerise/ds-utils": "^0.31.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"react": ">=16.9.0 <= 17.0.2",
|
|
44
44
|
"styled-components": "5.0.1"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "f591d14d24d6a14aab76edcb60f04aaadec8336d"
|
|
47
47
|
}
|