@funnest/charts-react 0.3.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.js +10 -4
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1274,6 +1274,12 @@ function TreemapChart({
1274
1274
  // src/viz/candles.tsx
1275
1275
  import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1276
1276
  var KO = { open: "\uC2DC\uAC00", high: "\uACE0\uAC00", low: "\uC800\uAC00", close: "\uC885\uAC00", volume: "\uAC70\uB798\uB7C9" };
1277
+ var fade = (color, a) => {
1278
+ const m = /^#([0-9a-f]{6})$/i.exec(color);
1279
+ if (!m) return `color-mix(in srgb, ${color} ${Math.round(a * 100)}%, transparent)`;
1280
+ const n = parseInt(m[1], 16);
1281
+ return `rgba(${n >> 16 & 255},${n >> 8 & 255},${n & 255},${a})`;
1282
+ };
1277
1283
  function CandlePlot({
1278
1284
  data,
1279
1285
  yAxisId,
@@ -1410,7 +1416,7 @@ function CandlestickChart({
1410
1416
  highlightScrubbed: false,
1411
1417
  getBarColor: (_v, i) => {
1412
1418
  const d = data[i];
1413
- return d ? `color-mix(in srgb, ${d.close >= d.open ? upColor : downColor} 30%, transparent)` : void 0;
1419
+ return d ? fade(d.close >= d.open ? upColor : downColor, 0.3) : void 0;
1414
1420
  }
1415
1421
  }
1416
1422
  ),
@@ -1455,11 +1461,11 @@ function Scrubber({
1455
1461
  const ctx = useCartesianChart();
1456
1462
  const i = ctx.scrubIndex;
1457
1463
  const { setDimFuture } = ctx;
1458
- const fade = dimFuture && !hideOverlay;
1464
+ const fade2 = dimFuture && !hideOverlay;
1459
1465
  useEffect5(() => {
1460
- setDimFuture(fade);
1466
+ setDimFuture(fade2);
1461
1467
  return () => setDimFuture(false);
1462
- }, [fade, setDimFuture]);
1468
+ }, [fade2, setDimFuture]);
1463
1469
  const pick = seriesIds ? ctx.series.filter((s) => seriesIds.includes(s.id)) : ctx.series;
1464
1470
  const colorOf = (s, v) => beaconColor?.(v, s.id) ?? s.color;
1465
1471
  if (i === null || i >= ctx.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-react",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "React bindings for Funnest Charts: the trading widget plus SVG line, area and bar charts",
5
5
  "keywords": [
6
6
  "react",
@@ -46,9 +46,9 @@
46
46
  "NOTICE"
47
47
  ],
48
48
  "dependencies": {
49
- "@funnest/charts": "0.3.0",
50
- "@funnest/charts-ui": "0.3.0",
51
- "@funnest/charts-viz": "0.3.0"
49
+ "@funnest/charts-ui": "0.4.0",
50
+ "@funnest/charts": "0.4.0",
51
+ "@funnest/charts-viz": "0.4.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "react": ">=18",