carbon-react 118.0.0 → 118.1.1

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 (169) hide show
  1. package/esm/__internal__/filter-object-properties/filter-object-properties.d.ts +1 -1
  2. package/esm/components/button-minor/button-minor.style.js +8 -0
  3. package/esm/components/pager/pager.component.js +5 -5
  4. package/esm/components/pill/pill.component.d.ts +3 -1
  5. package/esm/components/pill/pill.component.js +1 -0
  6. package/esm/components/select/__internal__/select-list-context.d.ts +7 -0
  7. package/esm/components/select/__internal__/select-text/index.d.ts +2 -0
  8. package/esm/components/select/__internal__/select-text/index.js +1 -0
  9. package/esm/components/select/__internal__/select-text/select-text.component.d.ts +33 -0
  10. package/esm/components/select/__internal__/select-text/select-text.component.js +16 -36
  11. package/esm/components/select/__internal__/select-text/select-text.style.d.ts +6 -1
  12. package/esm/components/select/filterable-select/filterable-select.component.d.ts +65 -0
  13. package/esm/components/select/filterable-select/filterable-select.component.js +568 -102
  14. package/esm/components/select/filterable-select/index.d.ts +2 -1
  15. package/esm/components/select/filterable-select/index.js +1 -0
  16. package/esm/components/select/index.d.ts +6 -0
  17. package/esm/components/select/index.js +6 -6
  18. package/esm/components/select/list-action-button/index.d.ts +2 -0
  19. package/esm/components/select/list-action-button/index.js +1 -0
  20. package/esm/components/select/list-action-button/list-action-button.component.d.ts +7 -0
  21. package/esm/components/select/list-action-button/list-action-button.component.js +9 -6
  22. package/esm/components/select/list-action-button/list-action-button.style.d.ts +2 -0
  23. package/esm/components/select/multi-select/index.d.ts +2 -1
  24. package/esm/components/select/multi-select/index.js +1 -0
  25. package/esm/components/select/multi-select/multi-select.component.d.ts +62 -0
  26. package/esm/components/select/multi-select/multi-select.component.js +575 -104
  27. package/esm/components/select/multi-select/multi-select.style.d.ts +4 -0
  28. package/esm/components/select/multi-select/multi-select.style.js +1 -0
  29. package/esm/components/select/option/index.d.ts +2 -25
  30. package/esm/components/select/option/index.js +1 -0
  31. package/esm/components/select/option/option.component.d.ts +34 -0
  32. package/esm/components/select/option/option.component.js +399 -62
  33. package/esm/components/select/option/option.style.d.ts +6 -0
  34. package/esm/components/select/option/option.style.js +0 -5
  35. package/esm/components/select/option-group-header/index.d.ts +2 -10
  36. package/esm/components/select/option-group-header/index.js +1 -0
  37. package/esm/components/select/option-group-header/option-group-header.component.d.ts +16 -0
  38. package/esm/components/select/option-group-header/option-group-header.component.js +4 -15
  39. package/esm/components/select/option-group-header/option-group-header.style.d.ts +2 -0
  40. package/esm/components/select/option-row/index.d.ts +2 -16
  41. package/esm/components/select/option-row/index.js +1 -0
  42. package/esm/components/select/option-row/option-row.component.d.ts +42 -0
  43. package/esm/components/select/option-row/option-row.component.js +10 -40
  44. package/esm/components/select/option-row/option-row.style.d.ts +6 -0
  45. package/esm/components/select/select-list/index.d.ts +2 -0
  46. package/esm/components/select/select-list/index.js +1 -0
  47. package/esm/components/select/select-list/select-list-container.style.d.ts +6 -0
  48. package/esm/components/select/select-list/select-list.component.d.ts +64 -0
  49. package/esm/components/select/select-list/select-list.component.js +69 -100
  50. package/esm/components/select/select-list/select-list.style.d.ts +12 -0
  51. package/esm/components/select/select-list/select-list.style.js +2 -2
  52. package/esm/components/select/select-textbox/index.d.ts +2 -1
  53. package/esm/components/select/select-textbox/index.js +1 -0
  54. package/esm/components/select/select-textbox/select-textbox.component.d.ts +81 -0
  55. package/esm/components/select/select-textbox/select-textbox.component.js +567 -142
  56. package/esm/components/select/select.style.d.ts +8 -0
  57. package/esm/components/select/simple-select/index.d.ts +2 -1
  58. package/esm/components/select/simple-select/index.js +1 -0
  59. package/esm/components/select/simple-select/simple-select.component.d.ts +58 -0
  60. package/esm/components/select/simple-select/simple-select.component.js +578 -111
  61. package/esm/components/select/utils/get-next-child-by-text.d.ts +5 -0
  62. package/esm/components/select/utils/get-next-child-by-text.js +20 -17
  63. package/esm/components/select/utils/get-next-index-by-key.d.ts +2 -0
  64. package/esm/components/select/utils/highlight-part-of-text.d.ts +2 -0
  65. package/esm/components/select/utils/highlight-part-of-text.js +10 -3
  66. package/esm/components/select/utils/is-expected-option.d.ts +2 -0
  67. package/esm/components/select/utils/is-expected-option.js +1 -1
  68. package/esm/components/select/utils/is-expected-value.d.ts +1 -0
  69. package/esm/components/select/utils/is-expected-value.js +1 -1
  70. package/esm/components/select/utils/is-navigation-key.d.ts +1 -0
  71. package/esm/components/select/utils/matching-text.style.d.ts +2 -0
  72. package/esm/components/select/utils/with-filter.hoc.d.ts +14 -0
  73. package/esm/components/select/utils/with-filter.hoc.js +59 -41
  74. package/esm/components/tabs/__internal__/tab-title/tab-title.component.js +1 -0
  75. package/lib/__internal__/filter-object-properties/filter-object-properties.d.ts +1 -1
  76. package/lib/components/button-minor/button-minor.style.js +8 -0
  77. package/lib/components/pager/pager.component.js +5 -5
  78. package/lib/components/pill/pill.component.d.ts +3 -1
  79. package/lib/components/pill/pill.component.js +1 -0
  80. package/lib/components/select/__internal__/select-list-context.d.ts +7 -0
  81. package/lib/components/select/__internal__/select-text/index.d.ts +2 -0
  82. package/lib/components/select/__internal__/select-text/index.js +15 -0
  83. package/lib/components/select/__internal__/select-text/package.json +6 -0
  84. package/lib/components/select/__internal__/select-text/select-text.component.d.ts +33 -0
  85. package/lib/components/select/__internal__/select-text/select-text.component.js +16 -36
  86. package/lib/components/select/__internal__/select-text/select-text.style.d.ts +6 -1
  87. package/lib/components/select/filterable-select/filterable-select.component.d.ts +65 -0
  88. package/lib/components/select/filterable-select/filterable-select.component.js +569 -103
  89. package/lib/components/select/filterable-select/index.d.ts +2 -1
  90. package/lib/components/select/filterable-select/index.js +15 -0
  91. package/lib/components/select/filterable-select/package.json +6 -0
  92. package/lib/components/select/index.d.ts +6 -0
  93. package/lib/components/select/index.js +6 -6
  94. package/lib/components/select/list-action-button/index.d.ts +2 -0
  95. package/lib/components/select/list-action-button/index.js +15 -0
  96. package/lib/components/select/list-action-button/list-action-button.component.d.ts +7 -0
  97. package/lib/components/select/list-action-button/list-action-button.component.js +9 -6
  98. package/lib/components/select/list-action-button/list-action-button.style.d.ts +2 -0
  99. package/lib/components/select/list-action-button/package.json +6 -0
  100. package/lib/components/select/multi-select/index.d.ts +2 -1
  101. package/lib/components/select/multi-select/index.js +15 -0
  102. package/lib/components/select/multi-select/multi-select.component.d.ts +62 -0
  103. package/lib/components/select/multi-select/multi-select.component.js +576 -105
  104. package/lib/components/select/multi-select/multi-select.style.d.ts +4 -0
  105. package/lib/components/select/multi-select/multi-select.style.js +1 -0
  106. package/lib/components/select/multi-select/package.json +6 -0
  107. package/lib/components/select/option/index.d.ts +2 -25
  108. package/lib/components/select/option/index.js +15 -0
  109. package/lib/components/select/option/option.component.d.ts +34 -0
  110. package/lib/components/select/option/option.component.js +399 -62
  111. package/lib/components/select/option/option.style.d.ts +6 -0
  112. package/lib/components/select/option/option.style.js +0 -8
  113. package/lib/components/select/option/package.json +6 -0
  114. package/lib/components/select/option-group-header/index.d.ts +2 -10
  115. package/lib/components/select/option-group-header/index.js +15 -0
  116. package/lib/components/select/option-group-header/option-group-header.component.d.ts +16 -0
  117. package/lib/components/select/option-group-header/option-group-header.component.js +4 -15
  118. package/lib/components/select/option-group-header/option-group-header.style.d.ts +2 -0
  119. package/lib/components/select/option-group-header/package.json +6 -0
  120. package/lib/components/select/option-row/index.d.ts +2 -16
  121. package/lib/components/select/option-row/index.js +15 -0
  122. package/lib/components/select/option-row/option-row.component.d.ts +42 -0
  123. package/lib/components/select/option-row/option-row.component.js +10 -40
  124. package/lib/components/select/option-row/option-row.style.d.ts +6 -0
  125. package/lib/components/select/option-row/package.json +6 -0
  126. package/lib/components/select/select-list/index.d.ts +2 -0
  127. package/lib/components/select/select-list/index.js +15 -0
  128. package/lib/components/select/select-list/package.json +6 -0
  129. package/lib/components/select/select-list/select-list-container.style.d.ts +6 -0
  130. package/lib/components/select/select-list/select-list.component.d.ts +64 -0
  131. package/lib/components/select/select-list/select-list.component.js +69 -100
  132. package/lib/components/select/select-list/select-list.style.d.ts +12 -0
  133. package/lib/components/select/select-list/select-list.style.js +2 -2
  134. package/lib/components/select/select-textbox/index.d.ts +2 -1
  135. package/lib/components/select/select-textbox/index.js +15 -0
  136. package/lib/components/select/select-textbox/package.json +6 -0
  137. package/lib/components/select/select-textbox/select-textbox.component.d.ts +81 -0
  138. package/lib/components/select/select-textbox/select-textbox.component.js +567 -142
  139. package/lib/components/select/select.style.d.ts +8 -0
  140. package/lib/components/select/simple-select/index.d.ts +2 -1
  141. package/lib/components/select/simple-select/index.js +15 -0
  142. package/lib/components/select/simple-select/package.json +6 -0
  143. package/lib/components/select/simple-select/simple-select.component.d.ts +58 -0
  144. package/lib/components/select/simple-select/simple-select.component.js +579 -113
  145. package/lib/components/select/utils/get-next-child-by-text.d.ts +5 -0
  146. package/lib/components/select/utils/get-next-child-by-text.js +20 -17
  147. package/lib/components/select/utils/get-next-index-by-key.d.ts +2 -0
  148. package/lib/components/select/utils/highlight-part-of-text.d.ts +2 -0
  149. package/lib/components/select/utils/highlight-part-of-text.js +10 -3
  150. package/lib/components/select/utils/is-expected-option.d.ts +2 -0
  151. package/lib/components/select/utils/is-expected-option.js +1 -1
  152. package/lib/components/select/utils/is-expected-value.d.ts +1 -0
  153. package/lib/components/select/utils/is-expected-value.js +1 -1
  154. package/lib/components/select/utils/is-navigation-key.d.ts +1 -0
  155. package/lib/components/select/utils/matching-text.style.d.ts +2 -0
  156. package/lib/components/select/utils/with-filter.hoc.d.ts +14 -0
  157. package/lib/components/select/utils/with-filter.hoc.js +59 -42
  158. package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +1 -0
  159. package/package.json +1 -1
  160. package/esm/components/select/__internal__/select-text/select-text.d.ts +0 -36
  161. package/esm/components/select/filterable-select/filterable-select.d.ts +0 -71
  162. package/esm/components/select/multi-select/multi-select.d.ts +0 -68
  163. package/esm/components/select/select-textbox/select-textbox.d.ts +0 -72
  164. package/esm/components/select/simple-select/simple-select.d.ts +0 -64
  165. package/lib/components/select/__internal__/select-text/select-text.d.ts +0 -36
  166. package/lib/components/select/filterable-select/filterable-select.d.ts +0 -71
  167. package/lib/components/select/multi-select/multi-select.d.ts +0 -68
  168. package/lib/components/select/select-textbox/select-textbox.d.ts +0 -72
  169. package/lib/components/select/simple-select/simple-select.d.ts +0 -64
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ /**
3
+ * Recreates HTML Select element functionality of finding first match based on typed characters
4
+ * */
5
+ export default function getNextChildByText(textToMatch: string, arrayOfChildren: React.ReactElement[], previousIndex?: number): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -5,20 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = getNextChildByText;
7
7
 
8
- /**
9
- * Recreates HTML Select element functionality of finding first match based on typed characters
10
- * */
11
- function getNextChildByText(textToMatch, arrayOfChildren, previousIndex = -1) {
12
- const lastCharacter = textToMatch.slice(-1);
13
- const isTheSameCharacter = textToMatch.split("").every(character => character === lastCharacter);
14
- let indexOfMatch = findElementStartingWithText(textToMatch, arrayOfChildren);
15
- const listOfMatches = getListOfMatches(arrayOfChildren, lastCharacter);
16
-
17
- if (isTheSameCharacter && listOfMatches.length > 1) {
18
- indexOfMatch = getIndexOfNextElement(listOfMatches, previousIndex);
19
- }
8
+ function findElementStartingWithText(textToMatch, list) {
9
+ return list.findIndex(child => {
10
+ var _child$props$text;
20
11
 
21
- return arrayOfChildren[indexOfMatch];
12
+ return (_child$props$text = child.props.text) === null || _child$props$text === void 0 ? void 0 : _child$props$text.toLowerCase().startsWith(textToMatch.toLowerCase());
13
+ });
22
14
  }
23
15
 
24
16
  function getListOfMatches(arrayOfChildren, lastCharacter) {
@@ -40,9 +32,20 @@ function getIndexOfNextElement(listOfMatches, previousIndex) {
40
32
 
41
33
  return listOfMatches[listOfMatches.indexOf(previousIndex) + 1];
42
34
  }
35
+ /**
36
+ * Recreates HTML Select element functionality of finding first match based on typed characters
37
+ * */
43
38
 
44
- function findElementStartingWithText(textToMatch, list) {
45
- return list.findIndex(child => {
46
- return child.props.text && child.props.text.toLowerCase().startsWith(textToMatch.toLowerCase());
47
- });
39
+
40
+ function getNextChildByText(textToMatch, arrayOfChildren, previousIndex = -1) {
41
+ const lastCharacter = textToMatch.slice(-1);
42
+ const isTheSameCharacter = textToMatch.split("").every(character => character === lastCharacter);
43
+ let indexOfMatch = findElementStartingWithText(textToMatch, arrayOfChildren);
44
+ const listOfMatches = getListOfMatches(arrayOfChildren, lastCharacter);
45
+
46
+ if (isTheSameCharacter && listOfMatches.length > 1) {
47
+ indexOfMatch = getIndexOfNextElement(listOfMatches, previousIndex);
48
+ }
49
+
50
+ return arrayOfChildren[indexOfMatch];
48
51
  }
@@ -0,0 +1,2 @@
1
+ export declare const PAGE_SIZE = 4;
2
+ export default function getNextIndexByKey(key: string, currentIndex: number, lastIndex: number, isLoading?: boolean): number;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export default function highlightPartOfTextRecursive(child: React.ReactNode, partToHighlight: string): React.ReactNode;
@@ -23,10 +23,11 @@ function highlightPartOfText(text, partToHighlight) {
23
23
 
24
24
  const precedingText = text.substr(0, indexOfFirstMatch);
25
25
  const matchingText = text.substr(indexOfFirstMatch, partToHighlight.length);
26
- let followingText = text.substr(indexOfFirstMatch + partToHighlight.length, text.length);
26
+ const followingText = text.substr(indexOfFirstMatch + partToHighlight.length, text.length);
27
+ let followingTextNode = followingText;
27
28
 
28
29
  if (followingText.length >= partToHighlight.length) {
29
- followingText = highlightPartOfText(followingText, partToHighlight);
30
+ followingTextNode = highlightPartOfText(followingText, partToHighlight);
30
31
  }
31
32
 
32
33
  const newValue = [/*#__PURE__*/_react.default.createElement("span", {
@@ -35,7 +36,7 @@ function highlightPartOfText(text, partToHighlight) {
35
36
  key: "match"
36
37
  }, matchingText), /*#__PURE__*/_react.default.createElement("span", {
37
38
  key: "following"
38
- }, followingText)];
39
+ }, followingTextNode)];
39
40
  return newValue;
40
41
  }
41
42
 
@@ -43,6 +44,12 @@ function highlightPartOfTextRecursive(child, partToHighlight) {
43
44
  if (typeof child === "string") {
44
45
  return highlightPartOfText(child, partToHighlight);
45
46
  }
47
+ /* istanbul ignore if */
48
+
49
+
50
+ if (! /*#__PURE__*/_react.default.isValidElement(child)) {
51
+ return child;
52
+ }
46
53
 
47
54
  const highlightedChildren = _react.default.Children.map(child.props.children, grandChild => highlightPartOfTextRecursive(grandChild, partToHighlight));
48
55
 
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function isExpectedOption(element: React.ReactElement, expectedValue?: string | Record<string, unknown> | null): boolean;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = isExpectedOption;
7
7
 
8
- var _option = _interopRequireDefault(require("../option/option.component"));
8
+ var _option = _interopRequireDefault(require("../option"));
9
9
 
10
10
  var _optionRow = _interopRequireDefault(require("../option-row/option-row.component"));
11
11
 
@@ -0,0 +1 @@
1
+ export default function isExpectedValue(currentValue: string | Record<string, unknown>, expectedValue: string | Record<string, unknown>): boolean;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = isExpectedValue;
7
7
 
8
8
  function isExpectedValue(currentValue, expectedValue) {
9
- if (typeof currentValue === "object" && currentValue.id !== null && currentValue.id !== undefined) {
9
+ if (typeof currentValue === "object" && currentValue.id !== null && currentValue.id !== undefined && typeof expectedValue === "object") {
10
10
  return currentValue.id === expectedValue.id;
11
11
  }
12
12
 
@@ -0,0 +1 @@
1
+ export default function isNavigationKey(key: string): boolean;
@@ -0,0 +1,2 @@
1
+ declare const MatchingText: import("styled-components").StyledComponent<"span", any, {}, never>;
2
+ export default MatchingText;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ interface WrappedComponentProps {
3
+ filterText?: string;
4
+ isLoading?: boolean;
5
+ multiColumn?: boolean;
6
+ tableHeader?: React.ReactNode;
7
+ children?: React.ReactNode;
8
+ }
9
+ export interface FilteredComponentProps extends WrappedComponentProps {
10
+ noResultsMessage?: string;
11
+ }
12
+ /** Filters wrapped component children based on provided filter text and highlights matching content */
13
+ declare const withFilter: <T extends WrappedComponentProps>(WrappedComponent: React.ComponentType<T>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<FilteredComponentProps & T> & React.RefAttributes<HTMLDivElement>>;
14
+ export default withFilter;
@@ -7,15 +7,13 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
10
  var _useLocale = _interopRequireDefault(require("../../../hooks/__internal__/useLocale"));
13
11
 
14
12
  var _optionRow = _interopRequireDefault(require("../option-row/option-row.style"));
15
13
 
16
14
  var _option = _interopRequireDefault(require("../option/option.style"));
17
15
 
18
- var _option2 = _interopRequireDefault(require("../option/option.component"));
16
+ var _option2 = _interopRequireDefault(require("../option"));
19
17
 
20
18
  var _optionRow2 = _interopRequireDefault(require("../option-row/option-row.component"));
21
19
 
@@ -46,6 +44,11 @@ const filterOptionRows = (optionRow, filterText) => {
46
44
  const cells = _react.default.Children.toArray(optionRow.props.children);
47
45
 
48
46
  const hasText = cells.find(cell => {
47
+ /* istanbul ignore if */
48
+ if (! /*#__PURE__*/_react.default.isValidElement(cell)) {
49
+ return false;
50
+ }
51
+
49
52
  if (typeof cell.props.children === "string") {
50
53
  const processedText = cell.props.children.toLowerCase();
51
54
  const processedValue = filterText.toLowerCase();
@@ -64,15 +67,23 @@ const filterOptionRows = (optionRow, filterText) => {
64
67
  };
65
68
 
66
69
  const filterChildren = filterText => children => {
67
- // eslint-disable-next-line consistent-return
68
70
  const filteredChildren = _react.default.Children.map(children, child => {
71
+ /* istanbul ignore if */
72
+ if (! /*#__PURE__*/_react.default.isValidElement(child)) {
73
+ return null;
74
+ }
75
+
69
76
  if (child.type === _option2.default) {
70
77
  return filterOptions(child, filterText);
71
78
  }
79
+ /* istanbul ignore else */
80
+
72
81
 
73
82
  if (child.type === _optionRow2.default) {
74
83
  return filterOptionRows(child, filterText);
75
84
  }
85
+ /* istanbul ignore next */
86
+
76
87
 
77
88
  return null;
78
89
  });
@@ -80,9 +91,40 @@ const filterChildren = filterText => children => {
80
91
  if (_react.default.Children.count(filteredChildren)) return filteredChildren;
81
92
  return null;
82
93
  };
83
- /** Filters wrapped component children based on provided filter text and highlights matching content */
84
94
 
95
+ function addHighlightedContent(filteredElements, filterText) {
96
+ return _react.default.Children.map(filteredElements, child => {
97
+ let highlightedContent;
98
+ /* istanbul ignore if */
99
+
100
+ if (! /*#__PURE__*/_react.default.isValidElement(child)) {
101
+ return child;
102
+ }
85
103
 
104
+ if (child.type === _option2.default) {
105
+ highlightedContent = (0, _highlightPartOfText.default)(child.props.text, filterText);
106
+ }
107
+
108
+ if (child.type === _optionRow2.default) {
109
+ highlightedContent = _react.default.Children.map(child.props.children, cell => {
110
+ /* istanbul ignore if */
111
+ if (! /*#__PURE__*/_react.default.isValidElement(cell)) {
112
+ return cell;
113
+ }
114
+
115
+ return /*#__PURE__*/_react.default.cloneElement(cell, {
116
+ children: (0, _highlightPartOfText.default)(cell.props.children, filterText)
117
+ });
118
+ });
119
+ }
120
+
121
+ return /*#__PURE__*/_react.default.cloneElement(child, {
122
+ children: highlightedContent
123
+ });
124
+ });
125
+ }
126
+
127
+ /** Filters wrapped component children based on provided filter text and highlights matching content */
86
128
  const withFilter = WrappedComponent => {
87
129
  const FilteredComponent = /*#__PURE__*/_react.default.forwardRef(({
88
130
  children,
@@ -106,8 +148,9 @@ const withFilter = WrappedComponent => {
106
148
  if (multiColumn) {
107
149
  var _tableHeader$props;
108
150
 
109
- const colSpan = _react.default.Children.count(tableHeader === null || tableHeader === void 0 ? void 0 : (_tableHeader$props = tableHeader.props) === null || _tableHeader$props === void 0 ? void 0 : _tableHeader$props.children);
110
-
151
+ const colSpan = /*#__PURE__*/_react.default.isValidElement(tableHeader) ?
152
+ /* istanbul ignore next */
153
+ _react.default.Children.count(tableHeader === null || tableHeader === void 0 ? void 0 : (_tableHeader$props = tableHeader.props) === null || _tableHeader$props === void 0 ? void 0 : _tableHeader$props.children) : 1;
111
154
  return /*#__PURE__*/_react.default.createElement(_optionRow.default, null, /*#__PURE__*/_react.default.createElement("td", {
112
155
  style: {
113
156
  fontWeight: "normal"
@@ -124,45 +167,19 @@ const withFilter = WrappedComponent => {
124
167
 
125
168
  return children;
126
169
  }, [children, filterText, isLoading, multiColumn, noResultsMessage, tableHeader, l]);
127
- return /*#__PURE__*/_react.default.createElement(WrappedComponent, _extends({
128
- filterText: filterText,
129
- isLoading: isLoading,
130
- multiColumn: multiColumn,
131
- tableHeader: tableHeader
132
- }, props, {
170
+ const wrappedComponentProps = {
171
+ filterText,
172
+ isLoading,
173
+ multiColumn,
174
+ tableHeader,
175
+ ...props
176
+ };
177
+ return /*#__PURE__*/_react.default.createElement(WrappedComponent, _extends({}, wrappedComponentProps, {
133
178
  ref: forwardedRef
134
179
  }), getFilteredChildren());
135
180
  });
136
181
 
137
- function addHighlightedContent(filteredElements, filterText) {
138
- return _react.default.Children.map(filteredElements, child => {
139
- let highlightedContent;
140
-
141
- if (child.type === _option2.default) {
142
- highlightedContent = (0, _highlightPartOfText.default)(child.props.text, filterText);
143
- }
144
-
145
- if (child.type === _optionRow2.default) {
146
- highlightedContent = _react.default.Children.map(child.props.children, cell => /*#__PURE__*/_react.default.cloneElement(cell, {
147
- children: (0, _highlightPartOfText.default)(cell.props.children, filterText)
148
- }));
149
- }
150
-
151
- return /*#__PURE__*/_react.default.cloneElement(child, {
152
- children: highlightedContent
153
- });
154
- });
155
- }
156
-
157
- FilteredComponent.propTypes = {
158
- forwardedRef: _propTypes.default.object,
159
- children: _propTypes.default.node,
160
- filterText: _propTypes.default.string,
161
- noResultsMessage: _propTypes.default.string,
162
- isLoading: _propTypes.default.bool,
163
- multiColumn: _propTypes.default.bool,
164
- tableHeader: _propTypes.default.node
165
- };
182
+ FilteredComponent.displayName = "FilteredComponent";
166
183
  return FilteredComponent;
167
184
  };
168
185
 
@@ -217,6 +217,7 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
217
217
  href: href,
218
218
  target: "_blank"
219
219
  }), titleChildren) : /*#__PURE__*/_react.default.createElement(_tabTitle.StyledTabTitleButton, _extends({}, titleWrapperProps, {
220
+ type: "button",
220
221
  ref: ref
221
222
  }), titleChildren);
222
223
  return /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "118.0.0",
3
+ "version": "118.1.1",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -1,36 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface SelectTextProps {
4
- /** If true the Component will be disabled */
5
- disabled?: boolean;
6
- /** Value to be displayed */
7
- formattedValue?: string;
8
- /** Label id passed from Select component */
9
- labelId?: string;
10
- /** If true, the list is displayed */
11
- isOpen?: boolean;
12
- /** Callback function for when the Select Textbox loses it's focus. */
13
- onBlur?: (ev: React.FocusEvent<HTMLElement>) => void;
14
- /** Callback function for when the component is clicked. */
15
- onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
16
- /** Callback function for when the Select Textbox is focused. */
17
- onFocus?: (ev: React.FocusEvent<HTMLElement>) => void;
18
- /** Callback function for when the key is pressed when focused on Select Text. */
19
- onKeyDown?: (ev: React.KeyboardEvent<HTMLElement>) => void;
20
- /** Callback function for when the left mouse key is pressed when focused on Select Text. */
21
- onMouseDown?: (ev: React.MouseEvent<HTMLElement>) => void;
22
- /** Placeholder string to be displayed when formattedValue is empty */
23
- placeholder?: string;
24
- /** If true the Component will be read-only */
25
- readOnly?: boolean;
26
- /** If true the component has no border and a transparent background */
27
- transparent?: boolean;
28
- /** Id of the Select Text element */
29
- textId?: string;
30
- /** Component size */
31
- size?: string;
32
- }
33
-
34
- declare function SelectText(props: SelectTextProps): JSX.Element;
35
-
36
- export default SelectText;
@@ -1,71 +0,0 @@
1
- import * as React from "react";
2
- import { Side } from "@floating-ui/dom";
3
- import Button from "../../button";
4
- import { FormInputPropTypes } from "../select-textbox/select-textbox";
5
-
6
- export interface FilterableSelectProps
7
- extends Omit<FormInputPropTypes, "defaultValue" | "value"> {
8
- /** Prop to specify the aria-label attribute of the component input */
9
- "aria-label"?: string;
10
- /** Prop to specify the aria-labeledby property of the component input */
11
- "aria-labelledby"?: string;
12
- /** Identifier used for testing purposes, applied to the root element of the component. */
13
- "data-component"?: string;
14
- /** Identifier used for testing purposes, applied to the root element of the component. */
15
- "data-element"?: string;
16
- /** Identifier used for testing purposes, applied to the root element of the component. */
17
- "data-role"?: string;
18
- /** Child components (such as Option or OptionRow) for the SelectList */
19
- children: React.ReactNode;
20
- /** The default selected value(s), when the component is operating in uncontrolled mode */
21
- defaultValue?: string | Record<string, unknown>;
22
- /** Boolean to toggle where SelectList is rendered in relation to the Select Input */
23
- disablePortal?: boolean;
24
- /** If true the loader animation is displayed in the option list */
25
- isLoading?: boolean;
26
- /** True for default text button or a Button Component to be rendered */
27
- listActionButton?: boolean | typeof Button;
28
- /** When true component will work in multi column mode.
29
- * Children should consist of OptionRow components in this mode
30
- */
31
- multiColumn?: boolean;
32
- /** A custom message to be displayed when any option does not match the filter text */
33
- noResultsMessage?: string;
34
- /** A custom callback for when the input text changes */
35
- onFilterChange?: (filterText: string) => void;
36
- /** A custom callback for when the dropdown menu opens */
37
- onOpen?: () => void;
38
- /** A callback for when the Action Button is triggered */
39
- onListAction?: () => void;
40
- /** A callback that is triggered when a user scrolls to the bottom of the list */
41
- onListScrollBottom?: () => void;
42
- /** If true the Component opens on focus */
43
- openOnFocus?: boolean;
44
- /** SelectList table header, should consist of multiple th elements.
45
- * Works only in multiColumn mode
46
- */
47
- tableHeader?: React.ReactNode;
48
- /** The selected value(s), when the component is operating in controlled mode */
49
- value?: string | Record<string, unknown>;
50
- /** Overrides the default tooltip position */
51
- tooltipPosition?: "top" | "bottom" | "left" | "right";
52
- /** Maximum list height - defaults to 180 */
53
- listMaxHeight?: number;
54
- /** Placement of the select list in relation to the input element */
55
- listPlacement?: Side;
56
- /** Use the opposite list placement if the set placement does not fit */
57
- flipEnabled?: boolean;
58
- /** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
59
- * DOM at all times, which may cause performance problems on very large lists */
60
- enableVirtualScroll?: boolean;
61
- /** The number of options to render into the DOM at once, either side of the currently-visible ones.
62
- * Higher values make for smoother scrolling but may impact performance.
63
- * Only used if the `enableVirtualScroll` prop is set. */
64
- virtualScrollOverscan?: number;
65
- }
66
-
67
- declare function FilterableSelect(
68
- props: FilterableSelectProps & React.RefAttributes<HTMLInputElement>
69
- ): JSX.Element;
70
-
71
- export default FilterableSelect;
@@ -1,68 +0,0 @@
1
- import * as React from "react";
2
- import { Side } from "@floating-ui/dom";
3
- import { FormInputPropTypes } from "../select-textbox/select-textbox";
4
-
5
- export interface MultiSelectProps
6
- extends Omit<FormInputPropTypes, "defaultValue" | "value"> {
7
- /** Prop to specify the aria-label attribute of the component input */
8
- "aria-label"?: string;
9
- /** Prop to specify the aria-labeledby property of the component input */
10
- "aria-labelledby"?: string;
11
- /** Identifier used for testing purposes, applied to the root element of the component. */
12
- "data-component"?: string;
13
- /** Identifier used for testing purposes, applied to the root element of the component. */
14
- "data-element"?: string;
15
- /** Identifier used for testing purposes, applied to the root element of the component. */
16
- "data-role"?: string;
17
- /** Size of an input */
18
- size?: "small" | "medium" | "large";
19
- /** Child components (such as Option or OptionRow) for the SelectList */
20
- children: React.ReactNode;
21
- /** The default selected value(s), when the component is operating in uncontrolled mode */
22
- defaultValue?: string[] | Record<string, unknown>[];
23
- /** Boolean to toggle where SelectList is rendered in relation to the Select Input */
24
- disablePortal?: boolean;
25
- /** If true the loader animation is displayed in the option list */
26
- isLoading?: boolean;
27
- /** When true component will work in multi column mode.
28
- * Children should consist of OptionRow components in this mode
29
- */
30
- multiColumn?: boolean;
31
- /** A custom message to be displayed when any option does not match the filter text */
32
- noResultsMessage?: string;
33
- /** A custom callback for when the input text changes */
34
- onFilterChange?: (filterText: string) => void;
35
- /** A custom callback for when the dropdown menu opens */
36
- onOpen?: () => void;
37
- /** If true the Component opens on focus */
38
- openOnFocus?: boolean;
39
- /** SelectList table header, should consist of multiple th elements.
40
- * Works only in multiColumn mode
41
- */
42
- tableHeader?: React.ReactNode;
43
- /** The selected value(s), when the component is operating in controlled mode */
44
- value?: string[] | Record<string, unknown>[];
45
- /** Overrides the default tooltip position */
46
- tooltipPosition?: "top" | "bottom" | "left" | "right";
47
- /** Maximum list height - defaults to 180 */
48
- listMaxHeight?: number;
49
- /** Placement of the select list in relation to the input element */
50
- listPlacement?: Side;
51
- /** Use the opposite list placement if the set placement does not fit */
52
- flipEnabled?: boolean;
53
- /** Wraps the pill text when it would overflow the input width */
54
- wrapPillText?: boolean;
55
- /** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
56
- * DOM at all times, which may cause performance problems on very large lists */
57
- enableVirtualScroll?: boolean;
58
- /** The number of options to render into the DOM at once, either side of the currently-visible ones.
59
- * Higher values make for smoother scrolling but may impact performance.
60
- * Only used if the `enableVirtualScroll` prop is set. */
61
- virtualScrollOverscan?: number;
62
- }
63
-
64
- declare function MultiSelect(
65
- props: MultiSelectProps & React.RefAttributes<HTMLInputElement>
66
- ): JSX.Element;
67
-
68
- export default MultiSelect;
@@ -1,72 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { CommonTextboxProps } from "../../textbox";
4
- import { ValidationProps } from "../../../__internal__/validations";
5
-
6
- export interface FormInputPropTypes
7
- extends ValidationProps,
8
- Omit<CommonTextboxProps, "onClick"> {
9
- /** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
10
- adaptiveLabelBreakpoint?: number;
11
- /** Prop to specify the aria-label attribute of the component input */
12
- ariaLabel?: string;
13
- /** Prop to specify the aria-labeledby property of the component input */
14
- ariaLabelledBy?: string;
15
- /** If true the Component will be focused when rendered */
16
- autoFocus?: boolean;
17
- /** If true, the component will be disabled */
18
- disabled?: boolean;
19
- /** Id attribute of the input element */
20
- id?: string;
21
- /** The width of the input as a percentage */
22
- inputWidth?: number;
23
- /** Label content */
24
- label?: string;
25
- /** A message that the Help component will display */
26
- labelHelp?: React.ReactNode;
27
- /** When true label is inline */
28
- labelInline?: boolean;
29
- /** Label width */
30
- labelWidth?: number;
31
- /** Name attribute of the input element */
32
- name?: string;
33
- /** Specify a callback triggered on blur */
34
- onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
35
- /** Specify a callback triggered on change */
36
- onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
37
- /** pecify a callback triggered on click */
38
- onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
39
- /** Specify a callback triggered on focus */
40
- onFocus?: (ev: React.FocusEvent<HTMLInputElement>) => void;
41
- /** pecify a callback triggered on keuyDown */
42
- onKeyDown?: (ev: React.KeyboardEvent<HTMLInputElement>) => void;
43
- /** Placeholder string to be displayed in input */
44
- placeholder?: string;
45
- /** Flag to configure component as mandatory */
46
- required?: boolean;
47
- /** If true, the component will be read-only */
48
- readOnly?: boolean;
49
- /** Size of an input */
50
- size?: "small" | "medium" | "large";
51
- }
52
-
53
- export interface SelectTextboxProps extends FormInputPropTypes {
54
- /** Id attribute of the select list */
55
- "aria-controls"?: string;
56
- /** Value to be displayed in the Textbox */
57
- formattedValue?: string;
58
- /** If true, the input will be displayed */
59
- hasTextCursor?: boolean;
60
- /** If true, the list is displayed */
61
- isOpen?: boolean;
62
- /** Value of the Select Input */
63
- selectedValue?:
64
- | string
65
- | Record<string, unknown>
66
- | string[]
67
- | Record<string, unknown>[];
68
- }
69
-
70
- declare function SelectTextbox(props: SelectTextboxProps): JSX.Element;
71
-
72
- export default SelectTextbox;
@@ -1,64 +0,0 @@
1
- import * as React from "react";
2
- import { Side } from "@floating-ui/dom";
3
- import { FormInputPropTypes } from "../select-textbox/select-textbox";
4
-
5
- export interface SimpleSelectProps
6
- extends Omit<FormInputPropTypes, "defaultValue" | "value"> {
7
- /** Prop to specify the aria-label attribute of the component input */
8
- "aria-label"?: string;
9
- /** Prop to specify the aria-labeledby property of the component input */
10
- "aria-labelledby"?: string;
11
- /** Identifier used for testing purposes, applied to the root element of the component. */
12
- "data-component"?: string;
13
- /** Identifier used for testing purposes, applied to the root element of the component. */
14
- "data-element"?: string;
15
- /** Identifier used for testing purposes, applied to the root element of the component. */
16
- "data-role"?: string;
17
- /** Child components (such as Option or OptionRow) for the SelectList */
18
- children: React.ReactNode;
19
- /** The default selected value(s), when the component is operating in uncontrolled mode */
20
- defaultValue?: string | Record<string, unknown>;
21
- /** Boolean to toggle where SelectList is rendered in relation to the Select Input */
22
- disablePortal?: boolean;
23
- /** If true the loader animation is displayed in the option list */
24
- isLoading?: boolean;
25
- /** When true component will work in multi column mode.
26
- * Children should consist of OptionRow components in this mode
27
- */
28
- multiColumn?: boolean;
29
- /** A callback that is triggered when a user scrolls to the bottom of the list */
30
- onListScrollBottom?: () => void;
31
- /** A custom callback for when the dropdown menu opens */
32
- onOpen?: () => void;
33
- /** If true the Component opens on focus */
34
- openOnFocus?: boolean;
35
- /** SelectList table header, should consist of multiple th elements.
36
- * Works only in multiColumn mode
37
- */
38
- tableHeader?: React.ReactNode;
39
- /** If true the component input has no border and is transparent */
40
- transparent?: boolean;
41
- /** The selected value(s), when the component is operating in controlled mode */
42
- value?: string | Record<string, unknown>;
43
- /** Overrides the default tooltip position */
44
- tooltipPosition?: "top" | "bottom" | "left" | "right";
45
- /** Maximum list height - defaults to 180 */
46
- listMaxHeight?: number;
47
- /** Placement of the select list in relation to the input element */
48
- listPlacement?: Side;
49
- /** Use the opposite list placement if the set placement does not fit */
50
- flipEnabled?: boolean;
51
- /** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
52
- * DOM at all times, which may cause performance problems on very large lists */
53
- enableVirtualScroll?: boolean;
54
- /** The number of options to render into the DOM at once, either side of the currently-visible ones.
55
- * Higher values make for smoother scrolling but may impact performance.
56
- * Only used if the `enableVirtualScroll` prop is set. */
57
- virtualScrollOverscan?: number;
58
- }
59
-
60
- declare function SimpleSelect(
61
- props: SimpleSelectProps & React.RefAttributes<HTMLInputElement>
62
- ): JSX.Element;
63
-
64
- export default SimpleSelect;