@carbon/ibm-products 2.0.0-rc.3 → 2.0.0-rc.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. package/css/index-full-carbon.css +63 -157
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -9
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +8 -151
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +3 -9
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +63 -157
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +3 -9
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +63 -157
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +3 -9
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/AddSelect/AddSelectBody.js +2 -2
  18. package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +2 -2
  19. package/es/components/Datagrid/Datagrid/DatagridContent.js +9 -4
  20. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +2 -1
  21. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +3 -0
  22. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +10 -9
  23. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +1 -2
  24. package/es/components/Datagrid/useInfiniteScroll.js +5 -2
  25. package/es/components/Datagrid/utils/getArgTypes.js +4 -0
  26. package/es/components/EditUpdateCards/EditUpdateCards.js +144 -0
  27. package/es/components/EditUpdateCards/index.js +7 -0
  28. package/es/components/PageHeader/PageHeaderTitle.js +3 -1
  29. package/es/components/SidePanel/SidePanel.js +44 -51
  30. package/es/components/SidePanel/motion/variants.js +45 -0
  31. package/es/components/index.js +2 -1
  32. package/es/global/js/package-settings.js +2 -1
  33. package/es/global/js/utils/getBezierValues.js +20 -0
  34. package/es/global/js/utils/motionConstants.js +45 -0
  35. package/lib/components/AddSelect/AddSelectBody.js +2 -2
  36. package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +2 -2
  37. package/lib/components/Datagrid/Datagrid/DatagridContent.js +8 -3
  38. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +2 -1
  39. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +3 -0
  40. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +9 -8
  41. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +1 -2
  42. package/lib/components/Datagrid/useInfiniteScroll.js +5 -2
  43. package/lib/components/Datagrid/utils/getArgTypes.js +4 -0
  44. package/lib/components/EditUpdateCards/EditUpdateCards.js +152 -0
  45. package/lib/components/EditUpdateCards/index.js +13 -0
  46. package/lib/components/PageHeader/PageHeaderTitle.js +3 -1
  47. package/lib/components/SidePanel/SidePanel.js +45 -50
  48. package/lib/components/SidePanel/motion/variants.js +55 -0
  49. package/lib/components/index.js +9 -1
  50. package/lib/global/js/package-settings.js +2 -1
  51. package/lib/global/js/utils/getBezierValues.js +29 -0
  52. package/lib/global/js/utils/motionConstants.js +55 -0
  53. package/package.json +5 -3
  54. package/scss/components/AddSelect/_add-select.scss +2 -2
  55. package/scss/components/Datagrid/_storybook-styles.scss +4 -0
  56. package/scss/components/Datagrid/styles/_useInlineEdit.scss +20 -5
  57. package/scss/components/Datagrid/styles/addons/_CustomizeColumnsModal.scss +2 -0
  58. package/scss/components/EditUpdateCards/_carbon-imports.scss +9 -0
  59. package/scss/components/EditUpdateCards/_edit-update-cards.scss +85 -0
  60. package/scss/components/EditUpdateCards/_index-with-carbon.scss +9 -0
  61. package/scss/components/EditUpdateCards/_index.scss +8 -0
  62. package/scss/components/EditUpdateCards/_storybook-styles.scss +55 -0
  63. package/scss/components/PageHeader/_page-header.scss +4 -0
  64. package/scss/components/SidePanel/_side-panel.scss +2 -78
  65. package/scss/components/SidePanel/_storybook-styles.scss +6 -1
  66. package/scss/components/_index-with-carbon.scss +1 -0
  67. package/scss/components/_index.scss +1 -0
@@ -159,8 +159,7 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
159
159
  primaryButtonDisabled: !isDirty,
160
160
  onRequestClose: onRequestClose,
161
161
  onRequestSubmit: onRequestSubmit,
162
- size: "sm",
163
- hasForm: true
162
+ size: "sm"
164
163
  }, /*#__PURE__*/_react.default.createElement("div", {
165
164
  className: "".concat(blockClass, "__customize-columns-instructions")
166
165
  }, instructionsLabel), /*#__PURE__*/_react.default.createElement(_Actions.default, {
@@ -30,7 +30,10 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
30
30
  var isFetching = instance.isFetching,
31
31
  tableHeight = instance.tableHeight,
32
32
  innerListRef = instance.innerListRef,
33
- fetchMoreData = instance.fetchMoreData;
33
+ fetchMoreData = instance.fetchMoreData,
34
+ tableId = instance.tableId;
35
+ var tableElement = document.querySelector("#".concat(tableId));
36
+ var totalTableHeight = tableHeight || (tableElement === null || tableElement === void 0 ? void 0 : tableElement.clientHeight);
34
37
  var loadMoreThreshold = 200;
35
38
 
36
39
  var emptyFetchData = function emptyFetchData() {}; // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -46,7 +49,7 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
46
49
  scrollOffset = _ref.scrollOffset;
47
50
 
48
51
  if (innerListRef && innerListRef.current) {
49
- if (!isFetching && scrollDirection === 'forward' && scrollOffset + tableHeight >= innerListRef.current.clientHeight - loadMoreThreshold) {
52
+ if (!isFetching && scrollDirection === 'forward' && scrollOffset + totalTableHeight >= innerListRef.current.clientHeight - loadMoreThreshold) {
50
53
  if (fetchMoreData) {
51
54
  fetchMore();
52
55
  }
@@ -88,6 +88,10 @@ var ARG_TYPES = {
88
88
  type: 'number'
89
89
  },
90
90
  description: 'This value controls the height of the expanded content area. _This value is set/passed inside of the `datagridState` object._'
91
+ },
92
+ customizeColumnsProps: {
93
+ control: 'object',
94
+ description: 'This is an object containing all of the props used with the column customization extension. _This value is set/passed inside of the `datagridState` object._'
91
95
  }
92
96
  };
93
97
  exports.ARG_TYPES = ARG_TYPES;
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.EditUpdateCards = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
+
16
+ var _react = _interopRequireDefault(require("react"));
17
+
18
+ var _propTypes = _interopRequireDefault(require("prop-types"));
19
+
20
+ var _classnames = _interopRequireDefault(require("classnames"));
21
+
22
+ var _devtools = require("../../global/js/utils/devtools");
23
+
24
+ var _settings = require("../../settings");
25
+
26
+ var _ProductiveCard = require("../ProductiveCard");
27
+
28
+ var _excluded = ["actionIcons", "actionsPlacement", "className", "description", "editChildren", "editMode", "label", "previewChildren", "title", "titleSize"];
29
+ // import { children } from 'cheerio/lib/api/traversing';
30
+ // Carbon and package components we use.
31
+
32
+ /* TODO: @import(s) of carbon components and other package components. */
33
+ // The block part of our conventional BEM class names (blockClass__E--M).
34
+ var blockClass = "".concat(_settings.pkg.prefix, "--edit-update-cards");
35
+ var componentName = 'EditUpdateCards'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
36
+ // Default values can be included here and then assigned to the prop params,
37
+ // e.g. prop = defaults.prop,
38
+ // This gathers default values together neatly and ensures non-primitive
39
+ // values are initialized early to avoid react making unnecessary re-renders.
40
+ // Note that default values are not required for props that are 'required',
41
+ // nor for props where the component can apply undefined values reasonably.
42
+ // Default values should be provided when the component needs to make a choice
43
+ // or assumption when a prop is not supplied.
44
+ // Default values for props
45
+ // const defaults = {
46
+ // /* TODO: add defaults for relevant props if needed */
47
+ // };
48
+
49
+ /**
50
+ * TODO: A description of the component.
51
+ */
52
+
53
+ var EditUpdateCards = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
54
+ var actionIcons = _ref.actionIcons,
55
+ actionsPlacement = _ref.actionsPlacement,
56
+ className = _ref.className,
57
+ description = _ref.description,
58
+ editChildren = _ref.editChildren,
59
+ editMode = _ref.editMode,
60
+ label = _ref.label,
61
+ previewChildren = _ref.previewChildren,
62
+ title = _ref.title,
63
+ titleSize = _ref.titleSize,
64
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
65
+ // const [editMode, setEditMode] = useState(false);
66
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
67
+ className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
68
+ className, // Apply any supplied class names to the main HTML element.
69
+ // example: `${blockClass}__template-string-class-${kind}-n-${size}`,
70
+ (0, _defineProperty2.default)({}, "".concat(blockClass, "__actions-bottom"), actionsPlacement === 'bottom')),
71
+ ref: ref,
72
+ role: "main"
73
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_ProductiveCard.ProductiveCard, {
74
+ actionIcons: actionIcons,
75
+ actionsPlacement: actionsPlacement,
76
+ className: className,
77
+ description: description,
78
+ label: label,
79
+ title: title,
80
+ titleSize: titleSize
81
+ }, editMode === false && /*#__PURE__*/_react.default.createElement("div", null, previewChildren), editMode && /*#__PURE__*/_react.default.createElement("div", null, editChildren)));
82
+ }); // Return a placeholder if not released and not enabled by feature flag
83
+
84
+
85
+ exports.EditUpdateCards = EditUpdateCards;
86
+ exports.EditUpdateCards = EditUpdateCards = _settings.pkg.checkComponentEnabled(EditUpdateCards, componentName); // The display name of the component, used by React. Note that displayName
87
+ // is used in preference to relying on function.name.
88
+
89
+ EditUpdateCards.displayName = componentName; // The types and DocGen commentary for the component props,
90
+ // in alphabetical order (for consistency).
91
+ // See https://www.npmjs.com/package/prop-types#usage.
92
+
93
+ EditUpdateCards.propTypes = {
94
+ /**
95
+ * Icons that are displayed on card. Refer to design documentation for implementation guidelines
96
+ */
97
+ actionIcons: _propTypes.default.arrayOf(_propTypes.default.shape({
98
+ id: _propTypes.default.string,
99
+ icon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
100
+ onKeyDown: _propTypes.default.func,
101
+ onClick: _propTypes.default.func,
102
+ iconDescription: _propTypes.default.string,
103
+ href: _propTypes.default.string
104
+ })),
105
+
106
+ /**
107
+ * Determines if the action icons are on the top or bottom of the card
108
+ */
109
+ actionsPlacement: _propTypes.default.oneOf(['top', 'bottom']),
110
+
111
+ /**
112
+ * Optional label for the top of the card.
113
+ */
114
+ className: _propTypes.default.string,
115
+
116
+ /**
117
+ * Optional header description
118
+ */
119
+ description: _propTypes.default.string,
120
+
121
+ /**
122
+ * Edit mode children
123
+ */
124
+ editChildren: _propTypes.default.node,
125
+
126
+ /**
127
+ * Edit mode
128
+ */
129
+ editMode: _propTypes.default.bool,
130
+
131
+ /**
132
+ * Optional label for the top of the card
133
+ */
134
+ label: _propTypes.default.string,
135
+
136
+ /**
137
+ * Preview mode children
138
+ */
139
+ previewChildren: _propTypes.default.node,
140
+
141
+ /**
142
+ * Title that's displayed at the top of the card
143
+ */
144
+ title: _propTypes.default.string,
145
+
146
+ /**
147
+ * Determines title size
148
+ */
149
+ titleSize: _propTypes.default.oneOf(['default', 'large'])
150
+ /* TODO: add types and DocGen for all props. */
151
+
152
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "EditUpdateCards", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _EditUpdateCards.EditUpdateCards;
10
+ }
11
+ });
12
+
13
+ var _EditUpdateCards = require("./EditUpdateCards");
@@ -84,7 +84,9 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
84
84
  return /*#__PURE__*/_react.default.createElement("div", {
85
85
  className: (0, _classnames.default)("".concat(blockClass, "__title"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__title--editable"), isEditable), (0, _defineProperty2.default)({}, "".concat(blockClass, "__title--fades"), hasBreadcrumbRow)),
86
86
  title: titleText
87
- }, titleInnards);
87
+ }, /*#__PURE__*/_react.default.createElement("h1", {
88
+ className: "".concat(blockClass, "__title-wrapper")
89
+ }, titleInnards));
88
90
  };
89
91
 
90
92
  exports.PageHeaderTitle = PageHeaderTitle;
@@ -19,6 +19,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
 
22
+ var _framerMotion = require("framer-motion");
23
+
22
24
  var _propTypes = _interopRequireDefault(require("prop-types"));
23
25
 
24
26
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -45,6 +47,8 @@ var _icons = require("@carbon/react/icons");
45
47
 
46
48
  var _ActionSet = require("../ActionSet");
47
49
 
50
+ var _variants = require("./motion/variants");
51
+
48
52
  var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "subtitle", "title"],
49
53
  _excluded2 = ["label", "kind", "icon", "leading", "disabled", "className", "onClick"];
50
54
 
@@ -106,20 +110,15 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
106
110
  title = _ref.title,
107
111
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
108
112
 
109
- var _useState = (0, _react.useState)(open),
113
+ var _useState = (0, _react.useState)(false),
110
114
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
111
- shouldRender = _useState2[0],
112
- setRender = _useState2[1];
115
+ animationComplete = _useState2[0],
116
+ setAnimationComplete = _useState2[1];
113
117
 
114
- var _useState3 = (0, _react.useState)(false),
118
+ var _useState3 = (0, _react.useState)(0),
115
119
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
116
- animationComplete = _useState4[0],
117
- setAnimationComplete = _useState4[1];
118
-
119
- var _useState5 = (0, _react.useState)(0),
120
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
121
- panelHeight = _useState6[0],
122
- setPanelHeight = _useState6[1];
120
+ panelHeight = _useState4[0],
121
+ setPanelHeight = _useState4[1];
123
122
 
124
123
  var sidePanelRef = (0, _react.useRef)();
125
124
  var sidePanelOverlayRef = (0, _react.useRef)();
@@ -149,8 +148,10 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
149
148
  // height css custom property
150
149
 
151
150
  if ((previousState === null || previousState === void 0 ? void 0 : previousState.size) !== size) {
151
+ var _sidePanelOuter$style;
152
+
152
153
  scrollableSection.scrollTop = 0;
153
- sidePanelOuter.style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
154
+ sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : (_sidePanelOuter$style = sidePanelOuter.style) === null || _sidePanelOuter$style === void 0 ? void 0 : _sidePanelOuter$style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
154
155
  }
155
156
  }
156
157
  }, [currentStep, ref, size, previousState === null || previousState === void 0 ? void 0 : previousState.size]); // set initial focus when side panel opens
@@ -178,12 +179,14 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
178
179
  }, [selectorPrimaryFocus, open, animationComplete]);
179
180
  (0, _react.useEffect)(function () {
180
181
  if (open && actions && actions.length && animationComplete) {
182
+ var _sidePanelOuter$style2;
183
+
181
184
  var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
182
185
  var actionsContainer = getActionsContainerElement();
183
186
  var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
184
187
 
185
188
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
186
- sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : sidePanelOuter.style.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
189
+ sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : (_sidePanelOuter$style2 = sidePanelOuter.style) === null || _sidePanelOuter$style2 === void 0 ? void 0 : _sidePanelOuter$style2.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
187
190
  }
188
191
  }, [actions, condensedActions, open, animationComplete]); // Add console warning if labelText is provided without a title.
189
192
  // This combination is not allowed.
@@ -196,13 +199,15 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
196
199
  /* istanbul ignore next */
197
200
 
198
201
  var handleResize = function handleResize(width, height) {
202
+ var _sidePanelOuter$style3;
203
+
199
204
  setPanelHeight(height);
200
205
  var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
201
206
  var actionsContainer = getActionsContainerElement();
202
- var actionsHeight = actionsContainer.offsetHeight + 16; // add additional 1rem spacing to bottom padding
207
+ var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
203
208
 
204
209
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
205
- sidePanelOuter.style.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
210
+ sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : (_sidePanelOuter$style3 = sidePanelOuter.style) === null || _sidePanelOuter$style3 === void 0 ? void 0 : _sidePanelOuter$style3.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
206
211
  };
207
212
 
208
213
  var getActionsContainerElement = function getActionsContainerElement() {
@@ -287,7 +292,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
287
292
  });
288
293
  }
289
294
 
290
- if (open && shouldRender && !animateTitle) {
295
+ if (open && !animateTitle) {
291
296
  var _sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
292
297
 
293
298
  var _sidePanelTitleElement = document.querySelector(".".concat(blockClass, "__title-container .").concat(blockClass, "__title-text"));
@@ -308,7 +313,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
308
313
  _sidePanelOuter === null || _sidePanelOuter === void 0 ? void 0 : _sidePanelOuter.style.setProperty("--".concat(blockClass, "--action-bar-container-height"), "".concat(sidePanelActionBarElementHeight, "px"));
309
314
  _sidePanelOuter === null || _sidePanelOuter === void 0 ? void 0 : _sidePanelOuter.style.setProperty("--".concat(blockClass, "--label-text-height"), "".concat(labelHeight, "px"));
310
315
  }
311
- }, [open, animateTitle, animationComplete, shouldRender, panelHeight, title, size, reducedMotion.matches]); // click outside functionality if `includeOverlay` prop is set
316
+ }, [open, animateTitle, animationComplete, panelHeight, title, size, reducedMotion.matches]); // click outside functionality if `includeOverlay` prop is set
312
317
 
313
318
  (0, _react.useEffect)(function () {
314
319
  var handleOutsideClick = function handleOutsideClick(event) {
@@ -334,18 +339,11 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
334
339
  return function () {
335
340
  document.removeEventListener('click', handleOutsideClick);
336
341
  };
337
- }, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, ref, onUnmount]); // initialize the side panel to open
338
-
339
- (0, _react.useEffect)(function () {
340
- if (open) {
341
- setRender(true);
342
- }
343
- }, [open]); // initializes the side panel to close
342
+ }, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, ref, onUnmount]); // initializes the side panel to close
344
343
 
345
344
  var onAnimationEnd = function onAnimationEnd() {
346
345
  if (!open) {
347
346
  onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
348
- setRender(false);
349
347
  }
350
348
 
351
349
  setAnimationComplete(true);
@@ -359,13 +357,8 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
359
357
  }
360
358
  }, [reducedMotion.matches]); // initializes the side panel to open
361
359
 
362
- var _onAnimationStart = function onAnimationStart(event) {
363
- event.persist();
364
- var isPanelTarget = event.target.id === "".concat(blockClass, "-outer");
365
-
366
- if (isPanelTarget) {
367
- setAnimationComplete(false);
368
- }
360
+ var _onAnimationStart = function onAnimationStart() {
361
+ setAnimationComplete(false);
369
362
  }; // used to reset margins of the slide in panel when closed/closing
370
363
 
371
364
 
@@ -382,13 +375,12 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
382
375
  }, [open, placement, selectorPageContent, slideIn]);
383
376
  (0, _react.useEffect)(function () {
384
377
  if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion.matches) {
385
- setRender(false);
386
378
  onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
387
379
  }
388
380
  }, [open, onUnmount, reducedMotion.matches, previousState === null || previousState === void 0 ? void 0 : previousState.open]); // used to set margins of content for slide in panel version
389
381
 
390
382
  (0, _react.useEffect)(function () {
391
- if (shouldRender && slideIn) {
383
+ if (open && slideIn) {
392
384
  var pageContentElement = document.querySelector(selectorPageContent);
393
385
 
394
386
  if (placement && placement === 'right' && pageContentElement) {
@@ -401,7 +393,7 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
401
393
  pageContentElement.style.marginLeft = _constants.SIDE_PANEL_SIZES[size];
402
394
  }
403
395
  }
404
- }, [slideIn, selectorPageContent, placement, shouldRender, size, reducedMotion.matches]); // adds focus trap functionality
396
+ }, [slideIn, selectorPageContent, placement, size, reducedMotion.matches, open]); // adds focus trap functionality
405
397
 
406
398
  /* istanbul ignore next */
407
399
 
@@ -506,20 +498,22 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
506
498
  onResize: handleResize,
507
499
  targetRef: contentRef
508
500
  });
509
- return shouldRender && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, (0, _devtools.getDevtoolsProps)(componentName), rest, {
501
+ return /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, null, open && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_framerMotion.motion.div, (0, _extends2.default)({}, (0, _devtools.getDevtoolsProps)(componentName), rest, {
510
502
  id: "".concat(blockClass, "-outer"),
511
503
  className: mainPanelClassNames,
512
- style: {
513
- animation: !reducedMotion.matches ? "".concat(open ? placement === 'right' ? "side-panel-entrance-right ".concat(_motion.moderate02) : "side-panel-entrance-left ".concat(_motion.moderate02) : placement === 'right' ? "side-panel-exit-right ".concat(_motion.moderate02) : "side-panel-exit-left ".concat(_motion.moderate02)) : null
514
- },
515
- onAnimationEnd: onAnimationEnd,
516
- onAnimationStart: function onAnimationStart(event) {
517
- return _onAnimationStart(event);
518
- },
519
504
  onBlur: handleBlur,
520
505
  ref: contentRef,
521
506
  role: "complementary",
522
- "aria-label": title
507
+ "aria-label": title,
508
+ onAnimationComplete: onAnimationEnd,
509
+ onAnimationStart: function onAnimationStart(event) {
510
+ return _onAnimationStart(event);
511
+ },
512
+ variants: _variants.panelVariants,
513
+ initial: "hidden",
514
+ animate: "visible",
515
+ exit: "exit",
516
+ custom: placement
523
517
  }), /*#__PURE__*/_react.default.createElement("span", {
524
518
  ref: startTrapRef,
525
519
  tabIndex: "0",
@@ -539,13 +533,14 @@ var SidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
539
533
  tabIndex: "0",
540
534
  role: "link",
541
535
  className: "".concat(blockClass, "__visually-hidden")
542
- }, "Focus sentinel")), includeOverlay && /*#__PURE__*/_react.default.createElement("div", {
536
+ }, "Focus sentinel")), /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, null, includeOverlay && /*#__PURE__*/_react.default.createElement(_framerMotion.motion.div, {
537
+ variants: _variants.overlayVariants,
538
+ initial: "hidden",
539
+ animate: "visible",
540
+ exit: "exit",
543
541
  ref: sidePanelOverlayRef,
544
- className: "".concat(blockClass, "__overlay"),
545
- style: {
546
- animation: !reducedMotion.matches ? "".concat(open ? "side-panel-overlay-entrance ".concat(_motion.moderate02) : "side-panel-overlay-exit ".concat(_motion.moderate02)) : null
547
- }
548
- }));
542
+ className: "".concat(blockClass, "__overlay")
543
+ }))));
549
544
  }); // Return a placeholder if not released and not enabled by feature flag
550
545
 
551
546
 
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.panelVariants = exports.overlayVariants = void 0;
7
+
8
+ var _motionConstants = require("../../../global/js/utils/motionConstants");
9
+
10
+ /**
11
+ * Copyright IBM Corp. 2022, 2022
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+ var overlayVariants = {
17
+ visible: {
18
+ opacity: 1,
19
+ transition: {
20
+ duration: _motionConstants.DURATIONS.moderate02,
21
+ ease: _motionConstants.EASINGS.productive.standard
22
+ }
23
+ },
24
+ hidden: {
25
+ opacity: 0
26
+ },
27
+ exit: {
28
+ opacity: 0
29
+ }
30
+ };
31
+ exports.overlayVariants = overlayVariants;
32
+ var panelVariants = {
33
+ visible: {
34
+ x: 0,
35
+ transition: {
36
+ duration: _motionConstants.DURATIONS.moderate02,
37
+ ease: _motionConstants.EASINGS.productive.standard
38
+ }
39
+ },
40
+ hidden: function hidden(placement) {
41
+ return {
42
+ x: placement === 'right' ? '100%' : -320
43
+ };
44
+ },
45
+ exit: function exit(placement) {
46
+ return {
47
+ x: placement === 'right' ? '100%' : -320,
48
+ transition: {
49
+ duration: _motionConstants.DURATIONS.moderate01,
50
+ ease: _motionConstants.EASINGS.productive.exit
51
+ }
52
+ };
53
+ }
54
+ };
55
+ exports.panelVariants = panelVariants;
@@ -117,6 +117,12 @@ Object.defineProperty(exports, "EditTearsheetNarrow", {
117
117
  return _EditTearsheetNarrow.EditTearsheetNarrow;
118
118
  }
119
119
  });
120
+ Object.defineProperty(exports, "EditUpdateCards", {
121
+ enumerable: true,
122
+ get: function get() {
123
+ return _EditUpdateCards.EditUpdateCards;
124
+ }
125
+ });
120
126
  Object.defineProperty(exports, "EmptyState", {
121
127
  enumerable: true,
122
128
  get: function get() {
@@ -502,4 +508,6 @@ var _EditTearsheet = require("./EditTearsheet");
502
508
 
503
509
  var _EditTearsheetNarrow = require("./EditTearsheetNarrow");
504
510
 
505
- var _EditFullPage = require("./EditFullPage");
511
+ var _EditFullPage = require("./EditFullPage");
512
+
513
+ var _EditUpdateCards = require("./EditUpdateCards");
@@ -73,7 +73,8 @@ var defaults = {
73
73
  Datagrid: false,
74
74
  EditTearsheet: false,
75
75
  EditTearsheetNarrow: false,
76
- EditFullPage: false
76
+ EditFullPage: false,
77
+ EditUpdateCards: false
77
78
  /* new component flags here - comment used by generate CLI */
78
79
 
79
80
  },
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBezierValues = void 0;
7
+
8
+ var _motion = require("@carbon/motion");
9
+
10
+ /**
11
+ * This function turns a cubic-bezier() string to an
12
+ * array of values that we can use with framer-motion
13
+ * @param {string} type - The carbon motion type, either 'standard', 'entrance', or 'exit'
14
+ * @param {string} mode - The carbon motion mode, either 'productive', or 'expressive'
15
+ */
16
+ var getBezierValues = function getBezierValues(type, mode) {
17
+ var cubicBezier = (0, _motion.motion)(type, mode);
18
+ var extractStringFromParens = /\(([^)]+)\)/;
19
+ var desiredBezierStrings = extractStringFromParens.exec(cubicBezier)[1];
20
+ var formattedDesiredBezierStrings = desiredBezierStrings.trim().split(',').map(Number);
21
+
22
+ if (Array.isArray(formattedDesiredBezierStrings)) {
23
+ return formattedDesiredBezierStrings;
24
+ }
25
+
26
+ return [];
27
+ };
28
+
29
+ exports.getBezierValues = getBezierValues;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EASINGS = exports.DURATIONS = void 0;
7
+
8
+ var _getBezierValues = require("./getBezierValues");
9
+
10
+ var _motion = require("@carbon/motion");
11
+
12
+ /**
13
+ * Copyright IBM Corp. 2022, 2022
14
+ *
15
+ * This source code is licensed under the Apache-2.0 license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */
18
+ var cleanMotionValue = function cleanMotionValue(val) {
19
+ return parseInt(val) / 1000;
20
+ };
21
+
22
+ var DURATIONS = {
23
+ // Micro-interactions such as button and toggle
24
+ fast01: cleanMotionValue(_motion.fast01),
25
+ // '70ms'
26
+ // Micro-interactions such as fade
27
+ fast02: cleanMotionValue(_motion.fast02),
28
+ // '110ms'
29
+ // Micro-interactions, small expansion, short distance movements
30
+ moderate01: cleanMotionValue(_motion.moderate01),
31
+ // '150ms'
32
+ // Expansion, system communication, toast
33
+ moderate02: cleanMotionValue(_motion.moderate02),
34
+ // '240ms'
35
+ // Large expansion, important system notifications
36
+ slow01: cleanMotionValue(_motion.slow01),
37
+ // '400ms'
38
+ // Background dimming
39
+ slow02: cleanMotionValue(_motion.slow02) // '700ms'
40
+
41
+ };
42
+ exports.DURATIONS = DURATIONS;
43
+ var EASINGS = {
44
+ productive: {
45
+ entrance: (0, _getBezierValues.getBezierValues)('entrance', 'productive'),
46
+ standard: (0, _getBezierValues.getBezierValues)('standard', 'productive'),
47
+ exit: (0, _getBezierValues.getBezierValues)('exit', 'productive')
48
+ },
49
+ expressive: {
50
+ entrance: (0, _getBezierValues.getBezierValues)('entrance', 'expressive'),
51
+ standard: (0, _getBezierValues.getBezierValues)('standard', 'expressive'),
52
+ exit: (0, _getBezierValues.getBezierValues)('exit', 'expressive')
53
+ }
54
+ };
55
+ exports.EASINGS = EASINGS;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.0.0-rc.3",
4
+ "version": "2.0.0-rc.4",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -36,11 +36,12 @@
36
36
  "access": "public"
37
37
  },
38
38
  "scripts": {
39
- "build": "run-s clean build-first build-all",
39
+ "build": "run-s clean build-first build-all build-css-update-maps",
40
40
  "build-all": "run-p 'build:*'",
41
41
  "build-first": "copyfiles 'src/**/*.scss' scss -u 1",
42
42
  "build:css-dev": "sass --style=expanded --load-path node_modules --load-path ../../node_modules scss:css",
43
43
  "build:css-min": "sass --style=compressed --load-path node_modules --load-path ../../node_modules scss/index.scss:css/index.min.css scss/index-full-carbon.scss:css/index-full-carbon.min.css scss/index-without-carbon.scss:css/index-without-carbon.min.css scss/index-without-carbon-released-only.scss:css/index-without-carbon-released-only.min.css",
44
+ "build-css-update-maps": "node ../../scripts/updateSourceMaps.js",
44
45
  "build:js-esm": "cross-env BABEL_ENV=esm yarn build:js:modules -d es",
45
46
  "build:js-cjs": "cross-env BABEL_ENV=cjs yarn build:js:modules -d lib",
46
47
  "build:js:modules": "babel src --ignore '**/__tests__','**/*.test.js','**/*.stories.js','src/utils/**/*'",
@@ -75,6 +76,7 @@
75
76
  "dependencies": {
76
77
  "@babel/runtime": "^7.18.9",
77
78
  "@carbon/telemetry": "^0.1.0",
79
+ "framer-motion": "^6.5.1",
78
80
  "immutability-helper": "^3.1.1",
79
81
  "react-dnd": "^15.1.2",
80
82
  "react-dnd-html5-backend": "^15.1.3",
@@ -92,5 +94,5 @@
92
94
  "react": "^16.8.6 || ^17.0.1",
93
95
  "react-dom": "^16.8.6 || ^17.0.1"
94
96
  },
95
- "gitHead": "5bffa40c7782ff89a267cd2f2f727b223a12ba50"
97
+ "gitHead": "77ce950cb5a0d555417788ed808509aa4e3c52c8"
96
98
  }
@@ -484,7 +484,7 @@ button.#{$block-class}__global-filter-toggle {
484
484
  margin-top: $spacing-03;
485
485
  }
486
486
 
487
- .#{$carbon-prefix}--tooltip,
488
- .#{$carbon-prefix}--overflow-menu-options {
487
+ .#{$block-class} .#{$carbon-prefix}--tooltip,
488
+ .#{$block-class} .#{$carbon-prefix}--overflow-menu-options {
489
489
  z-index: 9000;
490
490
  }