@carbon/ibm-products 2.68.0 → 2.69.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 (146) hide show
  1. package/css/carbon.css +382 -74
  2. package/css/carbon.css.map +1 -1
  3. package/css/index-full-carbon.css +524 -116
  4. package/css/index-full-carbon.css.map +1 -1
  5. package/css/index-full-carbon.min.css +1 -1
  6. package/css/index-full-carbon.min.css.map +1 -1
  7. package/css/index-without-carbon-released-only.css +126 -42
  8. package/css/index-without-carbon-released-only.css.map +1 -1
  9. package/css/index-without-carbon-released-only.min.css +1 -1
  10. package/css/index-without-carbon-released-only.min.css.map +1 -1
  11. package/css/index-without-carbon.css +142 -42
  12. package/css/index-without-carbon.css.map +1 -1
  13. package/css/index-without-carbon.min.css +1 -1
  14. package/css/index-without-carbon.min.css.map +1 -1
  15. package/css/index.css +185 -50
  16. package/css/index.css.map +1 -1
  17. package/css/index.min.css +1 -1
  18. package/css/index.min.css.map +1 -1
  19. package/es/_virtual/_commonjsHelpers.js +3 -1
  20. package/es/_virtual/index2.js +6 -2
  21. package/es/_virtual/index3.js +10 -0
  22. package/es/components/AddSelect/AddSelectColumn.js +41 -18
  23. package/es/components/AddSelect/AddSelectSort.js +15 -16
  24. package/es/components/AddSelect/types/index.d.ts +1 -1
  25. package/es/components/Card/Card.d.ts +2 -2
  26. package/es/components/Card/Card.js +7 -4
  27. package/es/components/Coachmark/Coachmark.d.ts +43 -0
  28. package/es/components/Coachmark/Coachmark.js +49 -33
  29. package/es/components/Coachmark/CoachmarkOverlay.js +6 -0
  30. package/es/components/Coachmark/index.d.ts +1 -0
  31. package/es/components/CoachmarkBeacon/CoachmarkBeacon.d.ts +11 -0
  32. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +19 -11
  33. package/es/components/CoachmarkButton/CoachmarkButton.js +7 -0
  34. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +6 -0
  35. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +7 -0
  36. package/es/components/Datagrid/Datagrid/DatagridContent.js +7 -5
  37. package/es/components/Datagrid/Datagrid/DatagridRow.d.ts +1 -1
  38. package/es/components/Datagrid/Datagrid/DatagridRow.js +4 -3
  39. package/es/components/Datagrid/Datagrid/DatagridToolbar.d.ts +1 -1
  40. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +8 -7
  41. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
  42. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
  43. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +4 -3
  44. package/es/components/Datagrid/useNestedRowExpander.js +4 -2
  45. package/es/components/Datagrid/useOnRowClick.d.ts +1 -1
  46. package/es/components/Datagrid/useOnRowClick.js +6 -4
  47. package/es/components/Datagrid/useRowExpander.js +4 -2
  48. package/es/components/Datagrid/useSelectRows.d.ts +1 -1
  49. package/es/components/Datagrid/useSelectRows.js +4 -3
  50. package/es/components/Datagrid/useSortableColumns.d.ts +1 -1
  51. package/es/components/Datagrid/useSortableColumns.js +6 -5
  52. package/es/components/EditInPlace/EditInPlace.d.ts +1 -1
  53. package/es/components/EditInPlace/EditInPlace.js +4 -3
  54. package/es/components/EmptyStates/EmptyStateContent.d.ts +30 -1
  55. package/es/components/EmptyStates/EmptyStateContent.js +2 -2
  56. package/es/components/ExportModal/ExportModal.js +7 -5
  57. package/es/components/FeatureFlags/index.d.ts +31 -12
  58. package/es/components/FeatureFlags/index.js +46 -15
  59. package/es/components/InterstitialScreen/InterstitialScreenBody.js +3 -2
  60. package/es/components/InterstitialScreen/InterstitialScreenFooter.js +5 -2
  61. package/es/components/InterstitialScreen/InterstitialScreenHeader.js +3 -1
  62. package/es/components/ProductiveCard/ProductiveCard.d.ts +1 -1
  63. package/es/components/ScrollGradient/ScrollGradient.js +9 -7
  64. package/es/components/SidePanel/SidePanel.js +74 -0
  65. package/es/components/SidePanel/constants.d.ts +14 -8
  66. package/es/components/SidePanel/constants.js +1 -1
  67. package/es/components/SidePanel/resizer/Resizer.d.ts +21 -0
  68. package/es/components/SidePanel/resizer/Resizer.js +271 -0
  69. package/es/components/TruncatedList/TruncatedList.d.ts +1 -1
  70. package/es/components/TruncatedList/TruncatedList.js +4 -3
  71. package/es/feature-flags.js +5 -1
  72. package/es/index.js +1 -0
  73. package/es/node_modules/@carbon/{icons-react/node_modules/@carbon/icon-helpers → icon-helpers}/es/index.js +3 -3
  74. package/es/node_modules/@carbon/icons-react/es/Icon.js +1 -1
  75. package/es/node_modules/@carbon/icons-react/es/generated/bucket-10.js +816 -808
  76. package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +615 -637
  77. package/es/node_modules/lodash.debounce/index.js +367 -0
  78. package/es/node_modules/prop-types/index.js +1 -1
  79. package/es/settings.js +1 -4
  80. package/lib/_virtual/_commonjsHelpers.js +3 -0
  81. package/lib/_virtual/index2.js +8 -2
  82. package/lib/_virtual/index3.js +12 -0
  83. package/lib/components/AddSelect/AddSelectColumn.js +40 -17
  84. package/lib/components/AddSelect/AddSelectSort.js +13 -14
  85. package/lib/components/AddSelect/types/index.d.ts +1 -1
  86. package/lib/components/Card/Card.d.ts +2 -2
  87. package/lib/components/Card/Card.js +7 -4
  88. package/lib/components/Coachmark/Coachmark.d.ts +43 -0
  89. package/lib/components/Coachmark/Coachmark.js +50 -32
  90. package/lib/components/Coachmark/CoachmarkOverlay.js +6 -0
  91. package/lib/components/Coachmark/index.d.ts +1 -0
  92. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.d.ts +11 -0
  93. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +19 -11
  94. package/lib/components/CoachmarkButton/CoachmarkButton.js +7 -0
  95. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +6 -0
  96. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +7 -0
  97. package/lib/components/Datagrid/Datagrid/DatagridContent.js +5 -3
  98. package/lib/components/Datagrid/Datagrid/DatagridRow.d.ts +1 -1
  99. package/lib/components/Datagrid/Datagrid/DatagridRow.js +2 -1
  100. package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +1 -1
  101. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +6 -5
  102. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
  103. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +3 -2
  104. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +2 -1
  105. package/lib/components/Datagrid/useNestedRowExpander.js +3 -1
  106. package/lib/components/Datagrid/useOnRowClick.d.ts +1 -1
  107. package/lib/components/Datagrid/useOnRowClick.js +5 -3
  108. package/lib/components/Datagrid/useRowExpander.js +3 -1
  109. package/lib/components/Datagrid/useSelectRows.d.ts +1 -1
  110. package/lib/components/Datagrid/useSelectRows.js +2 -1
  111. package/lib/components/Datagrid/useSortableColumns.d.ts +1 -1
  112. package/lib/components/Datagrid/useSortableColumns.js +4 -3
  113. package/lib/components/EditInPlace/EditInPlace.d.ts +1 -1
  114. package/lib/components/EditInPlace/EditInPlace.js +2 -1
  115. package/lib/components/EmptyStates/EmptyStateContent.d.ts +30 -1
  116. package/lib/components/EmptyStates/EmptyStateContent.js +2 -2
  117. package/lib/components/ExportModal/ExportModal.js +5 -3
  118. package/lib/components/FeatureFlags/index.d.ts +31 -12
  119. package/lib/components/FeatureFlags/index.js +46 -15
  120. package/lib/components/InterstitialScreen/InterstitialScreenBody.js +3 -2
  121. package/lib/components/InterstitialScreen/InterstitialScreenFooter.js +5 -2
  122. package/lib/components/InterstitialScreen/InterstitialScreenHeader.js +3 -1
  123. package/lib/components/ProductiveCard/ProductiveCard.d.ts +1 -1
  124. package/lib/components/ScrollGradient/ScrollGradient.js +8 -6
  125. package/lib/components/SidePanel/SidePanel.js +74 -0
  126. package/lib/components/SidePanel/constants.d.ts +14 -8
  127. package/lib/components/SidePanel/constants.js +1 -1
  128. package/lib/components/SidePanel/resizer/Resizer.d.ts +21 -0
  129. package/lib/components/SidePanel/resizer/Resizer.js +277 -0
  130. package/lib/components/TruncatedList/TruncatedList.d.ts +1 -1
  131. package/lib/components/TruncatedList/TruncatedList.js +2 -1
  132. package/lib/feature-flags.js +5 -1
  133. package/lib/index.js +1 -0
  134. package/lib/node_modules/@carbon/{icons-react/node_modules/@carbon/icon-helpers → icon-helpers}/es/index.js +3 -3
  135. package/lib/node_modules/@carbon/icons-react/es/Icon.js +1 -1
  136. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-10.js +839 -831
  137. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +621 -643
  138. package/lib/node_modules/lodash.debounce/index.js +369 -0
  139. package/lib/node_modules/prop-types/index.js +1 -1
  140. package/lib/settings.js +0 -4
  141. package/package.json +15 -15
  142. package/scss/components/AddSelect/_add-select.scss +12 -13
  143. package/scss/components/SidePanel/_side-panel-variables.scss +1 -5
  144. package/scss/components/SidePanel/_side-panel.scss +129 -12
  145. package/scss/global/decorators/_side-panel-decorator.scss +36 -8
  146. package/telemetry.yml +17 -0
@@ -5,9 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React__default, { useContext, createContext, useState, useRef, useEffect } from 'react';
9
- import PropTypes from '../../_virtual/index.js';
10
8
  import { FeatureFlags as FeatureFlags$1, createScope } from '@carbon/feature-flags';
9
+ import PropTypes from '../../_virtual/index.js';
10
+ import React__default, { useContext, createContext, useState, useRef, useEffect } from 'react';
11
+ import { deprecateProp } from '../../global/js/utils/props-helper.js';
11
12
 
12
13
  /**
13
14
  * Our FeatureFlagContext is used alongside the FeatureFlags component to enable
@@ -16,7 +17,7 @@ import { FeatureFlags as FeatureFlags$1, createScope } from '@carbon/feature-fla
16
17
  const FeatureFlagContext = /*#__PURE__*/createContext(FeatureFlags$1);
17
18
 
18
19
  /**
19
- * Supports individual feature flag values as props, merging them
20
+ * Supports an object of feature flag values with the `flags` prop, merging them
20
21
  * along with the current `FeatureFlagContext` to provide consumers to check if
21
22
  * a feature flag is enabled or disabled in a given React tree
22
23
  */
@@ -24,18 +25,30 @@ function FeatureFlags(_ref) {
24
25
  let {
25
26
  children,
26
27
  flags = {},
27
- ...newFlags
28
+ defaultPortalTargetBody = true,
29
+ enableDatagridUseInlineEdit = false,
30
+ enableDatagridUseEditableCell = false,
31
+ enableDatagridUseCustomizeColumns = false,
32
+ // exampleComponentSecondaryIcon = false,
33
+ // exampleComponentUseExample = false,
34
+ enableSidepanelResizer = false,
35
+ enableTestFlagA = false,
36
+ enableTestFlagB = false
28
37
  } = _ref;
29
38
  const parentScope = useContext(FeatureFlagContext);
30
- const newFlagsObject = Object.keys(newFlags).reduce((acc, key) => {
31
- acc[key] = newFlags[key];
32
- return acc;
33
- }, {});
39
+ const [prevParentScope, setPrevParentScope] = useState(parentScope);
34
40
  const combinedFlags = {
35
- ...newFlagsObject,
41
+ 'default-portal-target-body': defaultPortalTargetBody,
42
+ 'enable-datagrid-useInlineEdit': enableDatagridUseInlineEdit,
43
+ 'enable-datagrid-useEditableCell': enableDatagridUseEditableCell,
44
+ 'enable-datagrid-useCustomizeColumns': enableDatagridUseCustomizeColumns,
45
+ // 'ExampleComponent.secondaryIcon': exampleComponentSecondaryIcon,
46
+ // 'ExampleComponent.useExample': exampleComponentUseExample,
47
+ enableSidepanelResizer: enableSidepanelResizer,
48
+ 'enable-test-flag-a': enableTestFlagA,
49
+ 'enable-test-flag-b': enableTestFlagB,
36
50
  ...flags
37
51
  };
38
- const [prevParentScope, setPrevParentScope] = useState(parentScope);
39
52
  const [scope, updateScope] = useState(() => {
40
53
  const scope = createScope(combinedFlags);
41
54
  scope.mergeWithScope(parentScope);
@@ -48,8 +61,9 @@ function FeatureFlags(_ref) {
48
61
  setPrevParentScope(parentScope);
49
62
  }
50
63
 
51
- // We use a custom hook to detect if any of the individual flag props or their values change
52
- // If any flags have changed, we re-create the FeatureFlagScope using the updated flags
64
+ // We use a custom hook to detect if any of the keys or their values change
65
+ // for flags that are passed in. If they have changed, then we re-create the
66
+ // FeatureFlagScope using the new flags
53
67
  useChangedValue(combinedFlags, isEqual, changedFlags => {
54
68
  const scope = createScope(changedFlags);
55
69
  scope.mergeWithScope(parentScope);
@@ -62,9 +76,18 @@ function FeatureFlags(_ref) {
62
76
  FeatureFlags.propTypes = {
63
77
  children: PropTypes.node,
64
78
  /**
65
- * Provide the feature flags to enabled or disabled in the current React tree, this has been deprecated. as we are going to pass individual boolean props for each flag.
79
+ * Provide the feature flags to enabled or disabled in the current React tree
66
80
  */
67
- flags: PropTypes.objectOf(PropTypes.bool)
81
+ defaultPortalTargetBody: PropTypes.bool,
82
+ enableDatagridUseCustomizeColumns: PropTypes.bool,
83
+ enableDatagridUseEditableCell: PropTypes.bool,
84
+ enableDatagridUseInlineEdit: PropTypes.bool,
85
+ enableSidepanelResizer: PropTypes.bool,
86
+ enableTestFlagA: PropTypes.bool,
87
+ enableTestFlagB: PropTypes.bool,
88
+ // exampleComponentSecondaryIcon: PropTypes.bool,
89
+ // exampleComponentUseExample: PropTypes.bool,
90
+ flags: deprecateProp(PropTypes.objectOf(PropTypes.bool), 'The `flags` prop for `FeatureFlag` has been deprecated. Please pass the flags directly as props in camelCase')
68
91
  };
69
92
 
70
93
  /**
@@ -99,7 +122,10 @@ function useChangedValue(value, compare, callback) {
99
122
  }
100
123
 
101
124
  /**
102
- * Access whether a given flag is enabled or disabled in a given FeatureFlagContext
125
+ * Access whether a given flag is enabled or disabled in a given
126
+ * FeatureFlagContext
127
+ *
128
+ * @returns {boolean}
103
129
  */
104
130
  function useFeatureFlag(flag) {
105
131
  const scope = useContext(FeatureFlagContext);
@@ -108,6 +134,8 @@ function useFeatureFlag(flag) {
108
134
 
109
135
  /**
110
136
  * Access all feature flag information for the given FeatureFlagContext
137
+ *
138
+ * @returns {FeatureFlagScope}
111
139
  */
112
140
  function useFeatureFlags() {
113
141
  return useContext(FeatureFlagContext);
@@ -118,6 +146,9 @@ function useFeatureFlags() {
118
146
  * comparison since the objects we are comparing are objects with boolean flags
119
147
  * from the flags prop in the `FeatureFlags` component
120
148
  *
149
+ * @param {object} a
150
+ * @param {object} b
151
+ * @returns {boolean}
121
152
  */
122
153
  function isEqual(a, b) {
123
154
  if (a === b) {
@@ -14,7 +14,7 @@ import { pkg } from '../../settings.js';
14
14
  import { Carousel } from '../Carousel/Carousel.js';
15
15
  import '../Carousel/CarouselItem.js';
16
16
 
17
- const InterstitialScreenBody = /*#__PURE__*/React__default.forwardRef(props => {
17
+ const InterstitialScreenBody = /*#__PURE__*/React__default.forwardRef((props, ref) => {
18
18
  const {
19
19
  className = '',
20
20
  contentRenderer,
@@ -75,7 +75,7 @@ const InterstitialScreenBody = /*#__PURE__*/React__default.forwardRef(props => {
75
75
  const onScrollHandler = scrollPercent => setScrollPercent(scrollPercent);
76
76
  const renderBody = () => /*#__PURE__*/React__default.createElement("div", _extends({
77
77
  className: `${blockClass}--body ${className}`,
78
- ref: bodyScrollRef
78
+ ref: bodyScrollRef ?? ref
79
79
  }, rest), /*#__PURE__*/React__default.createElement("div", {
80
80
  className: `${blockClass}--content`
81
81
  }, stepType === 'multi' ? /*#__PURE__*/React__default.createElement("div", {
@@ -86,6 +86,7 @@ const InterstitialScreenBody = /*#__PURE__*/React__default.forwardRef(props => {
86
86
  onScroll: onScrollHandler
87
87
  }, bodyChildrenData)) : stepType === 'single' ? bodyChildrenData : ''));
88
88
  return isFullScreen ? renderBody() : /*#__PURE__*/React__default.createElement(ModalBody, {
89
+ ref: ref,
89
90
  className: bodyBlockClass
90
91
  }, renderBody());
91
92
  });
@@ -15,7 +15,7 @@ import { clamp } from '../../global/js/utils/clamp.js';
15
15
  import { ArrowRight } from '@carbon/react/icons';
16
16
 
17
17
  var _InlineLoading, _InlineLoading2, _InlineLoading3, _InlineLoading4;
18
- const InterstitialScreenFooter = /*#__PURE__*/React__default.forwardRef(props => {
18
+ const InterstitialScreenFooter = /*#__PURE__*/React__default.forwardRef((props, ref) => {
19
19
  const {
20
20
  className = '',
21
21
  skipButtonLabel = 'Skip',
@@ -79,6 +79,7 @@ const InterstitialScreenFooter = /*#__PURE__*/React__default.forwardRef(props =>
79
79
  return {};
80
80
  }, [loadingAction, isMultiStep, progStep, progStepCeil]);
81
81
  const getFooterContent = () => /*#__PURE__*/React__default.createElement("div", {
82
+ ref: ref,
82
83
  className: `${blockClass}--footer ${className}`
83
84
  }, isMultiStep && skipButtonLabel !== '' && /*#__PURE__*/React__default.createElement(Button, {
84
85
  className: `${blockClass}--skip-btn`,
@@ -122,7 +123,9 @@ const InterstitialScreenFooter = /*#__PURE__*/React__default.forwardRef(props =>
122
123
  disableButtonConfig
123
124
  }));
124
125
  }
125
- return isFullScreen ? getFooterContent() : /*#__PURE__*/React__default.createElement(ModalFooter, null, getFooterContent());
126
+ return isFullScreen ? getFooterContent() : /*#__PURE__*/React__default.createElement(ModalFooter, {
127
+ ref: ref
128
+ }, getFooterContent());
126
129
  });
127
130
  InterstitialScreenFooter.propTypes = {
128
131
  /**
@@ -13,7 +13,7 @@ import cx from 'classnames';
13
13
  import { InterstitialScreenContext } from './InterstitialScreen.js';
14
14
  import { useId } from '../../global/js/utils/useId.js';
15
15
 
16
- const InterstitialScreenHeader = /*#__PURE__*/React__default.forwardRef(props => {
16
+ const InterstitialScreenHeader = /*#__PURE__*/React__default.forwardRef((props, ref) => {
17
17
  var _h, _h2;
18
18
  const {
19
19
  className = '',
@@ -58,10 +58,12 @@ const InterstitialScreenHeader = /*#__PURE__*/React__default.forwardRef(props =>
58
58
  }, "Step ", progStep + 1, " of ", stepCount)));
59
59
  };
60
60
  return isFullScreen ? /*#__PURE__*/React__default.createElement("header", {
61
+ ref: ref,
61
62
  className: cx(headerBlockClass, className, {
62
63
  [`${headerBlockClass}--has-title`]: headerTitle || headerSubTitle || children
63
64
  })
64
65
  }, headerContent()) : /*#__PURE__*/React__default.createElement(ModalHeader, {
66
+ ref: ref,
65
67
  className: cx(headerBlockClass, className, {
66
68
  [`${headerBlockClass}--has-title`]: headerTitle || headerSubTitle || children
67
69
  }),
@@ -5,7 +5,7 @@ type overflowAction = {
5
5
  id?: string;
6
6
  itemText?: string;
7
7
  onClick?: (event: MouseEvent) => void;
8
- onKeydown?: (event: KeyboardEvent) => void;
8
+ onKeyDown?: (event: KeyboardEvent) => void;
9
9
  };
10
10
  type PlacementType = 'top' | 'bottom';
11
11
  type ClickZoneType = 'one' | 'two' | 'three';
@@ -10,8 +10,9 @@ import React__default, { useRef, useState, useEffect } from 'react';
10
10
  import PropTypes from '../../_virtual/index.js';
11
11
  import cx from 'classnames';
12
12
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
- import { carbon, pkg } from '../../settings.js';
13
+ import { pkg } from '../../settings.js';
14
14
  import { useIsOverflow, ScrollStates } from './constants.js';
15
+ import { usePrefix } from '@carbon/react';
15
16
  import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
16
17
 
17
18
  const blockClass = `${pkg.prefix}--scroll-gradient`;
@@ -19,7 +20,6 @@ const componentName = 'ScrollGradient';
19
20
 
20
21
  // Default values for props
21
22
  const defaults = {
22
- color: `var(--${carbon.prefix}-layer-01)`,
23
23
  hideStartGradient: false,
24
24
  onScroll: () => {},
25
25
  getScrollElementRef: () => {}
@@ -32,7 +32,7 @@ let ScrollGradient = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
32
32
  let {
33
33
  children,
34
34
  className,
35
- color = defaults.color,
35
+ color,
36
36
  onScroll = defaults.onScroll,
37
37
  scrollElementClassName,
38
38
  getScrollElementRef = defaults.getScrollElementRef,
@@ -43,6 +43,8 @@ let ScrollGradient = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
43
43
  const intersectionEndRef = useRef();
44
44
  const intersectionLeftRef = useRef();
45
45
  const intersectionRightRef = useRef();
46
+ const carbonPrefix = usePrefix();
47
+ const fallbackColor = `var(--${carbonPrefix}-layer-01)`;
46
48
  const scrollContainer = useRef(undefined);
47
49
  const contentChildrenContainer = useRef(undefined);
48
50
  const {
@@ -60,18 +62,18 @@ let ScrollGradient = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
60
62
  useIsomorphicEffect(() => {
61
63
  // start vertical styles
62
64
  startVerticalRef.current.style.right = gradientRight;
63
- startVerticalRef.current.style.backgroundImage = `linear-gradient(0deg, transparent, ${color} 90%)`;
65
+ startVerticalRef.current.style.backgroundImage = `linear-gradient(0deg, transparent, ${color ?? fallbackColor} 90%)`;
64
66
  // start horizontal styles
65
- startHorizontalRef.current.backgroundImage = `linear-gradient(-90deg, transparent, ${color} 90%)`;
67
+ startHorizontalRef.current.backgroundImage = `linear-gradient(-90deg, transparent, ${color ?? fallbackColor} 90%)`;
66
68
  startHorizontalRef.current.bottom = gradientBottom;
67
69
  // end vertical styles
68
70
  endVerticalRef.current.style.right = gradientRight;
69
71
  endVerticalRef.current.style.bottom = gradientBottom;
70
- endVerticalRef.current.style.backgroundImage = `linear-gradient(0deg, ${color} 10%, transparent)`;
72
+ endVerticalRef.current.style.backgroundImage = `linear-gradient(0deg, ${color ?? fallbackColor} 10%, transparent)`;
71
73
  // end horizontal styles
72
74
  endHorizontalRef.current.style.right = gradientRight;
73
75
  endHorizontalRef.current.style.bottom = gradientBottom;
74
- endHorizontalRef.current.style.backgroundImage = `linear-gradient(-90deg, ${color} 10%, transparent)`;
76
+ endHorizontalRef.current.style.backgroundImage = `linear-gradient(-90deg, ${color ?? fallbackColor} 10%, transparent)`;
75
77
  }, [color, gradientRight, gradientBottom]);
76
78
  const setGradientOnIntersection = (entry, gradientRef) => {
77
79
  if (gradientRef.current) {
@@ -8,8 +8,10 @@
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import { ArrowLeft, Close } from '@carbon/react/icons';
10
10
  import { Button, Section, IconButton, Heading } from '@carbon/react';
11
+ import { useFeatureFlag } from '../FeatureFlags/index.js';
11
12
  import React__default, { useState, useRef, useEffect, useCallback } from 'react';
12
13
  import { ActionSet } from '../ActionSet/ActionSet.js';
14
+ import { Resizer } from './resizer/Resizer.js';
13
15
  import PropTypes from '../../_virtual/index.js';
14
16
  import { SIDE_PANEL_SIZES } from './constants.js';
15
17
  import { allPropTypes } from '../../global/js/utils/props-helper.js';
@@ -98,6 +100,9 @@ const SidePanelBase = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
98
100
  } = useFocus(sidePanelRef);
99
101
  const panelRefValue = sidePanelRef.current;
100
102
  const previousOpen = usePreviousValue(open);
103
+ const enableResizer = useFeatureFlag('enableSidepanelResizer');
104
+ const sidePanelWidth = useRef(undefined);
105
+ const accumulatedDeltaRef = useRef(0);
101
106
  const shouldReduceMotion = usePrefersReducedMotion();
102
107
  const exitAnimationName = shouldReduceMotion ? 'side-panel-exit-reduced' : placement === 'right' ? 'side-panel-exit-right' : 'side-panel-exit-left';
103
108
  const {
@@ -111,6 +116,21 @@ const SidePanelBase = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
111
116
  onRequestClose?.();
112
117
  }
113
118
  };
119
+ useEffect(() => {
120
+ if (!enableResizer) {
121
+ return;
122
+ }
123
+ const parentEl = sidePanelRef.current?.parentElement;
124
+ if (parentEl) {
125
+ parentEl.style.removeProperty('--c4p-side-panel-modified-size');
126
+ }
127
+ }, [size, enableResizer, sidePanelRef]);
128
+ useEffect(() => {
129
+ if (!enableResizer) {
130
+ return;
131
+ }
132
+ sidePanelWidth.current = sidePanelRef?.current?.clientWidth;
133
+ }, [sidePanelRef, sidePanelRef?.current?.clientWidth, enableResizer]);
114
134
  useEffect(() => {
115
135
  if (open && !titleRef?.current) {
116
136
  setDoAnimateTitle(false);
@@ -118,6 +138,52 @@ const SidePanelBase = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
118
138
  setDoAnimateTitle(animateTitle);
119
139
  }
120
140
  }, [animateTitle, open]);
141
+ const onResize = useCallback((event, delta) => {
142
+ event.preventDefault();
143
+ event.stopPropagation();
144
+ const setWidth = width => {
145
+ const parentEl = sidePanelRef.current?.parentElement;
146
+ if (parentEl) {
147
+ parentEl.style.setProperty('--c4p-side-panel-modified-size', typeof width === 'number' ? `${width}px` : width);
148
+ }
149
+ };
150
+ if (event.type === 'keydown') {
151
+ const key = event.key;
152
+ switch (key) {
153
+ case 'Home':
154
+ setWidth('75vw');
155
+ break;
156
+ case 'End':
157
+ setWidth(SIDE_PANEL_SIZES['xs']);
158
+ break;
159
+ case 'ArrowLeft':
160
+ case 'ArrowRight':
161
+ accumulatedDeltaRef.current += delta;
162
+ setWidth((sidePanelWidth.current ?? 0) - (placement === 'right' ? accumulatedDeltaRef.current : -accumulatedDeltaRef.current));
163
+ break;
164
+ }
165
+ return;
166
+ }
167
+ if (sidePanelRef.current?.style) {
168
+ sidePanelRef.current.style.transition = 'none';
169
+ }
170
+ setWidth((sidePanelWidth.current ?? 0) - (placement === 'right' ? delta : -delta));
171
+ }, [placement, sidePanelRef, sidePanelWidth]);
172
+ const onResizeEnd = useCallback((_, ref) => {
173
+ accumulatedDeltaRef.current = 0;
174
+ sidePanelRef.current?.style?.removeProperty('transition');
175
+ const percent = Math.round((sidePanelRef.current.clientWidth || 0) / window.innerWidth * 100);
176
+ // custom a11y announcements
177
+ ref.current.setAttribute('aria-label', `side panel is covering ${percent}% of screen`);
178
+ sidePanelWidth.current = sidePanelRef.current?.clientWidth;
179
+ }, [sidePanelRef]);
180
+ const onDoubleClick = useCallback(() => {
181
+ sidePanelWidth.current = Math.min(parseFloat(SIDE_PANEL_SIZES[size]) * 16, window.innerWidth * 0.75);
182
+ const parentEl = sidePanelRef.current?.parentElement;
183
+ if (parentEl) {
184
+ parentEl.style.removeProperty('--c4p-side-panel-modified-size');
185
+ }
186
+ }, [sidePanelRef, size]);
121
187
  const titleItemsStyles = useCallback(progress => {
122
188
  if (subtitleRef?.current) {
123
189
  const subtitleEl = subtitleRef?.current;
@@ -317,6 +383,7 @@ const SidePanelBase = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
317
383
  [`${blockClass}--right-placement`]: placement === 'right',
318
384
  [`${blockClass}--left-placement`]: placement === 'left',
319
385
  [`${blockClass}--slide-in`]: slideIn,
386
+ [`${blockClass}--enable-sidepanel-resizer`]: enableResizer && window.innerWidth > 768,
320
387
  [`${blockClass}--has-decorator`]: decorator,
321
388
  [`${blockClass}--has-slug`]: slug,
322
389
  [`${blockClass}--has-ai-label`]: aiLabel,
@@ -460,6 +527,13 @@ const SidePanelBase = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
460
527
  onAnimationEnd: onAnimationEnd,
461
528
  onAnimationStart: onAnimationStart,
462
529
  onKeyDown: handleKeyDown
530
+ }), !slideIn && enableResizer && window.innerWidth > 768 && /*#__PURE__*/React__default.createElement(Resizer, {
531
+ className: `${blockClass}__resizer`,
532
+ orientation: "vertical",
533
+ "aria-valuenow": sidePanelWidth.current,
534
+ onResize: onResize,
535
+ onResizeEnd: onResizeEnd,
536
+ onDoubleClick: onDoubleClick
463
537
  }), renderHeader(), renderMain(), /*#__PURE__*/React__default.createElement(ActionSet, {
464
538
  actions: actions ?? [],
465
539
  className: primaryActionContainerClassNames,
@@ -1,8 +1,14 @@
1
- export namespace SIDE_PANEL_SIZES {
2
- let xs: string;
3
- let sm: string;
4
- let md: string;
5
- let lg: string;
6
- let xl: string;
7
- let max: string;
8
- }
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2021
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
+ export const SIDE_PANEL_SIZES: {
8
+ xs: string;
9
+ sm: string;
10
+ md: string;
11
+ lg: string;
12
+ xl: string;
13
+ '2xl': string;
14
+ };
@@ -11,7 +11,7 @@ const SIDE_PANEL_SIZES = {
11
11
  md: '30rem',
12
12
  lg: '40rem',
13
13
  xl: '65rem',
14
- max: '75%'
14
+ '2xl': '80rem'
15
15
  };
16
16
 
17
17
  export { SIDE_PANEL_SIZES };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import React from 'react';
10
+ export declare const DEBOUNCE_DELAY = 100;
11
+ /** Primary UI component for user interaction */
12
+ interface ResizerProps {
13
+ orientation: 'horizontal' | 'vertical';
14
+ onResize?: (event: MouseEvent | KeyboardEvent, delta: number) => void;
15
+ onResizeEnd?: (event: MouseEvent | KeyboardEvent, ref: React.RefObject<HTMLDivElement>) => void;
16
+ onDoubleClick?: (event: MouseEvent) => string | void;
17
+ className?: string;
18
+ [key: string]: any;
19
+ }
20
+ export declare const Resizer: React.ForwardRefExoticComponent<Omit<ResizerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
21
+ export default Resizer;