@trackunit/react-chart-components 0.0.302 → 0.0.303

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/index.cjs.js CHANGED
@@ -152,7 +152,7 @@ const cvaKpiContainer = cssClassVarianceUtilities.cvaMerge(["flex", "flex-col",
152
152
  * - The donut chart is displayed when the showChart prop is set to true.
153
153
  *
154
154
  * @param {boolean} showChart - Boolean to control the visibility of the chart.
155
- * @param {number} count - Value of the Kpi.
155
+ * @param {number|string|null} count - Value of the Kpi.
156
156
  * @param {number} totalCount - Total value of the Kpi.
157
157
  * @param {string} description - Description of the Kpi.
158
158
  * @param {string[]} colors - Colors of the Kpi.
@@ -161,7 +161,7 @@ const cvaKpiContainer = cssClassVarianceUtilities.cvaMerge(["flex", "flex-col",
161
161
  * @returns {JSX.Element} Kpi component
162
162
  */
163
163
  const Kpi = ({ className, dataTestId, showChart = false, count, description, totalCount, countColor, totalCountColor, suffix, inline = false, loading = false, }) => {
164
- return (jsxRuntime.jsxs("div", { className: cvaKpi({ className }), "data-testid": dataTestId, children: [showChart ? (jsxRuntime.jsx(KPIDonutChart, { count: Number(count), countColor: countColor, dataTestId: dataTestId ? dataTestId + "-donut-chart" : undefined, loading: loading, totalCount: totalCount, totalCountColor: totalCountColor })) : null, loading ? (jsxRuntime.jsxs("div", { className: cvaKpiContainer({ inline }), "data-testid": dataTestId ? `${dataTestId}-skeleton-lines` : null, children: [jsxRuntime.jsx(reactComponents.SkeletonLines, { lines: 1, width: 20 }), jsxRuntime.jsx(reactComponents.SkeletonLines, { lines: 1, width: 50 })] })) : (jsxRuntime.jsxs("div", { className: cvaKpiContainer({ inline, showChart }), "data-testid": dataTestId ? `${dataTestId}-container` : null, children: [jsxRuntime.jsxs("span", { className: cvaKpiCountContainer(), children: [jsxRuntime.jsx("span", { className: cvaKpiCount(), children: typeof count === "number" || typeof count === "string" ? count : "-" }), suffix ? (jsxRuntime.jsx("span", { className: cvaKpiSuffix(), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix })) : null] }), jsxRuntime.jsx("span", { className: cvaKpiDescription(), children: description })] }))] }));
164
+ return (jsxRuntime.jsxs("div", { className: cvaKpi({ className }), "data-testid": dataTestId, children: [showChart ? (jsxRuntime.jsx(KPIDonutChart, { count: Number(count), countColor: countColor, dataTestId: dataTestId ? dataTestId + "-donut-chart" : undefined, loading: loading, totalCount: totalCount, totalCountColor: totalCountColor })) : null, loading ? (jsxRuntime.jsxs("div", { className: cvaKpiContainer({ inline }), "data-testid": dataTestId ? `${dataTestId}-skeleton-lines` : null, children: [jsxRuntime.jsx(reactComponents.SkeletonLines, { lines: 1, width: 20 }), jsxRuntime.jsx(reactComponents.SkeletonLines, { lines: 1, width: 50 })] })) : (jsxRuntime.jsxs("div", { className: cvaKpiContainer({ inline, showChart }), "data-testid": dataTestId ? `${dataTestId}-container` : null, children: [jsxRuntime.jsxs("span", { className: cvaKpiCountContainer(), children: [jsxRuntime.jsx("span", { className: cvaKpiCount(), children: count !== null && count !== void 0 ? count : "-" }), suffix ? (jsxRuntime.jsx("span", { className: cvaKpiSuffix(), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix })) : null] }), jsxRuntime.jsx("span", { className: cvaKpiDescription(), children: description })] }))] }));
165
165
  };
166
166
 
167
167
  const cvaLegendItem = cssClassVarianceUtilities.cvaMerge([
package/index.esm.js CHANGED
@@ -144,7 +144,7 @@ const cvaKpiContainer = cvaMerge(["flex", "flex-col", "items-baseline"], {
144
144
  * - The donut chart is displayed when the showChart prop is set to true.
145
145
  *
146
146
  * @param {boolean} showChart - Boolean to control the visibility of the chart.
147
- * @param {number} count - Value of the Kpi.
147
+ * @param {number|string|null} count - Value of the Kpi.
148
148
  * @param {number} totalCount - Total value of the Kpi.
149
149
  * @param {string} description - Description of the Kpi.
150
150
  * @param {string[]} colors - Colors of the Kpi.
@@ -153,7 +153,7 @@ const cvaKpiContainer = cvaMerge(["flex", "flex-col", "items-baseline"], {
153
153
  * @returns {JSX.Element} Kpi component
154
154
  */
155
155
  const Kpi = ({ className, dataTestId, showChart = false, count, description, totalCount, countColor, totalCountColor, suffix, inline = false, loading = false, }) => {
156
- return (jsxs("div", { className: cvaKpi({ className }), "data-testid": dataTestId, children: [showChart ? (jsx(KPIDonutChart, { count: Number(count), countColor: countColor, dataTestId: dataTestId ? dataTestId + "-donut-chart" : undefined, loading: loading, totalCount: totalCount, totalCountColor: totalCountColor })) : null, loading ? (jsxs("div", { className: cvaKpiContainer({ inline }), "data-testid": dataTestId ? `${dataTestId}-skeleton-lines` : null, children: [jsx(SkeletonLines, { lines: 1, width: 20 }), jsx(SkeletonLines, { lines: 1, width: 50 })] })) : (jsxs("div", { className: cvaKpiContainer({ inline, showChart }), "data-testid": dataTestId ? `${dataTestId}-container` : null, children: [jsxs("span", { className: cvaKpiCountContainer(), children: [jsx("span", { className: cvaKpiCount(), children: typeof count === "number" || typeof count === "string" ? count : "-" }), suffix ? (jsx("span", { className: cvaKpiSuffix(), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix })) : null] }), jsx("span", { className: cvaKpiDescription(), children: description })] }))] }));
156
+ return (jsxs("div", { className: cvaKpi({ className }), "data-testid": dataTestId, children: [showChart ? (jsx(KPIDonutChart, { count: Number(count), countColor: countColor, dataTestId: dataTestId ? dataTestId + "-donut-chart" : undefined, loading: loading, totalCount: totalCount, totalCountColor: totalCountColor })) : null, loading ? (jsxs("div", { className: cvaKpiContainer({ inline }), "data-testid": dataTestId ? `${dataTestId}-skeleton-lines` : null, children: [jsx(SkeletonLines, { lines: 1, width: 20 }), jsx(SkeletonLines, { lines: 1, width: 50 })] })) : (jsxs("div", { className: cvaKpiContainer({ inline, showChart }), "data-testid": dataTestId ? `${dataTestId}-container` : null, children: [jsxs("span", { className: cvaKpiCountContainer(), children: [jsx("span", { className: cvaKpiCount(), children: count !== null && count !== void 0 ? count : "-" }), suffix ? (jsx("span", { className: cvaKpiSuffix(), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix })) : null] }), jsx("span", { className: cvaKpiDescription(), children: description })] }))] }));
157
157
  };
158
158
 
159
159
  const cvaLegendItem = cvaMerge([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-chart-components",
3
- "version": "0.0.302",
3
+ "version": "0.0.303",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
package/src/KPI/Kpi.d.ts CHANGED
@@ -6,8 +6,9 @@ export interface KpiProps extends CommonProps {
6
6
  *
7
7
  * @example
8
8
  * <Kpi count={29000} />
9
+ * <Kpi count="29,000" />
9
10
  */
10
- count: number | string;
11
+ count: number | string | null;
11
12
  /**
12
13
  * Total count of the Kpi.
13
14
  * This is useful when you want to display a donut chart.
@@ -63,7 +64,7 @@ export interface KpiProps extends CommonProps {
63
64
  * - The donut chart is displayed when the showChart prop is set to true.
64
65
  *
65
66
  * @param {boolean} showChart - Boolean to control the visibility of the chart.
66
- * @param {number} count - Value of the Kpi.
67
+ * @param {number|string|null} count - Value of the Kpi.
67
68
  * @param {number} totalCount - Total value of the Kpi.
68
69
  * @param {string} description - Description of the Kpi.
69
70
  * @param {string[]} colors - Colors of the Kpi.