@carbon/ibm-products 2.49.1 → 2.50.0-rc.0

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 (116) hide show
  1. package/css/index-full-carbon.css +1180 -1148
  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 +3 -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 +5 -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 +27 -20
  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/AboutModal/AboutModal.js +23 -6
  18. package/es/components/ActionBar/ActionBar.d.ts +5 -1
  19. package/es/components/ActionBar/ActionBar.js +13 -3
  20. package/es/components/ActionBar/ActionBarOverflowItems.d.ts +12 -3
  21. package/es/components/ActionBar/ActionBarOverflowItems.js +13 -3
  22. package/es/components/Carousel/Carousel.js +1 -2
  23. package/es/components/Coachmark/CoachmarkDragbar.js +0 -1
  24. package/es/components/Coachmark/CoachmarkHeader.js +0 -1
  25. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -1
  26. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +0 -1
  27. package/es/components/CoachmarkStack/CoachmarkStackHome.js +1 -2
  28. package/es/components/ConditionBuilder/ConditionBuilder.js +1 -3
  29. package/es/components/CreateTearsheet/CreateTearsheet.d.ts +6 -0
  30. package/es/components/CreateTearsheet/CreateTearsheet.js +13 -1
  31. package/es/components/CreateTearsheet/CreateTearsheetStep.d.ts +18 -0
  32. package/es/components/CreateTearsheet/CreateTearsheetStep.js +30 -3
  33. package/es/components/Datagrid/Datagrid/DatagridContent.js +4 -1
  34. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -21
  35. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +7 -2
  36. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -3
  37. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +4 -1
  38. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +3 -1
  39. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -1
  40. package/es/components/Datagrid/Datagrid/addons/stateReducer.d.ts +7 -0
  41. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +99 -41
  42. package/es/components/Datagrid/types/index.d.ts +2 -0
  43. package/es/components/Datagrid/useDisableSelectRows.js +18 -3
  44. package/es/components/Datagrid/useFlexResize.d.ts +0 -6
  45. package/es/components/Datagrid/useFlexResize.js +33 -17
  46. package/es/components/Datagrid/useSortableColumns.js +2 -1
  47. package/es/components/EditUpdateCards/EditUpdateCards.d.ts +1 -1
  48. package/es/components/EditUpdateCards/EditUpdateCards.js +1 -2
  49. package/es/components/PageHeader/PageHeader.js +12 -2
  50. package/es/components/PageHeader/PageHeaderUtils.js +0 -5
  51. package/es/components/SidePanel/SidePanel.js +6 -6
  52. package/es/components/TagOverflow/TagOverflow.d.ts +1 -1
  53. package/es/components/TagOverflow/TagOverflow.js +1 -2
  54. package/es/components/TagSet/TagSet.d.ts +8 -6
  55. package/es/components/TagSet/TagSet.js +38 -30
  56. package/es/components/TagSet/TagSetOverflow.d.ts +4 -0
  57. package/es/components/TagSet/TagSetOverflow.js +8 -2
  58. package/es/components/Tearsheet/Tearsheet.d.ts +1 -1
  59. package/es/components/Tearsheet/TearsheetNarrow.d.ts +1 -1
  60. package/es/components/Tearsheet/TearsheetShell.d.ts +1 -1
  61. package/es/components/Tearsheet/TearsheetShell.js +2 -1
  62. package/es/global/js/hooks/useCreateComponentStepChange.d.ts +3 -1
  63. package/es/global/js/hooks/useCreateComponentStepChange.js +18 -2
  64. package/es/global/js/utils/Wrap.d.ts +4 -0
  65. package/lib/components/AboutModal/AboutModal.js +22 -5
  66. package/lib/components/ActionBar/ActionBar.d.ts +5 -1
  67. package/lib/components/ActionBar/ActionBar.js +13 -3
  68. package/lib/components/ActionBar/ActionBarOverflowItems.d.ts +12 -3
  69. package/lib/components/ActionBar/ActionBarOverflowItems.js +13 -3
  70. package/lib/components/Carousel/Carousel.js +1 -2
  71. package/lib/components/Coachmark/CoachmarkDragbar.js +0 -1
  72. package/lib/components/Coachmark/CoachmarkHeader.js +0 -1
  73. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -1
  74. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +0 -1
  75. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +1 -2
  76. package/lib/components/ConditionBuilder/ConditionBuilder.js +1 -3
  77. package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +6 -0
  78. package/lib/components/CreateTearsheet/CreateTearsheet.js +13 -1
  79. package/lib/components/CreateTearsheet/CreateTearsheetStep.d.ts +18 -0
  80. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +29 -2
  81. package/lib/components/Datagrid/Datagrid/DatagridContent.js +4 -1
  82. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +3 -20
  83. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +7 -2
  84. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -3
  85. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +4 -1
  86. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +3 -1
  87. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -1
  88. package/lib/components/Datagrid/Datagrid/addons/stateReducer.d.ts +7 -0
  89. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +99 -40
  90. package/lib/components/Datagrid/types/index.d.ts +2 -0
  91. package/lib/components/Datagrid/useDisableSelectRows.js +18 -3
  92. package/lib/components/Datagrid/useFlexResize.d.ts +0 -6
  93. package/lib/components/Datagrid/useFlexResize.js +32 -16
  94. package/lib/components/Datagrid/useSortableColumns.js +2 -1
  95. package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +1 -1
  96. package/lib/components/EditUpdateCards/EditUpdateCards.js +1 -2
  97. package/lib/components/PageHeader/PageHeader.js +11 -1
  98. package/lib/components/PageHeader/PageHeaderUtils.js +0 -5
  99. package/lib/components/SidePanel/SidePanel.js +6 -6
  100. package/lib/components/TagOverflow/TagOverflow.d.ts +1 -1
  101. package/lib/components/TagOverflow/TagOverflow.js +1 -2
  102. package/lib/components/TagSet/TagSet.d.ts +8 -6
  103. package/lib/components/TagSet/TagSet.js +38 -30
  104. package/lib/components/TagSet/TagSetOverflow.d.ts +4 -0
  105. package/lib/components/TagSet/TagSetOverflow.js +8 -2
  106. package/lib/components/Tearsheet/Tearsheet.d.ts +1 -1
  107. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +1 -1
  108. package/lib/components/Tearsheet/TearsheetShell.d.ts +1 -1
  109. package/lib/components/Tearsheet/TearsheetShell.js +2 -1
  110. package/lib/global/js/hooks/useCreateComponentStepChange.d.ts +3 -1
  111. package/lib/global/js/hooks/useCreateComponentStepChange.js +18 -2
  112. package/lib/global/js/utils/Wrap.d.ts +4 -0
  113. package/package.json +12 -12
  114. package/scss/components/Datagrid/styles/_useSortableColumns.scss +1 -0
  115. package/scss/components/Tearsheet/_tearsheet.scss +2 -0
  116. package/telemetry.yml +6 -0
@@ -17,7 +17,7 @@ import { isRequiredIf } from '../../global/js/utils/props-helper.js';
17
17
  import { pkg } from '../../settings.js';
18
18
  import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
19
19
 
20
- var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags", "containingElementRef", "measurementOffset", "onOverflowTagChange"],
20
+ var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAutoAlign", "overflowAlign", "overflowClassName", "overflowType", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags", "containingElementRef", "measurementOffset", "onOverflowTagChange"],
21
21
  _excluded2 = ["label", "id"],
22
22
  _excluded3 = ["label", "onClose"];
23
23
  var componentName = 'TagSet';
@@ -32,14 +32,6 @@ var defaults = {
32
32
  overflowType: 'default',
33
33
  onOverflowTagChange: function onOverflowTagChange() {}
34
34
  };
35
-
36
- // interface TagType extends TagBaseProps
37
- // {
38
- // label: string;
39
- // // we duplicate this prop to improve the DocGen
40
- // type?: typeof tagTypes[number];
41
- // }
42
-
43
35
  var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
44
36
  var _ref$align = _ref.align,
45
37
  align = _ref$align === void 0 ? 'start' : _ref$align,
@@ -47,15 +39,20 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
47
39
  className = _ref.className,
48
40
  maxVisible = _ref.maxVisible,
49
41
  multiline = _ref.multiline,
42
+ overflowAutoAlign = _ref.overflowAutoAlign,
50
43
  _ref$overflowAlign = _ref.overflowAlign,
51
44
  overflowAlign = _ref$overflowAlign === void 0 ? 'bottom' : _ref$overflowAlign,
52
45
  overflowClassName = _ref.overflowClassName,
53
46
  _ref$overflowType = _ref.overflowType,
54
47
  overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType,
55
- allTagsModalTitle = _ref.allTagsModalTitle,
56
- allTagsModalSearchLabel = _ref.allTagsModalSearchLabel,
57
- allTagsModalSearchPlaceholderText = _ref.allTagsModalSearchPlaceholderText,
58
- showAllTagsLabel = _ref.showAllTagsLabel,
48
+ _ref$allTagsModalTitl = _ref.allTagsModalTitle,
49
+ allTagsModalTitle = _ref$allTagsModalTitl === void 0 ? 'All tags' : _ref$allTagsModalTitl,
50
+ _ref$allTagsModalSear = _ref.allTagsModalSearchLabel,
51
+ allTagsModalSearchLabel = _ref$allTagsModalSear === void 0 ? 'Search all tags' : _ref$allTagsModalSear,
52
+ _ref$allTagsModalSear2 = _ref.allTagsModalSearchPlaceholderText,
53
+ allTagsModalSearchPlaceholderText = _ref$allTagsModalSear2 === void 0 ? 'Search all tags' : _ref$allTagsModalSear2,
54
+ _ref$showAllTagsLabel = _ref.showAllTagsLabel,
55
+ showAllTagsLabel = _ref$showAllTagsLabel === void 0 ? 'View all tags' : _ref$showAllTagsLabel,
59
56
  tags = _ref.tags,
60
57
  containingElementRef = _ref.containingElementRef,
61
58
  _ref$measurementOffse = _ref.measurementOffset,
@@ -88,13 +85,21 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
88
85
  sizingTags = _useState10[0],
89
86
  setSizingTags = _useState10[1];
90
87
  var overflowTag = useRef(null);
91
- var _useState11 = useState(false),
88
+ var _useState11 = useState(0),
92
89
  _useState12 = _slicedToArray(_useState11, 2),
93
- popoverOpen = _useState12[0],
94
- setPopoverOpen = _useState12[1];
90
+ maxVisibleCount = _useState12[0],
91
+ setMaxVisibleCount = _useState12[1];
92
+ var _useState13 = useState(false),
93
+ _useState14 = _slicedToArray(_useState13, 2),
94
+ popoverOpen = _useState14[0],
95
+ setPopoverOpen = _useState14[1];
95
96
  var handleShowAllClick = function handleShowAllClick() {
96
97
  setShowAllModalOpen(true);
97
98
  };
99
+ useEffect(function () {
100
+ var maxCount = maxVisible || (tags === null || tags === void 0 ? void 0 : tags.length) || 0;
101
+ setMaxVisibleCount(maxCount);
102
+ }, [maxVisible, tags]);
98
103
  useEffect(function () {
99
104
  var newSizingTags = [];
100
105
  // create sizing tags
@@ -149,6 +154,7 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
149
154
  });
150
155
  newDisplayedTags.push( /*#__PURE__*/React__default.createElement(TagSetOverflow, {
151
156
  allTagsModalSearchThreshold: allTagsModalSearchThreshold,
157
+ overflowAutoAlign: overflowAutoAlign,
152
158
  className: overflowClassName,
153
159
  onShowAllClick: handleShowAllClick,
154
160
  overflowTags: newOverflowTags,
@@ -162,10 +168,10 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
162
168
  }));
163
169
  onOverflowTagChange === null || onOverflowTagChange === void 0 || onOverflowTagChange(newOverflowTags);
164
170
  setDisplayedTags(newDisplayedTags);
165
- }, [displayCount, overflowAlign, overflowClassName, overflowType, showAllTagsLabel, tags, onOverflowTagChange, popoverOpen, handleTagOnClose]);
171
+ }, [displayCount, overflowAlign, overflowClassName, overflowType, showAllTagsLabel, tags, onOverflowTagChange, popoverOpen, handleTagOnClose, overflowAutoAlign]);
166
172
  var checkFullyVisibleTags = useCallback(function () {
167
173
  if (multiline) {
168
- return setDisplayCount(maxVisible || 3);
174
+ return setDisplayCount(maxVisibleCount);
169
175
  }
170
176
 
171
177
  // how many will fit?
@@ -195,12 +201,12 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
195
201
  if (willFit < 1) {
196
202
  setDisplayCount(0);
197
203
  } else {
198
- setDisplayCount(maxVisible ? Math.min(willFit, maxVisible) : willFit);
204
+ setDisplayCount(maxVisibleCount ? Math.min(willFit, maxVisibleCount) : willFit);
199
205
  }
200
- }, [maxVisible, multiline, sizingTags, tagSetRef, measurementOffset, containingElementRef]);
206
+ }, [maxVisibleCount, multiline, sizingTags, tagSetRef, measurementOffset, containingElementRef]);
201
207
  useEffect(function () {
202
208
  checkFullyVisibleTags();
203
- }, [checkFullyVisibleTags, maxVisible, multiline, sizingTags]);
209
+ }, [checkFullyVisibleTags, maxVisibleCount, multiline, sizingTags]);
204
210
 
205
211
  /* don't know how to test resize */
206
212
  /* istanbul ignore next */
@@ -279,21 +285,21 @@ TagSet.propTypes = {
279
285
  */
280
286
  align: PropTypes.oneOf(['start', 'center', 'end']),
281
287
  /**
282
- * label text for the show all search. **Note: Required if more than 10 tags**
288
+ * label text for the show all search.
283
289
  */
284
- allTagsModalSearchLabel: string_required_if_more_than_10_tags,
290
+ allTagsModalSearchLabel: PropTypes.string,
285
291
  /**
286
- * placeholder text for the show all search. **Note: Required if more than 10 tags**
292
+ * placeholder text for the show all search.
287
293
  */
288
- allTagsModalSearchPlaceholderText: string_required_if_more_than_10_tags,
294
+ allTagsModalSearchPlaceholderText: PropTypes.string,
289
295
  /**
290
296
  * portal target for the all tags modal
291
297
  */
292
298
  allTagsModalTarget: PropTypes.node,
293
299
  /**
294
- * title for the show all modal. **Note: Required if more than 10 tags**
300
+ * title for the show all modal.
295
301
  */
296
- allTagsModalTitle: string_required_if_more_than_10_tags,
302
+ allTagsModalTitle: PropTypes.string,
297
303
  /**
298
304
  * className
299
305
  */
@@ -325,6 +331,10 @@ TagSet.propTypes = {
325
331
  * overflowAlign from the standard tooltip. Default center.
326
332
  */
327
333
  overflowAlign: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top']),
334
+ /**
335
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
336
+ */
337
+ overflowAutoAlign: PropTypes.bool,
328
338
  /**
329
339
  * overflowClassName for the tooltip popup
330
340
  */
@@ -335,10 +345,8 @@ TagSet.propTypes = {
335
345
  overflowType: PropTypes.oneOf(['default', 'tag']),
336
346
  /**
337
347
  * label for the overflow show all tags link.
338
- *
339
- * **Note:** Required if more than 10 tags
340
348
  */
341
- showAllTagsLabel: string_required_if_more_than_10_tags,
349
+ showAllTagsLabel: PropTypes.string,
342
350
  /**
343
351
  * The tags to be shown in the TagSet. Each tag is specified as an object
344
352
  * with properties: **label**\* (required) to supply the tag content, and
@@ -26,6 +26,10 @@ interface TagSetOverflowProps {
26
26
  * Type of rendering displayed inside of the tag overflow component
27
27
  */
28
28
  overflowType?: OverflowType;
29
+ /**
30
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
31
+ */
32
+ overflowAutoAlign?: boolean;
29
33
  /**
30
34
  * Open state of the popover
31
35
  */
@@ -13,7 +13,7 @@ import { Popover, Tag, PopoverContent, Link } from '@carbon/react';
13
13
  import { pkg } from '../../settings.js';
14
14
  import { useClickOutside } from '../../global/js/hooks/useClickOutside.js';
15
15
 
16
- var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"];
16
+ var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowAutoAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"];
17
17
  var componentName = 'TagSetOverflow';
18
18
  var blockClass = "".concat(pkg.prefix, "--tag-set-overflow");
19
19
 
@@ -28,6 +28,7 @@ var TagSetOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
28
28
  onShowAllClick = _ref.onShowAllClick,
29
29
  _ref$overflowAlign = _ref.overflowAlign,
30
30
  overflowAlign = _ref$overflowAlign === void 0 ? 'bottom' : _ref$overflowAlign,
31
+ overflowAutoAlign = _ref.overflowAutoAlign,
31
32
  overflowTags = _ref.overflowTags,
32
33
  overflowType = _ref.overflowType,
33
34
  showAllTagsLabel = _ref.showAllTagsLabel,
@@ -63,7 +64,8 @@ var TagSetOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
63
64
  dropShadow: true,
64
65
  highContrast: true,
65
66
  onKeyDown: handleEscKeyPress,
66
- open: popoverOpen
67
+ open: popoverOpen,
68
+ autoAlign: overflowAutoAlign
67
69
  }, /*#__PURE__*/React__default.createElement(Tag, {
68
70
  onClick: function onClick() {
69
71
  return setPopoverOpen === null || setPopoverOpen === void 0 ? void 0 : setPopoverOpen(!popoverOpen);
@@ -115,6 +117,10 @@ TagSetOverflow.propTypes = {
115
117
  * overflowAlign from the standard tooltip
116
118
  */
117
119
  overflowAlign: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top']),
120
+ /**
121
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
122
+ */
123
+ overflowAutoAlign: PropTypes.bool,
118
124
  /**
119
125
  * tags shown in overflow
120
126
  */
@@ -35,7 +35,7 @@ export interface TearsheetProps extends PropsWithChildren {
35
35
  *
36
36
  * See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
37
37
  */
38
- actions: ButtonProps<'button'>[];
38
+ actions?: ButtonProps<'button'>[];
39
39
  /**
40
40
  * The aria-label for the tearsheet, which is optional.
41
41
  * if it is not passed, the title will be used as the aria-label.
@@ -23,7 +23,7 @@ interface TearsheetNarrowBaseProps extends PropsWithChildren {
23
23
  *
24
24
  * See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
25
25
  */
26
- actions?: ButtonProps[];
26
+ actions?: ButtonProps<'button'>[];
27
27
  /**
28
28
  * The aria-label for the tearsheet, which is optional.
29
29
  * if it is not passed, the title will be used as the aria-label.
@@ -9,7 +9,7 @@ import React, { PropsWithChildren, ReactNode, RefObject } from 'react';
9
9
  import PropTypes from 'prop-types';
10
10
  import { type ButtonProps } from '@carbon/react';
11
11
  interface TearsheetShellProps extends PropsWithChildren {
12
- actions?: ButtonProps<any>[];
12
+ actions?: ButtonProps<'button'>[];
13
13
  ariaLabel?: string;
14
14
  /**
15
15
  * An optional class or classes to be added to the outermost element.
@@ -301,7 +301,8 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
301
301
  alwaysRender: includeActions
302
302
  }, /*#__PURE__*/React__default.createElement(Wrap, {
303
303
  className: "".concat(bc, "__content"),
304
- alwaysRender: !!(influencer && influencerPosition === 'right')
304
+ alwaysRender: !!(influencer && influencerPosition === 'right'),
305
+ tabIndex: -1
305
306
  }, children), /*#__PURE__*/React__default.createElement(Wrap, {
306
307
  className: cx(_defineProperty(_defineProperty({}, "".concat(bc, "__influencer"), true), "".concat(bc, "__influencer--wide"), influencerWidth === 'wide')),
307
308
  neverRender: influencerPosition !== 'right'
@@ -1,4 +1,4 @@
1
- export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedStep, stepData, onPrevious, onNext, isSubmitDisabled, setCurrentStep, setIsSubmitting, setLoadingPrevious, loadingPrevious, onClose, onRequestSubmit, componentName, currentStep, backButtonText, cancelButtonText, submitButtonText, nextButtonText, isSubmitting, componentBlockClass, setCreateComponentActions, setModalIsOpen, }: {
1
+ export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedStep, stepData, onPrevious, onNext, isSubmitDisabled, setCurrentStep, setIsSubmitting, setLoadingPrevious, loadingPrevious, onClose, onRequestSubmit, componentName, currentStep, backButtonText, cancelButtonText, submitButtonText, nextButtonText, isSubmitting, componentBlockClass, setCreateComponentActions, setModalIsOpen, experimentalSecondarySubmit, experimentalSecondarySubmitText, }: {
2
2
  firstIncludedStep: any;
3
3
  lastIncludedStep: any;
4
4
  stepData: any;
@@ -21,4 +21,6 @@ export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedSt
21
21
  componentBlockClass: any;
22
22
  setCreateComponentActions: any;
23
23
  setModalIsOpen: any;
24
+ experimentalSecondarySubmit: any;
25
+ experimentalSecondarySubmitText: any;
24
26
  }): void;
@@ -32,7 +32,9 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
32
32
  isSubmitting = _ref.isSubmitting,
33
33
  componentBlockClass = _ref.componentBlockClass,
34
34
  setCreateComponentActions = _ref.setCreateComponentActions,
35
- setModalIsOpen = _ref.setModalIsOpen;
35
+ setModalIsOpen = _ref.setModalIsOpen,
36
+ experimentalSecondarySubmit = _ref.experimentalSecondarySubmit,
37
+ experimentalSecondarySubmitText = _ref.experimentalSecondarySubmitText;
36
38
  var continueToNextStep = useCallback(function () {
37
39
  setIsSubmitting(false);
38
40
  setCurrentStep(function (prev) {
@@ -212,6 +214,11 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
212
214
  return _ref5.apply(this, arguments);
213
215
  };
214
216
  }();
217
+ var handleExperimentalSecondarySubmit = function handleExperimentalSecondarySubmit() {
218
+ if (typeof (experimentalSecondarySubmit === null || experimentalSecondarySubmit === void 0 ? void 0 : experimentalSecondarySubmit.onClick) === 'function') {
219
+ experimentalSecondarySubmit.onClick();
220
+ }
221
+ };
215
222
  if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 0) {
216
223
  var buttons = [];
217
224
  if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 1) {
@@ -232,6 +239,15 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
232
239
  } : onUnmount,
233
240
  kind: 'ghost'
234
241
  });
242
+ if (experimentalSecondarySubmitText && !(experimentalSecondarySubmit !== null && experimentalSecondarySubmit !== void 0 && experimentalSecondarySubmit.hideSecondarySubmit)) {
243
+ buttons.push({
244
+ key: 'create-action-button-experimentalSecondarySubmit',
245
+ label: experimentalSecondarySubmitText,
246
+ onClick: handleExperimentalSecondarySubmit,
247
+ kind: 'secondary',
248
+ disabled: experimentalSecondarySubmit === null || experimentalSecondarySubmit === void 0 ? void 0 : experimentalSecondarySubmit.disabled
249
+ });
250
+ }
235
251
  buttons.push({
236
252
  key: 'create-action-button-submit',
237
253
  label: currentStep < lastIncludedStep ? nextButtonText : submitButtonText,
@@ -243,7 +259,7 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
243
259
  });
244
260
  setCreateComponentActions(buttons);
245
261
  }
246
- }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious]);
262
+ }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious, experimentalSecondarySubmit, experimentalSecondarySubmitText]);
247
263
  };
248
264
 
249
265
  export { useCreateComponentStepChange };
@@ -26,6 +26,10 @@ interface WrapProps extends PropsWithChildren {
26
26
  */
27
27
  neverRender?: boolean;
28
28
  className?: string;
29
+ /**
30
+ * Tab index for the wrapper div
31
+ */
32
+ tabIndex?: number;
29
33
  }
30
34
  /**
31
35
  * A simple conditional wrapper that encloses its children in a <div> (or other
@@ -15,6 +15,7 @@ var React = require('react');
15
15
  var index = require('../../node_modules/prop-types/index.js');
16
16
  var cx = require('classnames');
17
17
  var devtools = require('../../global/js/utils/devtools.js');
18
+ var useFocus = require('../../global/js/hooks/useFocus.js');
18
19
  var settings = require('../../settings.js');
19
20
  var usePortalTarget = require('../../global/js/hooks/usePortalTarget.js');
20
21
  var uuidv4 = require('../../global/js/utils/uuidv4.js');
@@ -54,9 +55,13 @@ exports.AboutModal = /*#__PURE__*/React__default["default"].forwardRef(function
54
55
  version = _ref.version,
55
56
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
56
57
  var bodyRef = React.useRef(null);
58
+ var localRef = React.useRef();
59
+ var modalRef = ref || localRef;
57
60
  var contentRef = React.useRef(null);
58
61
  var contentId = uuidv4["default"]();
59
62
  var renderPortalUse = usePortalTarget.usePortalTarget(portalTargetIn);
63
+ var _useFocus = useFocus.useFocus(modalRef),
64
+ firstElement = _useFocus.firstElement;
60
65
 
61
66
  // We can't add a ref directly to the ModalBody, so track it in a ref
62
67
  // as the parent of the current bodyRef element
@@ -64,16 +69,28 @@ exports.AboutModal = /*#__PURE__*/React__default["default"].forwardRef(function
64
69
  var _contentRef$current;
65
70
  bodyRef.current = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.parentElement;
66
71
  }, [bodyRef]);
67
- return renderPortalUse( /*#__PURE__*/React__default["default"].createElement(react.ComposedModal, _rollupPluginBabelHelpers["extends"]({}, rest, {
72
+ React.useEffect(function () {
73
+ if (open) {
74
+ setTimeout(function () {
75
+ return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
76
+ }, 0);
77
+ }
78
+ // eslint-disable-next-line react-hooks/exhaustive-deps
79
+ }, [open]);
80
+ return renderPortalUse( /*#__PURE__*/React__default["default"].createElement(react.unstable_FeatureFlags, {
81
+ flags: {
82
+ 'enable-experimental-focus-wrap-without-sentinels': true
83
+ }
84
+ }, /*#__PURE__*/React__default["default"].createElement(react.ComposedModal, _rollupPluginBabelHelpers["extends"]({}, rest, {
68
85
  className: cx__default["default"](blockClass,
69
86
  // Apply the block class to the main HTML element
70
87
  className // Apply any supplied class names to the main HTML element.
71
88
  ),
72
- "aria-label": modalAriaLabel
89
+ "aria-label": modalAriaLabel,
90
+ ref: modalRef
73
91
  }, _rollupPluginBabelHelpers.objectSpread2({
74
92
  onClose: onClose,
75
- open: open,
76
- ref: ref
93
+ open: open
77
94
  }, devtools.getDevtoolsProps(componentName))), /*#__PURE__*/React__default["default"].createElement("div", {
78
95
  className: "".concat(blockClass, "__logo")
79
96
  }, logo), /*#__PURE__*/React__default["default"].createElement(react.ModalHeader, {
@@ -104,7 +121,7 @@ exports.AboutModal = /*#__PURE__*/React__default["default"].forwardRef(function
104
121
  theme: "g100"
105
122
  }, /*#__PURE__*/React__default["default"].createElement(react.ModalFooter, {
106
123
  className: "".concat(blockClass, "__footer")
107
- }, additionalInfo))));
124
+ }, additionalInfo)))));
108
125
  });
109
126
 
110
127
  // Return a placeholder if not released and not enabled by feature flag
@@ -1,4 +1,4 @@
1
- import React, { PropsWithChildren } from 'react';
1
+ import React, { PropsWithChildren, ForwardedRef } from 'react';
2
2
  import { ButtonProps } from '@carbon/type';
3
3
  import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
4
4
  interface Action extends ButtonProps {
@@ -49,6 +49,10 @@ interface ActionBarProps extends PropsWithChildren {
49
49
  * overflowAriaLabel label for open close button overflow used for action bar items that do nto fit.
50
50
  */
51
51
  overflowAriaLabel: string;
52
+ /**
53
+ * overflowMenuRef for the overflow menu width that is needed to calculate the width of the action bar with overflow
54
+ */
55
+ overflowMenuRef?: ForwardedRef<HTMLDivElement>;
52
56
  /**
53
57
  * align tags to right of available space
54
58
  */
@@ -26,7 +26,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
26
26
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
27
27
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
28
28
 
29
- var _excluded = ["actions", "className", "maxVisible", "menuOptionsClass", "onWidthChange", "overflowAriaLabel", "rightAlign"],
29
+ var _excluded = ["actions", "className", "maxVisible", "menuOptionsClass", "onWidthChange", "overflowAriaLabel", "overflowMenuRef", "rightAlign"],
30
30
  _excluded2 = ["key", "id"],
31
31
  _excluded3 = ["key"];
32
32
  // The block part of our conventional BEM class names (blockClass__E--M).
@@ -50,6 +50,7 @@ exports.ActionBar = /*#__PURE__*/React__default["default"].forwardRef(function (
50
50
  menuOptionsClass = _ref.menuOptionsClass,
51
51
  onWidthChange = _ref.onWidthChange,
52
52
  overflowAriaLabel = _ref.overflowAriaLabel,
53
+ overflowMenuRef = _ref.overflowMenuRef,
53
54
  rightAlign = _ref.rightAlign,
54
55
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
55
56
  var _useState = React.useState(0),
@@ -81,6 +82,7 @@ exports.ActionBar = /*#__PURE__*/React__default["default"].forwardRef(function (
81
82
  }, /*#__PURE__*/React__default["default"].createElement("span", null, /*#__PURE__*/React__default["default"].createElement(ActionBarOverflowItems.ActionBarOverflowItems, {
82
83
  className: "".concat(blockClass, "__hidden-sizing-item"),
83
84
  overflowAriaLabel: "hidden sizing overflow items",
85
+ overflowMenuRef: overflowMenuRef,
84
86
  overflowItems: [],
85
87
  key: "hidden-overflow-menu",
86
88
  tabIndex: -1
@@ -96,7 +98,7 @@ exports.ActionBar = /*#__PURE__*/React__default["default"].forwardRef(function (
96
98
  tabIndex: -1
97
99
  }));
98
100
  }))));
99
- }, [actions]);
101
+ }, [actions, overflowMenuRef]);
100
102
 
101
103
  // creates displayed items based on actions, displayCount and alignment
102
104
  React.useEffect(function () {
@@ -117,12 +119,13 @@ exports.ActionBar = /*#__PURE__*/React__default["default"].forwardRef(function (
117
119
  newDisplayedItems.push( /*#__PURE__*/React__default["default"].createElement(ActionBarOverflowItems.ActionBarOverflowItems, {
118
120
  menuOptionsClass: menuOptionsClass,
119
121
  overflowAriaLabel: overflowAriaLabel,
122
+ overflowMenuRef: overflowMenuRef,
120
123
  overflowItems: newOverflowItems,
121
124
  key: "overflow-menu-".concat(internalId.current)
122
125
  }));
123
126
  }
124
127
  setDisplayedItems(newDisplayedItems);
125
- }, [actions, displayCount, overflowAriaLabel, menuOptionsClass]);
128
+ }, [actions, displayCount, overflowAriaLabel, menuOptionsClass, overflowMenuRef]);
126
129
 
127
130
  // determine display count based on space available and width of pageActions
128
131
  var checkFullyVisibleItems = function checkFullyVisibleItems() {
@@ -259,6 +262,13 @@ exports.ActionBar.propTypes = {
259
262
  * overflowAriaLabel label for open close button overflow used for action bar items that do nto fit.
260
263
  */
261
264
  overflowAriaLabel: index["default"].string.isRequired,
265
+ /**
266
+ * overflowMenuRef for the overflow menu width that is needed to calculate the width of the action bar with overflow
267
+ */
268
+ /**@ts-ignore */
269
+ overflowMenuRef: index["default"].oneOfType([index["default"].shape({
270
+ current: index["default"].elementType
271
+ }), index["default"].object]),
262
272
  /**
263
273
  * align tags to right of available space
264
274
  */
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren, ReactElement } from 'react';
1
+ import { PropsWithChildren, ReactElement, ForwardedRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
4
4
  type OverflowItem = {
@@ -16,9 +16,13 @@ interface ActionBarOverflowItemProps extends PropsWithChildren {
16
16
  */
17
17
  menuOptionsClass?: string;
18
18
  /**
19
- * overflowAriaLabel label for open close button overflow used for action bar items that do nto fit.
19
+ * overflowAriaLabel label for open close button overflow used for action bar items that do not fit.
20
20
  */
21
21
  overflowAriaLabel?: string;
22
+ /**
23
+ * overflowMenuRef for the overflow menu width that is needed to calculate the width of the action bar with overflow
24
+ */
25
+ overflowMenuRef?: ForwardedRef<HTMLDivElement>;
22
26
  /**
23
27
  * overflowItems: items to bre shown in the ActionBar overflow menu
24
28
  */
@@ -29,7 +33,7 @@ interface ActionBarOverflowItemProps extends PropsWithChildren {
29
33
  tabIndex?: number;
30
34
  }
31
35
  export declare const ActionBarOverflowItems: {
32
- ({ className, menuOptionsClass, overflowItems, overflowAriaLabel, }: ActionBarOverflowItemProps): import("react/jsx-runtime").JSX.Element;
36
+ ({ className, menuOptionsClass, overflowItems, overflowAriaLabel, overflowMenuRef, }: ActionBarOverflowItemProps): import("react/jsx-runtime").JSX.Element;
33
37
  displayName: string;
34
38
  propTypes: {
35
39
  /**
@@ -48,6 +52,11 @@ export declare const ActionBarOverflowItems: {
48
52
  * overflowItems: items to bre shown in the ActionBar overflow menu
49
53
  */
50
54
  overflowItems: PropTypes.Requireable<(PropTypes.ReactElementLike | null | undefined)[]>;
55
+ /**
56
+ * overflowMenuRef for the overflow menu width that is needed to calculate the width of the action bar with overflow
57
+ */
58
+ /**@ts-ignore */
59
+ overflowMenuRef: PropTypes.Requireable<object>;
51
60
  /**
52
61
  * Optional tab index
53
62
  */
@@ -28,9 +28,12 @@ var ActionBarOverflowItems = function ActionBarOverflowItems(_ref) {
28
28
  var className = _ref.className,
29
29
  menuOptionsClass = _ref.menuOptionsClass,
30
30
  overflowItems = _ref.overflowItems,
31
- overflowAriaLabel = _ref.overflowAriaLabel;
31
+ overflowAriaLabel = _ref.overflowAriaLabel,
32
+ overflowMenuRef = _ref.overflowMenuRef;
32
33
  var internalId = React.useRef(uuidv4["default"]());
33
- return /*#__PURE__*/React__default["default"].createElement(react.OverflowMenu, {
34
+ return /*#__PURE__*/React__default["default"].createElement("div", {
35
+ ref: overflowMenuRef
36
+ }, /*#__PURE__*/React__default["default"].createElement(react.OverflowMenu, {
34
37
  "aria-label": overflowAriaLabel,
35
38
  className: cx__default["default"](blockClass, className),
36
39
  direction: "bottom",
@@ -54,7 +57,7 @@ var ActionBarOverflowItems = function ActionBarOverflowItems(_ref) {
54
57
  id: "".concat(internalId.current, "-").concat(index, "--item-label")
55
58
  }, item === null || item === void 0 ? void 0 : item.props.label), typeof (item === null || item === void 0 ? void 0 : item.props.renderIcon) === 'function' ? /*#__PURE__*/React__default["default"].createElement(ItemIcon, null) : item === null || item === void 0 ? void 0 : item.props.renderIcon)
56
59
  });
57
- }));
60
+ })));
58
61
  };
59
62
  ActionBarOverflowItems.displayName = componentName;
60
63
  ActionBarOverflowItems.propTypes = {
@@ -75,6 +78,13 @@ ActionBarOverflowItems.propTypes = {
75
78
  * overflowItems: items to bre shown in the ActionBar overflow menu
76
79
  */
77
80
  overflowItems: index["default"].arrayOf(index["default"].element),
81
+ /**
82
+ * overflowMenuRef for the overflow menu width that is needed to calculate the width of the action bar with overflow
83
+ */
84
+ /**@ts-ignore */
85
+ overflowMenuRef: index["default"].oneOfType([index["default"].shape({
86
+ current: index["default"].elementType
87
+ }), index["default"].object]),
78
88
  /**
79
89
  * Optional tab index
80
90
  */
@@ -276,8 +276,7 @@ var Carousel = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
276
276
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
277
277
  tabIndex: -1,
278
278
  className: cx__default["default"](blockClass, className),
279
- ref: carouselRef,
280
- role: "main"
279
+ ref: carouselRef
281
280
  }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement("div", {
282
281
  className: cx__default["default"]("".concat(blockClass, "__elements-container"))
283
282
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -93,7 +93,6 @@ exports.CoachmarkDragbar = /*#__PURE__*/React__default["default"].forwardRef(fun
93
93
  // example: [`${blockClass}__here-if-small`]: size === 'sm',
94
94
  }),
95
95
  ref: ref
96
- // role="main"
97
96
  }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement("button", {
98
97
  type: "button",
99
98
  className: "".concat(overlayBlockClass, "__handle"),
@@ -52,7 +52,6 @@ exports.CoachmarkHeader = /*#__PURE__*/React__default["default"].forwardRef(func
52
52
  return /*#__PURE__*/React__default["default"].createElement("header", _rollupPluginBabelHelpers["extends"]({}, rest, {
53
53
  className: cx__default["default"](blockClass, "".concat(blockClass, "__").concat(theme)),
54
54
  ref: ref
55
- // role="main"
56
55
  }, devtools.getDevtoolsProps(componentName)), showCloseButton && /*#__PURE__*/React__default["default"].createElement("div", {
57
56
  className: "".concat(overlayBlockClass, "--close-btn-container")
58
57
  }, /*#__PURE__*/React__default["default"].createElement(react.Button, {
@@ -48,7 +48,6 @@ exports.CoachmarkOverlayElement = /*#__PURE__*/React__default["default"].forward
48
48
  // example: [`${blockClass}__here-if-small`]: size === 'sm',
49
49
  }),
50
50
  ref: ref
51
- // role="main"
52
51
  }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement("div", {
53
52
  className: "".concat(blockClass, "__content")
54
53
  }, title && /*#__PURE__*/React__default["default"].createElement("h2", {
@@ -120,7 +120,6 @@ exports.CoachmarkOverlayElements = /*#__PURE__*/React__default["default"].forwar
120
120
  // example: [`${blockClass}__here-if-small`]: size === 'sm',
121
121
  }),
122
122
  ref: ref
123
- // role="main"
124
123
  }, devtools.getDevtoolsProps(componentName)), media && (media.render ? media.render() : /*#__PURE__*/React__default["default"].createElement(SteppedAnimatedMedia.SteppedAnimatedMedia, {
125
124
  className: "".concat(blockClass, "__element-stepped-media"),
126
125
  filePaths: media.filePaths,
@@ -89,8 +89,7 @@ exports.CoachmarkStackHome = /*#__PURE__*/React.forwardRef(function (_ref, ref)
89
89
  }
90
90
  return portalNode !== null && portalNode !== void 0 && portalNode.current ? /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
91
91
  className: cx__default["default"](blockClass, className),
92
- ref: ref,
93
- role: "main"
92
+ ref: ref
94
93
  }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement(CoachmarkHeader.CoachmarkHeader, {
95
94
  onClose: function onClose() {
96
95
  setLinkFocusIndex(0);
@@ -89,7 +89,6 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
89
89
  // switched classes dependant on props or state
90
90
  // example: [`${blockClass}__here-if-small`]: size === 'sm',
91
91
  }),
92
- role: "main",
93
92
  ref: conditionBuilderRef
94
93
  }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement(react.VStack, {
95
94
  className: "".concat(util.blockClass, "__").concat(variant),
@@ -180,8 +179,7 @@ exports.ConditionBuilder.propTypes = {
180
179
  }),
181
180
  /**
182
181
  * This is a mandatory prop that defines the input to the condition builder.
183
-
184
- */
182
+ */
185
183
  /**@ts-ignore */
186
184
  inputConfig: index["default"].shape({
187
185
  properties: index["default"].arrayOf(index["default"].shape({