@carbon/ibm-products 2.43.2-canary.306 → 2.43.2-canary.307

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.
@@ -71,9 +71,7 @@ exports.AboutModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
71
71
  // eslint-disable-next-line react-hooks/exhaustive-deps
72
72
  }, [open]);
73
73
  return renderPortalUse( /*#__PURE__*/React.createElement(react.unstable_FeatureFlags, {
74
- flags: {
75
- 'enable-experimental-focus-wrap-without-sentinels': true
76
- }
74
+ enableExperimentalFocusWrapWithoutSentinels: true
77
75
  }, /*#__PURE__*/React.createElement(react.ComposedModal, _rollupPluginBabelHelpers.extends({}, rest, {
78
76
  className: cx(blockClass,
79
77
  // Apply the block class to the main HTML element
@@ -129,9 +129,7 @@ exports.ExportModal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
129
129
  onBlur: onBlurHandler
130
130
  }, 'data-modal-primary-focus', true);
131
131
  return renderPortalUse( /*#__PURE__*/React.createElement(react.unstable_FeatureFlags, {
132
- flags: {
133
- 'enable-experimental-focus-wrap-without-sentinels': true
134
- }
132
+ enableExperimentalFocusWrapWithoutSentinels: true
135
133
  }, /*#__PURE__*/React.createElement(react.ComposedModal, _rollupPluginBabelHelpers.extends({}, rest, {
136
134
  className: cx(blockClass, className),
137
135
  "aria-label": title,
@@ -12,11 +12,12 @@ import PropTypes from 'prop-types';
12
12
  */
13
13
  declare const FeatureFlagContext: React.Context<any>;
14
14
  /**
15
- * Supports an object of feature flag values with the `flags` prop, merging them
15
+ * Supports individual feature flag values as props, merging them
16
16
  * along with the current `FeatureFlagContext` to provide consumers to check if
17
17
  * a feature flag is enabled or disabled in a given React tree
18
18
  */
19
- declare function FeatureFlags({ children, flags }: {
19
+ declare function FeatureFlags({ children, flags, ...newFlags }: {
20
+ [x: string]: any;
20
21
  children: any;
21
22
  flags?: {} | undefined;
22
23
  }): React.JSX.Element;
@@ -24,7 +25,7 @@ declare namespace FeatureFlags {
24
25
  var propTypes: {
25
26
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
26
27
  /**
27
- * Provide the feature flags to enabled or disabled in the current React tree
28
+ * 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.
28
29
  */
29
30
  flags: PropTypes.Requireable<{
30
31
  [x: string]: boolean | null | undefined;
@@ -12,6 +12,8 @@ var React = require('react');
12
12
  var index = require('../../_virtual/index.js');
13
13
  var FeatureFlags$1 = require('@carbon/feature-flags');
14
14
 
15
+ var _excluded = ["children", "flags"];
16
+
15
17
  /**
16
18
  * Our FeatureFlagContext is used alongside the FeatureFlags component to enable
17
19
  * or disable feature flags in a given React tree
@@ -19,21 +21,27 @@ var FeatureFlags$1 = require('@carbon/feature-flags');
19
21
  var FeatureFlagContext = /*#__PURE__*/React.createContext(FeatureFlags$1.FeatureFlags);
20
22
 
21
23
  /**
22
- * Supports an object of feature flag values with the `flags` prop, merging them
24
+ * Supports individual feature flag values as props, merging them
23
25
  * along with the current `FeatureFlagContext` to provide consumers to check if
24
26
  * a feature flag is enabled or disabled in a given React tree
25
27
  */
26
28
  function FeatureFlags(_ref) {
27
29
  var children = _ref.children,
28
30
  _ref$flags = _ref.flags,
29
- flags = _ref$flags === void 0 ? {} : _ref$flags;
31
+ flags = _ref$flags === void 0 ? {} : _ref$flags,
32
+ newFlags = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
30
33
  var parentScope = React.useContext(FeatureFlagContext);
34
+ var newFlagsObject = Object.keys(newFlags).reduce(function (acc, key) {
35
+ acc[key] = newFlags[key];
36
+ return acc;
37
+ }, {});
38
+ var combinedFlags = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, newFlagsObject), flags);
31
39
  var _useState = React.useState(parentScope),
32
40
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
33
41
  prevParentScope = _useState2[0],
34
42
  setPrevParentScope = _useState2[1];
35
43
  var _useState3 = React.useState(function () {
36
- var scope = FeatureFlags$1.createScope(flags);
44
+ var scope = FeatureFlags$1.createScope(combinedFlags);
37
45
  scope.mergeWithScope(parentScope);
38
46
  return scope;
39
47
  }),
@@ -41,16 +49,15 @@ function FeatureFlags(_ref) {
41
49
  scope = _useState4[0],
42
50
  updateScope = _useState4[1];
43
51
  if (parentScope !== prevParentScope) {
44
- var _scope = FeatureFlags$1.createScope(flags);
52
+ var _scope = FeatureFlags$1.createScope(combinedFlags);
45
53
  _scope.mergeWithScope(parentScope);
46
54
  updateScope(_scope);
47
55
  setPrevParentScope(parentScope);
48
56
  }
49
57
 
50
- // We use a custom hook to detect if any of the keys or their values change
51
- // for flags that are passed in. If they have changed, then we re-create the
52
- // FeatureFlagScope using the new flags
53
- useChangedValue(flags, isEqual, function (changedFlags) {
58
+ // We use a custom hook to detect if any of the individual flag props or their values change
59
+ // If any flags have changed, we re-create the FeatureFlagScope using the updated flags
60
+ useChangedValue(combinedFlags, isEqual, function (changedFlags) {
54
61
  var scope = FeatureFlags$1.createScope(changedFlags);
55
62
  scope.mergeWithScope(parentScope);
56
63
  updateScope(scope);
@@ -62,7 +69,7 @@ function FeatureFlags(_ref) {
62
69
  FeatureFlags.propTypes = {
63
70
  children: index.default.node,
64
71
  /**
65
- * Provide the feature flags to enabled or disabled in the current React tree
72
+ * 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.
66
73
  */
67
74
  flags: index.default.objectOf(index.default.bool)
68
75
  };
@@ -262,9 +262,7 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
262
262
  return _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), (width - 32) / width), "--".concat(bc, "--stacking-scale-factor-double"), (width - 64) / width);
263
263
  };
264
264
  return renderPortalUse( /*#__PURE__*/React.createElement(react.unstable_FeatureFlags, {
265
- flags: {
266
- 'enable-experimental-focus-wrap-without-sentinels': true
267
- }
265
+ enableExperimentalFocusWrapWithoutSentinels: true
268
266
  }, /*#__PURE__*/React.createElement(react.ComposedModal, _rollupPluginBabelHelpers.extends({}, rest, {
269
267
  "aria-label": ariaLabel || getNodeTextContent.getNodeTextContent(title),
270
268
  className: cx(bc, className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "--stacked-").concat(position, "-of-").concat(depth),