carbon-react 104.51.0 → 104.52.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.
Files changed (23) hide show
  1. package/esm/components/flat-table/flat-table-body/flat-table-body.component.js +6 -3
  2. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +2 -1
  3. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +4 -3
  4. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +2 -1
  5. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +6 -3
  6. package/esm/components/flat-table/flat-table-head/flat-table-head.component.d.ts +2 -1
  7. package/esm/components/flat-table/flat-table-head/flat-table-head.component.js +4 -3
  8. package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +3 -2
  9. package/esm/components/select/filterable-select/filterable-select.component.js +5 -3
  10. package/esm/components/select/select-textbox/select-textbox.component.d.ts +3 -3
  11. package/esm/components/select/select-textbox/select-textbox.component.js +6 -3
  12. package/lib/components/flat-table/flat-table-body/flat-table-body.component.js +6 -3
  13. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +2 -1
  14. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +4 -3
  15. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +2 -1
  16. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +6 -3
  17. package/lib/components/flat-table/flat-table-head/flat-table-head.component.d.ts +2 -1
  18. package/lib/components/flat-table/flat-table-head/flat-table-head.component.js +4 -3
  19. package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +3 -2
  20. package/lib/components/select/filterable-select/filterable-select.component.js +5 -3
  21. package/lib/components/select/select-textbox/select-textbox.component.d.ts +3 -3
  22. package/lib/components/select/select-textbox/select-textbox.component.js +6 -3
  23. package/package.json +1 -1
@@ -1,11 +1,14 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  import React from "react";
2
4
  import PropTypes from "prop-types";
3
5
  const FlatTableBody = /*#__PURE__*/React.forwardRef(({
4
- children
6
+ children,
7
+ ...rest
5
8
  }, ref) => {
6
- return /*#__PURE__*/React.createElement("tbody", {
9
+ return /*#__PURE__*/React.createElement("tbody", _extends({
7
10
  ref: ref
8
- }, children);
11
+ }, rest), children);
9
12
  });
10
13
  FlatTableBody.propTypes = {
11
14
  /** Array of FlatTableRow. */
@@ -1,5 +1,6 @@
1
1
  export default FlatTableBodyDraggable;
2
- declare function FlatTableBodyDraggable({ children, getOrder }: {
2
+ declare function FlatTableBodyDraggable({ children, getOrder, ...rest }: {
3
+ [x: string]: any;
3
4
  children: any;
4
5
  getOrder: any;
5
6
  }): JSX.Element;
@@ -33,7 +33,8 @@ DropTarget.propTypes = {
33
33
 
34
34
  const FlatTableBodyDraggable = ({
35
35
  children,
36
- getOrder
36
+ getOrder,
37
+ ...rest
37
38
  }) => {
38
39
  const [draggableItems, setDraggableItems] = useState(React.Children.toArray(children));
39
40
  const isFirstRender = useRef(true);
@@ -76,9 +77,9 @@ const FlatTableBodyDraggable = ({
76
77
 
77
78
  return /*#__PURE__*/React.createElement(DndProvider, {
78
79
  backend: HTML5Backend
79
- }, /*#__PURE__*/React.createElement(DropTarget, {
80
+ }, /*#__PURE__*/React.createElement(DropTarget, _extends({
80
81
  getOrder: getItemsId
81
- }, draggableItems.map(item => /*#__PURE__*/React.cloneElement(item, {
82
+ }, rest), draggableItems.map(item => /*#__PURE__*/React.cloneElement(item, {
82
83
  id: `${item.props.id}`,
83
84
  moveItem,
84
85
  findItem,
@@ -1,5 +1,6 @@
1
1
  export default FlatTableCheckbox;
2
- declare function FlatTableCheckbox({ as, checked, onChange, selectable, onClick, leftPosition, cellIndex, reportCellWidth, ariaLabelledBy, }: {
2
+ declare function FlatTableCheckbox({ as, checked, onChange, selectable, onClick, leftPosition, cellIndex, reportCellWidth, ariaLabelledBy, ...rest }: {
3
+ [x: string]: any;
3
4
  as?: string | undefined;
4
5
  checked: any;
5
6
  onChange: any;
@@ -1,3 +1,5 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  import React, { useLayoutEffect, useRef } from "react";
2
4
  import PropTypes from "prop-types";
3
5
  import StyledFlatTableCheckbox from "./flat-table-checkbox.style";
@@ -12,7 +14,8 @@ const FlatTableCheckbox = ({
12
14
  leftPosition,
13
15
  cellIndex,
14
16
  reportCellWidth,
15
- ariaLabelledBy
17
+ ariaLabelledBy,
18
+ ...rest
16
19
  }) => {
17
20
  const ref = useRef(null);
18
21
  useLayoutEffect(() => {
@@ -31,13 +34,13 @@ const FlatTableCheckbox = ({
31
34
  event.stopPropagation();
32
35
  };
33
36
 
34
- return /*#__PURE__*/React.createElement(StyledFlatTableCheckbox, {
37
+ return /*#__PURE__*/React.createElement(StyledFlatTableCheckbox, _extends({
35
38
  ref: ref,
36
39
  makeCellSticky: !!reportCellWidth,
37
40
  leftPosition: leftPosition || 0,
38
41
  "data-element": dataElement,
39
42
  as: as
40
- }, selectable && /*#__PURE__*/React.createElement(Checkbox, {
43
+ }, rest), selectable && /*#__PURE__*/React.createElement(Checkbox, {
41
44
  checked: checked,
42
45
  onChange: onChange,
43
46
  name: "flat-table-checkbox",
@@ -1,5 +1,6 @@
1
1
  export default FlatTableHead;
2
- declare function FlatTableHead({ children }: {
2
+ declare function FlatTableHead({ children, ...rest }: {
3
+ [x: string]: any;
3
4
  children: any;
4
5
  }): JSX.Element;
5
6
  declare namespace FlatTableHead {
@@ -8,7 +8,8 @@ const getRefs = length => Array.from({
8
8
  }, () => /*#__PURE__*/React.createRef());
9
9
 
10
10
  const FlatTableHead = ({
11
- children
11
+ children,
12
+ ...rest
12
13
  }) => {
13
14
  const [rowHeights, setRowHeights] = useState([]);
14
15
  const refs = getRefs(React.Children.count(children));
@@ -21,10 +22,10 @@ const FlatTableHead = ({
21
22
  }, []);
22
23
 
23
24
  if (React.Children.count(children) === 1) {
24
- return /*#__PURE__*/React.createElement(StyledFlatTableHead, null, children);
25
+ return /*#__PURE__*/React.createElement(StyledFlatTableHead, rest, children);
25
26
  }
26
27
 
27
- return /*#__PURE__*/React.createElement(StyledFlatTableHead, null, React.Children.map(children, (child, index) => {
28
+ return /*#__PURE__*/React.createElement(StyledFlatTableHead, rest, React.Children.map(children, (child, index) => {
28
29
  /* Applies left border if preceding row has a FlatTableRowHeader and current one does not.
29
30
  This is only needed when the preceding row has rowSpans applied,
30
31
  as in any other use case the rows will all have FlatTableRowHeaders */
@@ -28,7 +28,8 @@ const FlatTableRow = /*#__PURE__*/React.forwardRef(({
28
28
  id,
29
29
  draggable,
30
30
  findItem,
31
- moveItem
31
+ moveItem,
32
+ ...rest
32
33
  }, ref) => {
33
34
  const [isExpanded, setIsExpanded] = useState(expanded);
34
35
  let rowRef = useRef();
@@ -127,7 +128,7 @@ const FlatTableRow = /*#__PURE__*/React.forwardRef(({
127
128
  horizontalBorderSize: horizontalBorderSize,
128
129
  applyBorderLeft: applyBorderLeft,
129
130
  draggable: draggable
130
- }, interactiveRowProps), React.Children.map(children, (child, index) => {
131
+ }, interactiveRowProps, rest), React.Children.map(children, (child, index) => {
131
132
  return child && /*#__PURE__*/React.cloneElement(child, {
132
133
  expandable: expandable && index === firstCellIndex(),
133
134
  onClick: expandable && index === firstCellIndex() && firstColumnExpandable ? () => toggleExpanded() : undefined,
@@ -16,6 +16,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
16
16
  defaultValue,
17
17
  id,
18
18
  name,
19
+ label,
19
20
  children,
20
21
  onOpen,
21
22
  onChange,
@@ -45,7 +46,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
45
46
  }, inputRef) => {
46
47
  const [activeDescendantId, setActiveDescendantId] = useState();
47
48
  const selectListId = useRef(guid());
48
- const labelId = useRef(guid());
49
+ const labelId = useRef(label ? guid() : undefined);
49
50
  const containerRef = useRef();
50
51
  const listboxRef = useRef();
51
52
  const isControlled = useRef(value !== undefined);
@@ -366,6 +367,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
366
367
  return {
367
368
  id,
368
369
  name,
370
+ label,
369
371
  disabled,
370
372
  readOnly,
371
373
  inputRef: assignInput,
@@ -391,7 +393,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
391
393
  const selectList = /*#__PURE__*/React.createElement(FilterableSelectList, {
392
394
  ref: listboxRef,
393
395
  id: selectListId.current,
394
- labelId: labelId.current,
396
+ labelId: label ? labelId.current : undefined,
395
397
  anchorElement: textboxRef && textboxRef.parentElement,
396
398
  onSelect: onSelectOption,
397
399
  onSelectListClose: onSelectListClose,
@@ -426,10 +428,10 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
426
428
  ref: containerRef
427
429
  }, /*#__PURE__*/React.createElement(SelectTextbox, _extends({
428
430
  activeDescendantId: activeDescendantId,
431
+ labelId: label ? labelId.current : undefined,
429
432
  "aria-controls": isOpen ? selectListId.current : undefined,
430
433
  isOpen: isOpen,
431
434
  hasTextCursor: true,
432
- labelId: labelId.current,
433
435
  textboxRef: textboxRef
434
436
  }, getTextboxProps()))), isOpen && selectList);
435
437
  });
@@ -1,14 +1,14 @@
1
1
  export default SelectTextbox;
2
- declare function SelectTextbox({ accessibilityLabelId, "aria-controls": ariaControls, value, disabled, isOpen, readOnly, placeholder, labelId, size, onClick, onFocus, onBlur, onChange, selectedValue, required, textboxRef, hasTextCursor, transparent, activeDescendantId, ...restProps }: {
2
+ declare function SelectTextbox({ accessibilityLabelId, labelId, "aria-controls": ariaControls, value, disabled, isOpen, readOnly, placeholder, size, onClick, onFocus, onBlur, onChange, selectedValue, required, textboxRef, hasTextCursor, transparent, activeDescendantId, ...restProps }: {
3
3
  [x: string]: any;
4
- accessibilityLabelId?: string | undefined;
4
+ accessibilityLabelId: any;
5
+ labelId: any;
5
6
  "aria-controls": any;
6
7
  value: any;
7
8
  disabled: any;
8
9
  isOpen: any;
9
10
  readOnly: any;
10
11
  placeholder: any;
11
- labelId: any;
12
12
  size: any;
13
13
  onClick: any;
14
14
  onFocus: any;
@@ -45,14 +45,14 @@ const modifiers = [{
45
45
  }];
46
46
 
47
47
  const SelectTextbox = ({
48
- accessibilityLabelId = "",
48
+ accessibilityLabelId,
49
+ labelId,
49
50
  "aria-controls": ariaControls,
50
51
  value,
51
52
  disabled,
52
53
  isOpen,
53
54
  readOnly,
54
55
  placeholder,
55
- labelId,
56
56
  size,
57
57
  onClick,
58
58
  onFocus,
@@ -133,9 +133,12 @@ const SelectTextbox = ({
133
133
  }
134
134
 
135
135
  function getInputAriaAttributes() {
136
+ const joinIds = (...ids) => ids.filter(item => item !== undefined).join(" ");
137
+
138
+ const ariaLabelledby = hasTextCursor ? joinIds(labelId, accessibilityLabelId) : joinIds(labelId, textId.current);
136
139
  return {
137
140
  "aria-expanded": isOpen,
138
- "aria-labelledby": hasTextCursor ? `${labelId} ${accessibilityLabelId}` : `${labelId} ${textId.current}`,
141
+ "aria-labelledby": ariaLabelledby || undefined,
139
142
  "aria-activedescendant": activeDescendantId,
140
143
  "aria-controls": ariaControls,
141
144
  "aria-autocomplete": hasTextCursor ? "both" : undefined,
@@ -11,12 +11,15 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
+
14
16
  const FlatTableBody = /*#__PURE__*/_react.default.forwardRef(({
15
- children
17
+ children,
18
+ ...rest
16
19
  }, ref) => {
17
- return /*#__PURE__*/_react.default.createElement("tbody", {
20
+ return /*#__PURE__*/_react.default.createElement("tbody", _extends({
18
21
  ref: ref
19
- }, children);
22
+ }, rest), children);
20
23
  });
21
24
 
22
25
  FlatTableBody.propTypes = {
@@ -1,5 +1,6 @@
1
1
  export default FlatTableBodyDraggable;
2
- declare function FlatTableBodyDraggable({ children, getOrder }: {
2
+ declare function FlatTableBodyDraggable({ children, getOrder, ...rest }: {
3
+ [x: string]: any;
3
4
  children: any;
4
5
  getOrder: any;
5
6
  }): JSX.Element;
@@ -52,7 +52,8 @@ DropTarget.propTypes = {
52
52
 
53
53
  const FlatTableBodyDraggable = ({
54
54
  children,
55
- getOrder
55
+ getOrder,
56
+ ...rest
56
57
  }) => {
57
58
  const [draggableItems, setDraggableItems] = (0, _react.useState)(_react.default.Children.toArray(children));
58
59
  const isFirstRender = (0, _react.useRef)(true);
@@ -95,9 +96,9 @@ const FlatTableBodyDraggable = ({
95
96
 
96
97
  return /*#__PURE__*/_react.default.createElement(_reactDnd.DndProvider, {
97
98
  backend: _reactDndHtml5Backend.HTML5Backend
98
- }, /*#__PURE__*/_react.default.createElement(DropTarget, {
99
+ }, /*#__PURE__*/_react.default.createElement(DropTarget, _extends({
99
100
  getOrder: getItemsId
100
- }, draggableItems.map(item => /*#__PURE__*/_react.default.cloneElement(item, {
101
+ }, rest), draggableItems.map(item => /*#__PURE__*/_react.default.cloneElement(item, {
101
102
  id: `${item.props.id}`,
102
103
  moveItem,
103
104
  findItem,
@@ -1,5 +1,6 @@
1
1
  export default FlatTableCheckbox;
2
- declare function FlatTableCheckbox({ as, checked, onChange, selectable, onClick, leftPosition, cellIndex, reportCellWidth, ariaLabelledBy, }: {
2
+ declare function FlatTableCheckbox({ as, checked, onChange, selectable, onClick, leftPosition, cellIndex, reportCellWidth, ariaLabelledBy, ...rest }: {
3
+ [x: string]: any;
3
4
  as?: string | undefined;
4
5
  checked: any;
5
6
  onChange: any;
@@ -19,6 +19,8 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
19
19
 
20
20
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
+
22
24
  const FlatTableCheckbox = ({
23
25
  as = "td",
24
26
  checked,
@@ -28,7 +30,8 @@ const FlatTableCheckbox = ({
28
30
  leftPosition,
29
31
  cellIndex,
30
32
  reportCellWidth,
31
- ariaLabelledBy
33
+ ariaLabelledBy,
34
+ ...rest
32
35
  }) => {
33
36
  const ref = (0, _react.useRef)(null);
34
37
  (0, _react.useLayoutEffect)(() => {
@@ -47,13 +50,13 @@ const FlatTableCheckbox = ({
47
50
  event.stopPropagation();
48
51
  };
49
52
 
50
- return /*#__PURE__*/_react.default.createElement(_flatTableCheckbox.default, {
53
+ return /*#__PURE__*/_react.default.createElement(_flatTableCheckbox.default, _extends({
51
54
  ref: ref,
52
55
  makeCellSticky: !!reportCellWidth,
53
56
  leftPosition: leftPosition || 0,
54
57
  "data-element": dataElement,
55
58
  as: as
56
- }, selectable && /*#__PURE__*/_react.default.createElement(_checkbox.Checkbox, {
59
+ }, rest), selectable && /*#__PURE__*/_react.default.createElement(_checkbox.Checkbox, {
57
60
  checked: checked,
58
61
  onChange: onChange,
59
62
  name: "flat-table-checkbox",
@@ -1,5 +1,6 @@
1
1
  export default FlatTableHead;
2
- declare function FlatTableHead({ children }: {
2
+ declare function FlatTableHead({ children, ...rest }: {
3
+ [x: string]: any;
3
4
  children: any;
4
5
  }): JSX.Element;
5
6
  declare namespace FlatTableHead {
@@ -24,7 +24,8 @@ const getRefs = length => Array.from({
24
24
  }, () => /*#__PURE__*/_react.default.createRef());
25
25
 
26
26
  const FlatTableHead = ({
27
- children
27
+ children,
28
+ ...rest
28
29
  }) => {
29
30
  const [rowHeights, setRowHeights] = (0, _react.useState)([]);
30
31
  const refs = getRefs(_react.default.Children.count(children));
@@ -37,10 +38,10 @@ const FlatTableHead = ({
37
38
  }, []);
38
39
 
39
40
  if (_react.default.Children.count(children) === 1) {
40
- return /*#__PURE__*/_react.default.createElement(_flatTableHead.default, null, children);
41
+ return /*#__PURE__*/_react.default.createElement(_flatTableHead.default, rest, children);
41
42
  }
42
43
 
43
- return /*#__PURE__*/_react.default.createElement(_flatTableHead.default, null, _react.default.Children.map(children, (child, index) => {
44
+ return /*#__PURE__*/_react.default.createElement(_flatTableHead.default, rest, _react.default.Children.map(children, (child, index) => {
44
45
  /* Applies left border if preceding row has a FlatTableRowHeader and current one does not.
45
46
  This is only needed when the preceding row has rowSpans applied,
46
47
  as in any other use case the rows will all have FlatTableRowHeaders */
@@ -50,7 +50,8 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef(({
50
50
  id,
51
51
  draggable,
52
52
  findItem,
53
- moveItem
53
+ moveItem,
54
+ ...rest
54
55
  }, ref) => {
55
56
  const [isExpanded, setIsExpanded] = (0, _react.useState)(expanded);
56
57
  let rowRef = (0, _react.useRef)();
@@ -151,7 +152,7 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef(({
151
152
  horizontalBorderSize: horizontalBorderSize,
152
153
  applyBorderLeft: applyBorderLeft,
153
154
  draggable: draggable
154
- }, interactiveRowProps), _react.default.Children.map(children, (child, index) => {
155
+ }, interactiveRowProps, rest), _react.default.Children.map(children, (child, index) => {
155
156
  return child && /*#__PURE__*/_react.default.cloneElement(child, {
156
157
  expandable: expandable && index === firstCellIndex(),
157
158
  onClick: expandable && index === firstCellIndex() && firstColumnExpandable ? () => toggleExpanded() : undefined,
@@ -40,6 +40,7 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
40
40
  defaultValue,
41
41
  id,
42
42
  name,
43
+ label,
43
44
  children,
44
45
  onOpen,
45
46
  onChange,
@@ -69,7 +70,7 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
69
70
  }, inputRef) => {
70
71
  const [activeDescendantId, setActiveDescendantId] = (0, _react.useState)();
71
72
  const selectListId = (0, _react.useRef)((0, _guid.default)());
72
- const labelId = (0, _react.useRef)((0, _guid.default)());
73
+ const labelId = (0, _react.useRef)(label ? (0, _guid.default)() : undefined);
73
74
  const containerRef = (0, _react.useRef)();
74
75
  const listboxRef = (0, _react.useRef)();
75
76
  const isControlled = (0, _react.useRef)(value !== undefined);
@@ -390,6 +391,7 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
390
391
  return {
391
392
  id,
392
393
  name,
394
+ label,
393
395
  disabled,
394
396
  readOnly,
395
397
  inputRef: assignInput,
@@ -415,7 +417,7 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
415
417
  const selectList = /*#__PURE__*/_react.default.createElement(FilterableSelectList, {
416
418
  ref: listboxRef,
417
419
  id: selectListId.current,
418
- labelId: labelId.current,
420
+ labelId: label ? labelId.current : undefined,
419
421
  anchorElement: textboxRef && textboxRef.parentElement,
420
422
  onSelect: onSelectOption,
421
423
  onSelectListClose: onSelectListClose,
@@ -451,10 +453,10 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
451
453
  ref: containerRef
452
454
  }, /*#__PURE__*/_react.default.createElement(_selectTextbox.default, _extends({
453
455
  activeDescendantId: activeDescendantId,
456
+ labelId: label ? labelId.current : undefined,
454
457
  "aria-controls": isOpen ? selectListId.current : undefined,
455
458
  isOpen: isOpen,
456
459
  hasTextCursor: true,
457
- labelId: labelId.current,
458
460
  textboxRef: textboxRef
459
461
  }, getTextboxProps()))), isOpen && selectList);
460
462
  });
@@ -1,14 +1,14 @@
1
1
  export default SelectTextbox;
2
- declare function SelectTextbox({ accessibilityLabelId, "aria-controls": ariaControls, value, disabled, isOpen, readOnly, placeholder, labelId, size, onClick, onFocus, onBlur, onChange, selectedValue, required, textboxRef, hasTextCursor, transparent, activeDescendantId, ...restProps }: {
2
+ declare function SelectTextbox({ accessibilityLabelId, labelId, "aria-controls": ariaControls, value, disabled, isOpen, readOnly, placeholder, size, onClick, onFocus, onBlur, onChange, selectedValue, required, textboxRef, hasTextCursor, transparent, activeDescendantId, ...restProps }: {
3
3
  [x: string]: any;
4
- accessibilityLabelId?: string | undefined;
4
+ accessibilityLabelId: any;
5
+ labelId: any;
5
6
  "aria-controls": any;
6
7
  value: any;
7
8
  disabled: any;
8
9
  isOpen: any;
9
10
  readOnly: any;
10
11
  placeholder: any;
11
- labelId: any;
12
12
  size: any;
13
13
  onClick: any;
14
14
  onFocus: any;
@@ -66,14 +66,14 @@ const modifiers = [{
66
66
  }];
67
67
 
68
68
  const SelectTextbox = ({
69
- accessibilityLabelId = "",
69
+ accessibilityLabelId,
70
+ labelId,
70
71
  "aria-controls": ariaControls,
71
72
  value,
72
73
  disabled,
73
74
  isOpen,
74
75
  readOnly,
75
76
  placeholder,
76
- labelId,
77
77
  size,
78
78
  onClick,
79
79
  onFocus,
@@ -154,9 +154,12 @@ const SelectTextbox = ({
154
154
  }
155
155
 
156
156
  function getInputAriaAttributes() {
157
+ const joinIds = (...ids) => ids.filter(item => item !== undefined).join(" ");
158
+
159
+ const ariaLabelledby = hasTextCursor ? joinIds(labelId, accessibilityLabelId) : joinIds(labelId, textId.current);
157
160
  return {
158
161
  "aria-expanded": isOpen,
159
- "aria-labelledby": hasTextCursor ? `${labelId} ${accessibilityLabelId}` : `${labelId} ${textId.current}`,
162
+ "aria-labelledby": ariaLabelledby || undefined,
160
163
  "aria-activedescendant": activeDescendantId,
161
164
  "aria-controls": ariaControls,
162
165
  "aria-autocomplete": hasTextCursor ? "both" : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "104.51.0",
3
+ "version": "104.52.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {