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

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 (38) hide show
  1. package/css/index-full-carbon.css +221 -271
  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 +18 -6
  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 +25 -17
  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 +100 -97
  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 +1 -3
  18. package/es/components/ExportModal/ExportModal.js +1 -3
  19. package/es/components/FeatureFlags/index.d.ts +4 -3
  20. package/es/components/FeatureFlags/index.js +17 -10
  21. package/es/components/PageHeader/PageHeader.d.ts +2 -0
  22. package/es/components/PageHeader/PageHeader.js +4 -1
  23. package/es/components/PageHeader/PageHeaderTitle.d.ts +1 -0
  24. package/es/components/PageHeader/PageHeaderTitle.js +42 -8
  25. package/es/components/Tearsheet/TearsheetShell.js +1 -3
  26. package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +742 -740
  27. package/lib/components/AboutModal/AboutModal.js +1 -3
  28. package/lib/components/ExportModal/ExportModal.js +1 -3
  29. package/lib/components/FeatureFlags/index.d.ts +4 -3
  30. package/lib/components/FeatureFlags/index.js +16 -9
  31. package/lib/components/PageHeader/PageHeader.d.ts +2 -0
  32. package/lib/components/PageHeader/PageHeader.js +4 -1
  33. package/lib/components/PageHeader/PageHeaderTitle.d.ts +1 -0
  34. package/lib/components/PageHeader/PageHeaderTitle.js +39 -5
  35. package/lib/components/Tearsheet/TearsheetShell.js +1 -3
  36. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +742 -740
  37. package/package.json +10 -10
  38. package/scss/components/PageHeader/_page-header.scss +16 -3
@@ -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
  };
@@ -149,6 +149,7 @@ interface TitleIcon {
149
149
  cancelDescription?: string;
150
150
  editDescription?: string;
151
151
  saveDescription?: string;
152
+ tooltipAlignment?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
152
153
  }
153
154
  interface TitleContent {
154
155
  content: ReactNode;
@@ -269,6 +270,7 @@ interface PageHeaderBaseProps extends PropsWithChildren {
269
270
  * - editableLabel: label for edit required if onChange supplied
270
271
  * - cancelDescription: label for edit cancel button
271
272
  * - saveDescription: label for edit save button
273
+ * - tooltipAlignment: position for tooltip displayed for large titles. Default to "bottom"
272
274
  * - Object containing user defined contents. These must fit within the area defined for the title in both main part of the header and the breadcrumb.
273
275
  * - content: title or name of current location shown in main part of page header
274
276
  * - breadcrumbContent: version of content used in the breadcrumb on scroll. If not supplied
@@ -790,6 +790,7 @@ exports.PageHeader.propTypes = _rollupPluginBabelHelpers.objectSpread2({
790
790
  * - editableLabel: label for edit required if onChange supplied
791
791
  * - cancelDescription: label for edit cancel button
792
792
  * - saveDescription: label for edit save button
793
+ * - tooltipAlignment: position for tooltip displayed for large titles. Default to "bottom".
793
794
  * - Object containing user defined contents. These must fit within the area defined for the title in both main part of the header and the breadcrumb.
794
795
  * - content: title or name of current location shown in main part of page header
795
796
  * - breadcrumbContent: version of content used in the breadcrumb on scroll. If not supplied
@@ -814,7 +815,9 @@ exports.PageHeader.propTypes = _rollupPluginBabelHelpers.objectSpread2({
814
815
  //.isRequired.if(editInPlaceRequired),
815
816
  editDescription: index.default.string,
816
817
  // .isRequired.if(editInPlaceRequired),
817
- saveDescription: index.default.string //.isRequired.if(editInPlaceRequired),
818
+ saveDescription: index.default.string,
819
+ //.isRequired.if(editInPlaceRequired),
820
+ tooltipAlignment: index.default.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right'])
818
821
  // Update docgen if changed
819
822
  }), index.default.string, index.default.shape({
820
823
  content: index.default.node.isRequired,
@@ -18,6 +18,7 @@ export namespace PageHeaderTitle {
18
18
  onSave: PropTypes.Requireable<(...args: any[]) => any>;
19
19
  cancelDescription: any;
20
20
  saveDescription: any;
21
+ tooltipAlignment: PropTypes.Requireable<string>;
21
22
  }> | PropTypes.InferProps<{
22
23
  content: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
23
24
  breadcrumbContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -14,7 +14,7 @@ var cx = require('classnames');
14
14
  var react = require('@carbon/react');
15
15
  var EditInPlace = require('../EditInPlace/EditInPlace.js');
16
16
 
17
- var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "onSave", "editDescription", "editableLabel", "cancelDescription", "saveDescription"];
17
+ var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "onSave", "editDescription", "editableLabel", "cancelDescription", "saveDescription", "tooltipAlignment"];
18
18
 
19
19
  /**
20
20
  *
@@ -40,18 +40,41 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
40
40
  editableLabel = title.editableLabel,
41
41
  cancelDescription = title.cancelDescription,
42
42
  saveDescription = title.saveDescription,
43
+ _title$tooltipAlignme = title.tooltipAlignment,
44
+ tooltipAlignment = _title$tooltipAlignme === void 0 ? 'bottom' : _title$tooltipAlignme,
43
45
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(title, _excluded);
44
46
  var titleText;
45
47
  var isEditable = !!onSave;
48
+ var _useState = React.useState(),
49
+ _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
50
+ isEllipsisApplied = _useState2[0],
51
+ setIsEllipsisApplied = _useState2[1];
52
+ var longTitleRef = React.useRef(undefined);
53
+ var titleRef = React.useRef(undefined);
54
+ React.useLayoutEffect(function () {
55
+ setIsEllipsisApplied(isEllipsisActive());
56
+ }, [longTitleRef, titleRef, title]);
57
+ var isEllipsisActive = function isEllipsisActive() {
58
+ if (longTitleRef.current) {
59
+ var _longTitleRef$current, _longTitleRef$current2;
60
+ return ((_longTitleRef$current = longTitleRef.current) === null || _longTitleRef$current === void 0 ? void 0 : _longTitleRef$current.offsetWidth) < ((_longTitleRef$current2 = longTitleRef.current) === null || _longTitleRef$current2 === void 0 ? void 0 : _longTitleRef$current2.scrollWidth);
61
+ } else if (titleRef.current) {
62
+ var _titleRef$current, _titleRef$current2;
63
+ return ((_titleRef$current = titleRef.current) === null || _titleRef$current === void 0 ? void 0 : _titleRef$current.offsetWidth) < ((_titleRef$current2 = titleRef.current) === null || _titleRef$current2 === void 0 ? void 0 : _titleRef$current2.scrollWidth);
64
+ }
65
+ return false;
66
+ };
46
67
  if (text || !content) {
47
68
  if (text === undefined && typeof title === 'string') {
48
69
  text = title;
49
70
  asText = title;
50
71
  }
51
72
  var TitleIcon = icon;
52
- titleInnards = /*#__PURE__*/React.createElement(React.Fragment, null, icon && !loading ? /*#__PURE__*/React.createElement(TitleIcon, {
73
+ titleInnards = /*#__PURE__*/React.createElement(React.Fragment, null, icon && !loading ? /*#__PURE__*/React.createElement("span", {
74
+ className: "".concat(blockClass, "__title-icon-wrapper")
75
+ }, /*#__PURE__*/React.createElement(TitleIcon, {
53
76
  className: "".concat(blockClass, "__title-icon")
54
- }) : null, loading ? /*#__PURE__*/React.createElement(react.SkeletonText, {
77
+ })) : null, loading ? /*#__PURE__*/React.createElement(react.SkeletonText, {
55
78
  className: "".concat(blockClass, "__title-skeleton")
56
79
  }) : isEditable ? /*#__PURE__*/React.createElement(EditInPlace.EditInPlace, _rollupPluginBabelHelpers.extends({
57
80
  tooltipAlignment: "bottom",
@@ -64,7 +87,17 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
64
87
  onSave: onSave,
65
88
  size: "md",
66
89
  inheritTypography: true
67
- }, rest)) : /*#__PURE__*/React.createElement("span", {
90
+ }, rest)) : isEllipsisApplied ? /*#__PURE__*/React.createElement(react.DefinitionTooltip, {
91
+ openOnHover: false,
92
+ align: tooltipAlignment,
93
+ definition: text,
94
+ className: "".concat(blockClass, "__tooltip")
95
+ }, /*#__PURE__*/React.createElement("span", {
96
+ ref: longTitleRef,
97
+ className: "".concat(blockClass, "__titleText")
98
+ }, text)) : /*#__PURE__*/React.createElement("span", {
99
+ ref: titleRef,
100
+ className: "".concat(blockClass, "__titleText"),
68
101
  title: !loading ? asText : null
69
102
  }, text));
70
103
  } else {
@@ -119,7 +152,8 @@ PageHeaderTitle.propTypes = {
119
152
  onChange: index.default.func,
120
153
  onSave: index.default.func,
121
154
  cancelDescription: index.default.string.isRequired.if(editInPlaceRequired),
122
- saveDescription: index.default.string.isRequired.if(editInPlaceRequired)
155
+ saveDescription: index.default.string.isRequired.if(editInPlaceRequired),
156
+ tooltipAlignment: index.default.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right'])
123
157
  // Update docgen if changed
124
158
  }), index.default.string, index.default.shape({
125
159
  content: index.default.node.isRequired,
@@ -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),