@carbon/ibm-products 2.38.0-alpha.5 → 2.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. package/css/index-full-carbon.css +227 -0
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +218 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +227 -0
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +445 -0
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/ActionSet/ActionSet.js +3 -2
  18. package/es/components/Card/Card.js +50 -9
  19. package/es/components/Card/CardFooter.d.ts +5 -1
  20. package/es/components/Card/CardFooter.js +11 -1
  21. package/es/components/Carousel/Carousel.d.ts +6 -2
  22. package/es/components/Checklist/Checklist.d.ts +100 -2
  23. package/es/components/Checklist/Checklist.js +19 -15
  24. package/es/components/Checklist/Checklist.types.d.ts +19 -0
  25. package/es/components/Checklist/Checklist.types.js +22 -0
  26. package/es/components/Checklist/ChecklistChart.d.ts +6 -2
  27. package/es/components/Checklist/ChecklistChart.js +14 -33
  28. package/es/components/Checklist/ChecklistIcon.d.ts +5 -1
  29. package/es/components/Checklist/ChecklistIcon.js +9 -4
  30. package/es/components/Coachmark/Coachmark.d.ts +65 -2
  31. package/es/components/Coachmark/Coachmark.js +7 -10
  32. package/es/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
  33. package/es/components/Coachmark/CoachmarkDragbar.js +3 -1
  34. package/es/components/Coachmark/CoachmarkHeader.d.ts +27 -2
  35. package/es/components/Coachmark/CoachmarkHeader.js +0 -1
  36. package/es/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
  37. package/es/components/Coachmark/CoachmarkOverlay.js +18 -15
  38. package/es/components/Coachmark/CoachmarkTagline.d.ts +27 -2
  39. package/es/components/Coachmark/CoachmarkTagline.js +0 -1
  40. package/es/components/Coachmark/utils/enums.d.ts +20 -20
  41. package/es/components/Coachmark/utils/enums.js +22 -20
  42. package/es/components/CoachmarkButton/CoachmarkButton.d.ts +19 -2
  43. package/es/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
  44. package/es/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
  45. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +46 -2
  46. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +5 -4
  47. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
  48. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
  49. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  50. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +14 -24
  51. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
  52. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
  53. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
  54. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
  55. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
  56. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
  57. package/es/components/CreateInfluencer/CreateInfluencer.d.ts +55 -17
  58. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +67 -2
  59. package/es/components/DataSpreadsheet/DataSpreadsheet.js +48 -27
  60. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +139 -2
  61. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +60 -39
  62. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +89 -2
  63. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +39 -27
  64. package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
  65. package/es/components/DataSpreadsheet/types/index.d.ts +30 -0
  66. package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
  67. package/es/components/GetStartedCard/GetStartedCard.d.ts +5 -0
  68. package/es/components/GetStartedCard/GetStartedCard.js +82 -0
  69. package/es/components/GetStartedCard/index.d.ts +1 -0
  70. package/es/components/Guidebanner/Guidebanner.js +2 -2
  71. package/es/components/NotificationsPanel/NotificationsPanel.d.ts +162 -1
  72. package/es/components/NotificationsPanel/NotificationsPanel.js +10 -10
  73. package/es/components/SearchBar/SearchBar.d.ts +10 -1
  74. package/es/components/SearchBar/SearchBar.js +26 -20
  75. package/es/components/SidePanel/SidePanel.js +1 -1
  76. package/es/components/TagOverflow/TagOverflow.d.ts +5 -0
  77. package/es/components/TagOverflow/TagOverflow.js +153 -29
  78. package/es/components/TagOverflow/TagOverflowModal.d.ts +29 -0
  79. package/es/components/TagOverflow/TagOverflowModal.js +112 -0
  80. package/es/components/TagOverflow/TagOverflowPopover.d.ts +2 -0
  81. package/es/components/TagOverflow/TagOverflowPopover.js +135 -0
  82. package/es/components/TagSet/TagSet.d.ts +87 -3
  83. package/es/components/TagSet/TagSet.js +20 -9
  84. package/es/components/TagSet/TagSetModal.d.ts +32 -26
  85. package/es/components/TagSet/TagSetModal.js +5 -5
  86. package/es/components/TagSet/TagSetOverflow.d.ts +45 -2
  87. package/es/components/TagSet/TagSetOverflow.js +14 -12
  88. package/es/components/WebTerminal/WebTerminal.js +2 -2
  89. package/es/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
  90. package/es/components/WebTerminal/hooks/index.d.ts +16 -11
  91. package/es/components/WebTerminal/hooks/index.js +1 -1
  92. package/es/components/index.d.ts +1 -0
  93. package/es/global/js/package-settings.d.ts +2 -1
  94. package/es/global/js/package-settings.js +2 -1
  95. package/es/index.js +1 -0
  96. package/es/node_modules/@carbon/colors/es/index.js +4 -1
  97. package/es/settings.d.ts +2 -1
  98. package/lib/components/ActionSet/ActionSet.js +2 -1
  99. package/lib/components/Card/Card.js +50 -9
  100. package/lib/components/Card/CardFooter.d.ts +5 -1
  101. package/lib/components/Card/CardFooter.js +11 -1
  102. package/lib/components/Carousel/Carousel.d.ts +6 -2
  103. package/lib/components/Checklist/Checklist.d.ts +100 -2
  104. package/lib/components/Checklist/Checklist.js +19 -15
  105. package/lib/components/Checklist/Checklist.types.d.ts +19 -0
  106. package/lib/components/Checklist/Checklist.types.js +27 -0
  107. package/lib/components/Checklist/ChecklistChart.d.ts +6 -2
  108. package/lib/components/Checklist/ChecklistChart.js +17 -36
  109. package/lib/components/Checklist/ChecklistIcon.d.ts +5 -1
  110. package/lib/components/Checklist/ChecklistIcon.js +9 -4
  111. package/lib/components/Coachmark/Coachmark.d.ts +65 -2
  112. package/lib/components/Coachmark/Coachmark.js +6 -9
  113. package/lib/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
  114. package/lib/components/Coachmark/CoachmarkDragbar.js +3 -1
  115. package/lib/components/Coachmark/CoachmarkHeader.d.ts +27 -2
  116. package/lib/components/Coachmark/CoachmarkHeader.js +0 -1
  117. package/lib/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
  118. package/lib/components/Coachmark/CoachmarkOverlay.js +18 -15
  119. package/lib/components/Coachmark/CoachmarkTagline.d.ts +27 -2
  120. package/lib/components/Coachmark/CoachmarkTagline.js +0 -1
  121. package/lib/components/Coachmark/utils/enums.d.ts +20 -20
  122. package/lib/components/Coachmark/utils/enums.js +22 -20
  123. package/lib/components/CoachmarkButton/CoachmarkButton.d.ts +19 -2
  124. package/lib/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
  125. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
  126. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +46 -2
  127. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +5 -4
  128. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
  129. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
  130. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  131. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +13 -23
  132. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
  133. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
  134. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
  135. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
  136. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
  137. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
  138. package/lib/components/CreateInfluencer/CreateInfluencer.d.ts +55 -17
  139. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +67 -2
  140. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +48 -27
  141. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +139 -2
  142. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +59 -38
  143. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +89 -2
  144. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +39 -27
  145. package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
  146. package/lib/components/DataSpreadsheet/types/index.d.ts +30 -0
  147. package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
  148. package/lib/components/GetStartedCard/GetStartedCard.d.ts +5 -0
  149. package/lib/components/GetStartedCard/GetStartedCard.js +88 -0
  150. package/lib/components/GetStartedCard/index.d.ts +1 -0
  151. package/lib/components/Guidebanner/Guidebanner.js +2 -2
  152. package/lib/components/NotificationsPanel/NotificationsPanel.d.ts +162 -1
  153. package/lib/components/NotificationsPanel/NotificationsPanel.js +10 -10
  154. package/lib/components/SearchBar/SearchBar.d.ts +10 -1
  155. package/lib/components/SearchBar/SearchBar.js +26 -18
  156. package/lib/components/SidePanel/SidePanel.js +1 -1
  157. package/lib/components/TagOverflow/TagOverflow.d.ts +5 -0
  158. package/lib/components/TagOverflow/TagOverflow.js +154 -28
  159. package/lib/components/TagOverflow/TagOverflowModal.d.ts +29 -0
  160. package/lib/components/TagOverflow/TagOverflowModal.js +121 -0
  161. package/lib/components/TagOverflow/TagOverflowPopover.d.ts +2 -0
  162. package/lib/components/TagOverflow/TagOverflowPopover.js +144 -0
  163. package/lib/components/TagSet/TagSet.d.ts +87 -3
  164. package/lib/components/TagSet/TagSet.js +20 -9
  165. package/lib/components/TagSet/TagSetModal.d.ts +32 -26
  166. package/lib/components/TagSet/TagSetModal.js +3 -3
  167. package/lib/components/TagSet/TagSetOverflow.d.ts +45 -2
  168. package/lib/components/TagSet/TagSetOverflow.js +14 -12
  169. package/lib/components/WebTerminal/WebTerminal.js +2 -2
  170. package/lib/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
  171. package/lib/components/WebTerminal/hooks/index.d.ts +16 -11
  172. package/lib/components/WebTerminal/hooks/index.js +1 -1
  173. package/lib/components/index.d.ts +1 -0
  174. package/lib/global/js/package-settings.d.ts +2 -1
  175. package/lib/global/js/package-settings.js +2 -1
  176. package/lib/index.js +5 -0
  177. package/lib/node_modules/@carbon/colors/es/index.js +6 -0
  178. package/lib/settings.d.ts +2 -1
  179. package/package.json +3 -3
  180. package/scss/components/Checklist/_carbon-imports.scss +2 -2
  181. package/scss/components/GetStartedCard/_carbon-imports.scss +9 -0
  182. package/scss/components/GetStartedCard/_get-started-card.scss +135 -0
  183. package/scss/components/GetStartedCard/_index-with-carbon.scss +9 -0
  184. package/scss/components/GetStartedCard/_index.scss +8 -0
  185. package/scss/components/TagOverflow/_tag-overflow.scss +157 -0
  186. package/scss/components/_index-released-only-with-carbon.scss +2 -1
  187. package/scss/components/_index-released-only.scss +2 -1
  188. package/scss/components/_index-with-carbon.scss +2 -0
  189. package/scss/components/_index.scss +1 -0
  190. package/telemetry.yml +28 -24
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useState, useEffect } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
@@ -13,7 +13,7 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
13
  import { pkg } from '../../settings.js';
14
14
  import { MultiSelect, Search, Button } from '@carbon/react';
15
15
 
16
- var _excluded = ["className", "clearButtonLabelText", "hideScopesLabel", "labelText", "onChange", "onSubmit", "placeHolderText", "scopes", "scopesTypeLabel", "scopeToString", "selectedScopes", "sortItems", "submitLabel", "translateWithId", "value"];
16
+ var _excluded = ["className", "clearButtonLabelText", "hideScopesLabel", "labelText", "onChange", "onSubmit", "placeholderText", "scopes", "scopesTypeLabel", "scopeToString", "selectedScopes", "sortItems", "submitLabel", "translateWithId", "value"];
17
17
 
18
18
  // The block part of our conventional BEM class names (blockClass__E--M).
19
19
  var blockClass = "".concat(pkg.prefix, "--search-bar");
@@ -39,7 +39,7 @@ var SearchBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
39
39
  onChange = _ref$onChange === void 0 ? defaults.onChange : _ref$onChange,
40
40
  _ref$onSubmit = _ref.onSubmit,
41
41
  onSubmit = _ref$onSubmit === void 0 ? defaults.onSubmit : _ref$onSubmit,
42
- placeHolderText = _ref.placeHolderText,
42
+ placeholderText = _ref.placeholderText,
43
43
  _ref$scopes = _ref.scopes,
44
44
  scopes = _ref$scopes === void 0 ? [] : _ref$scopes,
45
45
  scopesTypeLabel = _ref.scopesTypeLabel,
@@ -113,30 +113,32 @@ var SearchBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
113
113
  setText(value);
114
114
  onChange(eventObject);
115
115
  };
116
+ var multiSelectProps = {
117
+ initialSelectedItems: selectedScopes,
118
+ items: scopes,
119
+ itemToString: scopeToString,
120
+ label: scopesTypeLabel,
121
+ sortItems: sortItems,
122
+ translateWithId: translateWithId
123
+ };
116
124
  return /*#__PURE__*/React__default.createElement("form", _extends({}, rest, {
117
125
  ref: ref
118
126
  }, getDevtoolsProps(componentName), {
119
127
  className: cx(blockClass, className, _defineProperty({}, "".concat(blockClass, "--hide-scopes-label"), hideScopesLabel)),
120
128
  onSubmit: handleSubmit
121
- }), scopes !== null && scopes !== void 0 && scopes.length ? /*#__PURE__*/React__default.createElement(MultiSelect, {
129
+ }), scopes !== null && scopes !== void 0 && scopes.length ? /*#__PURE__*/React__default.createElement(MultiSelect, _extends({}, multiSelectProps, {
122
130
  id: "".concat(blockClass, "__multi-select"),
123
131
  name: "search-scopes",
124
132
  className: "".concat(blockClass, "__scopes"),
125
- label: scopesTypeLabel,
126
133
  onChange: handleSearchScopeChange,
127
- initialSelectedItems: selectedScopes,
128
- items: scopes,
129
- itemToString: scopeToString,
130
- translateWithId: translateWithId,
131
- sortItems: sortItems,
132
134
  size: "lg"
133
- }) : null, /*#__PURE__*/React__default.createElement(Search, {
135
+ })) : null, /*#__PURE__*/React__default.createElement(Search, {
134
136
  className: "".concat(blockClass, "__input"),
135
137
  closeButtonLabelText: clearButtonLabelText,
136
138
  labelText: labelText || '',
137
139
  name: "search-input",
138
140
  onChange: handleInputChange,
139
- placeholder: placeHolderText,
141
+ placeholder: placeholderText,
140
142
  value: text,
141
143
  size: "lg"
142
144
  }), /*#__PURE__*/React__default.createElement(Button, {
@@ -164,11 +166,19 @@ var conditionalScopePropValidator = function conditionalScopePropValidator(props
164
166
  }
165
167
  return PropTypes.string.apply(PropTypes, [props, propName, componentName].concat(rest));
166
168
  };
169
+ var deprecatedProps = {
170
+ /**
171
+ * **Deprecated**
172
+ *
173
+ * Provide accessible label text for the scopes MultiSelect.
174
+ */
175
+ titleText: PropTypes.string
176
+ };
167
177
 
168
178
  // The types and DocGen commentary for the component props,
169
179
  // in alphabetical order (for consistency).
170
180
  // See https://www.npmjs.com/package/prop-types#usage.
171
- SearchBar.propTypes = {
181
+ SearchBar.propTypes = _objectSpread2({
172
182
  /** @type {string} Optional additional class name. */
173
183
  className: PropTypes.string,
174
184
  /** @type {string} The label text for the search text input. */
@@ -184,7 +194,7 @@ SearchBar.propTypes = {
184
194
  /** @type {Function} Function handler for when the user submits a search. */
185
195
  onSubmit: PropTypes.func,
186
196
  /** @type {string} Placeholder text to be displayed in the search input. */
187
- placeHolderText: PropTypes.string.isRequired,
197
+ placeholderText: PropTypes.string.isRequired,
188
198
  /** @type {Function} Function to get the text for each scope to display in dropdown. */
189
199
  scopeToString: PropTypes.func,
190
200
  /** @type {Array<any>} Array of allowed search scopes. */
@@ -206,16 +216,12 @@ SearchBar.propTypes = {
206
216
 
207
217
  /** @type {string} The label text for the search submit button. */
208
218
  submitLabel: PropTypes.string.isRequired,
209
- /**
210
- * Provide accessible label text for the scopes MultiSelect.
211
- */
212
- titleText: PropTypes.string,
213
219
  /** @type {func} Callback function for translating MultiSelect's child ListBoxMenuIcon SVG title. */
214
220
  translateWithId: PropTypes.func,
215
221
  // eslint-disable-line react/require-default-props
216
222
 
217
223
  /** @type {string} Search query value. */
218
224
  value: PropTypes.string
219
- };
225
+ }, deprecatedProps);
220
226
 
221
- export { SearchBar };
227
+ export { SearchBar, deprecatedProps };
@@ -346,7 +346,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
346
346
  });
347
347
  }
348
348
  return /*#__PURE__*/React__default.createElement("div", {
349
- className: cx("".concat(blockClass, "__header"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__header--on-detail-step"), currentStep > 0), "".concat(blockClass, "__header--no-title-animation"), !doAnimateTitle), "".concat(blockClass, "__header--reduced-motion"), reducedMotion.matches), "".concat(blockClass, "__header--has-title"), title)),
349
+ className: cx("".concat(blockClass, "__header"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__header--on-detail-step"), currentStep > 0), "".concat(blockClass, "__header--no-title-animation"), !animateTitle), "".concat(blockClass, "__header--reduced-motion"), reducedMotion.matches), "".concat(blockClass, "__header--has-title"), title)),
350
350
  ref: headerRef
351
351
  }, currentStep > 0 && /*#__PURE__*/React__default.createElement(Button, {
352
352
  "aria-label": navigationBackIconDescription,
@@ -2,4 +2,9 @@
2
2
  * TODO: A description of the component.
3
3
  */
4
4
  export let TagOverflow: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ /**
6
+ * The strings shown in the showAllModal are only shown if we have more than allTagsModalSearchLThreshold
7
+ * @returns null if no problems
8
+ */
9
+ export const string_required_if_more_than_10_tags: (props: any, propName: any, componentName: any, location: any, propFullName: any, secret: any) => any;
5
10
  import React from 'react';
@@ -10,40 +10,67 @@ import React__default, { useRef, useState, useCallback, useEffect } from 'react'
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
12
12
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
+ import { isRequiredIf } from '../../global/js/utils/props-helper.js';
13
14
  import { pkg } from '../../settings.js';
14
15
  import { Tooltip, Tag } from '@carbon/react';
15
16
  import { TYPES } from './constants.js';
16
17
  import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
17
- import { TagSet } from '../TagSet/TagSet.js';
18
+ import { TagOverflowPopover } from './TagOverflowPopover.js';
19
+ import { TagOverflowModal } from './TagOverflowModal.js';
18
20
 
19
- var _excluded = ["className", "items", "tagComponent", "maxVisible", "multiline"],
21
+ var _excluded = ["items", "tagComponent", "align", "showAllTagsLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "className", "containingElementRef", "measurementOffset", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange"],
20
22
  _excluded2 = ["className", "id"];
21
23
  var blockClass = "".concat(pkg.prefix, "--tag-overflow");
22
24
  var componentName = 'TagOverflow';
25
+ var allTagsModalSearchThreshold = 10;
26
+
27
+ // TODO: support prop overflowType
23
28
 
24
29
  // Default values for props
25
30
  var defaults = {
26
- items: []
31
+ items: [],
32
+ align: 'start',
33
+ measurementOffset: 0,
34
+ overflowAlign: 'bottom',
35
+ overflowType: 'default',
36
+ onOverflowTagChange: function onOverflowTagChange() {}
27
37
  };
28
38
 
29
39
  /**
30
40
  * TODO: A description of the component.
31
41
  */
32
42
  var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
33
- var className = _ref.className,
34
- _ref$items = _ref.items,
43
+ var _ref$items = _ref.items,
35
44
  items = _ref$items === void 0 ? defaults.items : _ref$items,
36
45
  tagComponent = _ref.tagComponent,
46
+ _ref$align = _ref.align,
47
+ align = _ref$align === void 0 ? defaults.align : _ref$align,
48
+ showAllTagsLabel = _ref.showAllTagsLabel,
49
+ allTagsModalSearchLabel = _ref.allTagsModalSearchLabel,
50
+ allTagsModalSearchPlaceholderText = _ref.allTagsModalSearchPlaceholderText,
51
+ allTagsModalTarget = _ref.allTagsModalTarget,
52
+ allTagsModalTitle = _ref.allTagsModalTitle,
53
+ className = _ref.className,
54
+ containingElementRef = _ref.containingElementRef,
55
+ _ref$measurementOffse = _ref.measurementOffset,
56
+ measurementOffset = _ref$measurementOffse === void 0 ? defaults.measurementOffset : _ref$measurementOffse,
37
57
  maxVisible = _ref.maxVisible,
38
58
  multiline = _ref.multiline,
59
+ _ref$overflowAlign = _ref.overflowAlign,
60
+ overflowAlign = _ref$overflowAlign === void 0 ? defaults.overflowAlign : _ref$overflowAlign,
61
+ overflowClassName = _ref.overflowClassName,
62
+ _ref$overflowType = _ref.overflowType,
63
+ overflowType = _ref$overflowType === void 0 ? defaults.overflowType : _ref$overflowType,
64
+ _ref$onOverflowTagCha = _ref.onOverflowTagChange,
65
+ onOverflowTagChange = _ref$onOverflowTagCha === void 0 ? defaults.onOverflowTagChange : _ref$onOverflowTagCha,
39
66
  rest = _objectWithoutProperties(_ref, _excluded);
40
67
  var localContainerRef = useRef(null);
41
68
  var containerRef = ref || localContainerRef;
42
69
  var itemRefs = useRef(null);
43
70
  var overflowRef = useRef(null);
44
- // measurementOffset is the value of margin applied on each items
71
+ // itemOffset is the value of margin applied on each items
45
72
  // This value is required for calculating how many items will fit within the container
46
- var measurementOffset = 4;
73
+ var itemOffset = 4;
47
74
  var overflowIndicatorWidth = 40;
48
75
  var _useState = useState(0),
49
76
  _useState2 = _slicedToArray(_useState, 2),
@@ -57,10 +84,25 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
57
84
  _useState6 = _slicedToArray(_useState5, 2),
58
85
  overflowItems = _useState6[0],
59
86
  setOverflowItems = _useState6[1];
87
+ var _useState7 = useState(false),
88
+ _useState8 = _slicedToArray(_useState7, 2),
89
+ showAllModalOpen = _useState8[0],
90
+ setShowAllModalOpen = _useState8[1];
91
+ var _useState9 = useState(false),
92
+ _useState10 = _slicedToArray(_useState9, 2),
93
+ popoverOpen = _useState10[0],
94
+ setPopoverOpen = _useState10[1];
95
+ var resizeElm = containingElementRef && containingElementRef.current ? containingElementRef : containerRef;
96
+ var handleShowAllClick = function handleShowAllClick() {
97
+ setShowAllModalOpen(true);
98
+ };
99
+ var handleModalClose = function handleModalClose() {
100
+ setShowAllModalOpen(false);
101
+ };
60
102
  var handleResize = function handleResize() {
61
- setContainerWidth(containerRef.current.offsetWidth);
103
+ setContainerWidth(resizeElm.current.offsetWidth);
62
104
  };
63
- useResizeObserver(containerRef, handleResize);
105
+ useResizeObserver(resizeElm, handleResize);
64
106
  var getMap = function getMap() {
65
107
  if (!itemRefs.current) {
66
108
  itemRefs.current = new Map();
@@ -74,6 +116,7 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
74
116
  }
75
117
  };
76
118
  var getVisibleItems = useCallback(function () {
119
+ var _overflowRef$current;
77
120
  if (!itemRefs.current) {
78
121
  return items;
79
122
  }
@@ -82,13 +125,16 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
82
125
  return _visibleItems;
83
126
  }
84
127
  var map = getMap();
85
- var overflowContainerWidth = overflowRef.current.offsetWidth > overflowIndicatorWidth ? overflowRef.current.offsetWidth : overflowIndicatorWidth;
86
- var maxWidth = containerWidth - overflowContainerWidth;
128
+ var optionalContainingElement = containingElementRef === null || containingElementRef === void 0 ? void 0 : containingElementRef.current;
129
+ var measurementOffsetValue = typeof measurementOffset === 'number' ? measurementOffset : 0;
130
+ var spaceAvailable = optionalContainingElement ? optionalContainingElement.offsetWidth - measurementOffsetValue : containerWidth;
131
+ var overflowContainerWidth = ((_overflowRef$current = overflowRef.current) === null || _overflowRef$current === void 0 ? void 0 : _overflowRef$current.offsetWidth) > overflowIndicatorWidth ? overflowRef.current.offsetWidth : overflowIndicatorWidth;
132
+ var maxWidth = spaceAvailable - overflowContainerWidth;
87
133
  var childrenWidth = 0;
88
134
  var maxReached = false;
89
135
  return items.reduce(function (prev, cur) {
90
136
  if (!maxReached) {
91
- var itemWidth = map.get(cur.id) + measurementOffset;
137
+ var itemWidth = map.get(cur.id) + itemOffset;
92
138
  var fits = itemWidth + childrenWidth < maxWidth;
93
139
  if (fits) {
94
140
  childrenWidth += itemWidth;
@@ -99,7 +145,7 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
99
145
  }
100
146
  return prev;
101
147
  }, []);
102
- }, [itemRefs, overflowRef, containerWidth, items, multiline, maxVisible]);
148
+ }, [itemRefs, overflowRef, containerWidth, items, multiline, maxVisible, containingElementRef, measurementOffset]);
103
149
  var getCustomComponent = function getCustomComponent(item) {
104
150
  var className = item.className,
105
151
  id = item.id,
@@ -121,14 +167,16 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
121
167
  var overflowItemsArr = hiddenItems === null || hiddenItems === void 0 ? void 0 : hiddenItems.map(function (item) {
122
168
  return {
123
169
  type: item.tagType,
124
- label: item.label
170
+ label: item.label,
171
+ id: item.id
125
172
  };
126
173
  });
127
174
  setVisibleItems(visibleItemsArr);
128
175
  setOverflowItems(overflowItemsArr);
129
- }, [containerWidth, items, maxVisible, getVisibleItems]);
176
+ onOverflowTagChange === null || onOverflowTagChange === void 0 || onOverflowTagChange(overflowItemsArr);
177
+ }, [containerWidth, items, maxVisible, getVisibleItems, onOverflowTagChange]);
130
178
  return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
131
- className: cx(blockClass, className, _defineProperty({}, "".concat(blockClass, "--multiline"), multiline)),
179
+ className: cx(blockClass, className, "".concat(blockClass, "--align-").concat(align), _defineProperty({}, "".concat(blockClass, "--multiline"), multiline)),
132
180
  ref: containerRef,
133
181
  role: "main"
134
182
  }, getDevtoolsProps(componentName)), visibleItems.length > 0 && visibleItems.map(function (item) {
@@ -153,14 +201,27 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
153
201
  }), /*#__PURE__*/React__default.createElement("span", {
154
202
  className: "".concat(blockClass, "__indicator"),
155
203
  ref: overflowRef
156
- }, overflowItems.length > 0 && /*#__PURE__*/React__default.createElement(TagSet, {
157
- tags: overflowItems,
158
- allTagsModalTitle: "All tags",
159
- containingElementRef: overflowRef,
160
- allTagsModalSearchLabel: "Search all tags",
161
- allTagsModalSearchPlaceholderText: "Search all tags",
162
- showAllTagsLabel: "Show all tags"
163
- })));
204
+ }, overflowItems.length > 0 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TagOverflowPopover, {
205
+ allTagsModalSearchThreshold: allTagsModalSearchThreshold,
206
+ className: overflowClassName,
207
+ onShowAllClick: handleShowAllClick,
208
+ overflowTags: overflowItems,
209
+ overflowAlign: overflowAlign,
210
+ overflowType: overflowType,
211
+ showAllTagsLabel: showAllTagsLabel,
212
+ key: "tag-overflow-popover",
213
+ ref: overflowRef,
214
+ popoverOpen: popoverOpen,
215
+ setPopoverOpen: setPopoverOpen
216
+ }), /*#__PURE__*/React__default.createElement(TagOverflowModal, {
217
+ allTags: items,
218
+ open: showAllModalOpen,
219
+ title: allTagsModalTitle,
220
+ onClose: handleModalClose,
221
+ searchLabel: allTagsModalSearchLabel,
222
+ searchPlaceholder: allTagsModalSearchPlaceholderText,
223
+ portalTarget: allTagsModalTarget
224
+ }))));
164
225
  });
165
226
 
166
227
  // Return a placeholder if not released and not enabled by feature flag
@@ -171,20 +232,56 @@ TagOverflow = pkg.checkComponentEnabled(TagOverflow, componentName);
171
232
  TagOverflow.displayName = componentName;
172
233
  var tagTypes = Object.keys(TYPES);
173
234
 
235
+ /**
236
+ * The strings shown in the showAllModal are only shown if we have more than allTagsModalSearchLThreshold
237
+ * @returns null if no problems
238
+ */
239
+ var string_required_if_more_than_10_tags = isRequiredIf(PropTypes.string, function (_ref2) {
240
+ var items = _ref2.items;
241
+ return items && items.length > allTagsModalSearchThreshold;
242
+ });
243
+
174
244
  // The types and DocGen commentary for the component props,
175
245
  // in alphabetical order (for consistency).
176
246
  // See https://www.npmjs.com/package/prop-types#usage.
177
247
  TagOverflow.propTypes = {
248
+ /**
249
+ * align the Tags displayed by the TagSet. Default start.
250
+ */
251
+ align: PropTypes.oneOf(['start', 'center', 'end']),
252
+ /**
253
+ * label text for the show all search. **Note: Required if more than 10 tags**
254
+ */
255
+ allTagsModalSearchLabel: string_required_if_more_than_10_tags,
256
+ /**
257
+ * placeholder text for the show all search. **Note: Required if more than 10 tags**
258
+ */
259
+ allTagsModalSearchPlaceholderText: string_required_if_more_than_10_tags,
260
+ /**
261
+ * portal target for the all tags modal
262
+ */
263
+ allTagsModalTarget: PropTypes.node,
264
+ /**
265
+ * title for the show all modal. **Note: Required if more than 10 tags**
266
+ */
267
+ allTagsModalTitle: string_required_if_more_than_10_tags,
178
268
  /**
179
269
  * Provide an optional class to be applied to the containing node.
180
270
  */
181
271
  className: PropTypes.string,
272
+ /**
273
+ * Optional ref for custom resize container to measure available space
274
+ * Default will measure the available space of the TagSet container itself.
275
+ */
276
+ containingElementRef: PropTypes.object,
182
277
  /**
183
278
  * The items to be shown in the TagOverflow. Each item is specified as an object with properties:
184
- * **label**\* (required) to supply the item content,
185
- * **id**\* (required) to uniquely identify the each item.
186
- * **tagType** the type value to be passed to the Carbon Tag component
187
- * if you are passing an tagComponent prop for rendering custom components,
279
+ * **label**\* (required) to supply the content,
280
+ * **id**\* (required) to uniquely identify each item.
281
+ * **tagType** the type value to be passed to the Carbon Tag component.
282
+ * Refer https://react.carbondesignsystem.com/?path=/docs/components-tag--default to see the possible values for tagType
283
+ *
284
+ * If you want to render a custom component, pass it as tagComponent prop and
188
285
  * then pass the props required for your custom component as the properties of item object
189
286
  */
190
287
  items: PropTypes.arrayOf(PropTypes.shape({
@@ -196,14 +293,41 @@ TagOverflow.propTypes = {
196
293
  * maximum visible items
197
294
  */
198
295
  maxVisible: PropTypes.number,
296
+ /**
297
+ * Specify offset amount for measure available space, only used when `containingElementSelector`
298
+ * is also provided
299
+ */
300
+ measurementOffset: PropTypes.number,
199
301
  /**
200
302
  * display items in multiple lines
201
303
  */
202
304
  multiline: PropTypes.bool,
305
+ /**
306
+ * Handler to get overflow tags
307
+ */
308
+ onOverflowTagChange: PropTypes.func,
309
+ /**
310
+ * overflowAlign from the standard tooltip. Default center.
311
+ */
312
+ overflowAlign: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top']),
313
+ /**
314
+ * overflowClassName for the tooltip popup
315
+ */
316
+ overflowClassName: PropTypes.string,
317
+ /**
318
+ * Type of rendering displayed inside of the tag overflow component
319
+ */
320
+ overflowType: PropTypes.oneOf(['default', 'tag']),
321
+ /**
322
+ * label for the overflow show all tags link.
323
+ *
324
+ * **Note:** Required if more than 10 tags
325
+ */
326
+ showAllTagsLabel: string_required_if_more_than_10_tags,
203
327
  /** Component definition of the items to be rendered inside TagOverflow.
204
328
  * If this is not passed, items will be rendered as Tag component
205
329
  */
206
330
  tagComponent: PropTypes.elementType
207
331
  };
208
332
 
209
- export { TagOverflow };
333
+ export { TagOverflow, string_required_if_more_than_10_tags };
@@ -0,0 +1,29 @@
1
+ export function TagOverflowModal({ allTags, className, title, onClose, open, portalTarget: portalTargetIn, searchLabel, searchPlaceholder, ...rest }: {
2
+ [x: string]: any;
3
+ allTags: any;
4
+ className: any;
5
+ title: any;
6
+ onClose: any;
7
+ open: any;
8
+ portalTarget: any;
9
+ searchLabel?: string | undefined;
10
+ searchPlaceholder: any;
11
+ }): any;
12
+ export namespace TagOverflowModal {
13
+ export namespace propTypes {
14
+ let allTags: PropTypes.Requireable<(PropTypes.InferProps<{
15
+ label: PropTypes.Validator<string>;
16
+ }> | null | undefined)[]>;
17
+ let className: PropTypes.Requireable<string>;
18
+ let onClose: PropTypes.Requireable<(...args: any[]) => any>;
19
+ let open: PropTypes.Requireable<boolean>;
20
+ let portalTarget: PropTypes.Requireable<PropTypes.ReactNodeLike>;
21
+ let searchLabel: PropTypes.Requireable<string>;
22
+ let searchPlaceholder: PropTypes.Requireable<string>;
23
+ let title: PropTypes.Requireable<string>;
24
+ }
25
+ export { componentName as displayName };
26
+ }
27
+ import PropTypes from 'prop-types';
28
+ declare const componentName: "TagOverflowModal";
29
+ export {};
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useState } from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import { ComposedModal, ModalHeader, Search, ModalBody, Tag } from '@carbon/react';
13
+ import { pkg } from '../../settings.js';
14
+ import { prepareProps } from '../../global/js/utils/props-helper.js';
15
+ import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
16
+
17
+ var _excluded = ["allTags", "className", "title", "onClose", "open", "portalTarget", "searchLabel", "searchPlaceholder"],
18
+ _excluded2 = ["label", "id"];
19
+ var componentName = 'TagOverflowModal';
20
+ var blockClass = "".concat(pkg.prefix, "--tag-overflow-modal");
21
+
22
+ // Default values for props
23
+ var defaults = {
24
+ // marked as required by TagSet if needed, default used to satisfy <Search /> component
25
+ searchLabel: ''
26
+ };
27
+ var TagOverflowModal = function TagOverflowModal(_ref) {
28
+ var allTags = _ref.allTags,
29
+ className = _ref.className,
30
+ title = _ref.title,
31
+ onClose = _ref.onClose,
32
+ open = _ref.open,
33
+ portalTargetIn = _ref.portalTarget,
34
+ _ref$searchLabel = _ref.searchLabel,
35
+ searchLabel = _ref$searchLabel === void 0 ? defaults.searchLabel : _ref$searchLabel,
36
+ searchPlaceholder = _ref.searchPlaceholder,
37
+ rest = _objectWithoutProperties(_ref, _excluded);
38
+ var _useState = useState(''),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ search = _useState2[0],
41
+ setSearch = _useState2[1];
42
+ var renderPortalUse = usePortalTarget(portalTargetIn);
43
+ var getFilteredItems = function getFilteredItems() {
44
+ var newFilteredModalTags = [];
45
+ if (open) {
46
+ if (search === '') {
47
+ newFilteredModalTags = allTags.slice(0);
48
+ } else {
49
+ var lCaseSearch = search.toLocaleLowerCase();
50
+ allTags.forEach(function (tag) {
51
+ var _tag$dataSearch, _tag$label;
52
+ var dataSearch = (_tag$dataSearch = tag['data-search']) === null || _tag$dataSearch === void 0 || (_tag$dataSearch = _tag$dataSearch.toLocaleLowerCase()) === null || _tag$dataSearch === void 0 ? void 0 : _tag$dataSearch.indexOf(lCaseSearch);
53
+ var labelSearch = (_tag$label = tag.label) === null || _tag$label === void 0 || (_tag$label = _tag$label.toLocaleLowerCase()) === null || _tag$label === void 0 ? void 0 : _tag$label.indexOf(lCaseSearch);
54
+ if (dataSearch > -1 || labelSearch > -1) {
55
+ newFilteredModalTags.push(tag);
56
+ }
57
+ });
58
+ }
59
+ }
60
+ return newFilteredModalTags;
61
+ };
62
+ var handleSearch = function handleSearch(evt) {
63
+ setSearch(evt.target.value || '');
64
+ };
65
+ return renderPortalUse( /*#__PURE__*/React__default.createElement(ComposedModal, _extends({}, rest, {
66
+ containerClassName: "".concat(blockClass, "__container"),
67
+ className: cx(className, blockClass),
68
+ size: "sm",
69
+ "aria-label": "Search all",
70
+ open: open,
71
+ onClose: onClose
72
+ }), /*#__PURE__*/React__default.createElement(ModalHeader, {
73
+ className: "".concat(blockClass, "__header"),
74
+ closeModal: onClose,
75
+ title: title
76
+ }, /*#__PURE__*/React__default.createElement(Search, {
77
+ "data-modal-primary-focus": true,
78
+ className: "".concat(blockClass, "__search"),
79
+ labelText: searchLabel,
80
+ placeholder: searchPlaceholder,
81
+ onChange: handleSearch,
82
+ size: "lg"
83
+ })), /*#__PURE__*/React__default.createElement(ModalBody, {
84
+ className: "".concat(blockClass, "__body"),
85
+ hasForm: true
86
+ }, getFilteredItems().map(function (_ref2) {
87
+ var label = _ref2.label,
88
+ id = _ref2.id,
89
+ other = _objectWithoutProperties(_ref2, _excluded2);
90
+ return /*#__PURE__*/React__default.createElement(Tag, _extends({}, other, {
91
+ filter: false,
92
+ key: id
93
+ }), label);
94
+ })), /*#__PURE__*/React__default.createElement("div", {
95
+ className: "".concat(blockClass, "__fade")
96
+ })));
97
+ };
98
+ TagOverflowModal.propTypes = {
99
+ allTags: PropTypes.arrayOf(PropTypes.shape(_objectSpread2(_objectSpread2({}, prepareProps(Tag.propTypes, 'filter')), {}, {
100
+ label: PropTypes.string.isRequired
101
+ }))),
102
+ className: PropTypes.string,
103
+ onClose: PropTypes.func,
104
+ open: PropTypes.bool,
105
+ portalTarget: PropTypes.node,
106
+ searchLabel: PropTypes.string,
107
+ searchPlaceholder: PropTypes.string,
108
+ title: PropTypes.string
109
+ };
110
+ TagOverflowModal.displayName = componentName;
111
+
112
+ export { TagOverflowModal };
@@ -0,0 +1,2 @@
1
+ export const TagOverflowPopover: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
+ import React from 'react';