@wonderflow/react-components 12.10.0 → 12.11.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/dist/components/circular-progress/circular-progress.d.ts +4 -0
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/circular-progress.js +4 -3
- package/dist/components/circular-progress/circular-progress.module.css +1 -1
- package/dist/components/circular-progress/circular-progress.stories.d.ts.map +1 -1
- package/dist/components/circular-progress/circular-progress.stories.js +1 -0
- package/dist/components/circular-progress/circular-progress.test.js +5 -0
- package/package.json +4 -4
|
@@ -19,6 +19,10 @@ export declare type CircularProgressProps = {
|
|
|
19
19
|
* Show or hide the progress value.
|
|
20
20
|
*/
|
|
21
21
|
showProgress?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Show or hide the percent sign next to the value.
|
|
24
|
+
*/
|
|
25
|
+
showPercentSign?: boolean;
|
|
22
26
|
};
|
|
23
27
|
export declare const CircularProgress: import("react").ForwardRefExoticComponent<{
|
|
24
28
|
style?: Record<string, any> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circular-progress.d.ts","sourceRoot":"","sources":["../../../src/components/circular-progress/circular-progress.tsx"],"names":[],"mappings":";AAuBA,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"circular-progress.d.ts","sourceRoot":"","sources":["../../../src/components/circular-progress/circular-progress.tsx"],"names":[],"mappings":";AAuBA,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAA;AAED,eAAO,MAAM,gBAAgB;;;0EAsC3B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022-
|
|
3
|
+
* Copyright 2022-2024 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -17,12 +17,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
17
17
|
import clsx from 'clsx';
|
|
18
18
|
import { forwardRef, useCallback, useMemo, } from 'react';
|
|
19
19
|
import * as styles from './circular-progress.module.css';
|
|
20
|
-
export const CircularProgress = forwardRef(({ className, value, max = 100, dimension = 'regular', showProgress, style, ...otherProps }, forwardedRef) => {
|
|
20
|
+
export const CircularProgress = forwardRef(({ className, value, max = 100, dimension = 'regular', showProgress, showPercentSign = false, style, ...otherProps }, forwardedRef) => {
|
|
21
21
|
const getPercentage = useCallback(() => (value ? Math.round((100 * value) / max) : 0), [max, value]);
|
|
22
|
+
const sign = showPercentSign ? '%' : '';
|
|
22
23
|
const clamp = useMemo(() => (num, min, max) => Math.min(Math.max(num, min), max), []);
|
|
23
24
|
const dynamicStyle = {
|
|
24
25
|
'--progress': `${getPercentage()}%`,
|
|
25
26
|
};
|
|
26
|
-
return (_jsx("div", { ref: forwardedRef, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: clsx(styles.CircularProgress, className), "data-circular-progress": clamp(getPercentage(), 0, 100)
|
|
27
|
+
return (_jsx("div", { ref: forwardedRef, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: clsx(styles.CircularProgress, className), "data-circular-progress": `${clamp(getPercentage(), 0, 100)}${sign}`, "data-circular-progress-dimension": dimension, "data-circular-progress-show-progress": showProgress, style: { ...dynamicStyle, ...style }, ...otherProps }));
|
|
27
28
|
});
|
|
28
29
|
CircularProgress.displayName = 'CircularProgress';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.CircularProgress{--hue:220;--track-size:4px;--track-bg:var(--dimmed-1);aspect-ratio:1/1;display:grid;font-size:1rem;font-weight:token(--wds-wds-font-weight-bold);inline-size:4rem;min-inline-size:64px;place-items:center;position:relative}.CircularProgress[data-circular-progress-show-progress=true]:after{content:attr(data-circular-progress);display:block}.CircularProgress[data-circular-progress-dimension=regular]{--track-size:8px;font-size:1.75rem;inline-size:8.5rem}.CircularProgress[data-circular-progress-dimension=big]{--track-size:16px;font-size:
|
|
1
|
+
@layer components{.CircularProgress{--hue:220;--track-size:4px;--track-bg:var(--dimmed-1);aspect-ratio:1/1;display:grid;font-size:1rem;font-weight:token(--wds-wds-font-weight-bold);inline-size:4rem;min-inline-size:64px;place-items:center;position:relative}.CircularProgress[data-circular-progress-show-progress=true]:after{content:attr(data-circular-progress);display:block}.CircularProgress[data-circular-progress-dimension=regular]{--track-size:8px;font-size:1.75rem;inline-size:8.5rem}.CircularProgress[data-circular-progress-dimension=big]{--track-size:16px;font-size:2.5rem;inline-size:11.5rem}.CircularProgress:before{background:conic-gradient(var(--progress-color,var(--cta-default)),var(--progress-color,var(--cta-default)) var(--progress,0),var(--track-bg) var(--progress,0) 100%);border-radius:50%;bottom:0;content:"";left:0;-webkit-mask-image:radial-gradient(transparent calc(71% - var(--track-size)),#000 calc(71% - var(--track-size) + .5px));mask-image:radial-gradient(transparent calc(71% - var(--track-size)),#000 calc(71% - var(--track-size) + .5px));position:absolute;right:0;top:0;z-index:0}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circular-progress.stories.d.ts","sourceRoot":"","sources":["../../../src/components/circular-progress/circular-progress.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"circular-progress.stories.d.ts","sourceRoot":"","sources":["../../../src/components/circular-progress/circular-progress.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,gBAAgB,CAsBjD,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,WAAW;;;+FAAoB,CAAC"}
|
|
@@ -10,4 +10,9 @@ describe('<CircularProgress>', () => {
|
|
|
10
10
|
const { container } = render(_jsx(CircularProgress, { value: 0 }));
|
|
11
11
|
expect(container).not.toBeNull();
|
|
12
12
|
});
|
|
13
|
+
test(' it should render percent sign', () => {
|
|
14
|
+
const { container } = render(_jsx(CircularProgress, { value: 10, showPercentSign: true }));
|
|
15
|
+
expect(document.querySelector('[data-circular-progress="10%"]')).toBeDefined();
|
|
16
|
+
expect(container).not.toBeNull();
|
|
17
|
+
});
|
|
13
18
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderflow/react-components",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.11.0",
|
|
4
4
|
"description": "UI components from Wonderflow's Wanda design system",
|
|
5
5
|
"author": "Wonderflow",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"@types/react-dom": "17.0.14",
|
|
83
83
|
"@types/react-table": "7.7.18",
|
|
84
84
|
"@types/react-test-renderer": "18.0.7",
|
|
85
|
-
"@wonderflow/config": "12.
|
|
86
|
-
"@wonderflow/tokens": "12.
|
|
87
|
-
"@wonderflow/charts": "12.
|
|
85
|
+
"@wonderflow/config": "12.11.0",
|
|
86
|
+
"@wonderflow/tokens": "12.11.0",
|
|
87
|
+
"@wonderflow/charts": "12.11.0",
|
|
88
88
|
"@types/uuid": "9.0.7",
|
|
89
89
|
"babel-loader": "8.2.5",
|
|
90
90
|
"cpy-cli": "3.1.1",
|