@coinbase/cds-web 9.7.1 → 9.7.2

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
+ ## 9.7.2 (7/23/2026 PST)
12
+
13
+ #### 🐞 Fixes
14
+
15
+ - Fix: adjust select placeholder fallback. [[#805](https://github.com/coinbase/cds/pull/805)]
16
+
11
17
  ## 9.7.1 ((7/22/2026, 01:58 PM PST))
12
18
 
13
19
  This is an artificial version bump with no new change.
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultSelectControl.d.ts","sourceRoot":"","sources":["../../../src/alpha/select/DefaultSelectControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAgB9E,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AA4BlB,KAAK,wBAAwB,GAAG,CAC9B,IAAI,SAAS,UAAU,EACvB,iBAAiB,SAAS,MAAM,GAAG,MAAM,EAEzC,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,CAAC,GAAG;IACnD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B,KACE,KAAK,CAAC,YAAY,CAAC;AAqgBxB,eAAO,MAAM,oBAAoB,EAAoC,wBAAwB,CAAC"}
1
+ {"version":3,"file":"DefaultSelectControl.d.ts","sourceRoot":"","sources":["../../../src/alpha/select/DefaultSelectControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAgB9E,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AA4BlB,KAAK,wBAAwB,GAAG,CAC9B,IAAI,SAAS,UAAU,EACvB,iBAAiB,SAAS,MAAM,GAAG,MAAM,EAEzC,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,CAAC,GAAG;IACnD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B,KACE,KAAK,CAAC,YAAY,CAAC;AA4gBxB,eAAO,MAAM,oBAAoB,EAAoC,wBAAwB,CAAC"}
@@ -120,19 +120,23 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
120
120
  });
121
121
  return map;
122
122
  }, [options]);
123
+ const matchedOption = useMemo(() => {
124
+ if (isMultiSelect || value === null || Array.isArray(value)) return undefined;
125
+ return optionsMap.get(value);
126
+ }, [isMultiSelect, optionsMap, value]);
127
+ const isShowingPlaceholder = matchedOption === undefined;
123
128
  const singleValueContent = useMemo(() => {
124
- var _ref3, _ref4, _option$label;
125
- const option = !isMultiSelect ? optionsMap.get(value) : undefined;
126
- const label = (_ref3 = (_ref4 = (_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : option === null || option === void 0 ? void 0 : option.description) !== null && _ref4 !== void 0 ? _ref4 : option === null || option === void 0 ? void 0 : option.value) !== null && _ref3 !== void 0 ? _ref3 : placeholder;
127
- return hasValue ? label : placeholder;
128
- }, [hasValue, isMultiSelect, optionsMap, placeholder, value]);
129
+ var _ref3, _matchedOption$label;
130
+ if (!matchedOption) return placeholder;
131
+ return (_ref3 = (_matchedOption$label = matchedOption.label) !== null && _matchedOption$label !== void 0 ? _matchedOption$label : matchedOption.description) !== null && _ref3 !== void 0 ? _ref3 : matchedOption.value;
132
+ }, [matchedOption, placeholder]);
129
133
  const computedControlAccessibilityLabel = useMemo(() => {
130
134
  // For multi-select, set the label to the content of each selected value and the hidden selected options label
131
135
  if (isMultiSelect) {
132
136
  const selectedValues = value.map(v => {
133
- var _ref5, _ref6, _option$label2;
137
+ var _ref4, _ref5, _option$label;
134
138
  const option = optionsMap.get(v);
135
- return (_ref5 = (_ref6 = (_option$label2 = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label2 !== void 0 ? _option$label2 : option === null || option === void 0 ? void 0 : option.description) !== null && _ref6 !== void 0 ? _ref6 : option === null || option === void 0 ? void 0 : option.value) !== null && _ref5 !== void 0 ? _ref5 : v;
139
+ return (_ref4 = (_ref5 = (_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : option === null || option === void 0 ? void 0 : option.description) !== null && _ref5 !== void 0 ? _ref5 : option === null || option === void 0 ? void 0 : option.value) !== null && _ref4 !== void 0 ? _ref4 : v;
136
140
  }).slice(0, maxSelectedOptionsToShow).join(', ');
137
141
  return "".concat(accessibilityLabel, ", ").concat(value.length > 0 ? selectedValues : placeholder !== null && placeholder !== void 0 ? placeholder : '').concat(value.length > maxSelectedOptionsToShow ? ', ' + hiddenSelectedOptionsLabel : '');
138
142
  }
@@ -206,7 +210,7 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
206
210
  flexWrap: "wrap",
207
211
  gap: 1,
208
212
  children: [optionsToShow.map((option, index) => {
209
- var _option$value, _ref7, _ref8, _option$label3;
213
+ var _option$value, _ref6, _ref7, _option$label2;
210
214
  const accessibilityLabel = typeof option.label === 'string' ? option.label : typeof option.description === 'string' ? option.description : (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : '';
211
215
  return /*#__PURE__*/_jsx(InputChip, {
212
216
  compact: true,
@@ -225,7 +229,7 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
225
229
  flexShrink: 1,
226
230
  font: "label1",
227
231
  overflow: "truncate",
228
- children: (_ref7 = (_ref8 = (_option$label3 = option.label) !== null && _option$label3 !== void 0 ? _option$label3 : option.description) !== null && _ref8 !== void 0 ? _ref8 : option.value) !== null && _ref7 !== void 0 ? _ref7 : ''
232
+ children: (_ref6 = (_ref7 = (_option$label2 = option.label) !== null && _option$label2 !== void 0 ? _option$label2 : option.description) !== null && _ref7 !== void 0 ? _ref7 : option.value) !== null && _ref6 !== void 0 ? _ref6 : ''
229
233
  })
230
234
  }, option.value);
231
235
  }), value.length - maxSelectedOptionsToShow > 0 && /*#__PURE__*/_jsx(InputChip, {
@@ -239,7 +243,7 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
239
243
  }
240
244
  return typeof singleValueContent === 'string' ? /*#__PURE__*/_jsx(Text, {
241
245
  as: "p",
242
- color: hasValue ? 'fg' : 'fgMuted',
246
+ color: isShowingPlaceholder ? 'fgMuted' : 'fg',
243
247
  display: "block",
244
248
  font: font,
245
249
  overflow: "truncate",
@@ -247,7 +251,7 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
247
251
  width: "100%",
248
252
  children: singleValueContent
249
253
  }) : singleValueContent;
250
- }, [hasValue, isMultiSelect, singleValueContent, font, align, value, maxSelectedOptionsToShow, hiddenSelectedOptionsLabel, optionsMap, removeSelectedOptionAccessibilityLabel, handleUnselectValue, isInteractionBlocked]);
254
+ }, [hasValue, isMultiSelect, isShowingPlaceholder, singleValueContent, font, align, value, maxSelectedOptionsToShow, hiddenSelectedOptionsLabel, optionsMap, removeSelectedOptionAccessibilityLabel, handleUnselectValue, isInteractionBlocked]);
251
255
  const inputNode = useMemo(() => /*#__PURE__*/_jsxs(Pressable, {
252
256
  ref: controlPressableRef,
253
257
  noScaleOnPress: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-web",
3
- "version": "9.7.1",
3
+ "version": "9.7.2",
4
4
  "description": "Coinbase Design System - Web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -227,7 +227,7 @@
227
227
  "react-dom": "^18.0.0 || ~19.1.2"
228
228
  },
229
229
  "dependencies": {
230
- "@coinbase/cds-common": "^9.7.1",
230
+ "@coinbase/cds-common": "^9.7.2",
231
231
  "@coinbase/cds-icons": "^5.21.0",
232
232
  "@coinbase/cds-illustrations": "^4.44.0",
233
233
  "@coinbase/cds-lottie-files": "^3.3.4",