carbon-react 126.4.2 → 126.4.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/esm/components/select/filterable-select/filterable-select.component.js +2 -2
- package/esm/components/select/select-list/select-list.component.js +11 -1
- package/lib/components/select/filterable-select/filterable-select.component.js +2 -2
- package/lib/components/select/select-list/select-list.component.js +11 -1
- package/package.json +1 -1
|
@@ -265,7 +265,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
265
265
|
const {
|
|
266
266
|
id: selectedOptionId,
|
|
267
267
|
text,
|
|
268
|
-
value: newValue,
|
|
268
|
+
value: newValue = "",
|
|
269
269
|
selectionType,
|
|
270
270
|
selectionConfirmed
|
|
271
271
|
} = optionData;
|
|
@@ -279,7 +279,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
279
279
|
setHighlightedValue(newValue);
|
|
280
280
|
}
|
|
281
281
|
setTextValue(text || /* istanbul ignore next */"");
|
|
282
|
-
triggerChange(newValue, selectionConfirmed);
|
|
282
|
+
triggerChange(newValue, !!selectionConfirmed);
|
|
283
283
|
setActiveDescendantId(selectedOptionId);
|
|
284
284
|
if (selectionType !== "navigationKey") {
|
|
285
285
|
openOnFocusFlagBlock.current = !!openOnFocus;
|
|
@@ -249,6 +249,16 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
249
249
|
const currentOption = childrenList[currentOptionsListIndex];
|
|
250
250
|
if (! /*#__PURE__*/React.isValidElement(currentOption)) {
|
|
251
251
|
onSelectListClose();
|
|
252
|
+
|
|
253
|
+
// need to call onSelect here with empty text/value to clear the input when
|
|
254
|
+
// no matches found in FilterableSelect
|
|
255
|
+
onSelect({
|
|
256
|
+
id: undefined,
|
|
257
|
+
text: "",
|
|
258
|
+
value: "",
|
|
259
|
+
selectionType: "enterKey",
|
|
260
|
+
selectionConfirmed: false
|
|
261
|
+
});
|
|
252
262
|
return;
|
|
253
263
|
}
|
|
254
264
|
if (currentOption.props.disabled) {
|
|
@@ -308,7 +318,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
308
318
|
setCurrentOptionsListIndex(previousIndex => {
|
|
309
319
|
const match = getNextChildByText(filterText, childrenList, previousIndex);
|
|
310
320
|
if (!match) {
|
|
311
|
-
return
|
|
321
|
+
return -1;
|
|
312
322
|
}
|
|
313
323
|
const indexOfMatch = getIndexOfMatch(match.props.value);
|
|
314
324
|
virtualizer.scrollToIndex(indexOfMatch, SCROLL_OPTIONS);
|
|
@@ -274,7 +274,7 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
|
|
|
274
274
|
const {
|
|
275
275
|
id: selectedOptionId,
|
|
276
276
|
text,
|
|
277
|
-
value: newValue,
|
|
277
|
+
value: newValue = "",
|
|
278
278
|
selectionType,
|
|
279
279
|
selectionConfirmed
|
|
280
280
|
} = optionData;
|
|
@@ -288,7 +288,7 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
|
|
|
288
288
|
setHighlightedValue(newValue);
|
|
289
289
|
}
|
|
290
290
|
setTextValue(text || /* istanbul ignore next */"");
|
|
291
|
-
triggerChange(newValue, selectionConfirmed);
|
|
291
|
+
triggerChange(newValue, !!selectionConfirmed);
|
|
292
292
|
setActiveDescendantId(selectedOptionId);
|
|
293
293
|
if (selectionType !== "navigationKey") {
|
|
294
294
|
openOnFocusFlagBlock.current = !!openOnFocus;
|
|
@@ -258,6 +258,16 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
258
258
|
const currentOption = childrenList[currentOptionsListIndex];
|
|
259
259
|
if (! /*#__PURE__*/_react.default.isValidElement(currentOption)) {
|
|
260
260
|
onSelectListClose();
|
|
261
|
+
|
|
262
|
+
// need to call onSelect here with empty text/value to clear the input when
|
|
263
|
+
// no matches found in FilterableSelect
|
|
264
|
+
onSelect({
|
|
265
|
+
id: undefined,
|
|
266
|
+
text: "",
|
|
267
|
+
value: "",
|
|
268
|
+
selectionType: "enterKey",
|
|
269
|
+
selectionConfirmed: false
|
|
270
|
+
});
|
|
261
271
|
return;
|
|
262
272
|
}
|
|
263
273
|
if (currentOption.props.disabled) {
|
|
@@ -317,7 +327,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
317
327
|
setCurrentOptionsListIndex(previousIndex => {
|
|
318
328
|
const match = (0, _getNextChildByText.default)(filterText, childrenList, previousIndex);
|
|
319
329
|
if (!match) {
|
|
320
|
-
return
|
|
330
|
+
return -1;
|
|
321
331
|
}
|
|
322
332
|
const indexOfMatch = getIndexOfMatch(match.props.value);
|
|
323
333
|
virtualizer.scrollToIndex(indexOfMatch, SCROLL_OPTIONS);
|