@carbon/ibm-products 1.11.0 → 1.12.0
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.
- package/README.md +0 -3
- package/css/index-full-carbon.css +1543 -529
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +5 -5
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +12 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +2 -2
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +77 -187
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +4 -4
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +194 -187
- package/css/index.css.map +1 -1
- package/css/index.min.css +5 -5
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +63 -12
- package/es/components/AddSelect/AddSelectColumn.js +58 -22
- package/es/components/AddSelect/AddSelectList.js +38 -18
- package/es/components/AddSelect/AddSelectSidebar.js +2 -1
- package/es/components/ButtonMenu/ButtonMenu.js +11 -3
- package/es/components/CreateFullPage/CreateFullPageStep.js +4 -4
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +4 -4
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +107 -89
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +93 -20
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +50 -2
- package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
- package/es/components/ImportModal/ImportModal.js +2 -2
- package/es/components/UserProfileImage/UserProfileImage.js +1 -1
- package/es/components/index.js +0 -1
- package/es/global/js/package-settings.js +1 -2
- package/lib/components/AddSelect/AddSelect.js +63 -12
- package/lib/components/AddSelect/AddSelectColumn.js +57 -21
- package/lib/components/AddSelect/AddSelectList.js +39 -17
- package/lib/components/AddSelect/AddSelectSidebar.js +2 -1
- package/lib/components/ButtonMenu/ButtonMenu.js +11 -3
- package/lib/components/CreateFullPage/CreateFullPageStep.js +4 -4
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +4 -4
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +108 -91
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +94 -20
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +52 -7
- package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +3 -1
- package/lib/components/ImportModal/ImportModal.js +1 -1
- package/lib/components/UserProfileImage/UserProfileImage.js +1 -1
- package/lib/components/index.js +0 -8
- package/lib/global/js/package-settings.js +1 -2
- package/package.json +16 -16
- package/scss/components/AboutModal/_about-modal.scss +2 -2
- package/scss/components/ActionSet/_action-set.scss +3 -1
- package/scss/components/AddSelect/_add-select.scss +41 -2
- package/scss/components/CreateModal/_create-modal.scss +7 -5
- package/scss/components/CreateModal/_storybook-styles.scss +8 -7
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +21 -3
- package/scss/components/ExportModal/_export-modal.scss +3 -3
- package/scss/components/InlineEdit/_inline-edit.scss +3 -0
- package/scss/components/ModifiedTabs/_modified-tabs.scss +4 -9
- package/scss/components/NotificationsPanel/_notifications-panel.scss +9 -5
- package/scss/components/OptionsTile/_options-tile.scss +0 -1
- package/scss/components/RemoveModal/_remove-modal.scss +3 -3
- package/scss/components/TagSet/_tag-set.scss +2 -1
- package/scss/components/Tearsheet/_tearsheet.scss +4 -1
- package/scss/components/_index.scss +0 -1
- package/es/components/LoadingBar/LoadingBar.js +0 -156
- package/es/components/LoadingBar/index.js +0 -7
- package/lib/components/LoadingBar/LoadingBar.js +0 -170
- package/lib/components/LoadingBar/index.js +0 -13
- package/scss/components/LoadingBar/_index.scss +0 -8
- package/scss/components/LoadingBar/_loading-bar.scss +0 -224
- package/scss/components/LoadingBar/_storybook-styles.scss +0 -14
@@ -2,14 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
-
var _excluded = ["columnInputPlaceholder", "filteredItems", "header"];
|
5
|
+
var _excluded = ["columnInputPlaceholder", "filteredItems", "header", "multiSelection", "setMultiSelection"];
|
6
6
|
//
|
7
7
|
// Copyright IBM Corp. 2022
|
8
8
|
//
|
9
9
|
// This source code is licensed under the Apache-2.0 license found in the
|
10
10
|
// LICENSE file in the root directory of this source tree.
|
11
11
|
//
|
12
|
-
import React, { useState } from 'react';
|
12
|
+
import React, { useState, useEffect } from 'react';
|
13
13
|
import PropTypes from 'prop-types';
|
14
14
|
import { TextInput, Tag, OverflowMenu, OverflowMenuItem, Checkbox } from 'carbon-components-react';
|
15
15
|
import { Filter32, ArrowsVertical32, ArrowUp16, ArrowDown16 } from '@carbon/icons-react';
|
@@ -23,30 +23,43 @@ export var AddSelectColumn = function AddSelectColumn(_ref) {
|
|
23
23
|
var columnInputPlaceholder = _ref.columnInputPlaceholder,
|
24
24
|
filteredItems = _ref.filteredItems,
|
25
25
|
header = _ref.header,
|
26
|
+
multiSelection = _ref.multiSelection,
|
27
|
+
setMultiSelection = _ref.setMultiSelection,
|
26
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
27
29
|
|
28
|
-
var _useState = useState(
|
30
|
+
var _useState = useState(false),
|
29
31
|
_useState2 = _slicedToArray(_useState, 2),
|
30
|
-
|
31
|
-
|
32
|
+
allSelected = _useState2[0],
|
33
|
+
setAllSelected = _useState2[1];
|
32
34
|
|
33
35
|
var _useState3 = useState(''),
|
34
36
|
_useState4 = _slicedToArray(_useState3, 2),
|
35
|
-
|
36
|
-
|
37
|
+
searchTerm = _useState4[0],
|
38
|
+
setSearchTerm = _useState4[1];
|
37
39
|
|
38
40
|
var _useState5 = useState(''),
|
39
41
|
_useState6 = _slicedToArray(_useState5, 2),
|
40
|
-
|
41
|
-
|
42
|
+
sortDirection = _useState6[0],
|
43
|
+
setSortDirection = _useState6[1];
|
42
44
|
|
43
|
-
var _useState7 = useState(
|
45
|
+
var _useState7 = useState(''),
|
44
46
|
_useState8 = _slicedToArray(_useState7, 2),
|
45
|
-
|
46
|
-
|
47
|
+
sortAttribute = _useState8[0],
|
48
|
+
setSortAttribute = _useState8[1];
|
49
|
+
|
50
|
+
var _useState9 = useState([]),
|
51
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
52
|
+
filters = _useState10[0],
|
53
|
+
setFilters = _useState10[1];
|
47
54
|
|
48
55
|
var blockClass = "".concat(pkg.prefix, "--add-select");
|
49
|
-
var colClass = "".concat(blockClass, "__column");
|
56
|
+
var colClass = "".concat(blockClass, "__column");
|
57
|
+
useEffect(function () {
|
58
|
+
var isAllSelected = filteredItems.every(function (item) {
|
59
|
+
return multiSelection.includes(item.id);
|
60
|
+
});
|
61
|
+
setAllSelected(isAllSelected);
|
62
|
+
}, [filteredItems, multiSelection]); // sorting
|
50
63
|
|
51
64
|
var colSortBy = (_filteredItems$find = filteredItems.find(function (item) {
|
52
65
|
return item.sortBy;
|
@@ -80,6 +93,21 @@ export var AddSelectColumn = function AddSelectColumn(_ref) {
|
|
80
93
|
setSortDirection(direction);
|
81
94
|
};
|
82
95
|
|
96
|
+
var selectAllHandler = function selectAllHandler(checked) {
|
97
|
+
var itemIds = filteredItems.map(function (item) {
|
98
|
+
return item.id;
|
99
|
+
});
|
100
|
+
|
101
|
+
if (checked) {
|
102
|
+
setMultiSelection([].concat(_toConsumableArray(multiSelection), _toConsumableArray(itemIds)));
|
103
|
+
} else {
|
104
|
+
var newItems = multiSelection.filter(function (i) {
|
105
|
+
return !itemIds.includes(i);
|
106
|
+
});
|
107
|
+
setMultiSelection(newItems);
|
108
|
+
}
|
109
|
+
};
|
110
|
+
|
83
111
|
var filterHandler = function filterHandler(checked, opt) {
|
84
112
|
if (checked) {
|
85
113
|
var newFilters = [].concat(_toConsumableArray(filters), [opt]);
|
@@ -177,19 +205,27 @@ export var AddSelectColumn = function AddSelectColumn(_ref) {
|
|
177
205
|
})));
|
178
206
|
})))), /*#__PURE__*/React.createElement("div", {
|
179
207
|
className: "".concat(blockClass, "__tag-container")
|
180
|
-
}, /*#__PURE__*/React.createElement(
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
208
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
209
|
+
id: "".concat(uuidv4(), "-select-all"),
|
210
|
+
checked: allSelected,
|
211
|
+
onChange: selectAllHandler,
|
212
|
+
labelText: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
213
|
+
className: "".concat(blockClass, "__tag-container-label")
|
214
|
+
}, header), /*#__PURE__*/React.createElement(Tag, {
|
215
|
+
type: "gray",
|
216
|
+
size: "sm"
|
217
|
+
}, colItems.length))
|
218
|
+
})), /*#__PURE__*/React.createElement(AddSelectList, _extends({}, props, {
|
219
|
+
filteredItems: colItems,
|
220
|
+
setMultiSelection: setMultiSelection,
|
221
|
+
multiSelection: multiSelection
|
188
222
|
})));
|
189
223
|
};
|
190
224
|
AddSelectColumn.propTypes = {
|
191
225
|
columnInputPlaceholder: PropTypes.string,
|
192
226
|
filteredItems: PropTypes.array,
|
193
|
-
header: PropTypes.string
|
227
|
+
header: PropTypes.string,
|
228
|
+
multiSelection: PropTypes.array,
|
229
|
+
setMultiSelection: PropTypes.func
|
194
230
|
};
|
195
231
|
AddSelectColumn.displayName = componentName;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
2
3
|
//
|
3
4
|
// Copyright IBM Corp. 2022
|
@@ -6,14 +7,15 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
6
7
|
// LICENSE file in the root directory of this source tree.
|
7
8
|
//
|
8
9
|
import React from 'react';
|
9
|
-
import { Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody, StructuredListCell } from 'carbon-components-react';
|
10
|
+
import { Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody, StructuredListCell, Dropdown } from 'carbon-components-react';
|
10
11
|
import { ChevronRight16 } from '@carbon/icons-react';
|
11
12
|
import PropTypes from 'prop-types';
|
13
|
+
import cx from 'classnames';
|
12
14
|
import { pkg } from '../../settings';
|
13
15
|
var componentName = 'AddSelectList';
|
14
16
|
export var AddSelectList = function AddSelectList(_ref) {
|
15
17
|
var filteredItems = _ref.filteredItems,
|
16
|
-
|
18
|
+
modifiers = _ref.modifiers,
|
17
19
|
multi = _ref.multi,
|
18
20
|
multiSelection = _ref.multiSelection,
|
19
21
|
path = _ref.path,
|
@@ -27,13 +29,13 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
27
29
|
setSingleSelection(value);
|
28
30
|
};
|
29
31
|
|
30
|
-
var handleMultiSelection = function handleMultiSelection(
|
32
|
+
var handleMultiSelection = function handleMultiSelection(id, checked) {
|
31
33
|
if (checked) {
|
32
|
-
var newValues = [].concat(_toConsumableArray(multiSelection), [
|
34
|
+
var newValues = [].concat(_toConsumableArray(multiSelection), [id]);
|
33
35
|
setMultiSelection(newValues);
|
34
36
|
} else {
|
35
37
|
var _newValues = multiSelection.filter(function (v) {
|
36
|
-
return v !==
|
38
|
+
return v !== id;
|
37
39
|
});
|
38
40
|
|
39
41
|
setMultiSelection(_newValues);
|
@@ -99,32 +101,50 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
99
101
|
}
|
100
102
|
};
|
101
103
|
|
104
|
+
var isSelected = function isSelected(id) {
|
105
|
+
return multiSelection.includes(id);
|
106
|
+
};
|
107
|
+
|
102
108
|
return /*#__PURE__*/React.createElement("div", {
|
103
109
|
className: "".concat(blockClass, "-wrapper")
|
104
110
|
}, /*#__PURE__*/React.createElement(StructuredListWrapper, {
|
105
111
|
selection: true,
|
106
112
|
className: "".concat(blockClass)
|
107
113
|
}, /*#__PURE__*/React.createElement(StructuredListBody, null, filteredItems.map(function (item) {
|
114
|
+
var _modifiers$options;
|
115
|
+
|
108
116
|
return /*#__PURE__*/React.createElement(StructuredListRow, {
|
109
117
|
key: item.id,
|
110
|
-
className: "".concat(blockClass, "-row")
|
118
|
+
className: cx("".concat(blockClass, "-row"), _defineProperty({}, "".concat(blockClass, "-row-selected"), isSelected(item.id)))
|
111
119
|
}, /*#__PURE__*/React.createElement(StructuredListCell, {
|
112
120
|
className: "".concat(blockClass, "-cell")
|
113
121
|
}, /*#__PURE__*/React.createElement("div", {
|
114
122
|
className: "".concat(blockClass, "-cell-wrapper")
|
115
|
-
}, multi ? /*#__PURE__*/React.createElement(
|
116
|
-
className: "".concat(blockClass, "-checkbox")
|
117
|
-
|
118
|
-
|
123
|
+
}, multi ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
124
|
+
className: "".concat(blockClass, "-checkbox")
|
125
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
126
|
+
onChange: function onChange(checked) {
|
127
|
+
return handleMultiSelection(item.id, checked);
|
119
128
|
},
|
120
|
-
labelText:
|
121
|
-
className: "".concat(blockClass, "-cell-title")
|
122
|
-
}, item.title), /*#__PURE__*/React.createElement("span", {
|
123
|
-
className: "".concat(blockClass, "-cell-subtitle")
|
124
|
-
}, item.subtitle)) : item.title,
|
129
|
+
labelText: item.title,
|
125
130
|
id: item.id,
|
126
|
-
checked:
|
127
|
-
|
131
|
+
checked: isSelected(item.id),
|
132
|
+
className: "".concat(blockClass, "-checkbox-wrapper")
|
133
|
+
}), /*#__PURE__*/React.createElement("div", {
|
134
|
+
className: "".concat(blockClass, "-checkbox-label-text")
|
135
|
+
}, /*#__PURE__*/React.createElement("span", {
|
136
|
+
className: "".concat(blockClass, "-cell-title")
|
137
|
+
}, item.title), item.subtitle && /*#__PURE__*/React.createElement("span", {
|
138
|
+
className: "".concat(blockClass, "-cell-subtitle")
|
139
|
+
}, item.subtitle))), (modifiers === null || modifiers === void 0 ? void 0 : (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) && /*#__PURE__*/React.createElement(Dropdown, {
|
140
|
+
id: "".concat(item.id, "-modifier"),
|
141
|
+
type: "inline",
|
142
|
+
items: modifiers === null || modifiers === void 0 ? void 0 : modifiers.options,
|
143
|
+
light: true,
|
144
|
+
label: modifiers === null || modifiers === void 0 ? void 0 : modifiers.label,
|
145
|
+
disabled: !isSelected(item.id),
|
146
|
+
className: "".concat(blockClass, "-dropdown")
|
147
|
+
})) : /*#__PURE__*/React.createElement(RadioButton, {
|
128
148
|
className: "".concat(blockClass, "-radio"),
|
129
149
|
name: "add-select-selections",
|
130
150
|
id: item.id,
|
@@ -141,7 +161,7 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
141
161
|
};
|
142
162
|
AddSelectList.propTypes = {
|
143
163
|
filteredItems: PropTypes.array,
|
144
|
-
|
164
|
+
modifiers: PropTypes.object,
|
145
165
|
multi: PropTypes.bool,
|
146
166
|
multiSelection: PropTypes.array,
|
147
167
|
path: PropTypes.array,
|
@@ -54,7 +54,8 @@ export var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
54
54
|
return handleItemRemove(id);
|
55
55
|
},
|
56
56
|
kind: "ghost",
|
57
|
-
className: "".concat(blockClass, "-item-remove-button")
|
57
|
+
className: "".concat(blockClass, "-item-remove-button"),
|
58
|
+
size: "sm"
|
58
59
|
}));
|
59
60
|
};
|
60
61
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["children", "className", "iconDescription", "label", "menuOptionsClass", "renderIcon", "size"];
|
3
|
+
var _excluded = ["children", "className", "iconDescription", "kind", "label", "menuOptionsClass", "renderIcon", "size"];
|
4
4
|
|
5
5
|
/**
|
6
6
|
* Copyright IBM Corp. 2021, 2021
|
@@ -22,7 +22,8 @@ var componentName = 'ButtonMenu'; // NOTE: the component SCSS is not imported he
|
|
22
22
|
// Default values for props
|
23
23
|
|
24
24
|
var defaults = {
|
25
|
-
size: 'default'
|
25
|
+
size: 'default',
|
26
|
+
kind: 'primary'
|
26
27
|
};
|
27
28
|
/**
|
28
29
|
* Combining a standard button with an overflow menu, this component appears
|
@@ -36,6 +37,8 @@ export var ButtonMenu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
36
37
|
var children = _ref.children,
|
37
38
|
className = _ref.className,
|
38
39
|
iconDescription = _ref.iconDescription,
|
40
|
+
_ref$kind = _ref.kind,
|
41
|
+
kind = _ref$kind === void 0 ? defaults.kind : _ref$kind,
|
39
42
|
label = _ref.label,
|
40
43
|
menuOptionsClass = _ref.menuOptionsClass,
|
41
44
|
Icon = _ref.renderIcon,
|
@@ -50,7 +53,7 @@ export var ButtonMenu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
50
53
|
menuOptionsClass: cx("".concat(blockClass, "__options"), menuOptionsClass),
|
51
54
|
renderIcon: function renderIcon() {
|
52
55
|
return /*#__PURE__*/React.createElement("div", {
|
53
|
-
className: cx(["".concat(blockClass, "__trigger"), "".concat(carbon.prefix, "--btn"), "".concat(carbon.prefix, "--btn--
|
56
|
+
className: cx(["".concat(blockClass, "__trigger"), "".concat(carbon.prefix, "--btn"), "".concat(carbon.prefix, "--btn--").concat(kind), "".concat(carbon.prefix, "--btn--").concat(size)])
|
54
57
|
}, label, Icon && /*#__PURE__*/React.createElement(Icon, {
|
55
58
|
"aria-hidden": "true",
|
56
59
|
"aria-label": iconDescription,
|
@@ -86,6 +89,11 @@ ButtonMenu.propTypes = {
|
|
86
89
|
*/
|
87
90
|
iconDescription: Button.propTypes.iconDescription,
|
88
91
|
|
92
|
+
/**
|
93
|
+
* The three types the menu button supports: primary, tertiary and ghost.
|
94
|
+
*/
|
95
|
+
kind: PropTypes.oneOf(['primary', 'tertiary', 'ghost']),
|
96
|
+
|
89
97
|
/**
|
90
98
|
* The button label for the menu trigger.
|
91
99
|
*/
|
@@ -61,23 +61,23 @@ export var CreateFullPageStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
61
61
|
shouldIncludeStep: shouldIncludeStep,
|
62
62
|
secondaryLabel: secondaryLabel,
|
63
63
|
title: title
|
64
|
-
}); // This useEffect reports back the
|
64
|
+
}); // This useEffect reports back the onMount value so that they can be used
|
65
65
|
// in the appropriate custom hooks.
|
66
66
|
|
67
67
|
useEffect(function () {
|
68
68
|
if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep) && (previousState === null || previousState === void 0 ? void 0 : previousState.currentStep) !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
|
69
|
-
stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnNext(onNext);
|
70
69
|
stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnMount(onMount);
|
71
70
|
}
|
72
|
-
}, [onMount,
|
71
|
+
}, [onMount, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]);
|
73
72
|
useEffect(function () {
|
74
73
|
setShouldIncludeStep(includeStep);
|
75
|
-
}, [includeStep, stepsContext, title]); // Whenever we are the current step, supply our disableSubmit
|
74
|
+
}, [includeStep, stepsContext, title]); // Whenever we are the current step, supply our disableSubmit and onNext values to the
|
76
75
|
// steps container context so that it can manage the 'Next' button appropriately.
|
77
76
|
|
78
77
|
useEffect(function () {
|
79
78
|
if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
|
80
79
|
stepsContext.setIsDisabled(disableSubmit);
|
80
|
+
stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnNext(onNext); // needs to be updated here otherwise there could be stale state values from only initially setting onNext
|
81
81
|
}
|
82
82
|
}, [stepsContext, stepNumber, disableSubmit, onNext]);
|
83
83
|
return stepsContext ? /*#__PURE__*/React.createElement("section", _extends({}, rest, {
|
@@ -63,24 +63,24 @@ export var CreateTearsheetStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
63
63
|
shouldIncludeStep: shouldIncludeStep,
|
64
64
|
secondaryLabel: secondaryLabel,
|
65
65
|
title: title
|
66
|
-
}); // This useEffect reports back the
|
66
|
+
}); // This useEffect reports back the onMount value so that they can be used
|
67
67
|
// in the appropriate custom hooks.
|
68
68
|
|
69
69
|
useEffect(function () {
|
70
70
|
if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep) && (previousState === null || previousState === void 0 ? void 0 : previousState.currentStep) !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
|
71
|
-
stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnNext(onNext);
|
72
71
|
stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnMount(onMount);
|
73
72
|
}
|
74
|
-
}, [onMount,
|
73
|
+
}, [onMount, stepsContext, stepNumber, previousState === null || previousState === void 0 ? void 0 : previousState.currentStep]); // Used to take the `includeStep` prop and use it as a local state value
|
75
74
|
|
76
75
|
useEffect(function () {
|
77
76
|
setShouldIncludeStep(includeStep);
|
78
|
-
}, [includeStep, stepsContext, title]); // Whenever we are the current step, supply our disableSubmit
|
77
|
+
}, [includeStep, stepsContext, title]); // Whenever we are the current step, supply our disableSubmit and onNext values to the
|
79
78
|
// steps container context so that it can manage the 'Next' button appropriately.
|
80
79
|
|
81
80
|
useEffect(function () {
|
82
81
|
if (stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)) {
|
83
82
|
stepsContext.setIsDisabled(disableSubmit);
|
83
|
+
stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.setOnNext(onNext); // needs to be updated here otherwise there could be stale state values from only initially setting onNext
|
84
84
|
}
|
85
85
|
}, [stepsContext, stepNumber, disableSubmit, onNext]);
|
86
86
|
return stepsContext ? /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|