@carbon/ibm-products 1.33.0 → 1.34.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/css/index-full-carbon.css +78 -145
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +4 -4
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +6 -142
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +3 -3
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +61 -143
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +4 -4
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +76 -143
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +4 -4
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  18. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +0 -1
  19. package/es/components/Datagrid/utils/getArgTypes.js +4 -0
  20. package/es/components/InlineEditV2/InlineEditV2.js +249 -0
  21. package/es/components/InlineEditV2/index.js +1 -0
  22. package/es/components/PageHeader/PageHeaderTitle.js +3 -1
  23. package/es/components/SidePanel/SidePanel.js +44 -51
  24. package/es/components/SidePanel/motion/variants.js +39 -0
  25. package/es/components/index.js +2 -1
  26. package/es/global/js/package-settings.js +2 -1
  27. package/es/global/js/utils/getBezierValues.js +20 -0
  28. package/es/global/js/utils/motionConstants.js +45 -0
  29. package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  30. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +0 -1
  31. package/lib/components/Datagrid/utils/getArgTypes.js +4 -0
  32. package/lib/components/InlineEditV2/InlineEditV2.js +277 -0
  33. package/lib/components/InlineEditV2/index.js +13 -0
  34. package/lib/components/PageHeader/PageHeaderTitle.js +3 -1
  35. package/lib/components/SidePanel/SidePanel.js +45 -50
  36. package/lib/components/SidePanel/motion/variants.js +49 -0
  37. package/lib/components/index.js +9 -1
  38. package/lib/global/js/package-settings.js +2 -1
  39. package/lib/global/js/utils/getBezierValues.js +29 -0
  40. package/lib/global/js/utils/motionConstants.js +55 -0
  41. package/package.json +16 -14
  42. package/scss/components/Datagrid/_storybook-styles.scss +4 -0
  43. package/scss/components/InlineEditV2/_index.scss +10 -0
  44. package/scss/components/InlineEditV2/_inline-edit-v2.scss +81 -0
  45. package/scss/components/ModifiedTabs/_modified-tabs.scss +1 -1
  46. package/scss/components/PageHeader/_page-header.scss +4 -0
  47. package/scss/components/SidePanel/_side-panel.scss +0 -75
  48. package/scss/components/_index.scss +2 -0
@@ -0,0 +1,249 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["cancelLabel", "editLabel", "invalid", "invalidLabel", "onCancel", "onChange", "onSave", "readOnly", "saveLabel", "value"];
6
+ import React, { useState, useEffect, forwardRef, useRef } from 'react';
7
+ import { Button } from 'carbon-components-react';
8
+ import cx from 'classnames';
9
+ import PropTypes from 'prop-types';
10
+ import { Edit24, Checkmark24, Close24, EditOff24, WarningFilled16 } from '@carbon/icons-react';
11
+ import { pkg, carbon } from '../../settings';
12
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
13
+ var componentName = 'InlineEditV2';
14
+ var blockClass = "".concat(pkg.prefix, "--inline-edit-v2");
15
+ export var InlineEditV2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
16
+ var _cx;
17
+
18
+ var cancelLabel = _ref.cancelLabel,
19
+ editLabel = _ref.editLabel,
20
+ invalid = _ref.invalid,
21
+ invalidLabel = _ref.invalidLabel,
22
+ onCancel = _ref.onCancel,
23
+ onChange = _ref.onChange,
24
+ onSave = _ref.onSave,
25
+ readOnly = _ref.readOnly,
26
+ saveLabel = _ref.saveLabel,
27
+ value = _ref.value,
28
+ rest = _objectWithoutProperties(_ref, _excluded);
29
+
30
+ var _useState = useState(false),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ focused = _useState2[0],
33
+ setFocused = _useState2[1];
34
+
35
+ var _useState3 = useState(''),
36
+ _useState4 = _slicedToArray(_useState3, 2),
37
+ initialValue = _useState4[0],
38
+ setInitialValue = _useState4[1];
39
+
40
+ var _useState5 = useState(false),
41
+ _useState6 = _slicedToArray(_useState5, 2),
42
+ dirtyInput = _useState6[0],
43
+ setDirtyInput = _useState6[1];
44
+
45
+ var inputRef = useRef(null);
46
+ var canSave = value !== initialValue && !invalid;
47
+ var escaping = useRef(false);
48
+ useEffect(function () {
49
+ if (!initialValue && !dirtyInput) {
50
+ setInitialValue(value);
51
+ }
52
+ }, [initialValue, dirtyInput, value]);
53
+
54
+ var isTargetingChild = function isTargetingChild(_ref2) {
55
+ var currentTarget = _ref2.currentTarget,
56
+ relatedTarget = _ref2.relatedTarget;
57
+ return currentTarget.contains(relatedTarget);
58
+ };
59
+
60
+ var onChangeHandler = function onChangeHandler(_ref3) {
61
+ var target = _ref3.target;
62
+
63
+ if (!dirtyInput) {
64
+ setDirtyInput(true);
65
+ }
66
+
67
+ onChange(target.value);
68
+ };
69
+
70
+ var onFocusHandler = function onFocusHandler(e) {
71
+ if (readOnly) {
72
+ return;
73
+ }
74
+
75
+ if (!isTargetingChild(e)) {
76
+ inputRef.current.focus();
77
+ setFocused(true);
78
+ }
79
+ };
80
+
81
+ var onSaveHandler = function onSaveHandler() {
82
+ setInitialValue(value);
83
+ setFocused(false);
84
+ setDirtyInput(false);
85
+ onSave();
86
+ };
87
+
88
+ var onCancelHandler = function onCancelHandler() {
89
+ setFocused(false);
90
+ setDirtyInput(false);
91
+ onCancel(initialValue);
92
+ };
93
+
94
+ var onBlurHandler = function onBlurHandler(e) {
95
+ if (readOnly || escaping.current) {
96
+ return;
97
+ }
98
+
99
+ if (!isTargetingChild(e)) {
100
+ if (canSave) {
101
+ onSaveHandler();
102
+ } else {
103
+ onCancelHandler();
104
+ }
105
+ }
106
+ };
107
+
108
+ var returnHandler = function returnHandler() {
109
+ if (canSave) {
110
+ onSaveHandler();
111
+ }
112
+ };
113
+
114
+ var escapeHandler = function escapeHandler() {
115
+ onCancelHandler();
116
+ };
117
+
118
+ var onKeyHandler = function onKeyHandler(e) {
119
+ // to prevent blur handler from being called twice add additional state to check if escape is being used
120
+ escaping.current = true;
121
+
122
+ switch (e.key) {
123
+ case 'Escape':
124
+ inputRef.current.blur();
125
+ escapeHandler();
126
+ break;
127
+
128
+ case 'Enter':
129
+ inputRef.current.blur();
130
+ returnHandler();
131
+ break;
132
+
133
+ default:
134
+ break;
135
+ }
136
+
137
+ escaping.current = false;
138
+ };
139
+
140
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
141
+ ref: ref
142
+ }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement("div", {
143
+ className: cx(blockClass, (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "-focused"), focused), _defineProperty(_cx, "".concat(blockClass, "-readonly"), readOnly), _cx)),
144
+ onFocus: onFocusHandler,
145
+ onBlur: onBlurHandler
146
+ }, /*#__PURE__*/React.createElement("input", {
147
+ className: cx("".concat(blockClass, "__text-input"), "".concat(carbon.prefix, "--text-input")),
148
+ type: "text",
149
+ value: value,
150
+ onChange: onChangeHandler,
151
+ ref: inputRef,
152
+ readOnly: readOnly,
153
+ onKeyDown: onKeyHandler
154
+ }), focused ? /*#__PURE__*/React.createElement(React.Fragment, null, invalid && /*#__PURE__*/React.createElement(WarningFilled16, {
155
+ className: "".concat(blockClass, "__warning-icon")
156
+ }), /*#__PURE__*/React.createElement(Button, {
157
+ hasIconOnly: true,
158
+ renderIcon: Close24,
159
+ size: "sm",
160
+ iconDescription: cancelLabel,
161
+ onClick: onCancelHandler,
162
+ kind: "ghost",
163
+ tabIndex: 0,
164
+ key: "cancel",
165
+ className: "".concat(blockClass, "__btn ").concat(blockClass, "__btn-cancel")
166
+ }), canSave && /*#__PURE__*/React.createElement(Button, {
167
+ hasIconOnly: true,
168
+ renderIcon: Checkmark24,
169
+ size: "sm",
170
+ iconDescription: saveLabel,
171
+ onClick: onSaveHandler,
172
+ kind: "ghost",
173
+ tabIndex: 0,
174
+ key: "save",
175
+ className: "".concat(blockClass, "__btn ").concat(blockClass, "__btn-save"),
176
+ disabled: !canSave
177
+ })) : /*#__PURE__*/React.createElement(Button, {
178
+ className: "".concat(blockClass, "__btn ").concat(blockClass, "__btn-edit"),
179
+ hasIconOnly: true,
180
+ renderIcon: readOnly ? EditOff24 : Edit24,
181
+ size: "sm",
182
+ iconDescription: editLabel,
183
+ onClick: onFocusHandler,
184
+ kind: "ghost",
185
+ disabled: readOnly,
186
+ tabIndex: 0,
187
+ key: "edit"
188
+ })), focused && invalid && /*#__PURE__*/React.createElement("p", {
189
+ className: "".concat(blockClass, "__warning-text")
190
+ }, invalidLabel));
191
+ });
192
+ InlineEditV2 = pkg.checkComponentEnabled(InlineEditV2, componentName);
193
+ InlineEditV2.displayName = componentName;
194
+ InlineEditV2.propTypes = {
195
+ /**
196
+ * label for cancel button
197
+ */
198
+ cancelLabel: PropTypes.string.isRequired,
199
+
200
+ /**
201
+ * label for edit button
202
+ */
203
+ editLabel: PropTypes.string.isRequired,
204
+
205
+ /**
206
+ * determines if the input is invalid
207
+ */
208
+ invalid: PropTypes.bool,
209
+
210
+ /**
211
+ * text that is displayed if the input is invalid
212
+ */
213
+ invalidLabel: PropTypes.string,
214
+
215
+ /**
216
+ * handler that is called when the cancel button is pressed or when the user removes focus from the input and there is no new value
217
+ */
218
+ onCancel: PropTypes.func.isRequired,
219
+
220
+ /**
221
+ * handler that is called when the input is updated
222
+ */
223
+ onChange: PropTypes.func.isRequired,
224
+
225
+ /**
226
+ * handler that is called when the save button is pressed or when the user removes focus from the input if it has a new value
227
+ */
228
+ onSave: PropTypes.func.isRequired,
229
+
230
+ /**
231
+ * determines if the input is in readOnly mode
232
+ */
233
+ readOnly: PropTypes.bool,
234
+
235
+ /**
236
+ * label for save button
237
+ */
238
+ saveLabel: PropTypes.string.isRequired,
239
+
240
+ /**
241
+ * current value of the input
242
+ */
243
+ value: PropTypes.string.isRequired
244
+ };
245
+ InlineEditV2.defaultProps = {
246
+ invalid: false,
247
+ invalidLabel: '',
248
+ readOnly: false
249
+ };
@@ -0,0 +1 @@
1
+ export { InlineEditV2 } from './InlineEditV2';
@@ -68,7 +68,9 @@ export var PageHeaderTitle = function PageHeaderTitle(_ref) {
68
68
  return /*#__PURE__*/React.createElement("div", {
69
69
  className: cx("".concat(blockClass, "__title"), _defineProperty({}, "".concat(blockClass, "__title--editable"), isEditable), _defineProperty({}, "".concat(blockClass, "__title--fades"), hasBreadcrumbRow)),
70
70
  title: titleText
71
- }, titleInnards);
71
+ }, /*#__PURE__*/React.createElement("h1", {
72
+ className: "".concat(blockClass, "__title-wrapper")
73
+ }, titleInnards));
72
74
  };
73
75
  export var inlineEditRequired = function inlineEditRequired(_ref2) {
74
76
  var onSave = _ref2.onSave;
@@ -16,7 +16,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
16
16
  * LICENSE file in the root directory of this source tree.
17
17
  */
18
18
  // Import portions of React that are needed.
19
- import React, { useState, useEffect, useRef } from 'react'; // Other standard imports.
19
+ import React, { useState, useEffect, useRef } from 'react';
20
+ import { motion, AnimatePresence } from 'framer-motion'; // Other standard imports.
20
21
 
21
22
  import PropTypes from 'prop-types';
22
23
  import cx from 'classnames';
@@ -32,6 +33,7 @@ import { usePreviousValue } from '../../global/js/hooks'; // Carbon and package
32
33
  import { Button } from 'carbon-components-react';
33
34
  import { Close20, ArrowLeft20 } from '@carbon/icons-react';
34
35
  import { ActionSet } from '../ActionSet';
36
+ import { overlayVariants, panelVariants } from './motion/variants';
35
37
  var blockClass = "".concat(pkg.prefix, "--side-panel");
36
38
  var componentName = 'SidePanel'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
37
39
  // Default values for props
@@ -82,20 +84,15 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
82
84
  title = _ref.title,
83
85
  rest = _objectWithoutProperties(_ref, _excluded);
84
86
 
85
- var _useState = useState(open),
87
+ var _useState = useState(false),
86
88
  _useState2 = _slicedToArray(_useState, 2),
87
- shouldRender = _useState2[0],
88
- setRender = _useState2[1];
89
+ animationComplete = _useState2[0],
90
+ setAnimationComplete = _useState2[1];
89
91
 
90
- var _useState3 = useState(false),
92
+ var _useState3 = useState(0),
91
93
  _useState4 = _slicedToArray(_useState3, 2),
92
- animationComplete = _useState4[0],
93
- setAnimationComplete = _useState4[1];
94
-
95
- var _useState5 = useState(0),
96
- _useState6 = _slicedToArray(_useState5, 2),
97
- panelHeight = _useState6[0],
98
- setPanelHeight = _useState6[1];
94
+ panelHeight = _useState4[0],
95
+ setPanelHeight = _useState4[1];
99
96
 
100
97
  var sidePanelRef = useRef();
101
98
  var sidePanelOverlayRef = useRef();
@@ -125,8 +122,10 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
125
122
  // height css custom property
126
123
 
127
124
  if ((previousState === null || previousState === void 0 ? void 0 : previousState.size) !== size) {
125
+ var _sidePanelOuter$style;
126
+
128
127
  scrollableSection.scrollTop = 0;
129
- sidePanelOuter.style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
128
+ 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"));
130
129
  }
131
130
  }
132
131
  }, [currentStep, ref, size, previousState === null || previousState === void 0 ? void 0 : previousState.size]); // set initial focus when side panel opens
@@ -154,12 +153,14 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
154
153
  }, [selectorPrimaryFocus, open, animationComplete]);
155
154
  useEffect(function () {
156
155
  if (open && actions && actions.length && animationComplete) {
156
+ var _sidePanelOuter$style2;
157
+
157
158
  var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
158
159
  var actionsContainer = getActionsContainerElement();
159
160
  var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
160
161
 
161
162
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
162
- sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : sidePanelOuter.style.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
163
+ 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);
163
164
  }
164
165
  }, [actions, condensedActions, open, animationComplete]); // Add console warning if labelText is provided without a title.
165
166
  // This combination is not allowed.
@@ -172,13 +173,15 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
172
173
  /* istanbul ignore next */
173
174
 
174
175
  var handleResize = function handleResize(width, height) {
176
+ var _sidePanelOuter$style3;
177
+
175
178
  setPanelHeight(height);
176
179
  var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
177
180
  var actionsContainer = getActionsContainerElement();
178
- var actionsHeight = actionsContainer.offsetHeight + 16; // add additional 1rem spacing to bottom padding
181
+ var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
179
182
 
180
183
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
181
- sidePanelOuter.style.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
184
+ 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);
182
185
  };
183
186
 
184
187
  var getActionsContainerElement = function getActionsContainerElement() {
@@ -263,7 +266,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
263
266
  });
264
267
  }
265
268
 
266
- if (open && shouldRender && !animateTitle) {
269
+ if (open && !animateTitle) {
267
270
  var _sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
268
271
 
269
272
  var _sidePanelTitleElement = document.querySelector(".".concat(blockClass, "__title-container .").concat(blockClass, "__title-text"));
@@ -284,7 +287,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
284
287
  _sidePanelOuter === null || _sidePanelOuter === void 0 ? void 0 : _sidePanelOuter.style.setProperty("--".concat(blockClass, "--action-bar-container-height"), "".concat(sidePanelActionBarElementHeight, "px"));
285
288
  _sidePanelOuter === null || _sidePanelOuter === void 0 ? void 0 : _sidePanelOuter.style.setProperty("--".concat(blockClass, "--label-text-height"), "".concat(labelHeight, "px"));
286
289
  }
287
- }, [open, animateTitle, animationComplete, shouldRender, panelHeight, title, size, reducedMotion.matches]); // click outside functionality if `includeOverlay` prop is set
290
+ }, [open, animateTitle, animationComplete, panelHeight, title, size, reducedMotion.matches]); // click outside functionality if `includeOverlay` prop is set
288
291
 
289
292
  useEffect(function () {
290
293
  var handleOutsideClick = function handleOutsideClick(event) {
@@ -310,18 +313,11 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
310
313
  return function () {
311
314
  document.removeEventListener('click', handleOutsideClick);
312
315
  };
313
- }, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, ref, onUnmount]); // initialize the side panel to open
314
-
315
- useEffect(function () {
316
- if (open) {
317
- setRender(true);
318
- }
319
- }, [open]); // initializes the side panel to close
316
+ }, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, ref, onUnmount]); // initializes the side panel to close
320
317
 
321
318
  var onAnimationEnd = function onAnimationEnd() {
322
319
  if (!open) {
323
320
  onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
324
- setRender(false);
325
321
  }
326
322
 
327
323
  setAnimationComplete(true);
@@ -335,13 +331,8 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
335
331
  }
336
332
  }, [reducedMotion.matches]); // initializes the side panel to open
337
333
 
338
- var _onAnimationStart = function onAnimationStart(event) {
339
- event.persist();
340
- var isPanelTarget = event.target.id === "".concat(blockClass, "-outer");
341
-
342
- if (isPanelTarget) {
343
- setAnimationComplete(false);
344
- }
334
+ var _onAnimationStart = function onAnimationStart() {
335
+ setAnimationComplete(false);
345
336
  }; // used to reset margins of the slide in panel when closed/closing
346
337
 
347
338
 
@@ -358,13 +349,12 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
358
349
  }, [open, placement, selectorPageContent, slideIn]);
359
350
  useEffect(function () {
360
351
  if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion.matches) {
361
- setRender(false);
362
352
  onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
363
353
  }
364
354
  }, [open, onUnmount, reducedMotion.matches, previousState === null || previousState === void 0 ? void 0 : previousState.open]); // used to set margins of content for slide in panel version
365
355
 
366
356
  useEffect(function () {
367
- if (shouldRender && slideIn) {
357
+ if (open && slideIn) {
368
358
  var pageContentElement = document.querySelector(selectorPageContent);
369
359
 
370
360
  if (placement && placement === 'right' && pageContentElement) {
@@ -377,7 +367,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
377
367
  pageContentElement.style.marginLeft = SIDE_PANEL_SIZES[size];
378
368
  }
379
369
  }
380
- }, [slideIn, selectorPageContent, placement, shouldRender, size, reducedMotion.matches]); // adds focus trap functionality
370
+ }, [slideIn, selectorPageContent, placement, size, reducedMotion.matches, open]); // adds focus trap functionality
381
371
 
382
372
  /* istanbul ignore next */
383
373
 
@@ -475,20 +465,22 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
475
465
  onResize: handleResize,
476
466
  targetRef: contentRef
477
467
  });
478
- return shouldRender && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", _extends({}, getDevtoolsProps(componentName), rest, {
468
+ return /*#__PURE__*/React.createElement(AnimatePresence, null, open && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(motion.div, _extends({}, getDevtoolsProps(componentName), rest, {
479
469
  id: "".concat(blockClass, "-outer"),
480
470
  className: mainPanelClassNames,
481
- style: {
482
- animation: !reducedMotion.matches ? "".concat(open ? placement === 'right' ? "side-panel-entrance-right ".concat(moderate02) : "side-panel-entrance-left ".concat(moderate02) : placement === 'right' ? "side-panel-exit-right ".concat(moderate02) : "side-panel-exit-left ".concat(moderate02)) : null
483
- },
484
- onAnimationEnd: onAnimationEnd,
485
- onAnimationStart: function onAnimationStart(event) {
486
- return _onAnimationStart(event);
487
- },
488
471
  onBlur: handleBlur,
489
472
  ref: contentRef,
490
473
  role: "complementary",
491
- "aria-label": title
474
+ "aria-label": title,
475
+ onAnimationComplete: onAnimationEnd,
476
+ onAnimationStart: function onAnimationStart(event) {
477
+ return _onAnimationStart(event);
478
+ },
479
+ variants: panelVariants,
480
+ initial: "hidden",
481
+ animate: "visible",
482
+ exit: "exit",
483
+ custom: placement
492
484
  }), /*#__PURE__*/React.createElement("span", {
493
485
  ref: startTrapRef,
494
486
  tabIndex: "0",
@@ -508,13 +500,14 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
508
500
  tabIndex: "0",
509
501
  role: "link",
510
502
  className: "".concat(blockClass, "__visually-hidden")
511
- }, "Focus sentinel")), includeOverlay && /*#__PURE__*/React.createElement("div", {
503
+ }, "Focus sentinel")), /*#__PURE__*/React.createElement(AnimatePresence, null, includeOverlay && /*#__PURE__*/React.createElement(motion.div, {
504
+ variants: overlayVariants,
505
+ initial: "hidden",
506
+ animate: "visible",
507
+ exit: "exit",
512
508
  ref: sidePanelOverlayRef,
513
- className: "".concat(blockClass, "__overlay"),
514
- style: {
515
- animation: !reducedMotion.matches ? "".concat(open ? "side-panel-overlay-entrance ".concat(moderate02) : "side-panel-overlay-exit ".concat(moderate02)) : null
516
- }
517
- }));
509
+ className: "".concat(blockClass, "__overlay")
510
+ }))));
518
511
  }); // Return a placeholder if not released and not enabled by feature flag
519
512
 
520
513
  SidePanel = pkg.checkComponentEnabled(SidePanel, componentName);
@@ -0,0 +1,39 @@
1
+ import { DURATIONS, EASINGS } from '../../../global/js/utils/motionConstants';
2
+ export var overlayVariants = {
3
+ visible: {
4
+ opacity: 1,
5
+ transition: {
6
+ duration: DURATIONS.moderate02,
7
+ ease: EASINGS.productive.standard
8
+ }
9
+ },
10
+ hidden: {
11
+ opacity: 0
12
+ },
13
+ exit: {
14
+ opacity: 0
15
+ }
16
+ };
17
+ export var panelVariants = {
18
+ visible: {
19
+ x: 0,
20
+ transition: {
21
+ duration: DURATIONS.moderate02,
22
+ ease: EASINGS.productive.standard
23
+ }
24
+ },
25
+ hidden: function hidden(placement) {
26
+ return {
27
+ x: placement === 'right' ? '100%' : -320
28
+ };
29
+ },
30
+ exit: function exit(placement) {
31
+ return {
32
+ x: placement === 'right' ? '100%' : -320,
33
+ transition: {
34
+ duration: DURATIONS.moderate01,
35
+ ease: EASINGS.productive.exit
36
+ }
37
+ };
38
+ }
39
+ };
@@ -40,4 +40,5 @@ export { DataSpreadsheet } from './DataSpreadsheet';
40
40
  export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit } from './Datagrid';
41
41
  export { EditTearsheet } from './EditTearsheet';
42
42
  export { EditTearsheetNarrow } from './EditTearsheetNarrow';
43
- export { EditFullPage } from './EditFullPage';
43
+ export { EditFullPage } from './EditFullPage';
44
+ export { InlineEditV2 } from './InlineEditV2';
@@ -69,7 +69,8 @@ var defaults = {
69
69
  Datagrid: false,
70
70
  EditTearsheet: false,
71
71
  EditTearsheetNarrow: false,
72
- EditFullPage: false
72
+ EditFullPage: false,
73
+ InlineEditV2: false
73
74
  /* new component flags here - comment used by generate CLI */
74
75
 
75
76
  },
@@ -0,0 +1,20 @@
1
+ import { motion } from '@carbon/motion';
2
+ /**
3
+ * This function turns a cubic-bezier() string to an
4
+ * array of values that we can use with framer-motion
5
+ * @param {string} type - The carbon motion type, either 'standard', 'entrance', or 'exit'
6
+ * @param {string} mode - The carbon motion mode, either 'productive', or 'expressive'
7
+ */
8
+
9
+ export var getBezierValues = function getBezierValues(type, mode) {
10
+ var cubicBezier = motion(type, mode);
11
+ var extractStringFromParens = /\(([^)]+)\)/;
12
+ var desiredBezierStrings = extractStringFromParens.exec(cubicBezier)[1];
13
+ var formattedDesiredBezierStrings = desiredBezierStrings.trim().split(',').map(Number);
14
+
15
+ if (Array.isArray(formattedDesiredBezierStrings)) {
16
+ return formattedDesiredBezierStrings;
17
+ }
18
+
19
+ return [];
20
+ };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2022
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
+ import { getBezierValues } from './getBezierValues';
8
+ import { fast01, fast02, moderate01, moderate02, slow01, slow02 } from '@carbon/motion';
9
+
10
+ var cleanMotionValue = function cleanMotionValue(val) {
11
+ return parseInt(val) / 1000;
12
+ };
13
+
14
+ export var DURATIONS = {
15
+ // Micro-interactions such as button and toggle
16
+ fast01: cleanMotionValue(fast01),
17
+ // '70ms'
18
+ // Micro-interactions such as fade
19
+ fast02: cleanMotionValue(fast02),
20
+ // '110ms'
21
+ // Micro-interactions, small expansion, short distance movements
22
+ moderate01: cleanMotionValue(moderate01),
23
+ // '150ms'
24
+ // Expansion, system communication, toast
25
+ moderate02: cleanMotionValue(moderate02),
26
+ // '240ms'
27
+ // Large expansion, important system notifications
28
+ slow01: cleanMotionValue(slow01),
29
+ // '400ms'
30
+ // Background dimming
31
+ slow02: cleanMotionValue(slow02) // '700ms'
32
+
33
+ };
34
+ export var EASINGS = {
35
+ productive: {
36
+ entrance: getBezierValues('entrance', 'productive'),
37
+ standard: getBezierValues('standard', 'productive'),
38
+ exit: getBezierValues('exit', 'productive')
39
+ },
40
+ expressive: {
41
+ entrance: getBezierValues('entrance', 'expressive'),
42
+ standard: getBezierValues('standard', 'expressive'),
43
+ exit: getBezierValues('exit', 'expressive')
44
+ }
45
+ };
@@ -170,7 +170,7 @@ DatagridContent.propTypes = {
170
170
  withVirtualScroll: _propTypes.default.bool,
171
171
  DatagridActions: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
172
172
  DatagridPagination: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
173
- CustomizeColumnsModal: _propTypes.default.element,
173
+ CustomizeColumnsModal: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
174
174
  isFetching: _propTypes.default.bool,
175
175
  leftPanel: _propTypes.default.object,
176
176
  fullHeightDatagrid: _propTypes.default.bool,
@@ -121,7 +121,6 @@ var Columns = function Columns(_ref) {
121
121
  }, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
122
122
  wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
123
123
  checked: getVisibleColumnsCount() === columns.length,
124
- empty: !!getVisibleColumnsCount() === 0,
125
124
  indeterminate: getVisibleColumnsCount() < columns.length && getVisibleColumnsCount() > 0,
126
125
  onChange: function onChange() {
127
126
  onSelectColumn(columns, getVisibleColumnsCount() !== columns.length);
@@ -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;