@carbon/ibm-products 2.17.0 → 2.17.2
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +584 -187
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +84 -8
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +90 -8
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +138 -8
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/CreateSidePanel/CreateSidePanel.js +7 -1
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +6 -4
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +3 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +13 -3
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +19 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +8 -0
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +67 -24
- package/es/components/Datagrid/useExpandedRow.js +3 -6
- package/es/components/Datagrid/useFocusRowExpander.js +40 -0
- package/es/components/Datagrid/useNestedRowExpander.js +9 -0
- package/es/components/Datagrid/useNestedRows.js +1 -5
- package/es/components/Datagrid/useRowExpander.js +9 -0
- package/es/components/Datagrid/useSelectRows.js +23 -11
- package/es/components/EditSidePanel/EditSidePanel.js +8 -2
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/es/components/SidePanel/SidePanel.js +39 -19
- package/es/global/js/hooks/useCreateComponentStepChange.js +1 -1
- package/es/global/js/package-settings.js +0 -2
- package/lib/components/CreateSidePanel/CreateSidePanel.js +7 -1
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +6 -4
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +3 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +13 -3
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +19 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +8 -0
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +68 -25
- package/lib/components/Datagrid/useExpandedRow.js +2 -5
- package/lib/components/Datagrid/useFocusRowExpander.js +45 -0
- package/lib/components/Datagrid/useNestedRowExpander.js +9 -0
- package/lib/components/Datagrid/useNestedRows.js +1 -5
- package/lib/components/Datagrid/useRowExpander.js +9 -0
- package/lib/components/Datagrid/useSelectRows.js +23 -11
- package/lib/components/EditSidePanel/EditSidePanel.js +8 -2
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/lib/components/SidePanel/SidePanel.js +38 -18
- package/lib/global/js/hooks/useCreateComponentStepChange.js +1 -1
- package/lib/global/js/package-settings.js +0 -2
- package/package.json +5 -5
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +6 -0
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +21 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +1 -1
- package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +9 -0
- package/scss/components/SidePanel/_side-panel.scss +22 -6
- package/scss/components/WebTerminal/_web-terminal.scss +5 -0
@@ -12,6 +12,7 @@ import { TableToolbar, TableBatchActions, TableBatchAction, MenuButton, MenuItem
|
|
12
12
|
import { useResizeObserver } from '../../../global/js/hooks/useResizeObserver';
|
13
13
|
import { pkg, carbon } from '../../../settings';
|
14
14
|
import cx from 'classnames';
|
15
|
+
import { handleSelectAllRowData } from './addons/stateReducer';
|
15
16
|
var blockClass = "".concat(pkg.prefix, "--datagrid__table-toolbar");
|
16
17
|
var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridState, width, ref) {
|
17
18
|
var _useState = useState(false),
|
@@ -32,6 +33,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
32
33
|
toolbarBatchActions = datagridState.toolbarBatchActions,
|
33
34
|
setGlobalFilter = datagridState.setGlobalFilter,
|
34
35
|
rows = datagridState.rows,
|
36
|
+
dispatch = datagridState.dispatch,
|
37
|
+
getRowId = datagridState.getRowId,
|
35
38
|
batchActionMenuButtonLabel = datagridState.batchActionMenuButtonLabel,
|
36
39
|
translateWithIdBatchActions = datagridState.translateWithIdBatchActions;
|
37
40
|
var batchActionMenuButtonLabelText = batchActionMenuButtonLabel !== null && batchActionMenuButtonLabel !== void 0 ? batchActionMenuButtonLabel : 'More';
|
@@ -109,6 +112,11 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
|
|
109
112
|
var onSelectAllHandler = function onSelectAllHandler() {
|
110
113
|
toggleAllRowsSelected(true);
|
111
114
|
onSelectAllRows === null || onSelectAllRows === void 0 || onSelectAllRows(true);
|
115
|
+
handleSelectAllRowData({
|
116
|
+
dispatch: dispatch,
|
117
|
+
rows: rows,
|
118
|
+
getRowId: getRowId
|
119
|
+
});
|
112
120
|
};
|
113
121
|
|
114
122
|
// Only display the first two batch actions, the rest are
|
@@ -16,6 +16,7 @@ var COLUMN_RESIZING = 'columnResizing';
|
|
16
16
|
var COLUMN_RESIZE_END = 'columnDoneResizing';
|
17
17
|
var INIT = 'init';
|
18
18
|
var TOGGLE_ROW_SELECTED = 'toggleRowSelected';
|
19
|
+
var TOGGLE_ALL_ROWS_SELECTED = 'toggleAllRowsSelected';
|
19
20
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
20
21
|
export var handleColumnResizeEndEvent = function handleColumnResizeEndEvent(dispatch, onColResizeEnd, headerId, isKeyEvent) {
|
21
22
|
dispatch({
|
@@ -47,35 +48,77 @@ export var handleColumnResizingEvent = function handleColumnResizingEvent(dispat
|
|
47
48
|
}
|
48
49
|
});
|
49
50
|
};
|
50
|
-
export var handleToggleRowSelected = function handleToggleRowSelected(
|
51
|
+
export var handleToggleRowSelected = function handleToggleRowSelected(_ref) {
|
52
|
+
var dispatch = _ref.dispatch,
|
53
|
+
rowData = _ref.rowData,
|
54
|
+
isChecked = _ref.isChecked,
|
55
|
+
getRowId = _ref.getRowId,
|
56
|
+
selectAll = _ref.selectAll;
|
51
57
|
return dispatch({
|
52
58
|
type: TOGGLE_ROW_SELECTED,
|
53
59
|
payload: {
|
54
60
|
rowData: rowData,
|
61
|
+
isChecked: isChecked,
|
62
|
+
getRowId: getRowId,
|
63
|
+
selectAll: selectAll
|
64
|
+
}
|
65
|
+
});
|
66
|
+
};
|
67
|
+
export var handleSelectAllRowData = function handleSelectAllRowData(_ref2) {
|
68
|
+
var dispatch = _ref2.dispatch,
|
69
|
+
rows = _ref2.rows,
|
70
|
+
getRowId = _ref2.getRowId,
|
71
|
+
indeterminate = _ref2.indeterminate,
|
72
|
+
isChecked = _ref2.isChecked;
|
73
|
+
return dispatch({
|
74
|
+
type: TOGGLE_ALL_ROWS_SELECTED,
|
75
|
+
payload: {
|
76
|
+
rows: rows,
|
77
|
+
getRowId: getRowId,
|
78
|
+
indeterminate: indeterminate,
|
55
79
|
isChecked: isChecked
|
56
80
|
}
|
57
81
|
});
|
58
82
|
};
|
59
83
|
export var stateReducer = function stateReducer(newState, action) {
|
60
84
|
switch (action.type) {
|
85
|
+
case TOGGLE_ALL_ROWS_SELECTED:
|
86
|
+
{
|
87
|
+
var _ref3 = action.payload || {},
|
88
|
+
rows = _ref3.rows,
|
89
|
+
getRowId = _ref3.getRowId,
|
90
|
+
indeterminate = _ref3.indeterminate,
|
91
|
+
isChecked = _ref3.isChecked;
|
92
|
+
if (rows) {
|
93
|
+
var newSelectedRowData = {};
|
94
|
+
rows.forEach(function (row) {
|
95
|
+
newSelectedRowData[getRowId(row, row.index)] = row;
|
96
|
+
});
|
97
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
98
|
+
selectedRowData: indeterminate || !isChecked ? {} : newSelectedRowData
|
99
|
+
});
|
100
|
+
}
|
101
|
+
return _objectSpread({}, newState);
|
102
|
+
}
|
61
103
|
case TOGGLE_ROW_SELECTED:
|
62
104
|
{
|
63
|
-
var
|
64
|
-
rowData =
|
65
|
-
|
105
|
+
var _ref4 = action.payload || {},
|
106
|
+
rowData = _ref4.rowData,
|
107
|
+
_isChecked = _ref4.isChecked,
|
108
|
+
_getRowId = _ref4.getRowId;
|
66
109
|
if (!rowData) {
|
67
110
|
return;
|
68
111
|
}
|
69
|
-
if (
|
112
|
+
if (_isChecked) {
|
70
113
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
71
|
-
selectedRowData: _objectSpread(_objectSpread({}, newState.selectedRowData), {}, _defineProperty({}, rowData.index, rowData))
|
114
|
+
selectedRowData: _objectSpread(_objectSpread({}, newState.selectedRowData), {}, _defineProperty({}, _getRowId(rowData, rowData.index), rowData))
|
72
115
|
});
|
73
116
|
}
|
74
|
-
if (rowData && !
|
117
|
+
if (rowData && !_isChecked) {
|
75
118
|
var newData = _objectSpread({}, newState.selectedRowData);
|
76
|
-
var dataWithRemovedRow = Object.fromEntries(Object.entries(newData).filter(function (
|
77
|
-
var
|
78
|
-
key =
|
119
|
+
var dataWithRemovedRow = Object.fromEntries(Object.entries(newData).filter(function (_ref5) {
|
120
|
+
var _ref6 = _slicedToArray(_ref5, 1),
|
121
|
+
key = _ref6[0];
|
79
122
|
return parseInt(key) !== parseInt(rowData.index);
|
80
123
|
}));
|
81
124
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
@@ -92,27 +135,27 @@ export var stateReducer = function stateReducer(newState, action) {
|
|
92
135
|
}
|
93
136
|
case COLUMN_RESIZE_START:
|
94
137
|
{
|
95
|
-
var
|
96
|
-
headerId =
|
138
|
+
var _ref7 = action.payload || {},
|
139
|
+
headerId = _ref7.headerId;
|
97
140
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
98
141
|
isResizing: headerId
|
99
142
|
});
|
100
143
|
}
|
101
144
|
case COLUMN_RESIZING:
|
102
145
|
{
|
103
|
-
var
|
104
|
-
_headerId =
|
105
|
-
newWidth =
|
106
|
-
defaultWidth =
|
146
|
+
var _ref8 = action.payload || {},
|
147
|
+
_headerId = _ref8.headerId,
|
148
|
+
newWidth = _ref8.newWidth,
|
149
|
+
defaultWidth = _ref8.defaultWidth;
|
107
150
|
var newColumnWidth = {};
|
108
151
|
if (typeof _headerId === 'undefined') {
|
109
152
|
return _objectSpread({}, newState);
|
110
153
|
}
|
111
154
|
newColumnWidth[_headerId] = newWidth;
|
112
|
-
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (
|
113
|
-
var
|
114
|
-
_ =
|
115
|
-
value =
|
155
|
+
var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (_ref9) {
|
156
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
157
|
+
_ = _ref10[0],
|
158
|
+
value = _ref10[1];
|
116
159
|
return !isNaN(value);
|
117
160
|
}));
|
118
161
|
var headerIdArray = newState.columnResizing.headerIdWidths || [];
|
@@ -127,10 +170,10 @@ export var stateReducer = function stateReducer(newState, action) {
|
|
127
170
|
}
|
128
171
|
case COLUMN_RESIZE_END:
|
129
172
|
{
|
130
|
-
var
|
131
|
-
onColResizeEnd =
|
132
|
-
_headerId2 =
|
133
|
-
isKeyEvent =
|
173
|
+
var _ref11 = action.payload || {},
|
174
|
+
onColResizeEnd = _ref11.onColResizeEnd,
|
175
|
+
_headerId2 = _ref11.headerId,
|
176
|
+
isKeyEvent = _ref11.isKeyEvent;
|
134
177
|
var currentColumn = {};
|
135
178
|
currentColumn[_headerId2] = newState.columnResizing.columnWidths[_headerId2];
|
136
179
|
var allChangedColumns = newState.columnResizing.columnWidths;
|
@@ -9,14 +9,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
10
10
|
*/
|
11
11
|
|
12
|
-
import {
|
13
|
-
import { pkg } from '../../settings';
|
12
|
+
import { useState } from 'react';
|
14
13
|
import DatagridExpandedRow from './Datagrid/DatagridExpandedRow';
|
15
14
|
import useRowExpander from './useRowExpander';
|
16
15
|
var useExpandedRow = function useExpandedRow(hooks) {
|
17
|
-
useEffect(function () {
|
18
|
-
pkg.checkReportFeatureEnabled('Datagrid.useExpandedRow');
|
19
|
-
}, []);
|
20
16
|
useRowExpander(hooks);
|
21
17
|
var useInstance = function useInstance(instance) {
|
22
18
|
var rows = instance.rows,
|
@@ -38,7 +34,8 @@ var useExpandedRow = function useExpandedRow(hooks) {
|
|
38
34
|
});
|
39
35
|
Object.assign(instance, {
|
40
36
|
rows: rowsWithExpand,
|
41
|
-
setExpandedRowHeight: setExpandedRowHeight
|
37
|
+
setExpandedRowHeight: setExpandedRowHeight,
|
38
|
+
withExpandedRows: true
|
42
39
|
});
|
43
40
|
};
|
44
41
|
hooks.useInstance.push(useInstance);
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 2023
|
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
|
+
|
8
|
+
import { useEffect } from 'react';
|
9
|
+
|
10
|
+
// Focuses the row expander after a nested/expandable row state change.
|
11
|
+
// We have to add this workaround because react-table is re-rendering the entire row
|
12
|
+
// which removes the focus from the expander and interrupts the keyboard navigation
|
13
|
+
// flow.
|
14
|
+
export var useFocusRowExpander = function useFocusRowExpander(_ref) {
|
15
|
+
var instance = _ref.instance,
|
16
|
+
_ref$lastExpandedRowI = _ref.lastExpandedRowIndex,
|
17
|
+
lastExpandedRowIndex = _ref$lastExpandedRowI === void 0 ? 0 : _ref$lastExpandedRowI,
|
18
|
+
blockClass = _ref.blockClass,
|
19
|
+
activeElement = _ref.activeElement;
|
20
|
+
useEffect(function () {
|
21
|
+
// We need to return at this point so that the focus is not stolen from
|
22
|
+
// other interactive elements in the Datagrid
|
23
|
+
if (!activeElement.classList.contains("".concat(blockClass, "__row-expander"))) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
var tableId = instance === null || instance === void 0 ? void 0 : instance.tableId;
|
27
|
+
var rowElements = document.querySelectorAll("#".concat(tableId, " tbody tr"));
|
28
|
+
var rowElementsArray = Array.from(rowElements);
|
29
|
+
var activeRow = rowElementsArray.filter(function (r) {
|
30
|
+
if (r.getAttribute('data-nested-row-id') === lastExpandedRowIndex) {
|
31
|
+
return r;
|
32
|
+
}
|
33
|
+
return null;
|
34
|
+
});
|
35
|
+
if (activeRow.length) {
|
36
|
+
var rowExpander = activeRow[0].querySelector(".".concat(blockClass, "__row-expander"));
|
37
|
+
rowExpander.focus();
|
38
|
+
}
|
39
|
+
}, [instance === null || instance === void 0 ? void 0 : instance.tableId, instance === null || instance === void 0 ? void 0 : instance.expandedRows, lastExpandedRowIndex, blockClass, activeElement]);
|
40
|
+
};
|
@@ -15,12 +15,20 @@ import React, { useRef } from 'react';
|
|
15
15
|
import { ChevronRight } from '@carbon/react/icons';
|
16
16
|
import cx from 'classnames';
|
17
17
|
import { pkg, carbon } from '../../settings';
|
18
|
+
import { useFocusRowExpander } from './useFocusRowExpander';
|
18
19
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
19
20
|
var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
20
21
|
var tempState = useRef();
|
22
|
+
var lastExpandedRowIndex = useRef();
|
21
23
|
var useInstance = function useInstance(instance) {
|
22
24
|
tempState.current = instance;
|
23
25
|
};
|
26
|
+
useFocusRowExpander({
|
27
|
+
instance: tempState === null || tempState === void 0 ? void 0 : tempState.current,
|
28
|
+
lastExpandedRowIndex: lastExpandedRowIndex === null || lastExpandedRowIndex === void 0 ? void 0 : lastExpandedRowIndex.current,
|
29
|
+
blockClass: blockClass,
|
30
|
+
activeElement: document.activeElement
|
31
|
+
});
|
24
32
|
var visibleColumns = function visibleColumns(columns) {
|
25
33
|
var expanderColumn = {
|
26
34
|
id: 'expander',
|
@@ -32,6 +40,7 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
32
40
|
// Prevents `onRowClick` from being called if `useOnRowClick` is included
|
33
41
|
event.stopPropagation();
|
34
42
|
row.toggleRowExpanded();
|
43
|
+
lastExpandedRowIndex.current = row.id;
|
35
44
|
}
|
36
45
|
});
|
37
46
|
var _ref2 = (tempState === null || tempState === void 0 ? void 0 : tempState.current) || {},
|
@@ -6,15 +6,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
7
7
|
*/
|
8
8
|
|
9
|
-
import { useEffect } from 'react';
|
10
|
-
import { pkg } from '../../settings';
|
11
9
|
import cx from 'classnames';
|
10
|
+
import { pkg } from '../../settings';
|
12
11
|
import useNestedRowExpander from './useNestedRowExpander';
|
13
12
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
14
13
|
var useNestedRows = function useNestedRows(hooks) {
|
15
|
-
useEffect(function () {
|
16
|
-
pkg.checkReportFeatureEnabled('Datagrid.useNestedRows');
|
17
|
-
}, []);
|
18
14
|
useNestedRowExpander(hooks);
|
19
15
|
var marginLeft = 24;
|
20
16
|
var getRowProps = function getRowProps(props, _ref) {
|
@@ -15,12 +15,20 @@ import React, { useRef } from 'react';
|
|
15
15
|
import { ChevronDown, ChevronUp } from '@carbon/react/icons';
|
16
16
|
import { pkg, carbon } from '../../settings';
|
17
17
|
import cx from 'classnames';
|
18
|
+
import { useFocusRowExpander } from './useFocusRowExpander';
|
18
19
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
19
20
|
var useRowExpander = function useRowExpander(hooks) {
|
20
21
|
var tempState = useRef();
|
22
|
+
var lastExpandedRowIndex = useRef();
|
21
23
|
var useInstance = function useInstance(instance) {
|
22
24
|
tempState.current = instance;
|
23
25
|
};
|
26
|
+
useFocusRowExpander({
|
27
|
+
instance: tempState === null || tempState === void 0 ? void 0 : tempState.current,
|
28
|
+
lastExpandedRowIndex: lastExpandedRowIndex === null || lastExpandedRowIndex === void 0 ? void 0 : lastExpandedRowIndex.current,
|
29
|
+
blockClass: blockClass,
|
30
|
+
activeElement: document.activeElement
|
31
|
+
});
|
24
32
|
var visibleColumns = function visibleColumns(columns) {
|
25
33
|
var expanderColumn = {
|
26
34
|
id: 'expander',
|
@@ -31,6 +39,7 @@ var useRowExpander = function useRowExpander(hooks) {
|
|
31
39
|
// Prevents `onRowClick` from being called if `useOnRowClick` is included
|
32
40
|
event.stopPropagation();
|
33
41
|
row.toggleRowExpanded();
|
42
|
+
lastExpandedRowIndex.current = row.id;
|
34
43
|
}
|
35
44
|
});
|
36
45
|
var _ref2 = (tempState === null || tempState === void 0 ? void 0 : tempState.current) || {},
|
@@ -6,14 +6,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
var _excluded = ["onChange", "title"];
|
7
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
8
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
9
|
-
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
9
|
+
/**
|
10
|
+
* Copyright IBM Corp. 2020, 2023
|
11
|
+
*
|
12
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
15
14
|
*/
|
16
|
-
|
15
|
+
|
17
16
|
import React, { useLayoutEffect, useState } from 'react';
|
18
17
|
import cx from 'classnames';
|
19
18
|
import { TableSelectRow } from '@carbon/react';
|
@@ -43,7 +42,14 @@ var useSelectRows = function useSelectRows(hooks) {
|
|
43
42
|
});
|
44
43
|
});
|
45
44
|
hooks.visibleColumns.push(function (columns) {
|
46
|
-
|
45
|
+
// Ensures that the first column is the row expander in the
|
46
|
+
// case of selected rows and expandable rows being used together
|
47
|
+
var newColOrder = _toConsumableArray(columns);
|
48
|
+
var expanderColumnIndex = newColOrder.findIndex(function (col) {
|
49
|
+
return col.id === 'expander';
|
50
|
+
});
|
51
|
+
var expanderCol = expanderColumnIndex > -1 ? newColOrder.splice(expanderColumnIndex, 1) : [];
|
52
|
+
return [].concat(_toConsumableArray(expanderColumnIndex > -1 && expanderCol && expanderCol.length ? expanderCol : []), [{
|
47
53
|
id: selectionColumnId,
|
48
54
|
Header: function Header(gridState) {
|
49
55
|
return /*#__PURE__*/React.createElement(SelectAll, gridState);
|
@@ -51,7 +57,7 @@ var useSelectRows = function useSelectRows(hooks) {
|
|
51
57
|
Cell: function Cell(gridState) {
|
52
58
|
return /*#__PURE__*/React.createElement(SelectRow, gridState);
|
53
59
|
}
|
54
|
-
}]
|
60
|
+
}], _toConsumableArray(newColOrder));
|
55
61
|
});
|
56
62
|
};
|
57
63
|
var useHighlightSelection = function useHighlightSelection(hooks) {
|
@@ -79,7 +85,8 @@ var SelectRow = function SelectRow(datagridState) {
|
|
79
85
|
onRowSelect = datagridState.onRowSelect,
|
80
86
|
columns = datagridState.columns,
|
81
87
|
withStickyColumn = datagridState.withStickyColumn,
|
82
|
-
dispatch = datagridState.dispatch
|
88
|
+
dispatch = datagridState.dispatch,
|
89
|
+
getRowId = datagridState.getRowId;
|
83
90
|
var _useState = useState(window.innerWidth),
|
84
91
|
_useState2 = _slicedToArray(_useState, 2),
|
85
92
|
windowSize = _useState2[0],
|
@@ -103,7 +110,12 @@ var SelectRow = function SelectRow(datagridState) {
|
|
103
110
|
}
|
104
111
|
onChange(event);
|
105
112
|
onRowSelect === null || onRowSelect === void 0 || onRowSelect(row, event);
|
106
|
-
handleToggleRowSelected(
|
113
|
+
handleToggleRowSelected({
|
114
|
+
dispatch: dispatch,
|
115
|
+
rowData: row,
|
116
|
+
isChecked: event.target.checked,
|
117
|
+
getRowId: getRowId
|
118
|
+
});
|
107
119
|
};
|
108
120
|
var selectDisabled = isFetching || row.getRowProps().disabled;
|
109
121
|
var _row$getToggleRowSele2 = row.getToggleRowSelectedProps(),
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
-
var _excluded = ["children", "className", "disableSubmit", "formTitle", "formDescription", "onRequestClose", "onRequestSubmit", "open", "placement", "primaryButtonText", "secondaryButtonText", "selectorPrimaryFocus", "selectorPageContent", "size", "slideIn", "subtitle", "title"];
|
4
|
+
var _excluded = ["children", "className", "disableSubmit", "id", "formTitle", "formDescription", "onRequestClose", "onRequestSubmit", "open", "placement", "primaryButtonText", "secondaryButtonText", "selectorPrimaryFocus", "selectorPageContent", "size", "slideIn", "subtitle", "title"];
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
7
7
|
/**
|
@@ -45,6 +45,7 @@ export var EditSidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
45
45
|
var children = _ref.children,
|
46
46
|
className = _ref.className,
|
47
47
|
disableSubmit = _ref.disableSubmit,
|
48
|
+
id = _ref.id,
|
48
49
|
formTitle = _ref.formTitle,
|
49
50
|
formDescription = _ref.formDescription,
|
50
51
|
onRequestClose = _ref.onRequestClose,
|
@@ -84,7 +85,8 @@ export var EditSidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
84
85
|
onRequestClose: onRequestClose,
|
85
86
|
title: title,
|
86
87
|
subtitle: subtitle,
|
87
|
-
selectorPrimaryFocus: selectorPrimaryFocus
|
88
|
+
selectorPrimaryFocus: selectorPrimaryFocus,
|
89
|
+
id: id
|
88
90
|
}, getDevtoolsProps(componentName)), {
|
89
91
|
placement: placement,
|
90
92
|
slideIn: slideIn,
|
@@ -136,6 +138,10 @@ EditSidePanel.propTypes = {
|
|
136
138
|
* Specifies a required field that provides a title for a form
|
137
139
|
*/
|
138
140
|
formTitle: PropTypes.node.isRequired,
|
141
|
+
/**
|
142
|
+
* Unique identifier
|
143
|
+
*/
|
144
|
+
id: PropTypes.string,
|
139
145
|
/**
|
140
146
|
* Specifies an optional handler which is called when the CreateSidePanel
|
141
147
|
* is closed.
|
@@ -47,6 +47,7 @@ export var NoDataEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
47
47
|
className: cx(blockClass, className, "".concat(blockClass, "-position--").concat(illustrationPosition), "".concat(blockClass, "-type--noData")),
|
48
48
|
ref: ref
|
49
49
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NoDataIllustration, {
|
50
|
+
title: title,
|
50
51
|
theme: illustrationTheme,
|
51
52
|
size: size
|
52
53
|
}), /*#__PURE__*/React.createElement(EmptyStateContent, {
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
-
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"],
|
5
|
+
var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "id", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "slug", "subtitle", "title"],
|
6
6
|
_excluded2 = ["label", "kind", "icon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
|
7
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
8
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
@@ -14,7 +14,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
14
14
|
*/
|
15
15
|
|
16
16
|
// Import portions of React that are needed.
|
17
|
-
import React, { useState, useEffect, useRef } from 'react';
|
17
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
18
18
|
import { motion, AnimatePresence } from 'framer-motion';
|
19
19
|
|
20
20
|
// Other standard imports.
|
@@ -65,6 +65,8 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
65
65
|
condensedActions = _ref.condensedActions,
|
66
66
|
_ref$currentStep = _ref.currentStep,
|
67
67
|
currentStep = _ref$currentStep === void 0 ? defaults.currentStep : _ref$currentStep,
|
68
|
+
_ref$id = _ref.id,
|
69
|
+
id = _ref$id === void 0 ? blockClass : _ref$id,
|
68
70
|
includeOverlay = _ref.includeOverlay,
|
69
71
|
labelText = _ref.labelText,
|
70
72
|
_ref$navigationBackIc = _ref.navigationBackIconDescription,
|
@@ -81,6 +83,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
81
83
|
_ref$size = _ref.size,
|
82
84
|
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
83
85
|
slideIn = _ref.slideIn,
|
86
|
+
slug = _ref.slug,
|
84
87
|
subtitle = _ref.subtitle,
|
85
88
|
title = _ref.title,
|
86
89
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -105,6 +108,10 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
105
108
|
var reducedMotion = typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
|
106
109
|
matches: true
|
107
110
|
};
|
111
|
+
var getActionsContainerElement = useCallback(function () {
|
112
|
+
var sidePanelOuter = document.querySelector("#".concat(id));
|
113
|
+
return sidePanelOuter && sidePanelOuter.querySelector(".".concat(blockClass, "__actions-container"));
|
114
|
+
}, [id]);
|
108
115
|
|
109
116
|
// scroll panel to top going between steps
|
110
117
|
useEffect(function () {
|
@@ -112,7 +119,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
112
119
|
if (panelRef && panelRef.current) {
|
113
120
|
var _document$querySelect;
|
114
121
|
var scrollableSection = panelRef.current.querySelector(".".concat(blockClass, "__inner-content"));
|
115
|
-
var sidePanelOuter = document.querySelector("#".concat(
|
122
|
+
var sidePanelOuter = document.querySelector("#".concat(id));
|
116
123
|
var initialTitleHeight = (_document$querySelect = document.querySelector(".".concat(blockClass, "__title-container"))) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.offsetHeight;
|
117
124
|
scrollableSection.scrollTop = 0;
|
118
125
|
// The size of the panel has changed while it is still opened
|
@@ -124,7 +131,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
124
131
|
sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style = sidePanelOuter.style) === null || _sidePanelOuter$style === void 0 || _sidePanelOuter$style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
|
125
132
|
}
|
126
133
|
}
|
127
|
-
}, [currentStep, ref, size, previousState === null || previousState === void 0 ? void 0 : previousState.size]);
|
134
|
+
}, [currentStep, ref, size, previousState === null || previousState === void 0 ? void 0 : previousState.size, id]);
|
128
135
|
|
129
136
|
// set initial focus when side panel opens
|
130
137
|
useEffect(function () {
|
@@ -148,13 +155,13 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
148
155
|
useEffect(function () {
|
149
156
|
if (open && actions && actions.length && animationComplete) {
|
150
157
|
var _sidePanelOuter$style2;
|
151
|
-
var sidePanelOuter = document.querySelector("#".concat(
|
158
|
+
var sidePanelOuter = document.querySelector("#".concat(id));
|
152
159
|
var actionsContainer = getActionsContainerElement();
|
153
160
|
var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
|
154
161
|
actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
|
155
162
|
sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style2 = sidePanelOuter.style) === null || _sidePanelOuter$style2 === void 0 || _sidePanelOuter$style2.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
|
156
163
|
}
|
157
|
-
}, [actions, condensedActions, open, animationComplete]);
|
164
|
+
}, [actions, condensedActions, open, animationComplete, id, getActionsContainerElement]);
|
158
165
|
|
159
166
|
// Add console warning if labelText is provided without a title.
|
160
167
|
// This combination is not allowed.
|
@@ -169,23 +176,19 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
169
176
|
var _sidePanelOuter$style3;
|
170
177
|
var height = _ref2.height;
|
171
178
|
setPanelHeight(height);
|
172
|
-
var sidePanelOuter = document.querySelector("#".concat(
|
179
|
+
var sidePanelOuter = document.querySelector("#".concat(id));
|
173
180
|
var actionsContainer = getActionsContainerElement();
|
174
181
|
var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
|
175
182
|
actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
|
176
183
|
sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style3 = sidePanelOuter.style) === null || _sidePanelOuter$style3 === void 0 || _sidePanelOuter$style3.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
|
177
184
|
};
|
178
|
-
var getActionsContainerElement = function getActionsContainerElement() {
|
179
|
-
var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
|
180
|
-
return sidePanelOuter && sidePanelOuter.querySelector(".".concat(blockClass, "__actions-container"));
|
181
|
-
};
|
182
185
|
|
183
186
|
// Title and subtitle scroll animation
|
184
187
|
useEffect(function () {
|
185
188
|
if (open && animateTitle && animationComplete && title && title.length && !reducedMotion.matches) {
|
186
189
|
var _document$querySelect2, _document$querySelect3, _document$querySelect4;
|
187
|
-
var sidePanelOuter = document.querySelector("#".concat(
|
188
|
-
var sidePanelScrollArea = document.querySelector("#".concat(
|
190
|
+
var sidePanelOuter = document.querySelector("#".concat(id));
|
191
|
+
var sidePanelScrollArea = document.querySelector("#".concat(id, " .").concat(blockClass, "__inner-content"));
|
189
192
|
var sidePanelTitleElement = document.querySelector(".".concat(blockClass, "__title-text"));
|
190
193
|
var sidePanelCollapsedTitleElement = document.querySelector(".".concat(blockClass, "__collapsed-title-text"));
|
191
194
|
var sidePanelSubtitleElement = document.querySelector(".".concat("".concat(blockClass, "__subtitle-text")));
|
@@ -260,7 +263,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
260
263
|
});
|
261
264
|
}
|
262
265
|
if (open && !animateTitle) {
|
263
|
-
var _sidePanelOuter = document.querySelector("#".concat(
|
266
|
+
var _sidePanelOuter = document.querySelector("#".concat(id));
|
264
267
|
var _sidePanelTitleElement = document.querySelector(".".concat(blockClass, "__title-container .").concat(blockClass, "__title-text"));
|
265
268
|
var _sidePanelSubtitleElement = document.querySelector(".".concat(blockClass, "__subtitle-text"));
|
266
269
|
var actionToolbarElement = document.querySelector(".".concat(blockClass, "__action-toolbar"));
|
@@ -274,7 +277,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
274
277
|
_sidePanelOuter === null || _sidePanelOuter === void 0 || _sidePanelOuter.style.setProperty("--".concat(blockClass, "--action-bar-container-height"), "".concat(sidePanelActionBarElementHeight, "px"));
|
275
278
|
_sidePanelOuter === null || _sidePanelOuter === void 0 || _sidePanelOuter.style.setProperty("--".concat(blockClass, "--label-text-height"), "".concat(labelHeight, "px"));
|
276
279
|
}
|
277
|
-
}, [open, animateTitle, animationComplete, panelHeight, title, size, reducedMotion.matches]);
|
280
|
+
}, [open, animateTitle, animationComplete, panelHeight, title, size, reducedMotion.matches, id]);
|
278
281
|
|
279
282
|
// click outside functionality if `includeOverlay` prop is set
|
280
283
|
useEffect(function () {
|
@@ -371,9 +374,16 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
371
374
|
}
|
372
375
|
};
|
373
376
|
var primaryActionContainerClassNames = cx(["".concat(blockClass, "__actions-container"), _defineProperty({}, "".concat(blockClass, "__actions-container-condensed"), condensedActions)]);
|
374
|
-
var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (_ref5 = {}, _defineProperty(_ref5, "".concat(blockClass, "__container-right-placement"), placement === 'right'), _defineProperty(_ref5, "".concat(blockClass, "__container-left-placement"), placement === 'left'), _defineProperty(_ref5, "".concat(blockClass, "__container-with-action-toolbar"), actionToolbarButtons && actionToolbarButtons.length), _defineProperty(_ref5, "".concat(blockClass, "__container-without-overlay"), !includeOverlay && !slideIn), _defineProperty(_ref5, "".concat(blockClass, "__container-is-animating"), !animationComplete || !open), _ref5)]);
|
377
|
+
var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (_ref5 = {}, _defineProperty(_ref5, "".concat(blockClass, "__container-right-placement"), placement === 'right'), _defineProperty(_ref5, "".concat(blockClass, "__container-left-placement"), placement === 'left'), _defineProperty(_ref5, "".concat(blockClass, "__container-with-action-toolbar"), actionToolbarButtons && actionToolbarButtons.length), _defineProperty(_ref5, "".concat(blockClass, "__container-without-overlay"), !includeOverlay && !slideIn), _defineProperty(_ref5, "".concat(blockClass, "__container-is-animating"), !animationComplete || !open), _defineProperty(_ref5, "".concat(blockClass, "__container--has-slug"), slug), _ref5)]);
|
375
378
|
var renderHeader = function renderHeader() {
|
376
379
|
var _cx, _cx2;
|
380
|
+
var normalizedSlug;
|
381
|
+
if (slug) {
|
382
|
+
normalizedSlug = /*#__PURE__*/React.cloneElement(slug, {
|
383
|
+
// slug size is sm unless actions and size > md
|
384
|
+
size: actions.length && /l/.test(size) ? 'md' : 'sm'
|
385
|
+
});
|
386
|
+
}
|
377
387
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
378
388
|
className: cx("".concat(blockClass, "__title-container"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__on-detail-step"), currentStep > 0), _defineProperty(_cx, "".concat(blockClass, "__on-detail-step-without-title"), currentStep > 0 && !title), _defineProperty(_cx, "".concat(blockClass, "__title-container--no-title-animation"), !animateTitle), _defineProperty(_cx, "".concat(blockClass, "__title-container-is-animating"), !animationComplete || !open), _defineProperty(_cx, "".concat(blockClass, "__title-container-without-title"), !title), _defineProperty(_cx, "".concat(blockClass, "__title-container--reduced-motion"), reducedMotion.matches), _cx))
|
379
389
|
}, currentStep > 0 && /*#__PURE__*/React.createElement(Button, {
|
@@ -391,7 +401,9 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
391
401
|
onClick: onNavigationBack
|
392
402
|
}), title && title.length && labelText && labelText.length && /*#__PURE__*/React.createElement("p", {
|
393
403
|
className: "".concat(blockClass, "__label-text")
|
394
|
-
}, labelText), title && title.length && renderTitle()), /*#__PURE__*/React.createElement(
|
404
|
+
}, labelText), title && title.length && renderTitle()), /*#__PURE__*/React.createElement("div", {
|
405
|
+
className: "".concat(blockClass, "__slug-and-close")
|
406
|
+
}, normalizedSlug, /*#__PURE__*/React.createElement(Button, {
|
395
407
|
"aria-label": closeIconDescription,
|
396
408
|
kind: "ghost",
|
397
409
|
size: "sm",
|
@@ -404,7 +416,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
404
416
|
className: "".concat(blockClass, "__close-button"),
|
405
417
|
onClick: onRequestClose,
|
406
418
|
ref: sidePanelCloseRef
|
407
|
-
}), subtitle && /*#__PURE__*/React.createElement("p", {
|
419
|
+
})), subtitle && /*#__PURE__*/React.createElement("p", {
|
408
420
|
className: cx("".concat(blockClass, "__subtitle-text"), (_cx2 = {}, _defineProperty(_cx2, "".concat(blockClass, "__subtitle-text-no-animation"), !animateTitle), _defineProperty(_cx2, "".concat(blockClass, "__subtitle-text-no-animation-no-action-toolbar"), !animateTitle && (!actionToolbarButtons || !actionToolbarButtons.length)), _defineProperty(_cx2, "".concat(blockClass, "__subtitle-text-is-animating"), !animationComplete && animateTitle), _defineProperty(_cx2, "".concat(blockClass, "__subtitle-without-title"), !title), _cx2))
|
409
421
|
}, subtitle), actionToolbarButtons && actionToolbarButtons.length && /*#__PURE__*/React.createElement("div", {
|
410
422
|
className: cx("".concat(blockClass, "__action-toolbar"), _defineProperty({}, "".concat(blockClass, "__action-toolbar-no-animation"), !animateTitle))
|
@@ -448,7 +460,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
448
460
|
var contentRef = ref || sidePanelRef;
|
449
461
|
useResizeObserver(contentRef, handleResize);
|
450
462
|
return /*#__PURE__*/React.createElement(AnimatePresence, null, open && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(motion.div, _extends({}, getDevtoolsProps(componentName), rest, {
|
451
|
-
id:
|
463
|
+
id: id,
|
452
464
|
className: mainPanelClassNames,
|
453
465
|
onBlur: handleBlur,
|
454
466
|
ref: contentRef,
|
@@ -556,6 +568,10 @@ SidePanel.propTypes = {
|
|
556
568
|
* Sets the current step of the side panel
|
557
569
|
*/
|
558
570
|
currentStep: PropTypes.number,
|
571
|
+
/**
|
572
|
+
* Unique identifier
|
573
|
+
*/
|
574
|
+
id: PropTypes.string,
|
559
575
|
/**
|
560
576
|
* Determines whether the side panel should render with an overlay
|
561
577
|
*/
|
@@ -615,6 +631,10 @@ SidePanel.propTypes = {
|
|
615
631
|
* Determines if this panel slides in
|
616
632
|
*/
|
617
633
|
slideIn: PropTypes.bool,
|
634
|
+
/**
|
635
|
+
* Provide a `Slug` component to be rendered inside the `SidePanel` component
|
636
|
+
*/
|
637
|
+
slug: PropTypes.node,
|
618
638
|
/**
|
619
639
|
* Sets the subtitle text
|
620
640
|
*/
|
@@ -66,7 +66,7 @@ export var useCreateComponentStepChange = function useCreateComponentStepChange(
|
|
66
66
|
useEffect(function () {
|
67
67
|
var onUnmount = function onUnmount() {
|
68
68
|
if (componentName !== 'CreateFullPage') {
|
69
|
-
setCurrentStep(
|
69
|
+
setCurrentStep(1);
|
70
70
|
}
|
71
71
|
setIsSubmitting(false);
|
72
72
|
onClose();
|