@coinbase/cds-web 8.17.2 → 8.17.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,12 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  <!-- template-start -->
10
10
 
11
+ ## 8.17.3 (10/14/2025 PST)
12
+
13
+ #### 🐞 Fixes
14
+
15
+ - Fix avatar hexagon shape. [[#107](https://github.com/coinbase/cds/pull/107)]
16
+
11
17
  ## 8.17.2 (10/16/2025 PST)
12
18
 
13
19
  #### 🐞 Fixes
@@ -13,8 +13,7 @@ export declare const HexagonAvatarClipPath: {
13
13
  displayName: string;
14
14
  };
15
15
  /**
16
- * Because the hexagon is not symmetrical, we have to get all mathy to scale the border appropriately
17
- * Note: These values were manually set with my eyeballs
16
+ * @deprecated will be removed in a future version
18
17
  */
19
18
  export declare const hexagonSvgTransformStyles: {
20
19
  readonly standard: {
@@ -71,12 +70,12 @@ type HexagonBorderProps = SharedProps & {
71
70
  * Child path elements are programmed to use the currentColor CSS value to inherit this color.
72
71
  */
73
72
  className?: string;
73
+ computedSize?: string | number;
74
74
  };
75
75
  export declare const HexagonBorder: React.MemoExoticComponent<
76
76
  ({
77
77
  strokeColor,
78
78
  offset,
79
- size,
80
79
  testID,
81
80
  className,
82
81
  }: HexagonBorderProps) => import('react/jsx-runtime').JSX.Element
@@ -1 +1 @@
1
- {"version":3,"file":"Hexagon.d.ts","sourceRoot":"","sources":["../../src/media/Hexagon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAO9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAC9C,eAAO,MAAM,0BAA0B,mCAAmC,CAAC;AAC3E,eAAO,MAAM,mBAAmB,+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C,MAAM,CAAC,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,aAAa,yEACwC,kBAAkB,6CAqBnF,CAAC;AAUF,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAiCxC,CAAC;AAGH,eAAO,MAAM,kBAAkB;;;CAK9B,CAAC"}
@@ -120,7 +120,7 @@ export const Avatar = /*#__PURE__*/memo(_ref => {
120
120
  offset: true,
121
121
  size: size,
122
122
  strokeColor: "currentColor"
123
- }), shape === 'hexagon' && borderColor && /*#__PURE__*/_jsx(HexagonBorder, {
123
+ }), shape === 'hexagon' && shouldShowBorder && /*#__PURE__*/_jsx(HexagonBorder, {
124
124
  size: size,
125
125
  strokeColor: "var(--color-".concat(borderColor, ")")
126
126
  })]
@@ -1 +1,2 @@
1
- @layer cds{.pathElementCss-p13ka9b8{fill:none;stroke-linecap:round;}}
1
+ @layer cds{.hexagonBorderContainerCss-h13ka9b8{position:absolute;inset:0;}.hexagonBorderContainerCss-h13ka9b8[data-offset='false']{width:calc(100% - 2px);height:calc(100% - 2px);-webkit-transform:translate(1px,1px);-ms-transform:translate(1px,1px);transform:translate(1px,1px);}.hexagonBorderContainerCss-h13ka9b8[data-offset='true']{inset:-2px;}
2
+ .pathElementCss-p1lp5uqu{fill:none;stroke-linecap:round;}}
@@ -1,6 +1,7 @@
1
1
  var _getBrowserGlobals;
2
2
  import React, { memo, useEffect, useMemo } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
+ import { cx } from '../cx';
4
5
  import { useIsBrowser } from '../hooks/useIsBrowser';
5
6
  import { Box } from '../layout/Box';
6
7
  import { getBrowserGlobals } from '../utils/browser';
@@ -8,26 +9,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
8
9
  export const cdsHexagonTestId = 'cds-hexagon';
9
10
  export const hexagonClipPathContainerId = 'cds-hexagon-clipPath-container';
10
11
  export const hexagonAvatarClipId = 'cds-hexagon-avatar-clipper';
12
+ const hexagonBorderWidth = 2;
11
13
 
12
14
  /**
13
15
  * We need to mount this to the DOM one time
14
16
  * This is currently done in the PortalProvider
15
17
  */
16
18
  export const HexagonAvatarClipPath = () => {
17
- // to get scale values use equation 1/x, where x is height or width
18
- const xScale = 1 / 66;
19
- const yScale = 1 / 62;
19
+ const viewBoxSize = 16;
20
20
  return /*#__PURE__*/_jsx("svg", {
21
21
  height: "0",
22
- viewBox: "0 0 66 62",
22
+ viewBox: "0 0 ".concat(viewBoxSize, " ").concat(viewBoxSize),
23
23
  width: "0",
24
24
  children: /*#__PURE__*/_jsx("defs", {
25
25
  children: /*#__PURE__*/_jsx("clipPath", {
26
26
  clipPathUnits: "objectBoundingBox",
27
27
  id: hexagonAvatarClipId,
28
- transform: "scale(".concat(xScale, " ").concat(yScale, ")"),
28
+ transform: "scale(".concat(1 / viewBoxSize, " ").concat(1 / viewBoxSize, ")"),
29
29
  children: /*#__PURE__*/_jsx("path", {
30
- d: "M63.4372 22.8624C66.2475 27.781 66.2475 33.819 63.4372 38.7376L54.981 53.5376C52.1324 58.5231 46.8307 61.6 41.0887 61.6H24.4562C18.7142 61.6 13.4125 58.5231 10.564 53.5376L2.10774 38.7376C-0.702577 33.819 -0.702582 27.781 2.10774 22.8624L10.564 8.06243C13.4125 3.07687 18.7142 0 24.4562 0H41.0887C46.8307 0 52.1324 3.07686 54.981 8.06242L63.4372 22.8624Z"
30
+ d: "M15.4855 6.0242C16.1715 7.24852 16.1715 8.75148 15.4855 9.97581L13.4213 13.6598C12.7259 14.9008 11.4317 15.6667 10.0301 15.6667H5.96994C4.56828 15.6667 3.2741 14.9008 2.57874 13.6598L0.514515 9.97581C-0.171504 8.75148 -0.171505 7.24852 0.514514 6.0242L2.57874 2.34022C3.2741 1.09922 4.56828 0.333336 5.96994 0.333336H10.0301C11.4317 0.333336 12.7259 1.09922 13.4213 2.34022L15.4855 6.0242Z"
31
31
  })
32
32
  })
33
33
  })
@@ -36,8 +36,7 @@ export const HexagonAvatarClipPath = () => {
36
36
  HexagonAvatarClipPath.displayName = 'HexagonAvatarClipPath';
37
37
 
38
38
  /**
39
- * Because the hexagon is not symmetrical, we have to get all mathy to scale the border appropriately
40
- * Note: These values were manually set with my eyeballs
39
+ * @deprecated will be removed in a future version
41
40
  */
42
41
  export const hexagonSvgTransformStyles = {
43
42
  standard: {
@@ -81,33 +80,30 @@ export const hexagonSvgTransformStyles = {
81
80
  }
82
81
  }
83
82
  };
84
- const pathElementCss = "pathElementCss-p13ka9b8";
83
+ const hexagonBorderContainerCss = "hexagonBorderContainerCss-h13ka9b8";
84
+ const pathElementCss = "pathElementCss-p1lp5uqu";
85
85
  export const HexagonBorder = /*#__PURE__*/memo(_ref => {
86
86
  let {
87
87
  strokeColor,
88
88
  offset,
89
- size = 'l',
90
89
  testID = cdsHexagonTestId,
91
90
  className
92
91
  } = _ref;
93
- const svgTransformStyles = hexagonSvgTransformStyles[offset ? 'offset' : 'standard'][size];
94
92
  return /*#__PURE__*/_jsx(Box, {
95
93
  "aria-hidden": true,
96
- className: className,
94
+ className: cx(hexagonBorderContainerCss, className),
95
+ "data-offset": !!offset,
97
96
  "data-testid": testID,
98
- height: "100%",
99
- position: "absolute",
100
- width: "100%",
101
97
  children: /*#__PURE__*/_jsx("svg", {
102
98
  "data-testid": "".concat(testID, "-svg"),
103
- style: svgTransformStyles,
104
- viewBox: "-2.25 0 70 62",
99
+ overflow: "visible",
100
+ viewBox: "0 0 16 16",
105
101
  children: /*#__PURE__*/_jsx("path", {
106
102
  className: pathElementCss,
107
- d: "M63.4372 22.8624C66.2475 27.781 66.2475 33.819 63.4372 38.7376L54.981 53.5376C52.1324 58.5231 46.8307 61.6 41.0887 61.6H24.4562C18.7142 61.6 13.4125 58.5231 10.564 53.5376L2.10774 38.7376C-0.702577 33.819 -0.702582 27.781 2.10774 22.8624L10.564 8.06243C13.4125 3.07687 18.7142 0 24.4562 0H41.0887C46.8307 0 52.1324 3.07686 54.981 8.06242L63.4372 22.8624Z",
103
+ d: "M15.4855 6.0242C16.1715 7.24852 16.1715 8.75148 15.4855 9.97581L13.4213 13.6598C12.7259 14.9008 11.4317 15.6667 10.0301 15.6667H5.96994C4.56828 15.6667 3.2741 14.9008 2.57874 13.6598L0.514515 9.97581C-0.171504 8.75148 -0.171505 7.24852 0.514514 6.0242L2.57874 2.34022C3.2741 1.09922 4.56828 0.333336 5.96994 0.333336H10.0301C11.4317 0.333336 12.7259 1.09922 13.4213 2.34022L15.4855 6.0242Z",
108
104
  "data-testid": "".concat(testID, "-path"),
109
105
  stroke: strokeColor,
110
- strokeWidth: 1.5,
106
+ strokeWidth: hexagonBorderWidth,
111
107
  vectorEffect: "non-scaling-stroke"
112
108
  })
113
109
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-web",
3
- "version": "8.17.2",
3
+ "version": "8.17.3",
4
4
  "description": "Coinbase Design System - Web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -147,7 +147,7 @@
147
147
  "react-dom": "^18.3.1"
148
148
  },
149
149
  "dependencies": {
150
- "@coinbase/cds-common": "^8.17.2",
150
+ "@coinbase/cds-common": "^8.17.3",
151
151
  "@coinbase/cds-icons": "^5.4.2",
152
152
  "@coinbase/cds-illustrations": "^4.24.0",
153
153
  "@coinbase/cds-lottie-files": "^3.3.2",