@carbon/react 1.60.2 → 1.60.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +949 -908
- package/es/components/ComboBox/ComboBox.js +8 -8
- package/es/components/MultiSelect/FilterableMultiSelect.js +5 -3
- package/lib/components/ComboBox/ComboBox.js +7 -7
- package/lib/components/MultiSelect/FilterableMultiSelect.js +5 -3
- package/package.json +2 -2
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import { useCombobox } from 'downshift';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React__default, { forwardRef, useEffect, useContext, useRef, useState } from 'react';
|
|
12
|
+
import React__default, { forwardRef, useEffect, useContext, useRef, useState, useMemo } from 'react';
|
|
13
13
|
import '../Text/index.js';
|
|
14
14
|
import { WarningFilled, WarningAltFilled, Checkmark } from '@carbon/icons-react';
|
|
15
15
|
import ListBox from '../ListBox/index.js';
|
|
@@ -382,6 +382,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
382
382
|
// when both the message is supplied *and* when the component is in
|
|
383
383
|
// the matching state (invalid, warn, etc).
|
|
384
384
|
const ariaDescribedBy = invalid && invalidText && invalidTextId || warn && warnText && warnTextId || helperText && !isFluid && helperTextId || undefined;
|
|
385
|
+
const menuProps = useMemo(() => getMenuProps({
|
|
386
|
+
'aria-label': deprecatedAriaLabel || ariaLabel,
|
|
387
|
+
ref: autoAlign ? refs.setFloating : null
|
|
388
|
+
}), [autoAlign, deprecatedAriaLabel, ariaLabel]);
|
|
385
389
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
386
390
|
className: wrapperClasses
|
|
387
391
|
}, titleText && /*#__PURE__*/React__default.createElement(Text, _extends({
|
|
@@ -399,7 +403,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
399
403
|
light: light,
|
|
400
404
|
size: size,
|
|
401
405
|
warn: warn,
|
|
402
|
-
ref: refs.setReference,
|
|
406
|
+
ref: autoAlign ? refs.setReference : null,
|
|
403
407
|
warnText: warnText,
|
|
404
408
|
warnTextId: warnTextId
|
|
405
409
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -412,7 +416,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
412
416
|
"aria-haspopup": "listbox",
|
|
413
417
|
title: textInput?.current?.value
|
|
414
418
|
}, getInputProps({
|
|
415
|
-
'aria-controls': isOpen ? undefined :
|
|
419
|
+
'aria-controls': isOpen ? undefined : menuProps.id,
|
|
416
420
|
placeholder,
|
|
417
421
|
ref: {
|
|
418
422
|
...mergeRefs(textInput, ref)
|
|
@@ -474,11 +478,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
474
478
|
// @ts-expect-error
|
|
475
479
|
isOpen: isOpen,
|
|
476
480
|
translateWithId: translateWithId
|
|
477
|
-
}))), normalizedSlug, /*#__PURE__*/React__default.createElement(ListBox.Menu,
|
|
478
|
-
'aria-label': deprecatedAriaLabel || ariaLabel
|
|
479
|
-
}), {
|
|
480
|
-
ref: mergeRefs(getMenuProps().ref, refs.setFloating)
|
|
481
|
-
}), isOpen ? filterItems(items, itemToString, inputValue).map((item, index) => {
|
|
481
|
+
}))), normalizedSlug, /*#__PURE__*/React__default.createElement(ListBox.Menu, menuProps, isOpen ? filterItems(items, itemToString, inputValue).map((item, index) => {
|
|
482
482
|
const isObject = item !== null && typeof item === 'object';
|
|
483
483
|
const title = isObject && 'text' in item && itemToElement ? item.text?.toString() : itemToString(item);
|
|
484
484
|
const itemProps = getItemProps({
|
|
@@ -231,8 +231,6 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
|
|
|
231
231
|
return changes;
|
|
232
232
|
case InputBlur:
|
|
233
233
|
case InputKeyDownEscape:
|
|
234
|
-
setInputFocused(false);
|
|
235
|
-
setInputValue('');
|
|
236
234
|
setIsOpen(false);
|
|
237
235
|
return changes;
|
|
238
236
|
case FunctionToggleMenu:
|
|
@@ -416,7 +414,11 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
|
|
|
416
414
|
$input.setSelectionRange($value.length, $value.length);
|
|
417
415
|
}
|
|
418
416
|
},
|
|
419
|
-
onFocus: () => setInputFocused(true)
|
|
417
|
+
onFocus: () => setInputFocused(true),
|
|
418
|
+
onBlur: () => {
|
|
419
|
+
!isOpen && setInputFocused(false);
|
|
420
|
+
setInputValue('');
|
|
421
|
+
}
|
|
420
422
|
}));
|
|
421
423
|
const menuProps = getMenuProps({}, {
|
|
422
424
|
suppressRefError: true
|
|
@@ -392,6 +392,10 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
392
392
|
// when both the message is supplied *and* when the component is in
|
|
393
393
|
// the matching state (invalid, warn, etc).
|
|
394
394
|
const ariaDescribedBy = invalid && invalidText && invalidTextId || warn && warnText && warnTextId || helperText && !isFluid && helperTextId || undefined;
|
|
395
|
+
const menuProps = React.useMemo(() => getMenuProps({
|
|
396
|
+
'aria-label': deprecatedAriaLabel || ariaLabel,
|
|
397
|
+
ref: autoAlign ? refs.setFloating : null
|
|
398
|
+
}), [autoAlign, deprecatedAriaLabel, ariaLabel]);
|
|
395
399
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
396
400
|
className: wrapperClasses
|
|
397
401
|
}, titleText && /*#__PURE__*/React__default["default"].createElement(Text.Text, _rollupPluginBabelHelpers["extends"]({
|
|
@@ -409,7 +413,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
409
413
|
light: light,
|
|
410
414
|
size: size,
|
|
411
415
|
warn: warn,
|
|
412
|
-
ref: refs.setReference,
|
|
416
|
+
ref: autoAlign ? refs.setReference : null,
|
|
413
417
|
warnText: warnText,
|
|
414
418
|
warnTextId: warnTextId
|
|
415
419
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -422,7 +426,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
422
426
|
"aria-haspopup": "listbox",
|
|
423
427
|
title: textInput?.current?.value
|
|
424
428
|
}, getInputProps({
|
|
425
|
-
'aria-controls': isOpen ? undefined :
|
|
429
|
+
'aria-controls': isOpen ? undefined : menuProps.id,
|
|
426
430
|
placeholder,
|
|
427
431
|
ref: {
|
|
428
432
|
...mergeRefs["default"](textInput, ref)
|
|
@@ -484,11 +488,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
484
488
|
// @ts-expect-error
|
|
485
489
|
isOpen: isOpen,
|
|
486
490
|
translateWithId: translateWithId
|
|
487
|
-
}))), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(index["default"].Menu,
|
|
488
|
-
'aria-label': deprecatedAriaLabel || ariaLabel
|
|
489
|
-
}), {
|
|
490
|
-
ref: mergeRefs["default"](getMenuProps().ref, refs.setFloating)
|
|
491
|
-
}), isOpen ? filterItems(items, itemToString, inputValue).map((item, index$1) => {
|
|
491
|
+
}))), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(index["default"].Menu, menuProps, isOpen ? filterItems(items, itemToString, inputValue).map((item, index$1) => {
|
|
492
492
|
const isObject = item !== null && typeof item === 'object';
|
|
493
493
|
const title = isObject && 'text' in item && itemToElement ? item.text?.toString() : itemToString(item);
|
|
494
494
|
const itemProps = getItemProps({
|
|
@@ -243,8 +243,6 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
243
243
|
return changes;
|
|
244
244
|
case InputBlur:
|
|
245
245
|
case InputKeyDownEscape:
|
|
246
|
-
setInputFocused(false);
|
|
247
|
-
setInputValue('');
|
|
248
246
|
setIsOpen(false);
|
|
249
247
|
return changes;
|
|
250
248
|
case FunctionToggleMenu:
|
|
@@ -428,7 +426,11 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
428
426
|
$input.setSelectionRange($value.length, $value.length);
|
|
429
427
|
}
|
|
430
428
|
},
|
|
431
|
-
onFocus: () => setInputFocused(true)
|
|
429
|
+
onFocus: () => setInputFocused(true),
|
|
430
|
+
onBlur: () => {
|
|
431
|
+
!isOpen && setInputFocused(false);
|
|
432
|
+
setInputValue('');
|
|
433
|
+
}
|
|
432
434
|
}));
|
|
433
435
|
const menuProps = getMenuProps({}, {
|
|
434
436
|
suppressRefError: true
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.60.
|
|
4
|
+
"version": "1.60.3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -142,5 +142,5 @@
|
|
|
142
142
|
"**/*.scss",
|
|
143
143
|
"**/*.css"
|
|
144
144
|
],
|
|
145
|
-
"gitHead": "
|
|
145
|
+
"gitHead": "7e7aa249813b0a3376f13f403702d8c3e2551952"
|
|
146
146
|
}
|