@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
@@ -5,11 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useContext, useState, useRef, useEffect, createContext } from 'react';
10
10
  import PropTypes from '../../_virtual/index.js';
11
11
  import { createScope, FeatureFlags as FeatureFlags$1 } from '@carbon/feature-flags';
12
12
 
13
+ var _excluded = ["children", "flags"];
14
+
13
15
  /**
14
16
  * Our FeatureFlagContext is used alongside the FeatureFlags component to enable
15
17
  * or disable feature flags in a given React tree
@@ -17,21 +19,27 @@ import { createScope, FeatureFlags as FeatureFlags$1 } from '@carbon/feature-fla
17
19
  var FeatureFlagContext = /*#__PURE__*/createContext(FeatureFlags$1);
18
20
 
19
21
  /**
20
- * Supports an object of feature flag values with the `flags` prop, merging them
22
+ * Supports individual feature flag values as props, merging them
21
23
  * along with the current `FeatureFlagContext` to provide consumers to check if
22
24
  * a feature flag is enabled or disabled in a given React tree
23
25
  */
24
26
  function FeatureFlags(_ref) {
25
27
  var children = _ref.children,
26
28
  _ref$flags = _ref.flags,
27
- flags = _ref$flags === void 0 ? {} : _ref$flags;
29
+ flags = _ref$flags === void 0 ? {} : _ref$flags,
30
+ newFlags = _objectWithoutProperties(_ref, _excluded);
28
31
  var parentScope = useContext(FeatureFlagContext);
32
+ var newFlagsObject = Object.keys(newFlags).reduce(function (acc, key) {
33
+ acc[key] = newFlags[key];
34
+ return acc;
35
+ }, {});
36
+ var combinedFlags = _objectSpread2(_objectSpread2({}, newFlagsObject), flags);
29
37
  var _useState = useState(parentScope),
30
38
  _useState2 = _slicedToArray(_useState, 2),
31
39
  prevParentScope = _useState2[0],
32
40
  setPrevParentScope = _useState2[1];
33
41
  var _useState3 = useState(function () {
34
- var scope = createScope(flags);
42
+ var scope = createScope(combinedFlags);
35
43
  scope.mergeWithScope(parentScope);
36
44
  return scope;
37
45
  }),
@@ -39,16 +47,15 @@ function FeatureFlags(_ref) {
39
47
  scope = _useState4[0],
40
48
  updateScope = _useState4[1];
41
49
  if (parentScope !== prevParentScope) {
42
- var _scope = createScope(flags);
50
+ var _scope = createScope(combinedFlags);
43
51
  _scope.mergeWithScope(parentScope);
44
52
  updateScope(_scope);
45
53
  setPrevParentScope(parentScope);
46
54
  }
47
55
 
48
- // We use a custom hook to detect if any of the keys or their values change
49
- // for flags that are passed in. If they have changed, then we re-create the
50
- // FeatureFlagScope using the new flags
51
- useChangedValue(flags, isEqual, function (changedFlags) {
56
+ // We use a custom hook to detect if any of the individual flag props or their values change
57
+ // If any flags have changed, we re-create the FeatureFlagScope using the updated flags
58
+ useChangedValue(combinedFlags, isEqual, function (changedFlags) {
52
59
  var scope = createScope(changedFlags);
53
60
  scope.mergeWithScope(parentScope);
54
61
  updateScope(scope);
@@ -60,7 +67,7 @@ function FeatureFlags(_ref) {
60
67
  FeatureFlags.propTypes = {
61
68
  children: PropTypes.node,
62
69
  /**
63
- * Provide the feature flags to enabled or disabled in the current React tree
70
+ * 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.
64
71
  */
65
72
  flags: PropTypes.objectOf(PropTypes.bool)
66
73
  };
@@ -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
@@ -788,6 +788,7 @@ PageHeader.propTypes = _objectSpread2({
788
788
  * - editableLabel: label for edit required if onChange supplied
789
789
  * - cancelDescription: label for edit cancel button
790
790
  * - saveDescription: label for edit save button
791
+ * - tooltipAlignment: position for tooltip displayed for large titles. Default to "bottom".
791
792
  * - 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.
792
793
  * - content: title or name of current location shown in main part of page header
793
794
  * - breadcrumbContent: version of content used in the breadcrumb on scroll. If not supplied
@@ -812,7 +813,9 @@ PageHeader.propTypes = _objectSpread2({
812
813
  //.isRequired.if(editInPlaceRequired),
813
814
  editDescription: PropTypes.string,
814
815
  // .isRequired.if(editInPlaceRequired),
815
- saveDescription: PropTypes.string //.isRequired.if(editInPlaceRequired),
816
+ saveDescription: PropTypes.string,
817
+ //.isRequired.if(editInPlaceRequired),
818
+ tooltipAlignment: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right'])
816
819
  // Update docgen if changed
817
820
  }), PropTypes.string, PropTypes.shape({
818
821
  content: PropTypes.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>;
@@ -5,14 +5,14 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default from 'react';
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useState, useRef, useLayoutEffect } from 'react';
10
10
  import PropTypes from '../../_virtual/index.js';
11
11
  import cx from 'classnames';
12
- import { SkeletonText } from '@carbon/react';
12
+ import { SkeletonText, DefinitionTooltip } from '@carbon/react';
13
13
  import { EditInPlace } from '../EditInPlace/EditInPlace.js';
14
14
 
15
- var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "onSave", "editDescription", "editableLabel", "cancelDescription", "saveDescription"];
15
+ var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "onSave", "editDescription", "editableLabel", "cancelDescription", "saveDescription", "tooltipAlignment"];
16
16
 
17
17
  /**
18
18
  *
@@ -38,18 +38,41 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
38
38
  editableLabel = title.editableLabel,
39
39
  cancelDescription = title.cancelDescription,
40
40
  saveDescription = title.saveDescription,
41
+ _title$tooltipAlignme = title.tooltipAlignment,
42
+ tooltipAlignment = _title$tooltipAlignme === void 0 ? 'bottom' : _title$tooltipAlignme,
41
43
  rest = _objectWithoutProperties(title, _excluded);
42
44
  var titleText;
43
45
  var isEditable = !!onSave;
46
+ var _useState = useState(),
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ isEllipsisApplied = _useState2[0],
49
+ setIsEllipsisApplied = _useState2[1];
50
+ var longTitleRef = useRef(undefined);
51
+ var titleRef = useRef(undefined);
52
+ useLayoutEffect(function () {
53
+ setIsEllipsisApplied(isEllipsisActive());
54
+ }, [longTitleRef, titleRef, title]);
55
+ var isEllipsisActive = function isEllipsisActive() {
56
+ if (longTitleRef.current) {
57
+ var _longTitleRef$current, _longTitleRef$current2;
58
+ 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);
59
+ } else if (titleRef.current) {
60
+ var _titleRef$current, _titleRef$current2;
61
+ 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);
62
+ }
63
+ return false;
64
+ };
44
65
  if (text || !content) {
45
66
  if (text === undefined && typeof title === 'string') {
46
67
  text = title;
47
68
  asText = title;
48
69
  }
49
70
  var TitleIcon = icon;
50
- titleInnards = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, icon && !loading ? /*#__PURE__*/React__default.createElement(TitleIcon, {
71
+ titleInnards = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, icon && !loading ? /*#__PURE__*/React__default.createElement("span", {
72
+ className: "".concat(blockClass, "__title-icon-wrapper")
73
+ }, /*#__PURE__*/React__default.createElement(TitleIcon, {
51
74
  className: "".concat(blockClass, "__title-icon")
52
- }) : null, loading ? /*#__PURE__*/React__default.createElement(SkeletonText, {
75
+ })) : null, loading ? /*#__PURE__*/React__default.createElement(SkeletonText, {
53
76
  className: "".concat(blockClass, "__title-skeleton")
54
77
  }) : isEditable ? /*#__PURE__*/React__default.createElement(EditInPlace, _extends({
55
78
  tooltipAlignment: "bottom",
@@ -62,7 +85,17 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
62
85
  onSave: onSave,
63
86
  size: "md",
64
87
  inheritTypography: true
65
- }, rest)) : /*#__PURE__*/React__default.createElement("span", {
88
+ }, rest)) : isEllipsisApplied ? /*#__PURE__*/React__default.createElement(DefinitionTooltip, {
89
+ openOnHover: false,
90
+ align: tooltipAlignment,
91
+ definition: text,
92
+ className: "".concat(blockClass, "__tooltip")
93
+ }, /*#__PURE__*/React__default.createElement("span", {
94
+ ref: longTitleRef,
95
+ className: "".concat(blockClass, "__titleText")
96
+ }, text)) : /*#__PURE__*/React__default.createElement("span", {
97
+ ref: titleRef,
98
+ className: "".concat(blockClass, "__titleText"),
66
99
  title: !loading ? asText : null
67
100
  }, text));
68
101
  } else {
@@ -117,7 +150,8 @@ PageHeaderTitle.propTypes = {
117
150
  onChange: PropTypes.func,
118
151
  onSave: PropTypes.func,
119
152
  cancelDescription: PropTypes.string.isRequired.if(editInPlaceRequired),
120
- saveDescription: PropTypes.string.isRequired.if(editInPlaceRequired)
153
+ saveDescription: PropTypes.string.isRequired.if(editInPlaceRequired),
154
+ tooltipAlignment: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right'])
121
155
  // Update docgen if changed
122
156
  }), PropTypes.string, PropTypes.shape({
123
157
  content: PropTypes.node.isRequired,
@@ -260,9 +260,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
260
260
  return _defineProperty(_defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), (width - 32) / width), "--".concat(bc, "--stacking-scale-factor-double"), (width - 64) / width);
261
261
  };
262
262
  return renderPortalUse( /*#__PURE__*/React__default.createElement(unstable_FeatureFlags, {
263
- flags: {
264
- 'enable-experimental-focus-wrap-without-sentinels': true
265
- }
263
+ enableExperimentalFocusWrapWithoutSentinels: true
266
264
  }, /*#__PURE__*/React__default.createElement(ComposedModal, _extends({}, rest, {
267
265
  "aria-label": ariaLabel || getNodeTextContent(title),
268
266
  className: cx(bc, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(bc, "--stacked-").concat(position, "-of-").concat(depth),