@coinbase/cds-mobile 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 PST)
|
|
12
18
|
|
|
13
19
|
#### 🐞 Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultSelectControl.d.ts","sourceRoot":"","sources":["../../../src/alpha/select/DefaultSelectControl.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,gBAAgB,EAAkB,MAAM,cAAc,CAAC;AAe3F,OAAO,KAAK,EAAE,kBAAkB,EAAgB,UAAU,EAAE,MAAM,UAAU,CAAC;AAY7E,KAAK,6BAA6B,GAAG,CACnC,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,KAAK,CAAC,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC;CAC9D,KACE,KAAK,CAAC,YAAY,CAAC;AAExB,eAAO,MAAM,6BAA6B,wCACvC,IAAI,SAAS,UAAU,EAAE,iBAAiB,SAAS,MAAM,sfAsCvD,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,CAAC,GAAG;IAC/C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC;CAC9D,
|
|
1
|
+
{"version":3,"file":"DefaultSelectControl.d.ts","sourceRoot":"","sources":["../../../src/alpha/select/DefaultSelectControl.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,gBAAgB,EAAkB,MAAM,cAAc,CAAC;AAe3F,OAAO,KAAK,EAAE,kBAAkB,EAAgB,UAAU,EAAE,MAAM,UAAU,CAAC;AAY7E,KAAK,6BAA6B,GAAG,CACnC,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,KAAK,CAAC,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC;CAC9D,KACE,KAAK,CAAC,YAAY,CAAC;AAExB,eAAO,MAAM,6BAA6B,wCACvC,IAAI,SAAS,UAAU,EAAE,iBAAiB,SAAS,MAAM,sfAsCvD,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,CAAC,GAAG;IAC/C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC;CAC9D,8CAuZF,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAoC,6BAA6B,CAAC"}
|
|
@@ -112,19 +112,23 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(_ref => {
|
|
|
112
112
|
});
|
|
113
113
|
return map;
|
|
114
114
|
}, [options]);
|
|
115
|
+
const matchedOption = useMemo(() => {
|
|
116
|
+
if (isMultiSelect || value === null || Array.isArray(value)) return undefined;
|
|
117
|
+
return optionsMap.get(value);
|
|
118
|
+
}, [isMultiSelect, optionsMap, value]);
|
|
119
|
+
const isShowingPlaceholder = matchedOption === undefined;
|
|
115
120
|
const singleValueContent = useMemo(() => {
|
|
116
|
-
var _ref3,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}, [hasValue, isMultiSelect, optionsMap, placeholder, value]);
|
|
121
|
+
var _ref3, _matchedOption$label;
|
|
122
|
+
if (!matchedOption) return placeholder;
|
|
123
|
+
return (_ref3 = (_matchedOption$label = matchedOption.label) != null ? _matchedOption$label : matchedOption.description) != null ? _ref3 : matchedOption.value;
|
|
124
|
+
}, [matchedOption, placeholder]);
|
|
121
125
|
const computedControlAccessibilityLabel = useMemo(() => {
|
|
122
126
|
// For multi-select, set the label to the content of each selected value and the hidden selected options label
|
|
123
127
|
if (isMultiSelect) {
|
|
124
128
|
const selectedValues = value.map(v => {
|
|
125
|
-
var
|
|
129
|
+
var _ref4, _ref5, _option$label;
|
|
126
130
|
const option = optionsMap.get(v);
|
|
127
|
-
return (
|
|
131
|
+
return (_ref4 = (_ref5 = (_option$label = option == null ? void 0 : option.label) != null ? _option$label : option == null ? void 0 : option.description) != null ? _ref5 : option == null ? void 0 : option.value) != null ? _ref4 : v;
|
|
128
132
|
}).slice(0, maxSelectedOptionsToShow).join(', ');
|
|
129
133
|
return accessibilityLabel + ", " + (value.length > 0 ? selectedValues : placeholder != null ? placeholder : '') + (value.length > maxSelectedOptionsToShow ? ', ' + hiddenSelectedOptionsLabel : '');
|
|
130
134
|
}
|
|
@@ -183,7 +187,7 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(_ref => {
|
|
|
183
187
|
maxWidth: "100%",
|
|
184
188
|
minWidth: 0,
|
|
185
189
|
children: [optionsToShow.map(option => {
|
|
186
|
-
var _option$value,
|
|
190
|
+
var _option$value, _ref6, _ref7, _option$label2;
|
|
187
191
|
const accessibilityLabel = typeof option.label === 'string' ? option.label : typeof option.description === 'string' ? option.description : (_option$value = option.value) != null ? _option$value : '';
|
|
188
192
|
return /*#__PURE__*/_jsx(InputChip, {
|
|
189
193
|
compact: true,
|
|
@@ -196,7 +200,7 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(_ref => {
|
|
|
196
200
|
event == null || event.stopPropagation();
|
|
197
201
|
onChange == null || onChange(option.value);
|
|
198
202
|
},
|
|
199
|
-
children: (
|
|
203
|
+
children: (_ref6 = (_ref7 = (_option$label2 = option.label) != null ? _option$label2 : option.description) != null ? _ref7 : option.value) != null ? _ref6 : ''
|
|
200
204
|
}, option.value);
|
|
201
205
|
}), value.length - maxSelectedOptionsToShow > 0 && /*#__PURE__*/_jsx(InputChip, {
|
|
202
206
|
compact: true,
|
|
@@ -209,12 +213,12 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(_ref => {
|
|
|
209
213
|
}
|
|
210
214
|
return typeof singleValueContent === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
211
215
|
align: align,
|
|
212
|
-
color:
|
|
216
|
+
color: isShowingPlaceholder ? 'fgMuted' : 'fg',
|
|
213
217
|
ellipsize: "tail",
|
|
214
218
|
font: font,
|
|
215
219
|
children: singleValueContent
|
|
216
220
|
}) : singleValueContent;
|
|
217
|
-
}, [hasValue, isMultiSelect, singleValueContent, font, align, value, maxSelectedOptionsToShow, valueAlignment, hiddenSelectedOptionsLabel, optionsMap, removeSelectedOptionAccessibilityLabel, disabled, onChange, isInteractionBlocked]);
|
|
221
|
+
}, [hasValue, isMultiSelect, isShowingPlaceholder, singleValueContent, font, align, value, maxSelectedOptionsToShow, valueAlignment, hiddenSelectedOptionsLabel, optionsMap, removeSelectedOptionAccessibilityLabel, disabled, onChange, isInteractionBlocked]);
|
|
218
222
|
|
|
219
223
|
// onBlur/onFocus on ViewProps allow null returns but TouchableOpacity's onBlur/onFocus props do not.
|
|
220
224
|
// This appears like a type inconsistency in react-native's type definitions.
|
|
@@ -303,6 +303,16 @@ const DefaultExample = () => {
|
|
|
303
303
|
value: value
|
|
304
304
|
});
|
|
305
305
|
};
|
|
306
|
+
const EmptyStringValueExample = () => {
|
|
307
|
+
const [value, setValue] = useState('');
|
|
308
|
+
return /*#__PURE__*/_jsx(Select, {
|
|
309
|
+
label: "Empty string value",
|
|
310
|
+
onChange: setValue,
|
|
311
|
+
options: exampleOptionsWithoutNull,
|
|
312
|
+
placeholder: "Select an option",
|
|
313
|
+
value: value
|
|
314
|
+
});
|
|
315
|
+
};
|
|
306
316
|
const TypedSelectExample = () => {
|
|
307
317
|
const typedOptions = [{
|
|
308
318
|
value: null,
|
|
@@ -1372,6 +1382,9 @@ const SelectV3Screen = () => {
|
|
|
1372
1382
|
children: [/*#__PURE__*/_jsx(Example, {
|
|
1373
1383
|
title: "Default",
|
|
1374
1384
|
children: /*#__PURE__*/_jsx(DefaultExample, {})
|
|
1385
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
1386
|
+
title: "Empty string value",
|
|
1387
|
+
children: /*#__PURE__*/_jsx(EmptyStringValueExample, {})
|
|
1375
1388
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1376
1389
|
title: "Typed",
|
|
1377
1390
|
children: /*#__PURE__*/_jsx(TypedSelectExample, {})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.2",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
"react-native-worklets": "0.5.2"
|
|
219
219
|
},
|
|
220
220
|
"dependencies": {
|
|
221
|
-
"@coinbase/cds-common": "^9.7.
|
|
221
|
+
"@coinbase/cds-common": "^9.7.2",
|
|
222
222
|
"@coinbase/cds-icons": "^5.21.0",
|
|
223
223
|
"@coinbase/cds-illustrations": "^4.44.0",
|
|
224
224
|
"@coinbase/cds-lottie-files": "^3.3.4",
|