cr-ui-lib 1.1.61 → 1.1.62

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/index.js CHANGED
@@ -225,6 +225,14 @@ var LineChart = ({
225
225
  }) => {
226
226
  const chartRef = React.useRef(null);
227
227
  const [chartKey, setChartKey] = React.useState(`chart-${Date.now()}`);
228
+ const formatValueWithCommas = (value) => {
229
+ if (value == null || value === "") return "";
230
+ const num = Number(value);
231
+ if (!isNaN(num)) {
232
+ return num.toLocaleString("en-US");
233
+ }
234
+ return String(value);
235
+ };
228
236
  React.useEffect(() => {
229
237
  const handleResize = () => {
230
238
  setChartKey(`chart-${Date.now()}`);
@@ -287,6 +295,7 @@ var LineChart = ({
287
295
  }
288
296
  const dataPoint = (_a = tooltipModel.dataPoints) == null ? void 0 : _a[0];
289
297
  const value = dataPoint == null ? void 0 : dataPoint.parsed.y;
298
+ const formattedValue = formatValueWithCommas(value);
290
299
  const label2 = dataPoint == null ? void 0 : dataPoint.label;
291
300
  const arrowSize = 8;
292
301
  const position = context.chart.canvas.getBoundingClientRect();
@@ -303,7 +312,7 @@ var LineChart = ({
303
312
  <svg width="10" height="10" viewBox="0 0 9 10" fill="none" xmlns="http://www.w3.org/2000/svg">
304
313
  <path d="M0.416687 3.36663H2.16669V9.08329H0.416687V3.36663ZM3.68335 0.916626H5.31669V9.08329H3.68335V0.916626ZM6.95002 5.58329H8.58335V9.08329H6.95002V5.58329Z" fill="#4683B4"/>
305
314
  </svg>&nbsp;
306
- ${labelPopupTitle}: <span style="color:#757575;">&nbsp;${value}</span>
315
+ ${labelPopupTitle}: <span style="color:#757575;">&nbsp;${formattedValue}</span>
307
316
  </span>
308
317
  </div>
309
318
  </div>
@@ -372,7 +381,7 @@ var LineChart = ({
372
381
  fill="#4683B4"
373
382
  />
374
383
  </svg>`}&nbsp;
375
- ${labelPopupTitle}: <span style="color:#131414;">&nbsp;${value}</span>
384
+ ${labelPopupTitle}: <span style="color:#131414;">&nbsp;${formattedValue}</span>
376
385
  </span>
377
386
  </div>
378
387
  </div>