@carbon/ibm-products 2.34.0 → 2.36.0-alpha.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (244) hide show
  1. package/css/index-full-carbon.css +32448 -32421
  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 +105 -91
  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 +765 -24496
  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 +2543 -18127
  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.d.ts +38 -2
  18. package/es/components/ActionSet/ActionSet.js +3 -5
  19. package/es/components/Coachmark/utils/enums.d.ts +36 -22
  20. package/es/components/CoachmarkBeacon/CoachmarkBeacon.d.ts +26 -2
  21. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -3
  22. package/es/components/CoachmarkFixed/CoachmarkFixed.js +1 -1
  23. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.d.ts +28 -2
  24. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -1
  25. package/es/components/ConditionBuilder/ConditionBuilder.d.ts +5 -0
  26. package/es/components/ConditionBuilder/ConditionBuilder.js +125 -0
  27. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +10 -0
  28. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +92 -0
  29. package/es/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.d.ts +38 -0
  30. package/es/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.js +88 -0
  31. package/es/components/ConditionBuilder/assets/sampleInput.d.ts +58 -0
  32. package/es/components/ConditionBuilder/index.d.ts +1 -0
  33. package/es/components/CreateFullPage/CreateFullPage.d.ts +121 -4
  34. package/es/components/CreateFullPage/CreateFullPage.js +14 -26
  35. package/es/components/CreateFullPage/CreateFullPageStep.js +22 -7
  36. package/es/components/CreateTearsheet/CreateTearsheet.js +2 -0
  37. package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
  38. package/es/components/Datagrid/Datagrid/DatagridRow.js +4 -3
  39. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -1
  40. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +10 -6
  41. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -2
  42. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +2 -1
  43. package/es/components/Datagrid/useEditableCell.js +15 -0
  44. package/es/components/DelimitedList/DelimitedList.d.ts +27 -2
  45. package/es/components/DelimitedList/DelimitedList.js +0 -1
  46. package/es/components/EditFullPage/EditFullPage.d.ts +19 -2
  47. package/es/components/EditFullPage/EditFullPage.js +3 -3
  48. package/es/components/EditInPlace/EditInPlace.d.ts +97 -5
  49. package/es/components/EditInPlace/EditInPlace.js +10 -6
  50. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +61 -2
  51. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -3
  52. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +61 -2
  53. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -2
  54. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +61 -2
  55. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -3
  56. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +61 -2
  57. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -3
  58. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +61 -2
  59. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -2
  60. package/es/components/ExportModal/ExportModal.d.ts +110 -2
  61. package/es/components/ExportModal/ExportModal.js +10 -4
  62. package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +1 -1
  63. package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +2 -2
  64. package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
  65. package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +5 -9
  66. package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +1 -1
  67. package/es/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.d.ts +5 -0
  68. package/es/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.js +92 -0
  69. package/es/components/FilterPanel/index.d.ts +1 -0
  70. package/es/components/FullPageError/FullPageError.d.ts +2 -1
  71. package/es/components/FullPageError/FullPageError.js +24 -49
  72. package/es/components/HTTPErrors/HTTPError403/HTTPError403.d.ts +40 -2
  73. package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
  74. package/es/components/HTTPErrors/HTTPError404/HTTPError404.d.ts +40 -2
  75. package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
  76. package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.d.ts +40 -2
  77. package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +1 -1
  78. package/es/components/ImportModal/ImportModal.d.ts +136 -2
  79. package/es/components/ImportModal/ImportModal.js +3 -2
  80. package/es/components/InlineTip/InlineTip.d.ts +90 -2
  81. package/es/components/InlineTip/InlineTip.js +3 -2
  82. package/es/components/InlineTip/InlineTipLink.d.ts +19 -2
  83. package/es/components/InterstitialScreenView/InterstitialScreenView.d.ts +23 -2
  84. package/es/components/InterstitialScreenView/InterstitialScreenView.js +0 -1
  85. package/es/components/InterstitialScreenViewModule/InterstitialScreenViewModule.d.ts +23 -2
  86. package/es/components/Nav/Nav.js +1 -1
  87. package/es/components/Nav/NavList.js +7 -7
  88. package/es/components/NonLinearReading/NonLinearReading.d.ts +28 -2
  89. package/es/components/NonLinearReading/NonLinearReading.js +2 -7
  90. package/es/components/NotificationsPanel/NotificationsPanel.js +1 -1
  91. package/es/components/PageHeader/PageHeader.js +3 -3
  92. package/es/components/PageHeader/PageHeaderUtils.d.ts +1 -1
  93. package/es/components/PageHeader/PageHeaderUtils.js +4 -3
  94. package/es/components/SearchBar/SearchBar.d.ts +51 -3
  95. package/es/components/SearchBar/SearchBar.js +5 -6
  96. package/es/components/SidePanel/SidePanel.js +62 -41
  97. package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +23 -2
  98. package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +6 -5
  99. package/es/components/TagOverflow/TagOverflow.d.ts +5 -0
  100. package/es/components/TagOverflow/TagOverflow.js +209 -0
  101. package/es/components/TagOverflow/constants.d.ts +14 -0
  102. package/es/components/TagOverflow/constants.js +30 -0
  103. package/es/components/TagOverflow/index.d.ts +1 -0
  104. package/es/components/Tearsheet/TearsheetNarrow.d.ts +105 -6
  105. package/es/components/Tearsheet/TearsheetNarrow.js +6 -1
  106. package/es/components/Toolbar/Toolbar.d.ts +23 -5
  107. package/es/components/Toolbar/Toolbar.js +30 -26
  108. package/es/components/TruncatedList/TruncatedList.d.ts +47 -2
  109. package/es/components/TruncatedList/TruncatedList.js +5 -4
  110. package/es/components/UserAvatar/UserAvatar.js +4 -2
  111. package/es/components/index.d.ts +4 -2
  112. package/es/global/js/package-settings.d.ts +3 -0
  113. package/es/global/js/package-settings.js +3 -0
  114. package/es/index.js +4 -0
  115. package/es/settings.d.ts +3 -0
  116. package/lib/components/ActionSet/ActionSet.d.ts +38 -2
  117. package/lib/components/ActionSet/ActionSet.js +3 -5
  118. package/lib/components/Coachmark/utils/enums.d.ts +36 -22
  119. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.d.ts +26 -2
  120. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -3
  121. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +1 -1
  122. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.d.ts +28 -2
  123. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -1
  124. package/lib/components/ConditionBuilder/ConditionBuilder.d.ts +5 -0
  125. package/lib/components/ConditionBuilder/ConditionBuilder.js +132 -0
  126. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +10 -0
  127. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +100 -0
  128. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.d.ts +38 -0
  129. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.js +98 -0
  130. package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +58 -0
  131. package/lib/components/ConditionBuilder/index.d.ts +1 -0
  132. package/lib/components/CreateFullPage/CreateFullPage.d.ts +121 -4
  133. package/lib/components/CreateFullPage/CreateFullPage.js +13 -25
  134. package/lib/components/CreateFullPage/CreateFullPageStep.js +20 -5
  135. package/lib/components/CreateTearsheet/CreateTearsheet.js +2 -0
  136. package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
  137. package/lib/components/Datagrid/Datagrid/DatagridRow.js +4 -3
  138. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -1
  139. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +11 -7
  140. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -2
  141. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +2 -1
  142. package/lib/components/Datagrid/useEditableCell.js +19 -0
  143. package/lib/components/DelimitedList/DelimitedList.d.ts +27 -2
  144. package/lib/components/DelimitedList/DelimitedList.js +0 -1
  145. package/lib/components/EditFullPage/EditFullPage.d.ts +19 -2
  146. package/lib/components/EditFullPage/EditFullPage.js +3 -3
  147. package/lib/components/EditInPlace/EditInPlace.d.ts +97 -5
  148. package/lib/components/EditInPlace/EditInPlace.js +10 -6
  149. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +61 -2
  150. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -3
  151. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +61 -2
  152. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -2
  153. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +61 -2
  154. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -3
  155. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +61 -2
  156. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -3
  157. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +61 -2
  158. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -2
  159. package/lib/components/ExportModal/ExportModal.d.ts +110 -2
  160. package/lib/components/ExportModal/ExportModal.js +10 -4
  161. package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +1 -1
  162. package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +2 -2
  163. package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
  164. package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +5 -9
  165. package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +1 -1
  166. package/lib/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.d.ts +5 -0
  167. package/lib/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.js +99 -0
  168. package/lib/components/FilterPanel/index.d.ts +1 -0
  169. package/lib/components/FullPageError/FullPageError.d.ts +2 -1
  170. package/lib/components/FullPageError/FullPageError.js +24 -49
  171. package/lib/components/HTTPErrors/HTTPError403/HTTPError403.d.ts +40 -2
  172. package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
  173. package/lib/components/HTTPErrors/HTTPError404/HTTPError404.d.ts +40 -2
  174. package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
  175. package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.d.ts +40 -2
  176. package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +1 -1
  177. package/lib/components/ImportModal/ImportModal.d.ts +136 -2
  178. package/lib/components/ImportModal/ImportModal.js +3 -2
  179. package/lib/components/InlineTip/InlineTip.d.ts +90 -2
  180. package/lib/components/InlineTip/InlineTip.js +3 -2
  181. package/lib/components/InlineTip/InlineTipLink.d.ts +19 -2
  182. package/lib/components/InterstitialScreenView/InterstitialScreenView.d.ts +23 -2
  183. package/lib/components/InterstitialScreenView/InterstitialScreenView.js +0 -1
  184. package/lib/components/InterstitialScreenViewModule/InterstitialScreenViewModule.d.ts +23 -2
  185. package/lib/components/Nav/Nav.js +1 -1
  186. package/lib/components/Nav/NavList.js +7 -7
  187. package/lib/components/NonLinearReading/NonLinearReading.d.ts +28 -2
  188. package/lib/components/NonLinearReading/NonLinearReading.js +2 -7
  189. package/lib/components/NotificationsPanel/NotificationsPanel.js +1 -1
  190. package/lib/components/PageHeader/PageHeader.js +3 -3
  191. package/lib/components/PageHeader/PageHeaderUtils.d.ts +1 -1
  192. package/lib/components/PageHeader/PageHeaderUtils.js +4 -3
  193. package/lib/components/SearchBar/SearchBar.d.ts +51 -3
  194. package/lib/components/SearchBar/SearchBar.js +5 -6
  195. package/lib/components/SidePanel/SidePanel.js +62 -41
  196. package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +23 -2
  197. package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +6 -5
  198. package/lib/components/TagOverflow/TagOverflow.d.ts +5 -0
  199. package/lib/components/TagOverflow/TagOverflow.js +216 -0
  200. package/lib/components/TagOverflow/constants.d.ts +14 -0
  201. package/lib/components/TagOverflow/constants.js +34 -0
  202. package/lib/components/TagOverflow/index.d.ts +1 -0
  203. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +105 -6
  204. package/lib/components/Tearsheet/TearsheetNarrow.js +6 -1
  205. package/lib/components/Toolbar/Toolbar.d.ts +23 -5
  206. package/lib/components/Toolbar/Toolbar.js +30 -26
  207. package/lib/components/TruncatedList/TruncatedList.d.ts +47 -2
  208. package/lib/components/TruncatedList/TruncatedList.js +5 -4
  209. package/lib/components/UserAvatar/UserAvatar.js +4 -2
  210. package/lib/components/index.d.ts +4 -2
  211. package/lib/global/js/package-settings.d.ts +3 -0
  212. package/lib/global/js/package-settings.js +3 -0
  213. package/lib/index.js +17 -0
  214. package/lib/settings.d.ts +3 -0
  215. package/package.json +5 -5
  216. package/scss/components/Coachmark/_coachmark-dragbar.scss +0 -1
  217. package/scss/components/Coachmark/_coachmark-tagline.scss +2 -2
  218. package/scss/components/ConditionBuilder/_carbon-imports.scss +9 -0
  219. package/scss/components/ConditionBuilder/_condition-builder.scss +25 -0
  220. package/scss/components/ConditionBuilder/_index-with-carbon.scss +9 -0
  221. package/scss/components/ConditionBuilder/_index.scss +8 -0
  222. package/scss/components/CreateFullPage/_create-full-page.scss +10 -10
  223. package/scss/components/Datagrid/styles/_useNestedRows.scss +5 -1
  224. package/scss/components/Datagrid/styles/_useSortableColumns.scss +2 -0
  225. package/scss/components/FilterPanel/_carbon-imports.scss +5 -0
  226. package/scss/components/FilterPanel/_filter-panel-accordion-item.scss +1 -3
  227. package/scss/components/FilterPanel/_filter-panel-checkbox-with-overflow.scss +0 -2
  228. package/scss/components/FilterPanel/_filter-panel-checkbox.scss +0 -1
  229. package/scss/components/FilterPanel/_filter-panel-search.scss +38 -0
  230. package/scss/components/FilterPanel/_index-with-carbon.scss +1 -0
  231. package/scss/components/FilterPanel/_index.scss +1 -0
  232. package/scss/components/FullPageError/_full-page-error.scss +10 -10
  233. package/scss/components/Guidebanner/_guidebanner.scss +1 -1
  234. package/scss/components/InlineTip/_inline-tip.scss +1 -1
  235. package/scss/components/ProductiveCard/_productive-card.scss +13 -0
  236. package/scss/components/SidePanel/_side-panel.scss +9 -9
  237. package/scss/components/TagOverflow/_carbon-imports.scss +9 -0
  238. package/scss/components/TagOverflow/_index-with-carbon.scss +9 -0
  239. package/scss/components/TagOverflow/_index.scss +8 -0
  240. package/scss/components/TagOverflow/_tag-overflow.scss +55 -0
  241. package/scss/components/Tearsheet/_tearsheet.scss +10 -0
  242. package/scss/components/UserAvatar/_user-avatar.scss +7 -3
  243. package/scss/components/_index-with-carbon.scss +2 -0
  244. package/scss/components/_index.scss +2 -0
@@ -14,7 +14,6 @@ var React = require('react');
14
14
  var framerMotion = require('framer-motion');
15
15
  var index = require('../../node_modules/prop-types/index.js');
16
16
  var cx = require('classnames');
17
- var useResizeObserver = require('../../global/js/hooks/useResizeObserver.js');
18
17
  var carbonMotion = require('@carbon/motion');
19
18
  var devtools = require('../../global/js/utils/devtools.js');
20
19
  var propsHelper = require('../../global/js/utils/props-helper.js');
@@ -34,7 +33,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
34
33
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
35
34
 
36
35
  var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "id", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "slug", "subtitle", "title"],
37
- _excluded2 = ["label", "kind", "icon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
36
+ _excluded2 = ["label", "kind", "hasIconOnly", "icon", "renderIcon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
38
37
  var blockClass = "".concat(settings.pkg.prefix, "--side-panel");
39
38
  var componentName = 'SidePanel';
40
39
  // `any` is a work around until ActionSet is migrated to TS
@@ -119,14 +118,48 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
119
118
  keyDownListener = _useFocus.keyDownListener;
120
119
  var panelRefValue = sidePanelRef.current;
121
120
  var shouldReduceMotion = framerMotion.useReducedMotion();
121
+
122
+ // Title animation on scroll related state
123
+ var _useState7 = React.useState(0),
124
+ _useState8 = _rollupPluginBabelHelpers.slicedToArray(_useState7, 2),
125
+ labelTextHeight = _useState8[0],
126
+ setLabelTextHeight = _useState8[1];
127
+ React.useEffect(function () {
128
+ if (open && !(titleRef !== null && titleRef !== void 0 && titleRef.current)) {
129
+ setDoAnimateTitle(false);
130
+ } else {
131
+ setDoAnimateTitle(animateTitle);
132
+ }
133
+ }, [animateTitle, open]);
134
+ var titleItemsStyles = React.useCallback(function (progress) {
135
+ if (subtitleRef !== null && subtitleRef !== void 0 && subtitleRef.current) {
136
+ var _subtitleEl$style;
137
+ var subtitleEl = subtitleRef === null || subtitleRef === void 0 ? void 0 : subtitleRef.current;
138
+ var height = subtitleEl === null || subtitleEl === void 0 ? void 0 : subtitleEl.clientHeight;
139
+ var calculatedMargin = height * progress;
140
+ subtitleEl === null || subtitleEl === void 0 || (_subtitleEl$style = subtitleEl.style) === null || _subtitleEl$style === void 0 || _subtitleEl$style.setProperty('margin-top', "".concat(-calculatedMargin, "px"));
141
+ }
142
+ if (labelTextRef !== null && labelTextRef !== void 0 && labelTextRef.current) {
143
+ var _labelTextRef$current;
144
+ var _calculatedMargin = labelTextHeight * progress;
145
+ labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current = labelTextRef.current) === null || _labelTextRef$current === void 0 || (_labelTextRef$current = _labelTextRef$current.style) === null || _labelTextRef$current === void 0 || _labelTextRef$current.setProperty('margin-top', "".concat(-_calculatedMargin, "px"));
146
+ }
147
+ }, [labelTextHeight]);
122
148
  React.useEffect(function () {
123
- setDoAnimateTitle(animateTitle);
124
- }, [animateTitle]);
149
+ if (open && animateTitle && labelTextRef !== null && labelTextRef !== void 0 && labelTextRef.current) {
150
+ var _labelTextRef$current2;
151
+ setLabelTextHeight(Number((labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current2 = labelTextRef.current) === null || _labelTextRef$current2 === void 0 ? void 0 : _labelTextRef$current2.clientHeight) || null));
152
+ }
153
+ }, [animateTitle, labelTextRef, open]);
125
154
  var handleScroll = React.useCallback(function () {
126
- var _animatedScrollRef$cu;
127
- var scrollTop = animatedScrollRef === null || animatedScrollRef === void 0 || (_animatedScrollRef$cu = animatedScrollRef.current) === null || _animatedScrollRef$cu === void 0 ? void 0 : _animatedScrollRef$cu.scrollTop;
128
- panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), (Math.min(Number(scrollTop), scrollAnimationDistance) / scrollAnimationDistance).toString());
129
- }, [scrollAnimationDistance, panelRefValue]);
155
+ if (doAnimateTitle && innerContentRef !== null && innerContentRef !== void 0 && innerContentRef.current) {
156
+ var _innerContentRef$curr;
157
+ var scrollTop = innerContentRef === null || innerContentRef === void 0 || (_innerContentRef$curr = innerContentRef.current) === null || _innerContentRef$curr === void 0 ? void 0 : _innerContentRef$curr.scrollTop;
158
+ var animationProgress = Math.min(Number(scrollTop), scrollAnimationDistance) / scrollAnimationDistance;
159
+ panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), animationProgress.toString());
160
+ titleItemsStyles(animationProgress);
161
+ }
162
+ }, [doAnimateTitle, panelRefValue === null || panelRefValue === void 0 ? void 0 : panelRefValue.style, scrollAnimationDistance, titleItemsStyles]);
130
163
  var reducedMotion = typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
131
164
  matches: true
132
165
  };
@@ -134,8 +167,8 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
134
167
  // scroll panel to top going between steps
135
168
  React.useEffect(function () {
136
169
  if (sidePanelRef && panelRefValue) {
137
- var _animatedScrollRef$cu2;
138
- var scrollableSection = (_animatedScrollRef$cu2 = animatedScrollRef.current) !== null && _animatedScrollRef$cu2 !== void 0 ? _animatedScrollRef$cu2 : innerContentRef.current;
170
+ var _animatedScrollRef$cu;
171
+ var scrollableSection = (_animatedScrollRef$cu = animatedScrollRef.current) !== null && _animatedScrollRef$cu !== void 0 ? _animatedScrollRef$cu : innerContentRef.current;
139
172
  if (scrollableSection) {
140
173
  scrollableSection.scrollTop = 0;
141
174
  }
@@ -158,9 +191,9 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
158
191
  var checkSetDoAnimateTitle = function checkSetDoAnimateTitle() {
159
192
  var canDoAnimateTitle = false;
160
193
  if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
161
- var _labelTextRef$current, _labelTextRef$current2, _subtitleRef$current$, _subtitleRef$current;
194
+ var _labelTextRef$current3, _labelTextRef$current4, _subtitleRef$current$, _subtitleRef$current;
162
195
  var titleEl = titleRef.current;
163
- var labelHeight = (_labelTextRef$current = labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current2 = labelTextRef.current) === null || _labelTextRef$current2 === void 0 ? void 0 : _labelTextRef$current2.offsetHeight) !== null && _labelTextRef$current !== void 0 ? _labelTextRef$current : 0;
196
+ var labelHeight = (_labelTextRef$current3 = labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current4 = labelTextRef.current) === null || _labelTextRef$current4 === void 0 ? void 0 : _labelTextRef$current4.offsetHeight) !== null && _labelTextRef$current3 !== void 0 ? _labelTextRef$current3 : 0;
164
197
  var subtitleHeight = (_subtitleRef$current$ = subtitleRef === null || subtitleRef === void 0 || (_subtitleRef$current = subtitleRef.current) === null || _subtitleRef$current === void 0 ? void 0 : _subtitleRef$current.offsetHeight) !== null && _subtitleRef$current$ !== void 0 ? _subtitleRef$current$ : 0;
165
198
 
166
199
  // Adjusts space at bottom of titles by changing where scrolling finishes
@@ -171,11 +204,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
171
204
 
172
205
  // used to calculate the header moves
173
206
  panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-distance"), _scrollAnimationDistance.toString());
174
- var scrollEl = animatedScrollRef.current;
175
- if (!scrollEl && animateTitle && !doAnimateTitle) {
176
- // may be switching back based on resize
177
- scrollEl = innerContentRef.current;
178
- }
207
+ var scrollEl = innerContentRef.current;
179
208
  if (scrollEl) {
180
209
  var _window2;
181
210
  var innerComputed = (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.getComputedStyle(innerContentRef.current);
@@ -189,20 +218,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
189
218
  }
190
219
  };
191
220
  React.useEffect(function () {
192
- if (doAnimateTitle && animatedScrollRef.current) {
193
- // only add scroll if the doAnimateTitle is already true
194
- // should come back through if false and canDoAnimateTitle is true
195
- animatedScrollRef.current.addEventListener('scroll', handleScroll);
196
- }
197
221
  if (!doAnimateTitle && sidePanelRef.current) {
198
222
  panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), '0');
199
223
  }
200
- }, [animatedScrollRef, doAnimateTitle, handleScroll, sidePanelRef, panelRefValue]);
201
-
202
- /* istanbul ignore next */
203
- var handleResize = function handleResize() {
204
- checkSetDoAnimateTitle();
205
- };
224
+ }, [doAnimateTitle, handleScroll, sidePanelRef, innerContentRef, open, panelRefValue === null || panelRefValue === void 0 ? void 0 : panelRefValue.style]);
206
225
 
207
226
  // Calculate scroll distances
208
227
  React.useEffect(function () {
@@ -211,7 +230,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
211
230
  }
212
231
 
213
232
  // eslint-disable-next-line react-hooks/exhaustive-deps
214
- }, [open, doAnimateTitle /* use do instead of animateTitle directly */, animationComplete, handleScroll, title, size, reducedMotion.matches, id, animatedScrollRef.current]);
233
+ }, [open, doAnimateTitle /* use do instead of animateTitle directly */, animationComplete, handleScroll, title, size, reducedMotion.matches, id]);
215
234
 
216
235
  // click outside functionality if `includeOverlay` prop is set
217
236
  React.useEffect(function () {
@@ -310,7 +329,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
310
329
  }
311
330
  }, [animationComplete, firstElement, open, selectorPrimaryFocus]);
312
331
  var primaryActionContainerClassNames = cx__default["default"](["".concat(blockClass, "__actions-container"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__actions-container--condensed"), condensedActions)]);
313
- var mainPanelClassNames = cx__default["default"]([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--right-placement"), placement === 'right'), "".concat(blockClass, "--left-placement"), placement === 'left'), "".concat(blockClass, "--slide-in"), slideIn), "".concat(blockClass, "--has-slug"), slug), "".concat(blockClass, "--condensed-actions"), condensedActions), "".concat(blockClass, "--animated-title"), doAnimateTitle), "".concat(blockClass, "--has-overlay"), includeOverlay)]);
332
+ var mainPanelClassNames = cx__default["default"]([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--right-placement"), placement === 'right'), "".concat(blockClass, "--left-placement"), placement === 'left'), "".concat(blockClass, "--slide-in"), slideIn), "".concat(blockClass, "--has-slug"), slug), "".concat(blockClass, "--condensed-actions"), condensedActions), "".concat(blockClass, "--has-overlay"), includeOverlay)]);
314
333
  var renderTitle = function renderTitle() {
315
334
  return /*#__PURE__*/React__default["default"].createElement("div", {
316
335
  className: cx__default["default"]("".concat(blockClass, "__title"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__title--no-label"), !labelTextRef.current)),
@@ -377,7 +396,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
377
396
  }, actionToolbarButtons.map(function (_ref4) {
378
397
  var label = _ref4.label,
379
398
  kind = _ref4.kind,
399
+ _ref4$hasIconOnly = _ref4.hasIconOnly,
400
+ hasIconOnly = _ref4$hasIconOnly === void 0 ? false : _ref4$hasIconOnly,
380
401
  icon = _ref4.icon,
402
+ renderIcon = _ref4.renderIcon,
381
403
  tooltipPosition = _ref4.tooltipPosition,
382
404
  tooltipAlignment = _ref4.tooltipAlignment,
383
405
  leading = _ref4.leading,
@@ -389,11 +411,13 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
389
411
  key: label,
390
412
  kind: kind || 'ghost',
391
413
  size: "sm",
392
- renderIcon: icon,
393
- iconDescription: label,
414
+ renderIcon: renderIcon || icon,
415
+ iconDescription: label
416
+ }, hasIconOnly && {
394
417
  tooltipPosition: tooltipPosition || 'bottom',
395
- tooltipAlignment: tooltipAlignment || 'start',
396
- hasIconOnly: !leading,
418
+ tooltipAlignment: tooltipAlignment || 'start'
419
+ }, {
420
+ hasIconOnly: hasIconOnly,
397
421
  disabled: disabled,
398
422
  className: cx__default["default"](["".concat(blockClass, "__action-toolbar-button"), className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__action-toolbar-leading-button"), leading)]),
399
423
  onClick: onClick
@@ -403,10 +427,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
403
427
  var renderMain = function renderMain() {
404
428
  return /*#__PURE__*/React__default["default"].createElement("div", {
405
429
  ref: innerContentRef,
406
- className: cx__default["default"]("".concat(blockClass, "__inner-content"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--scrolls"), !doAnimateTitle))
430
+ onScroll: handleScroll,
431
+ className: cx__default["default"]("".concat(blockClass, "__inner-content"), "".concat(blockClass, "--scrolls"), "".concat(!doAnimateTitle ? "".concat(blockClass, "__inner-content--no-animated-title") : ''))
407
432
  }, children);
408
433
  };
409
- useResizeObserver.useResizeObserver(sidePanelRef, handleResize, [open]);
410
434
  return /*#__PURE__*/React__default["default"].createElement(framerMotion.AnimatePresence, null, open && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(framerMotion.motion.div, _rollupPluginBabelHelpers["extends"]({}, devtools.getDevtoolsProps(componentName), rest, {
411
435
  id: id,
412
436
  className: mainPanelClassNames,
@@ -424,11 +448,8 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
424
448
  shouldReduceMotion: shouldReduceMotion
425
449
  },
426
450
  onKeyDown: keyDownListener
427
- }), doAnimateTitle ? /*#__PURE__*/React__default["default"].createElement("div", {
428
- ref: animatedScrollRef,
429
- className: "".concat(blockClass, "__animated-scroll-wrapper ").concat(blockClass, "--scrolls")
430
- }, renderHeader(), renderMain()) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/React__default["default"].createElement(MotionActionSet, {
431
- actions: actions,
451
+ }), /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/React__default["default"].createElement(MotionActionSet, {
452
+ actions: actions !== null && actions !== void 0 ? actions : [],
432
453
  className: primaryActionContainerClassNames,
433
454
  size: size === 'xs' ? 'sm' : size,
434
455
  custom: shouldReduceMotion,
@@ -1,5 +1,26 @@
1
1
  /**
2
- * The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
2
+ * Copyright IBM Corp. 2023, 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.
3
6
  */
4
- export const SteppedAnimatedMedia: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
7
  import React from 'react';
8
+ interface SteppedAnimatedMediaProps {
9
+ /**
10
+ * Optional class name for this component.
11
+ */
12
+ className?: string;
13
+ /**
14
+ * The file path(s) to json formatted Lottie animation files.
15
+ */
16
+ filePaths: string[] | undefined;
17
+ /**
18
+ * Which animation step from the filePaths array to play.
19
+ */
20
+ playStep?: number;
21
+ }
22
+ /**
23
+ * The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
24
+ */
25
+ export declare const SteppedAnimatedMedia: React.ForwardRefExoticComponent<SteppedAnimatedMediaProps & React.RefAttributes<HTMLDivElement>>;
26
+ export {};
@@ -37,7 +37,6 @@ var componentName = 'SteppedAnimatedMedia';
37
37
  var defaults = {
38
38
  playStep: 0
39
39
  };
40
-
41
40
  /**
42
41
  * The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
43
42
  */
@@ -52,8 +51,9 @@ var SteppedAnimatedMedia = /*#__PURE__*/React__default["default"].forwardRef(fun
52
51
  jsonData = _useState2[0],
53
52
  setJsonData = _useState2[1];
54
53
  var animRef = React.useRef();
55
- var backupRef = React.useRef();
54
+ var backupRef = React.useRef(null);
56
55
  var localRef = ref !== null && ref !== void 0 ? ref : backupRef;
56
+ var localRefValue = localRef.current;
57
57
  // load animation source
58
58
  React.useEffect(function () {
59
59
  var isJsonFile = function isJsonFile(filePath) {
@@ -100,11 +100,11 @@ var SteppedAnimatedMedia = /*#__PURE__*/React__default["default"].forwardRef(fun
100
100
  React.useEffect(function () {
101
101
  var _window;
102
102
  var prefersReducedMotion = (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : true;
103
- if (localRef.current) {
103
+ if (localRefValue) {
104
104
  var _animRef$current, _animRef$current2, _animRef$current3;
105
105
  (_animRef$current = animRef.current) === null || _animRef$current === void 0 || _animRef$current.destroy();
106
106
  animRef.current = lottie__default["default"].loadAnimation({
107
- container: localRef.current,
107
+ container: localRefValue,
108
108
  renderer: 'svg',
109
109
  animationData: jsonData[clamp__default["default"](playStep, 0, jsonData.length - 1)],
110
110
  loop: false,
@@ -119,7 +119,7 @@ var SteppedAnimatedMedia = /*#__PURE__*/React__default["default"].forwardRef(fun
119
119
  var _animRef$current4;
120
120
  return (_animRef$current4 = animRef.current) === null || _animRef$current4 === void 0 ? void 0 : _animRef$current4.destroy();
121
121
  };
122
- }, [jsonData, localRef, playStep]);
122
+ }, [jsonData, localRefValue, playStep]);
123
123
  if (!jsonData) {
124
124
  return null;
125
125
  }
@@ -138,6 +138,7 @@ SteppedAnimatedMedia.propTypes = {
138
138
  /**
139
139
  * The file path(s) to json formatted Lottie animation files.
140
140
  */
141
+ /**@ts-ignore*/
141
142
  filePaths: index["default"].arrayOf(index["default"].string).isRequired,
142
143
  /**
143
144
  * Which animation step from the filePaths array to play.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * TODO: A description of the component.
3
+ */
4
+ export let TagOverflow: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ import React from 'react';
@@ -0,0 +1,216 @@
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
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var React = require('react');
14
+ var index = require('../../node_modules/prop-types/index.js');
15
+ var cx = require('classnames');
16
+ var devtools = require('../../global/js/utils/devtools.js');
17
+ var settings = require('../../settings.js');
18
+ var react = require('@carbon/react');
19
+ var constants = require('./constants.js');
20
+ var useResizeObserver = require('../../global/js/hooks/useResizeObserver.js');
21
+ var TagSet = require('../TagSet/TagSet.js');
22
+
23
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
+
25
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
+
28
+ var _excluded = ["className", "items", "tagComponent", "maxVisible", "multiline"],
29
+ _excluded2 = ["className", "id"];
30
+ var blockClass = "".concat(settings.pkg.prefix, "--tag-overflow");
31
+ var componentName = 'TagOverflow';
32
+
33
+ // Default values for props
34
+ var defaults = {
35
+ items: []
36
+ };
37
+
38
+ /**
39
+ * TODO: A description of the component.
40
+ */
41
+ exports.TagOverflow = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
42
+ var className = _ref.className,
43
+ _ref$items = _ref.items,
44
+ items = _ref$items === void 0 ? defaults.items : _ref$items,
45
+ tagComponent = _ref.tagComponent,
46
+ maxVisible = _ref.maxVisible,
47
+ multiline = _ref.multiline,
48
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
49
+ var localContainerRef = React.useRef(null);
50
+ var containerRef = ref || localContainerRef;
51
+ var itemRefs = React.useRef(null);
52
+ var overflowRef = React.useRef(null);
53
+ // measurementOffset is the value of margin applied on each items
54
+ // This value is required for calculating how many items will fit within the container
55
+ var measurementOffset = 4;
56
+ var overflowIndicatorWidth = 40;
57
+ var _useState = React.useState(0),
58
+ _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
59
+ containerWidth = _useState2[0],
60
+ setContainerWidth = _useState2[1];
61
+ var _useState3 = React.useState([]),
62
+ _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
63
+ visibleItems = _useState4[0],
64
+ setVisibleItems = _useState4[1];
65
+ var _useState5 = React.useState([]),
66
+ _useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
67
+ overflowItems = _useState6[0],
68
+ setOverflowItems = _useState6[1];
69
+ var handleResize = function handleResize() {
70
+ setContainerWidth(containerRef.current.offsetWidth);
71
+ };
72
+ useResizeObserver.useResizeObserver(containerRef, handleResize);
73
+ var getMap = function getMap() {
74
+ if (!itemRefs.current) {
75
+ itemRefs.current = new Map();
76
+ }
77
+ return itemRefs.current;
78
+ };
79
+ var itemRefHandler = function itemRefHandler(id, node) {
80
+ var map = getMap();
81
+ if (id && node && map.get(id) !== node.offsetWidth) {
82
+ map.set(id, node.offsetWidth);
83
+ }
84
+ };
85
+ var getVisibleItems = React.useCallback(function () {
86
+ if (!itemRefs.current) {
87
+ return items;
88
+ }
89
+ if (multiline) {
90
+ var _visibleItems = maxVisible ? items === null || items === void 0 ? void 0 : items.slice(0, maxVisible) : items;
91
+ return _visibleItems;
92
+ }
93
+ var map = getMap();
94
+ var overflowContainerWidth = overflowRef.current.offsetWidth > overflowIndicatorWidth ? overflowRef.current.offsetWidth : overflowIndicatorWidth;
95
+ var maxWidth = containerWidth - overflowContainerWidth;
96
+ var childrenWidth = 0;
97
+ var maxReached = false;
98
+ return items.reduce(function (prev, cur) {
99
+ if (!maxReached) {
100
+ var itemWidth = map.get(cur.id) + measurementOffset;
101
+ var fits = itemWidth + childrenWidth < maxWidth;
102
+ if (fits) {
103
+ childrenWidth += itemWidth;
104
+ prev.push(cur);
105
+ } else {
106
+ maxReached = true;
107
+ }
108
+ }
109
+ return prev;
110
+ }, []);
111
+ }, [itemRefs, overflowRef, containerWidth, items, multiline, maxVisible]);
112
+ var getCustomComponent = function getCustomComponent(item) {
113
+ var className = item.className,
114
+ id = item.id,
115
+ other = _rollupPluginBabelHelpers.objectWithoutProperties(item, _excluded2);
116
+ return /*#__PURE__*/React__default["default"].createElement(tagComponent, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, other), {}, {
117
+ className: cx__default["default"]("".concat(blockClass, "__item"), className),
118
+ ref: function ref(node) {
119
+ return itemRefHandler(id, node);
120
+ }
121
+ }));
122
+ };
123
+ React.useEffect(function () {
124
+ var visibleItemsArr = getVisibleItems();
125
+ if (maxVisible && maxVisible < visibleItemsArr.length) {
126
+ var _visibleItemsArr;
127
+ visibleItemsArr = (_visibleItemsArr = visibleItemsArr) === null || _visibleItemsArr === void 0 ? void 0 : _visibleItemsArr.slice(0, maxVisible);
128
+ }
129
+ var hiddenItems = items === null || items === void 0 ? void 0 : items.slice(visibleItemsArr.length);
130
+ var overflowItemsArr = hiddenItems === null || hiddenItems === void 0 ? void 0 : hiddenItems.map(function (item) {
131
+ return {
132
+ type: item.tagType,
133
+ label: item.label
134
+ };
135
+ });
136
+ setVisibleItems(visibleItemsArr);
137
+ setOverflowItems(overflowItemsArr);
138
+ }, [containerWidth, items, maxVisible, getVisibleItems]);
139
+ return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
140
+ className: cx__default["default"](blockClass, className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--multiline"), multiline)),
141
+ ref: containerRef,
142
+ role: "main"
143
+ }, devtools.getDevtoolsProps(componentName)), visibleItems.length > 0 && visibleItems.map(function (item) {
144
+ // Render custom components
145
+ if (tagComponent) {
146
+ return getCustomComponent(item);
147
+ } else {
148
+ // If there is no template prop, then render items as Tags
149
+ return /*#__PURE__*/React__default["default"].createElement("div", {
150
+ ref: function ref(node) {
151
+ return itemRefHandler(item.id, node);
152
+ },
153
+ key: item.id
154
+ }, /*#__PURE__*/React__default["default"].createElement(react.Tooltip, {
155
+ align: "bottom",
156
+ label: item.label
157
+ }, /*#__PURE__*/React__default["default"].createElement(react.Tag, {
158
+ className: "".concat(blockClass, "__item--tag"),
159
+ type: item.tagType
160
+ }, item.label)));
161
+ }
162
+ }), /*#__PURE__*/React__default["default"].createElement("span", {
163
+ className: "".concat(blockClass, "__indicator"),
164
+ ref: overflowRef
165
+ }, overflowItems.length > 0 && /*#__PURE__*/React__default["default"].createElement(TagSet.TagSet, {
166
+ tags: overflowItems,
167
+ allTagsModalTitle: "All tags",
168
+ containingElementRef: overflowRef,
169
+ allTagsModalSearchLabel: "Search all tags",
170
+ allTagsModalSearchPlaceholderText: "Search all tags",
171
+ showAllTagsLabel: "Show all tags"
172
+ })));
173
+ });
174
+
175
+ // Return a placeholder if not released and not enabled by feature flag
176
+ exports.TagOverflow = settings.pkg.checkComponentEnabled(exports.TagOverflow, componentName);
177
+
178
+ // The display name of the component, used by React. Note that displayName
179
+ // is used in preference to relying on function.name.
180
+ exports.TagOverflow.displayName = componentName;
181
+ var tagTypes = Object.keys(constants.TYPES);
182
+
183
+ // The types and DocGen commentary for the component props,
184
+ // in alphabetical order (for consistency).
185
+ // See https://www.npmjs.com/package/prop-types#usage.
186
+ exports.TagOverflow.propTypes = {
187
+ /**
188
+ * Provide an optional class to be applied to the containing node.
189
+ */
190
+ className: index["default"].string,
191
+ /**
192
+ * The items to be shown in the TagOverflow. Each item is specified as an object with properties:
193
+ * **label**\* (required) to supply the item content,
194
+ * **id**\* (required) to uniquely identify the each item.
195
+ * **tagType** the type value to be passed to the Carbon Tag component
196
+ * if you are passing an tagComponent prop for rendering custom components,
197
+ * then pass the props required for your custom component as the properties of item object
198
+ */
199
+ items: index["default"].arrayOf(index["default"].shape({
200
+ id: index["default"].string.isRequired,
201
+ label: index["default"].string.isRequired,
202
+ tagType: index["default"].oneOf(tagTypes)
203
+ }).isRequired),
204
+ /**
205
+ * maximum visible items
206
+ */
207
+ maxVisible: index["default"].number,
208
+ /**
209
+ * display items in multiple lines
210
+ */
211
+ multiline: index["default"].bool,
212
+ /** Component definition of the items to be rendered inside TagOverflow.
213
+ * If this is not passed, items will be rendered as Tag component
214
+ */
215
+ tagComponent: index["default"].elementType
216
+ };
@@ -0,0 +1,14 @@
1
+ export const TYPES: {
2
+ red: string;
3
+ magenta: string;
4
+ purple: string;
5
+ blue: string;
6
+ cyan: string;
7
+ teal: string;
8
+ green: string;
9
+ gray: string;
10
+ 'cool-gray': string;
11
+ 'warm-gray': string;
12
+ 'high-contrast': string;
13
+ outline: string;
14
+ };
@@ -0,0 +1,34 @@
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
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ // Copyright IBM Corp. 2024, 2024
13
+ //
14
+ // This source code is licensed under the Apache-2.0 license found in the
15
+ // LICENSE file in the root directory of this source tree.
16
+ //
17
+
18
+ // Copied from @carbon/react/es/components/Tag/Tag.js
19
+ var TYPES = {
20
+ red: 'Red',
21
+ magenta: 'Magenta',
22
+ purple: 'Purple',
23
+ blue: 'Blue',
24
+ cyan: 'Cyan',
25
+ teal: 'Teal',
26
+ green: 'Green',
27
+ gray: 'Gray',
28
+ 'cool-gray': 'Cool-Gray',
29
+ 'warm-gray': 'Warm-Gray',
30
+ 'high-contrast': 'High-Contrast',
31
+ outline: 'Outline'
32
+ };
33
+
34
+ exports.TYPES = TYPES;
@@ -0,0 +1 @@
1
+ export { TagOverflow } from "./TagOverflow";