@carbon/ibm-products 2.48.0 → 2.49.0-rc.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/css/index-full-carbon.css +29 -14
- 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 +11 -2
- 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 +29 -14
- 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 +29 -14
- 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/APIKeyModal/APIKeyModal.types.d.ts +1 -1
- package/es/components/Card/Card.js +4 -2
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +100 -24
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +30 -27
- package/es/components/ConditionBuilder/ConditionBuilder.d.ts +9 -2
- package/es/components/ConditionBuilder/ConditionBuilder.js +13 -9
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +151 -0
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +26 -12
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +7 -7
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +62 -27
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +2 -3
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +86 -37
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.d.ts +29 -14
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +10 -9
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +40 -20
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +40 -37
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +10 -49
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -31
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +6 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +7 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +81 -31
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +14 -8
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +27 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +2 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +30 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +35 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +16 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts +32 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +4 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +35 -14
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +5 -6
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +25 -10
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +44 -17
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +50 -40
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +30 -13
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +2 -3
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +9 -10
- package/es/components/ConditionBuilder/utils/useDataConfigs.d.ts +18 -0
- package/es/components/ConditionBuilder/utils/useDataConfigs.js +120 -0
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/useTranslations.js +4 -1
- package/es/components/ConditionBuilder/utils/util.d.ts +12 -0
- package/es/components/ConditionBuilder/utils/util.js +48 -2
- package/es/components/CreateFullPage/CreateFullPageStep.d.ts +2 -2
- package/es/components/CreateFullPage/index.d.ts +1 -0
- package/es/components/CreateTearsheet/CreateTearsheet.js +3 -4
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +8 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +8 -3
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +20 -11
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +7 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +12 -7
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +18 -16
- package/es/components/Datagrid/types/index.d.ts +1 -0
- package/es/components/Datagrid/useActionsColumn.js +1 -4
- package/es/components/Datagrid/useFiltering.d.ts +1 -0
- package/es/components/Datagrid/useFiltering.js +14 -3
- package/es/components/EditInPlace/EditInPlace.js +7 -5
- package/es/components/NotificationsPanel/NotificationsPanel.d.ts +2 -0
- package/es/components/NotificationsPanel/NotificationsPanel.js +75 -5
- package/es/components/TagOverflow/TagOverflow.d.ts +1 -0
- package/es/components/TagOverflow/TagOverflow.js +8 -2
- package/es/components/TagOverflow/TagOverflowPopover.d.ts +1 -0
- package/es/components/TagOverflow/TagOverflowPopover.js +7 -1
- package/es/components/TagSet/TagSetOverflow.js +1 -1
- package/es/components/Tearsheet/Tearsheet.d.ts +2 -2
- package/es/components/Tearsheet/TearsheetShell.js +7 -3
- package/es/components/Toolbar/ToolbarButton.d.ts +12 -1
- package/es/components/Toolbar/ToolbarButton.js +16 -8
- package/es/global/js/hooks/useFocus.d.ts +1 -1
- package/es/global/js/hooks/useFocus.js +40 -24
- package/es/global/js/utils/keyboardNavigation.d.ts +27 -0
- package/es/global/js/utils/keyboardNavigation.js +37 -0
- package/es/global/js/utils/wrapFocus.d.ts +25 -0
- package/es/global/js/utils/wrapFocus.js +68 -0
- package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +1 -1
- package/lib/components/Card/Card.js +3 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +100 -24
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +36 -33
- package/lib/components/ConditionBuilder/ConditionBuilder.d.ts +9 -2
- package/lib/components/ConditionBuilder/ConditionBuilder.js +15 -11
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +151 -0
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +26 -12
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +15 -15
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +62 -27
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +7 -8
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +86 -37
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +4 -4
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.d.ts +29 -14
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +11 -10
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +8 -5
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +40 -20
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +47 -44
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +10 -49
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -31
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +6 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +7 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +81 -31
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +18 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +27 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +3 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +30 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +13 -8
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +35 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +22 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts +32 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +15 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +35 -14
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +5 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +25 -10
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +2 -2
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +44 -17
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +60 -50
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +30 -13
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +18 -19
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +12 -13
- package/lib/components/ConditionBuilder/utils/useDataConfigs.d.ts +18 -0
- package/lib/components/ConditionBuilder/utils/useDataConfigs.js +124 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/useTranslations.js +4 -1
- package/lib/components/ConditionBuilder/utils/util.d.ts +12 -0
- package/lib/components/ConditionBuilder/utils/util.js +53 -3
- package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +2 -2
- package/lib/components/CreateFullPage/index.d.ts +1 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.js +3 -4
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +8 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +8 -3
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +19 -10
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +11 -6
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +18 -16
- package/lib/components/Datagrid/types/index.d.ts +1 -0
- package/lib/components/Datagrid/useActionsColumn.js +1 -4
- package/lib/components/Datagrid/useFiltering.d.ts +1 -0
- package/lib/components/Datagrid/useFiltering.js +13 -1
- package/lib/components/EditInPlace/EditInPlace.js +7 -5
- package/lib/components/NotificationsPanel/NotificationsPanel.d.ts +2 -0
- package/lib/components/NotificationsPanel/NotificationsPanel.js +74 -4
- package/lib/components/TagOverflow/TagOverflow.d.ts +1 -0
- package/lib/components/TagOverflow/TagOverflow.js +8 -2
- package/lib/components/TagOverflow/TagOverflowPopover.d.ts +1 -0
- package/lib/components/TagOverflow/TagOverflowPopover.js +7 -1
- package/lib/components/TagSet/TagSetOverflow.js +1 -1
- package/lib/components/Tearsheet/Tearsheet.d.ts +2 -2
- package/lib/components/Tearsheet/TearsheetShell.js +6 -2
- package/lib/components/Toolbar/ToolbarButton.d.ts +12 -1
- package/lib/components/Toolbar/ToolbarButton.js +15 -6
- package/lib/global/js/hooks/useFocus.d.ts +1 -1
- package/lib/global/js/hooks/useFocus.js +40 -24
- package/lib/global/js/utils/keyboardNavigation.d.ts +27 -0
- package/lib/global/js/utils/keyboardNavigation.js +43 -0
- package/lib/global/js/utils/wrapFocus.d.ts +25 -0
- package/lib/global/js/utils/wrapFocus.js +73 -0
- package/package.json +4 -4
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +33 -22
- package/scss/components/Datagrid/styles/_datagrid.scss +7 -0
- package/scss/components/Datagrid/styles/_useActionsColumn.scss +4 -0
- package/scss/components/EditInPlace/_edit-in-place.scss +2 -2
- package/telemetry.yml +15 -6
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +0 -28
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +0 -123
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +0 -28
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +0 -131
@@ -16,6 +16,7 @@ var react = require('@carbon/react');
|
|
16
16
|
var settings = require('../../../settings.js');
|
17
17
|
var DatagridHead = require('./DatagridHead.js');
|
18
18
|
var useResizeObserver = require('../../../global/js/hooks/useResizeObserver.js');
|
19
|
+
var useIsomorphicEffect = require('../../../global/js/hooks/useIsomorphicEffect.js');
|
19
20
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
22
|
|
@@ -31,7 +32,6 @@ var rowSizeMap = {
|
|
31
32
|
};
|
32
33
|
var defaultRowHeight = rowSizeMap.lg;
|
33
34
|
var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
34
|
-
var _gridRef$current, _gridRef$current2;
|
35
35
|
var getTableBodyProps = datagridState.getTableBodyProps,
|
36
36
|
rows = datagridState.rows,
|
37
37
|
prepareRow = datagridState.prepareRow,
|
@@ -48,6 +48,8 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
48
48
|
gridRef = datagridState.gridRef,
|
49
49
|
tableId = datagridState.tableId,
|
50
50
|
onVirtualScroll = datagridState.onVirtualScroll;
|
51
|
+
var headWrapRef = React.useRef(null);
|
52
|
+
var innerRef = React.useRef(null);
|
51
53
|
|
52
54
|
/* istanbul ignore next */
|
53
55
|
var handleVirtualGridResize = function handleVirtualGridResize() {
|
@@ -68,7 +70,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
68
70
|
if (listRef && listRef.current) {
|
69
71
|
listRef.current.resetAfterIndex(0);
|
70
72
|
}
|
71
|
-
}, [listRef]);
|
73
|
+
}, [listRef, rowHeight]);
|
72
74
|
var visibleRows = DatagridPagination && page || rows;
|
73
75
|
var testRef = React.useRef(null);
|
74
76
|
|
@@ -88,12 +90,21 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
88
90
|
testRefValue === null || testRefValue === void 0 || testRefValue.removeEventListener('scroll', handleScroll);
|
89
91
|
};
|
90
92
|
});
|
93
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
94
|
+
if (headWrapRef.current && headWrapRef.current.style) {
|
95
|
+
var _gridRef$current;
|
96
|
+
headWrapRef.current.style.width = "".concat(gridRef === null || gridRef === void 0 || (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth, "px");
|
97
|
+
}
|
98
|
+
}, [headWrapRef, gridRef]);
|
99
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
100
|
+
if (testRef !== null && testRef !== void 0 && testRef.current && testRef.current.style) {
|
101
|
+
var _gridRef$current2;
|
102
|
+
testRef.current.style.width = "".concat(gridRef === null || gridRef === void 0 || (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth, "px");
|
103
|
+
}
|
104
|
+
}, [testRef, gridRef]);
|
91
105
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
92
106
|
className: "".concat(blockClass, "__head-wrap"),
|
93
|
-
|
94
|
-
width: gridRef === null || gridRef === void 0 || (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
|
95
|
-
overflow: 'hidden'
|
96
|
-
}
|
107
|
+
ref: headWrapRef
|
97
108
|
}, /*#__PURE__*/React__default["default"].createElement(DatagridHead["default"], datagridState)), /*#__PURE__*/React__default["default"].createElement(react.TableBody, _rollupPluginBabelHelpers["extends"]({}, getTableBodyProps({
|
98
109
|
role: undefined
|
99
110
|
}), {
|
@@ -113,10 +124,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
113
124
|
innerRef: innerListRef,
|
114
125
|
outerRef: testRef,
|
115
126
|
ref: listRef,
|
116
|
-
className: "".concat(blockClass, "__virtual-scrollbar")
|
117
|
-
style: {
|
118
|
-
width: gridRef === null || gridRef === void 0 || (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth
|
119
|
-
}
|
127
|
+
className: "".concat(blockClass, "__virtual-scrollbar")
|
120
128
|
}, function (_ref) {
|
121
129
|
var _row$RowRenderer;
|
122
130
|
var index = _ref.index,
|
@@ -126,6 +134,7 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
|
|
126
134
|
var _row$getRowProps = row.getRowProps(),
|
127
135
|
key = _row$getRowProps.key;
|
128
136
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
137
|
+
ref: innerRef,
|
129
138
|
style: _rollupPluginBabelHelpers.objectSpread2({}, style)
|
130
139
|
}, row === null || row === void 0 || (_row$RowRenderer = row.RowRenderer) === null || _row$RowRenderer === void 0 ? void 0 : _row$RowRenderer.call(row, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, datagridState), {}, {
|
131
140
|
row: row,
|
package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js
CHANGED
@@ -67,6 +67,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
67
67
|
_useState10 = _rollupPluginBabelHelpers.slicedToArray(_useState9, 2),
|
68
68
|
isDirty = _useState10[0],
|
69
69
|
setIsDirty = _useState10[1];
|
70
|
+
var prevColumnDefinitions = React.useRef();
|
70
71
|
var onRequestClose = function onRequestClose() {
|
71
72
|
setColumnObjects(columnDefinitions);
|
72
73
|
setIsTearsheetOpen(false);
|
@@ -129,6 +130,9 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
129
130
|
}, [columnObjects]);
|
130
131
|
var string = searchText.trim().toLowerCase();
|
131
132
|
React.useEffect(function () {
|
133
|
+
if (prevColumnDefinitions.current !== columnDefinitions) {
|
134
|
+
setColumnObjects(columnDefinitions);
|
135
|
+
}
|
132
136
|
var actionCount = columnObjects.filter(function (col) {
|
133
137
|
return col.id === 'actions';
|
134
138
|
}).length;
|
@@ -137,7 +141,8 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
137
141
|
}).length;
|
138
142
|
setVisibleColumnsCount(getVisibleColumnsCount() - actionCount - datagridSelectionCount < 0 ? 0 : getVisibleColumnsCount() - actionCount - datagridSelectionCount);
|
139
143
|
setTotalColumns(columnObjects.length - actionCount - datagridSelectionCount);
|
140
|
-
|
144
|
+
prevColumnDefinitions.current = columnDefinitions;
|
145
|
+
}, [getVisibleColumnsCount, columnObjects, columnDefinitions]);
|
141
146
|
return /*#__PURE__*/React__default["default"].createElement(TearsheetNarrow.TearsheetNarrow, {
|
142
147
|
className: "".concat(blockClass, "__customize-columns-tearsheet"),
|
143
148
|
open: isOpen,
|
@@ -25,6 +25,7 @@ var layout = require('@carbon/layout');
|
|
25
25
|
var useFilters = require('./hooks/useFilters.js');
|
26
26
|
var useShouldDisableButtons = require('./hooks/useShouldDisableButtons.js');
|
27
27
|
var useSubscribeToEventEmitter = require('./hooks/useSubscribeToEventEmitter.js');
|
28
|
+
var useIsomorphicEffect = require('../../../../../global/js/hooks/useIsomorphicEffect.js');
|
28
29
|
|
29
30
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
30
31
|
|
@@ -111,7 +112,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
111
112
|
var filterHeadingRef = React.useRef();
|
112
113
|
var filterSearchRef = React.useRef();
|
113
114
|
var actionSetRef = React.useRef();
|
114
|
-
|
115
|
+
var innerContainerRef = React.useRef();
|
115
116
|
/** State from hooks */
|
116
117
|
var _useShouldDisableButt = useShouldDisableButtons["default"]({
|
117
118
|
initialValue: true,
|
@@ -198,7 +199,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
198
199
|
useSubscribeToEventEmitter["default"](constants.CLEAR_FILTERS, function (tableId) {
|
199
200
|
reset(tableId);
|
200
201
|
});
|
201
|
-
var getScrollableContainerHeight = function
|
202
|
+
var getScrollableContainerHeight = React.useCallback(function () {
|
202
203
|
var _filterHeadingRef$cur, _filterSearchRef$curr, _actionSetRef$current;
|
203
204
|
var filterHeadingHeight = (_filterHeadingRef$cur = filterHeadingRef.current) === null || _filterHeadingRef$cur === void 0 ? void 0 : _filterHeadingRef$cur.getBoundingClientRect().height;
|
204
205
|
var filterSearchHeight = (_filterSearchRef$curr = filterSearchRef.current) === null || _filterSearchRef$curr === void 0 ? void 0 : _filterSearchRef$curr.getBoundingClientRect().height;
|
@@ -206,7 +207,13 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
206
207
|
var height = panelOpen ? "calc(100vh - ".concat(filterHeadingHeight, "px - ").concat( /* istanbul ignore next */
|
207
208
|
showFilterSearch ? filterSearchHeight : 0, "px - ").concat(updateMethod === constants.BATCH ? actionSetHeight : 0, "px)") : 0;
|
208
209
|
return height;
|
209
|
-
};
|
210
|
+
}, [filterHeadingRef, filterSearchRef, actionSetRef, panelOpen, showFilterSearch, updateMethod]);
|
211
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
212
|
+
var height = getScrollableContainerHeight();
|
213
|
+
if (innerContainerRef.current && innerContainerRef.current.style) {
|
214
|
+
innerContainerRef.current.style.height = height;
|
215
|
+
}
|
216
|
+
}, [getScrollableContainerHeight, innerContainerRef]);
|
210
217
|
return /*#__PURE__*/React__default["default"].createElement(framerMotion.motion.div, {
|
211
218
|
ref: filterPanelRef,
|
212
219
|
className: cx__default["default"](componentClass, "".concat(componentClass, "__container"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(componentClass, "--open"), panelOpen), "".concat(componentClass, "--batch"), showActionSet), "".concat(componentClass, "--instant"), !showActionSet)),
|
@@ -246,9 +253,7 @@ var FilterPanel = function FilterPanel(_ref) {
|
|
246
253
|
size: "sm"
|
247
254
|
})))), /*#__PURE__*/React__default["default"].createElement("div", {
|
248
255
|
className: "".concat(componentClass, "__inner-container"),
|
249
|
-
|
250
|
-
height: getScrollableContainerHeight()
|
251
|
-
},
|
256
|
+
ref: innerContainerRef,
|
252
257
|
onScroll: onInnerContainerScroll
|
253
258
|
}, filterSections.map(function (_ref2, index) {
|
254
259
|
var _ref2$categoryTitle = _ref2.categoryTitle,
|
@@ -19,6 +19,7 @@ var cx = require('classnames');
|
|
19
19
|
var propsHelper = require('../../../../../../global/js/utils/props-helper.js');
|
20
20
|
var InlineEditContext = require('../InlineEditContext/InlineEditContext.js');
|
21
21
|
var usePreviousValue = require('../../../../../../global/js/hooks/usePreviousValue.js');
|
22
|
+
var useIsomorphicEffect = require('../../../../../../global/js/hooks/useIsomorphicEffect.js');
|
22
23
|
var InlineEditButton = require('../InlineEditButton/InlineEditButton.js');
|
23
24
|
|
24
25
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
@@ -78,7 +79,6 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
78
79
|
var checkboxRef = React.useRef();
|
79
80
|
var numberInputRef = React.useRef();
|
80
81
|
var dropdownRef = React.useRef();
|
81
|
-
var datePickerRef = React.useRef();
|
82
82
|
var outerButtonElement = React.useRef();
|
83
83
|
var rowSize = instance.rowSize,
|
84
84
|
onDataUpdate = instance.onDataUpdate;
|
@@ -308,6 +308,13 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
308
308
|
return renderDropdownItem(item);
|
309
309
|
} : null;
|
310
310
|
};
|
311
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
312
|
+
if (dropdownRef.current && dropdownRef.current.style) {
|
313
|
+
var closestElement = dropdownRef.current.closest(".".concat(blockClass, "__inline-edit--select"));
|
314
|
+
closestElement.style.width = "".concat(cell.column.totalWidth, "px");
|
315
|
+
}
|
316
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
317
|
+
}, [dropdownRef.current, cell.column.totalWidth]);
|
311
318
|
var renderSelectCell = function renderSelectCell() {
|
312
319
|
var _ref6 = config || {},
|
313
320
|
inputProps = _ref6.inputProps;
|
@@ -317,9 +324,6 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
317
324
|
ariaLabel: cellLabel || 'Dropdown menu options'
|
318
325
|
}, inputProps, {
|
319
326
|
hideLabel: true,
|
320
|
-
style: {
|
321
|
-
width: cell.column.totalWidth
|
322
|
-
},
|
323
327
|
className: cx__default["default"]("".concat(blockClass, "__inline-edit--select"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit--select-").concat(rowSize), rowSize)),
|
324
328
|
items: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.items) || [],
|
325
329
|
initialSelectedItem: cell.value,
|
@@ -372,20 +376,21 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
372
376
|
return icons.Calendar;
|
373
377
|
}
|
374
378
|
};
|
375
|
-
var renderRegularCell = function renderRegularCell() {
|
376
|
-
return /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({}, inputProps, {
|
377
|
-
id: cellId
|
378
|
-
}));
|
379
|
-
};
|
380
379
|
var renderDateCell = function renderDateCell() {
|
381
380
|
var _config$inputProps, _outerButtonElement$c;
|
382
381
|
var datePickerPreparedProps = propsHelper.prepareProps(config.inputProps, ['datePickerInputProps']);
|
383
382
|
var datePickerInputProps = config === null || config === void 0 || (_config$inputProps = config.inputProps) === null || _config$inputProps === void 0 ? void 0 : _config$inputProps.datePickerInputProps;
|
384
383
|
return /*#__PURE__*/React__default["default"].createElement(react.DatePicker, _rollupPluginBabelHelpers["extends"]({}, datePickerPreparedProps, {
|
385
384
|
appendTo: outerButtonElement === null || outerButtonElement === void 0 || (_outerButtonElement$c = outerButtonElement.current) === null || _outerButtonElement$c === void 0 ? void 0 : _outerButtonElement$c.parentElement,
|
386
|
-
ref:
|
387
|
-
|
388
|
-
|
385
|
+
ref: function ref(el) {
|
386
|
+
if (el && el.style) {
|
387
|
+
el.style.width = "".concat(cell.column.totalWidth, "px");
|
388
|
+
var elementId = "".concat(blockClass, "__inline-edit--date-picker--").concat(cell.row.index);
|
389
|
+
var element = el.querySelector("input#".concat(elementId));
|
390
|
+
if (element) {
|
391
|
+
element.style.position = 'static';
|
392
|
+
}
|
393
|
+
}
|
389
394
|
},
|
390
395
|
datePickerType: "single",
|
391
396
|
className: cx__default["default"]("".concat(blockClass, "__inline-edit--date"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit--date-").concat(rowSize), rowSize)),
|
@@ -408,9 +413,6 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
408
413
|
},
|
409
414
|
value: cell.value
|
410
415
|
}), /*#__PURE__*/React__default["default"].createElement(react.DatePickerInput, _rollupPluginBabelHelpers["extends"]({}, datePickerInputProps, {
|
411
|
-
style: {
|
412
|
-
position: 'static'
|
413
|
-
},
|
414
416
|
placeholder: (datePickerInputProps === null || datePickerInputProps === void 0 ? void 0 : datePickerInputProps.placeholder) || 'mm/dd/yyyy',
|
415
417
|
labelText: (datePickerInputProps === null || datePickerInputProps === void 0 ? void 0 : datePickerInputProps.labelText) || cellLabel || 'Set date',
|
416
418
|
id: "".concat(blockClass, "__inline-edit--date-picker--").concat(cell.row.index),
|
@@ -533,7 +535,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
533
535
|
onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
|
534
536
|
onKeyDown: !nonEditCell ? handleKeyDown : null,
|
535
537
|
className: cx__default["default"]("".concat(blockClass, "__inline-edit--outer-cell-button"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), inEditMode && (config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue))), "".concat(blockClass, "__static--outer-cell"), !disabledCell))
|
536
|
-
},
|
538
|
+
}, (!inEditMode || disabledCell) && type !== 'checkbox' && /*#__PURE__*/React__default["default"].createElement(InlineEditButton.InlineEditButton, {
|
537
539
|
isActiveCell: cellId === activeCellId,
|
538
540
|
renderIcon: setRenderIcon(),
|
539
541
|
label: getLabel(),
|
@@ -223,6 +223,7 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
|
|
223
223
|
setGlobalFilter?: (filterValue: FilterValue) => void;
|
224
224
|
batchActionMenuButtonLabel?: string;
|
225
225
|
translateWithIdBatchActions?: TableBatchActionsProps['translateWithId'];
|
226
|
+
toolbarBatchActionsDisplayMin?: number;
|
226
227
|
onScroll?: (evt?: any) => void;
|
227
228
|
innerListRef?: MutableRefObject<HTMLDivElement>;
|
228
229
|
tableHeight?: number;
|
@@ -52,10 +52,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
52
52
|
}, isFetching && /*#__PURE__*/React__default["default"].createElement(react.IconSkeleton, {
|
53
53
|
className: "".concat(blockClass, "__actions-column-loading")
|
54
54
|
}), !isFetching && rowActions.length <= 2 && !isColumnSticky && /*#__PURE__*/React__default["default"].createElement("div", {
|
55
|
-
className: "".concat(blockClass, "_actions-column")
|
56
|
-
style: {
|
57
|
-
display: 'flex'
|
58
|
-
}
|
55
|
+
className: "".concat(blockClass, "_actions-column")
|
59
56
|
}, rowActions.map(function (action, index) {
|
60
57
|
var preparedActionProps = propsHelper.prepareProps(action, ['isDelete']);
|
61
58
|
var align = preparedActionProps.align,
|
@@ -14,6 +14,15 @@ var React = require('react');
|
|
14
14
|
var constants = require('./Datagrid/addons/Filtering/constants.js');
|
15
15
|
var FilterFlyout = require('./Datagrid/addons/Filtering/FilterFlyout.js');
|
16
16
|
|
17
|
+
// This function was taken from https://github.com/TanStack/table/blob/v7/src/filterTypes.js
|
18
|
+
var exactText = function exactText(rows, ids, filterValue) {
|
19
|
+
return rows.filter(function (row) {
|
20
|
+
return ids.some(function (id) {
|
21
|
+
var rowValue = row.values[id];
|
22
|
+
return rowValue !== undefined ? String(rowValue).toLowerCase() === String(filterValue).toLowerCase() : true;
|
23
|
+
});
|
24
|
+
});
|
25
|
+
};
|
17
26
|
var handleMultiFilter = function handleMultiFilter(rows, id, value) {
|
18
27
|
// gets all the items that are selected and returns their value
|
19
28
|
var selectedItems = value.filter(function (item) {
|
@@ -34,7 +43,7 @@ var handleMultiFilter = function handleMultiFilter(rows, id, value) {
|
|
34
43
|
var useFiltering = function useFiltering(hooks) {
|
35
44
|
/* istanbul ignore next */
|
36
45
|
var filterTypes = React.useMemo(function () {
|
37
|
-
return _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, constants.DATE, function (rows, id, _ref) {
|
46
|
+
return _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, constants.DATE, function (rows, id, _ref) {
|
38
47
|
var _ref2 = _rollupPluginBabelHelpers.slicedToArray(_ref, 2),
|
39
48
|
startDate = _ref2[0],
|
40
49
|
endDate = _ref2[1];
|
@@ -64,6 +73,8 @@ var useFiltering = function useFiltering(hooks) {
|
|
64
73
|
return handleMultiFilter(rows, id, value);
|
65
74
|
}), constants.MULTISELECT, function (rows, id, value) {
|
66
75
|
return handleMultiFilter(rows, id, value);
|
76
|
+
}), constants.RADIO, function (rows, id, value) {
|
77
|
+
return exactText(rows, id, value);
|
67
78
|
});
|
68
79
|
}, []);
|
69
80
|
hooks.useInstance.push(function (instance) {
|
@@ -99,3 +110,4 @@ var useFiltering = function useFiltering(hooks) {
|
|
99
110
|
var useFiltering$1 = useFiltering;
|
100
111
|
|
101
112
|
exports["default"] = useFiltering$1;
|
113
|
+
exports.exactText = exactText;
|
@@ -104,12 +104,10 @@ exports.EditInPlace = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
104
104
|
};
|
105
105
|
var onSaveHandler = function onSaveHandler() {
|
106
106
|
setInitialValue(value);
|
107
|
-
setFocused(false);
|
108
107
|
setDirtyInput(false);
|
109
108
|
onSave();
|
110
109
|
};
|
111
110
|
var onCancelHandler = function onCancelHandler() {
|
112
|
-
setFocused(false);
|
113
111
|
setDirtyInput(false);
|
114
112
|
onCancel(initialValue);
|
115
113
|
};
|
@@ -140,17 +138,21 @@ exports.EditInPlace = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
140
138
|
var escapeHandler = function escapeHandler() {
|
141
139
|
onCancelHandler();
|
142
140
|
};
|
141
|
+
var removeFocus = function removeFocus() {
|
142
|
+
var _inputRef$current2;
|
143
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.blur();
|
144
|
+
setFocused(false);
|
145
|
+
};
|
143
146
|
var onKeyHandler = function onKeyHandler(e) {
|
144
|
-
var _inputRef$current2, _inputRef$current3;
|
145
147
|
// to prevent blur handler from being called twice add additional state to check if escape is being used
|
146
148
|
escaping.current = true;
|
147
149
|
switch (e.key) {
|
148
150
|
case 'Escape':
|
149
|
-
(
|
151
|
+
removeFocus();
|
150
152
|
escapeHandler();
|
151
153
|
break;
|
152
154
|
case 'Enter':
|
153
|
-
(
|
155
|
+
removeFocus();
|
154
156
|
returnHandler();
|
155
157
|
break;
|
156
158
|
}
|
@@ -158,6 +158,8 @@ export interface NotificationsPanelProps {
|
|
158
158
|
* Sets the yesterday label text
|
159
159
|
*/
|
160
160
|
yesterdayLabel?: string;
|
161
|
+
/** Specify the CSS selectors that match the floating menus. */
|
162
|
+
selectorsFloatingMenus?: string[];
|
161
163
|
}
|
162
164
|
export declare let NotificationsPanel: React.ForwardRefExoticComponent<NotificationsPanelProps & React.RefAttributes<unknown>>;
|
163
165
|
export {};
|
@@ -20,6 +20,7 @@ var settings = require('../../settings.js');
|
|
20
20
|
var propsHelper = require('../../global/js/utils/props-helper.js');
|
21
21
|
var utils = require('./utils.js');
|
22
22
|
var usePrefersReducedMotion = require('../../global/js/hooks/usePrefersReducedMotion.js');
|
23
|
+
var wrapFocus = require('../../global/js/utils/wrapFocus.js');
|
23
24
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
24
25
|
var useClickOutside = require('../../global/js/hooks/useClickOutside.js');
|
25
26
|
var NotificationsEmptyState = require('../EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js');
|
@@ -30,7 +31,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
30
31
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
31
32
|
|
32
33
|
var _Close;
|
33
|
-
var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "hourAgoText", "hoursAgoText", "minuteAgoText", "minutesAgoText", "monthAgoText", "monthsAgoText", "nowText", "onClickOutside", "onDismissAllNotifications", "onDismissSingleNotification", "onDoNotDisturbChange", "onSettingsClick", "onViewAllClick", "open", "previousLabel", "readLessLabel", "readMoreLabel", "secondsAgoText", "settingsIconDescription", "title", "todayLabel", "viewAllLabel", "yearAgoText", "yearsAgoText", "yesterdayAtText", "yesterdayLabel"];
|
34
|
+
var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "hourAgoText", "hoursAgoText", "minuteAgoText", "minutesAgoText", "monthAgoText", "monthsAgoText", "nowText", "onClickOutside", "onDismissAllNotifications", "onDismissSingleNotification", "onDoNotDisturbChange", "onSettingsClick", "onViewAllClick", "open", "previousLabel", "readLessLabel", "readMoreLabel", "secondsAgoText", "settingsIconDescription", "title", "todayLabel", "viewAllLabel", "yearAgoText", "yearsAgoText", "yesterdayAtText", "yesterdayLabel", "selectorsFloatingMenus"];
|
34
35
|
|
35
36
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
36
37
|
var componentName = 'NotificationsPanel';
|
@@ -150,8 +151,12 @@ exports.NotificationsPanel = /*#__PURE__*/React__default["default"].forwardRef(f
|
|
150
151
|
yesterdayAtText = _ref$yesterdayAtText === void 0 ? defaults.yesterdayAtText : _ref$yesterdayAtText,
|
151
152
|
_ref$yesterdayLabel = _ref.yesterdayLabel,
|
152
153
|
yesterdayLabel = _ref$yesterdayLabel === void 0 ? defaults.yesterdayLabel : _ref$yesterdayLabel,
|
154
|
+
selectorsFloatingMenus = _ref.selectorsFloatingMenus,
|
153
155
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
154
|
-
var notificationPanelRef = React.useRef();
|
156
|
+
var notificationPanelRef = React.useRef(null);
|
157
|
+
var notificationPanelInnerRef = React.useRef(null);
|
158
|
+
var startSentinel = React.useRef(null);
|
159
|
+
var endSentinel = React.useRef(null);
|
155
160
|
var _useState = React.useState(open),
|
156
161
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
157
162
|
shouldRender = _useState2[0],
|
@@ -164,6 +169,7 @@ exports.NotificationsPanel = /*#__PURE__*/React__default["default"].forwardRef(f
|
|
164
169
|
open: open
|
165
170
|
});
|
166
171
|
var reducedMotion = usePrefersReducedMotion["default"]();
|
172
|
+
var carbonPrefix = react.usePrefix();
|
167
173
|
React.useEffect(function () {
|
168
174
|
// Set the notifications passed to the state within this component
|
169
175
|
setAllNotifications(data);
|
@@ -175,12 +181,56 @@ exports.NotificationsPanel = /*#__PURE__*/React__default["default"].forwardRef(f
|
|
175
181
|
// initialize the notification panel to open
|
176
182
|
if (open) {
|
177
183
|
setRender(true);
|
184
|
+
var observer = new MutationObserver(function () {
|
185
|
+
if (notificationPanelRef.current) {
|
186
|
+
var _querySelector;
|
187
|
+
var parentElement = notificationPanelRef.current;
|
188
|
+
parentElement === null || parentElement === void 0 || (_querySelector = parentElement.querySelector(".".concat(blockClass, "__dismiss-button"))) === null || _querySelector === void 0 || _querySelector.focus();
|
189
|
+
observer.disconnect();
|
190
|
+
}
|
191
|
+
});
|
192
|
+
if (notificationPanelRef.current) {
|
193
|
+
var parentElement = notificationPanelRef.current;
|
194
|
+
var button = parentElement === null || parentElement === void 0 ? void 0 : parentElement.querySelector(".".concat(blockClass, "__dismiss-button"));
|
195
|
+
button === null || button === void 0 || button.focus();
|
196
|
+
} else {
|
197
|
+
observer.observe(document.body, {
|
198
|
+
childList: true,
|
199
|
+
subtree: true
|
200
|
+
});
|
201
|
+
}
|
202
|
+
return function () {
|
203
|
+
return observer.disconnect();
|
204
|
+
};
|
178
205
|
}
|
179
206
|
}, [open]);
|
180
207
|
var onAnimationEnd = function onAnimationEnd() {
|
181
208
|
// initialize the notification panel to close
|
182
209
|
!open && setRender(false);
|
183
210
|
};
|
211
|
+
var handleBlur = function handleBlur(_ref2) {
|
212
|
+
var oldActiveNode = _ref2.target,
|
213
|
+
currentActiveNode = _ref2.relatedTarget;
|
214
|
+
if (open && currentActiveNode && oldActiveNode && notificationPanelInnerRef.current) {
|
215
|
+
var bodyNode = notificationPanelInnerRef.current;
|
216
|
+
var startSentinelNode = startSentinel.current;
|
217
|
+
var endSentinelNode = endSentinel.current;
|
218
|
+
wrapFocus["default"]({
|
219
|
+
bodyNode: bodyNode,
|
220
|
+
startTrapNode: startSentinelNode,
|
221
|
+
endTrapNode: endSentinelNode,
|
222
|
+
currentActiveNode: currentActiveNode,
|
223
|
+
oldActiveNode: oldActiveNode,
|
224
|
+
selectorsFloatingMenus: selectorsFloatingMenus === null || selectorsFloatingMenus === void 0 ? void 0 : selectorsFloatingMenus.filter(Boolean)
|
225
|
+
});
|
226
|
+
}
|
227
|
+
};
|
228
|
+
var handleKeydown = function handleKeydown(event) {
|
229
|
+
event.stopPropagation();
|
230
|
+
if (event.key === 'Escape') {
|
231
|
+
onClickOutside();
|
232
|
+
}
|
233
|
+
};
|
184
234
|
React.useEffect(function () {
|
185
235
|
if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion) {
|
186
236
|
setRender(false);
|
@@ -319,7 +369,17 @@ exports.NotificationsPanel = /*#__PURE__*/React__default["default"].forwardRef(f
|
|
319
369
|
onDismissSingleNotification(notification);
|
320
370
|
};
|
321
371
|
var mainSectionClassName = cx__default["default"](["".concat(blockClass, "__main-section"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__main-section-empty"), allNotifications && !allNotifications.length)]);
|
322
|
-
return shouldRender ? /*#__PURE__*/React__default["default"].createElement("
|
372
|
+
return shouldRender ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("button", {
|
373
|
+
type: "button",
|
374
|
+
className: "".concat(carbonPrefix, "--visually-hidden"),
|
375
|
+
ref: startSentinel
|
376
|
+
}, "Focus sentinel start"), /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
377
|
+
role: "dialog",
|
378
|
+
"aria-label": "Notification Panel",
|
379
|
+
onBlur: handleBlur,
|
380
|
+
tabIndex: 0,
|
381
|
+
onKeyDown: handleKeydown
|
382
|
+
}, rest, {
|
323
383
|
id: blockClass,
|
324
384
|
className: cx__default["default"](blockClass, className, "".concat(blockClass, "__container")),
|
325
385
|
style: {
|
@@ -328,6 +388,8 @@ exports.NotificationsPanel = /*#__PURE__*/React__default["default"].forwardRef(f
|
|
328
388
|
onAnimationEnd: onAnimationEnd,
|
329
389
|
ref: ref || notificationPanelRef
|
330
390
|
}, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement("div", {
|
391
|
+
ref: notificationPanelInnerRef
|
392
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
331
393
|
className: "".concat(blockClass, "__header-container")
|
332
394
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
333
395
|
className: "".concat(blockClass, "__header-flex")
|
@@ -391,7 +453,11 @@ exports.NotificationsPanel = /*#__PURE__*/React__default["default"].forwardRef(f
|
|
391
453
|
onClick: function onClick() {
|
392
454
|
return onSettingsClick();
|
393
455
|
}
|
394
|
-
})) : null)
|
456
|
+
})) : null)), /*#__PURE__*/React__default["default"].createElement("button", {
|
457
|
+
type: "button",
|
458
|
+
className: "".concat(carbonPrefix, "--visually-hidden"),
|
459
|
+
ref: endSentinel
|
460
|
+
}, "Focus sentinel end")) : null;
|
395
461
|
});
|
396
462
|
|
397
463
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -522,6 +588,10 @@ exports.NotificationsPanel.propTypes = {
|
|
522
588
|
* Sets the `seconds ago` label text
|
523
589
|
*/
|
524
590
|
secondsAgoText: index["default"].func,
|
591
|
+
/**
|
592
|
+
* Specify the CSS selectors that match the floating menus
|
593
|
+
*/
|
594
|
+
selectorsFloatingMenus: index["default"].arrayOf(index["default"].string.isRequired),
|
525
595
|
/**
|
526
596
|
* Sets the settings icon description text
|
527
597
|
*/
|
@@ -20,6 +20,7 @@ export interface TagOverflowProps {
|
|
20
20
|
allTagsModalSearchPlaceholderText?: string;
|
21
21
|
allTagsModalTarget?: ReactNode;
|
22
22
|
allTagsModalTitle?: string;
|
23
|
+
autoAlign?: boolean;
|
23
24
|
className?: string;
|
24
25
|
containingElementRef?: RefObject<HTMLElement>;
|
25
26
|
items: TagOverflowItem[];
|
@@ -27,7 +27,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
27
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
28
28
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
29
29
|
|
30
|
-
var _excluded = ["align", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "className", "containingElementRef", "items", "maxVisible", "measurementOffset", "multiline", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange", "showAllTagsLabel", "tagComponent"],
|
30
|
+
var _excluded = ["align", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "autoAlign", "className", "containingElementRef", "items", "maxVisible", "measurementOffset", "multiline", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange", "showAllTagsLabel", "tagComponent"],
|
31
31
|
_excluded2 = ["className", "id"],
|
32
32
|
_excluded3 = ["tagType"],
|
33
33
|
_excluded4 = ["id", "label", "tagType", "onClose"];
|
@@ -41,6 +41,7 @@ exports.TagOverflow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
41
41
|
allTagsModalSearchPlaceholderText = props.allTagsModalSearchPlaceholderText,
|
42
42
|
allTagsModalTarget = props.allTagsModalTarget,
|
43
43
|
allTagsModalTitle = props.allTagsModalTitle,
|
44
|
+
autoAlign = props.autoAlign,
|
44
45
|
className = props.className,
|
45
46
|
containingElementRef = props.containingElementRef,
|
46
47
|
items = props.items,
|
@@ -221,7 +222,8 @@ exports.TagOverflow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
221
222
|
key: "tag-overflow-popover",
|
222
223
|
ref: overflowRef,
|
223
224
|
popoverOpen: popoverOpen,
|
224
|
-
setPopoverOpen: setPopoverOpen
|
225
|
+
setPopoverOpen: setPopoverOpen,
|
226
|
+
autoAlign: autoAlign
|
225
227
|
}), /*#__PURE__*/React__default["default"].createElement(TagOverflowModal.TagOverflowModal, {
|
226
228
|
allTags: items,
|
227
229
|
open: showAllModalOpen,
|
@@ -275,6 +277,10 @@ exports.TagOverflow.propTypes = {
|
|
275
277
|
* title for the show all modal. **Note: Required if more than 10 tags**
|
276
278
|
*/
|
277
279
|
allTagsModalTitle: string_required_if_more_than_10_tags,
|
280
|
+
/**
|
281
|
+
* Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
|
282
|
+
*/
|
283
|
+
autoAlign: index["default"].bool,
|
278
284
|
/**
|
279
285
|
* Provide an optional class to be applied to the containing node.
|
280
286
|
*/
|
@@ -22,13 +22,14 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
24
24
|
|
25
|
-
var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"],
|
25
|
+
var _excluded = ["allTagsModalSearchThreshold", "autoAlign", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"],
|
26
26
|
_excluded2 = ["label", "id", "tagType", "filter", "onClose"];
|
27
27
|
var componentName = 'TagOverflowPopover';
|
28
28
|
var blockClass = "".concat(settings.pkg.prefix, "--tag-overflow-popover");
|
29
29
|
var TagOverflowPopover = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
30
30
|
var _overflowTags$length;
|
31
31
|
var allTagsModalSearchThreshold = props.allTagsModalSearchThreshold,
|
32
|
+
autoAlign = props.autoAlign,
|
32
33
|
className = props.className,
|
33
34
|
onShowAllClick = props.onShowAllClick,
|
34
35
|
overflowAlign = props.overflowAlign,
|
@@ -71,6 +72,7 @@ var TagOverflowPopover = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
71
72
|
ref: ref || localRef
|
72
73
|
}), /*#__PURE__*/React__default["default"].createElement(react.Popover, {
|
73
74
|
align: overflowAlign,
|
75
|
+
autoAlign: autoAlign,
|
74
76
|
className: cx__default["default"](className, "".concat(blockClass, "__el")),
|
75
77
|
dropShadow: true,
|
76
78
|
highContrast: true,
|
@@ -118,6 +120,10 @@ TagOverflowPopover.propTypes = {
|
|
118
120
|
* count of overflowTags over which a modal is offered
|
119
121
|
*/
|
120
122
|
allTagsModalSearchThreshold: index["default"].number,
|
123
|
+
/**
|
124
|
+
* Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
|
125
|
+
*/
|
126
|
+
autoAlign: index["default"].bool,
|
121
127
|
/**
|
122
128
|
* className
|
123
129
|
*/
|
@@ -78,7 +78,7 @@ var TagSetOverflow = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
78
78
|
return setPopoverOpen === null || setPopoverOpen === void 0 ? void 0 : setPopoverOpen(!popoverOpen);
|
79
79
|
},
|
80
80
|
className: cx__default["default"]("".concat(blockClass, "__popover-trigger"))
|
81
|
-
}, "+"
|
81
|
+
}, "+".concat(overflowTags.length)), /*#__PURE__*/React__default["default"].createElement(react.PopoverContent, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
82
82
|
ref: overflowTagContent,
|
83
83
|
className: "".concat(blockClass, "__content")
|
84
84
|
}, /*#__PURE__*/React__default["default"].createElement("ul", {
|
@@ -35,7 +35,7 @@ export interface TearsheetProps extends PropsWithChildren {
|
|
35
35
|
*
|
36
36
|
* See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
|
37
37
|
*/
|
38
|
-
actions: ButtonProps[];
|
38
|
+
actions: ButtonProps<'button'>[];
|
39
39
|
/**
|
40
40
|
* The aria-label for the tearsheet, which is optional.
|
41
41
|
* if it is not passed, the title will be used as the aria-label.
|
@@ -97,7 +97,7 @@ export interface TearsheetProps extends PropsWithChildren {
|
|
97
97
|
/**
|
98
98
|
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
99
99
|
*/
|
100
|
-
portalTarget
|
100
|
+
portalTarget?: ReactNode;
|
101
101
|
/**
|
102
102
|
* Specify a CSS selector that matches the DOM element that should be
|
103
103
|
* focused when the Modal opens.
|