@coinbase/cds-web-visualization 3.4.0-beta.1 → 3.4.0-beta.3

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 CHANGED
@@ -8,6 +8,16 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  <!-- template-start -->
10
10
 
11
+ ## 3.4.0-beta.3 (10/6/2025 PST)
12
+
13
+ #### 🐞 Fixes
14
+
15
+ - Factor sparkline container offset in axis label calculations. [[#88](https://github.com/coinbase/cds/pull/88)]
16
+
17
+ ## 3.4.0-beta.2 (10/6/2025 PST)
18
+
19
+ This is an artificial version bump with no new change.
20
+
11
21
  ## 3.4.0-beta.1 (10/3/2025 PST)
12
22
 
13
23
  #### 🚀 Updates
@@ -1 +1 @@
1
- {"version":3,"file":"SparklineInteractiveMarkerDates.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AASjE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA8C9E,MAAM,MAAM,oCAAoC,CAAC,MAAM,SAAS,MAAM,IAAI;IACxE,SAAS,EAAE,cAAc,CAAC;IAC1B,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC;CACpC,CAAC;AAEF,iBAAS,0CAA0C,CAAC,MAAM,SAAS,MAAM,EAAE,EACzE,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAoB,GACrB,EAAE,oCAAoC,CAAC,MAAM,CAAC,2CAkC9C;AAED,eAAO,MAAM,+BAA+B,EAEvC,OAAO,0CAA0C,CAAC"}
1
+ {"version":3,"file":"SparklineInteractiveMarkerDates.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AASjE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAkD9E,MAAM,MAAM,oCAAoC,CAAC,MAAM,SAAS,MAAM,IAAI;IACxE,SAAS,EAAE,cAAc,CAAC;IAC1B,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC;CACpC,CAAC;AAEF,iBAAS,0CAA0C,CAAC,MAAM,SAAS,MAAM,EAAE,EACzE,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAoB,GACrB,EAAE,oCAAoC,CAAC,MAAM,CAAC,2CA0C9C;AAED,eAAO,MAAM,+BAA+B,EAEvC,OAAO,0CAA0C,CAAC"}
@@ -13,14 +13,15 @@ const noPointerEvents = {
13
13
  };
14
14
  const SparklineInteractiveMarkerDate = /*#__PURE__*/memo(_ref => {
15
15
  let {
16
- getFormattedDate
16
+ getFormattedDate,
17
+ containerOffsetLeft
17
18
  } = _ref;
18
19
  const [xPos, setXPos] = useState(0);
19
20
  const setupRef = useCallback(ref => {
20
21
  if (ref) {
21
- setXPos(ref.offsetLeft + ref.offsetWidth / 2);
22
+ setXPos(ref.offsetLeft + ref.offsetWidth / 2 - containerOffsetLeft);
22
23
  }
23
- }, []);
24
+ }, [containerOffsetLeft]);
24
25
  const dateStr = getFormattedDate(xPos);
25
26
 
26
27
  // take up space while loading so when it finishes loading there is no jump
@@ -48,6 +49,7 @@ function SparklineInteractiveMarkerDatesWithGeneric(_ref2) {
48
49
  timePeriodGutter = 2
49
50
  } = _ref2;
50
51
  const [numberOfLabels, setNumberOfLabels] = useState(0);
52
+ const [containerOffsetLeft, setContainerOffsetLeft] = useState(0);
51
53
  const getFormattedDate = useDateLookup({
52
54
  getMarker,
53
55
  formatDate,
@@ -57,15 +59,17 @@ function SparklineInteractiveMarkerDatesWithGeneric(_ref2) {
57
59
  if (ref) {
58
60
  const numberOfLabelsFromWidth = Math.floor(ref.offsetWidth / labelWidth);
59
61
  setNumberOfLabels(Math.max(numberOfLabelsFromWidth, 4));
62
+ setContainerOffsetLeft(ref.offsetLeft);
60
63
  }
61
64
  }, []);
62
65
  const markers = useMemo(() => {
63
66
  return times(numberOfLabels).map((_, i) => {
64
67
  return /*#__PURE__*/_jsx(SparklineInteractiveMarkerDate, {
68
+ containerOffsetLeft: containerOffsetLeft,
65
69
  getFormattedDate: getFormattedDate
66
70
  }, i);
67
71
  });
68
- }, [getFormattedDate, numberOfLabels]);
72
+ }, [containerOffsetLeft, getFormattedDate, numberOfLabels]);
69
73
  return /*#__PURE__*/_jsx(HStack, {
70
74
  ref: setupRef,
71
75
  className: fadeInCss,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-web-visualization",
3
- "version": "3.4.0-beta.1",
3
+ "version": "3.4.0-beta.3",
4
4
  "description": "Coinbase Design System - Web Sparkline",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,10 +38,10 @@
38
38
  "CHANGELOG"
39
39
  ],
40
40
  "peerDependencies": {
41
- "@coinbase/cds-common": "^8.13.5",
42
- "@coinbase/cds-lottie-files": "^3.3.1",
43
- "@coinbase/cds-utils": "^2.3.2",
44
- "@coinbase/cds-web": "^8.13.5",
41
+ "@coinbase/cds-common": "^8.15.0",
42
+ "@coinbase/cds-lottie-files": "^3.3.2",
43
+ "@coinbase/cds-utils": "^2.3.3",
44
+ "@coinbase/cds-web": "^8.15.0",
45
45
  "react": "^18.3.1",
46
46
  "react-dom": "^18.3.1"
47
47
  },
@@ -58,10 +58,10 @@
58
58
  "@babel/preset-env": "^7.28.0",
59
59
  "@babel/preset-react": "^7.27.1",
60
60
  "@babel/preset-typescript": "^7.27.1",
61
- "@coinbase/cds-common": "^8.13.5",
62
- "@coinbase/cds-lottie-files": "^3.3.1",
63
- "@coinbase/cds-utils": "^2.3.2",
64
- "@coinbase/cds-web": "^8.13.5",
61
+ "@coinbase/cds-common": "^8.15.0",
62
+ "@coinbase/cds-lottie-files": "^3.3.2",
63
+ "@coinbase/cds-utils": "^2.3.3",
64
+ "@coinbase/cds-web": "^8.15.0",
65
65
  "@figma/code-connect": "^1.3.4",
66
66
  "@linaria/core": "^3.0.0-beta.22",
67
67
  "@types/react": "^18.3.12",