@carbon/ibm-products 2.48.0 → 2.49.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
@@ -15,6 +15,7 @@ import cx from 'classnames';
|
|
15
15
|
import { prepareProps } from '../../../../../../global/js/utils/props-helper.js';
|
16
16
|
import { InlineEditContext } from '../InlineEditContext/InlineEditContext.js';
|
17
17
|
import { usePreviousValue } from '../../../../../../global/js/hooks/usePreviousValue.js';
|
18
|
+
import { useIsomorphicEffect } from '../../../../../../global/js/hooks/useIsomorphicEffect.js';
|
18
19
|
import { InlineEditButton } from '../InlineEditButton/InlineEditButton.js';
|
19
20
|
|
20
21
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
@@ -69,7 +70,6 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
69
70
|
var checkboxRef = useRef();
|
70
71
|
var numberInputRef = useRef();
|
71
72
|
var dropdownRef = useRef();
|
72
|
-
var datePickerRef = useRef();
|
73
73
|
var outerButtonElement = useRef();
|
74
74
|
var rowSize = instance.rowSize,
|
75
75
|
onDataUpdate = instance.onDataUpdate;
|
@@ -299,6 +299,13 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
299
299
|
return renderDropdownItem(item);
|
300
300
|
} : null;
|
301
301
|
};
|
302
|
+
useIsomorphicEffect(function () {
|
303
|
+
if (dropdownRef.current && dropdownRef.current.style) {
|
304
|
+
var closestElement = dropdownRef.current.closest(".".concat(blockClass, "__inline-edit--select"));
|
305
|
+
closestElement.style.width = "".concat(cell.column.totalWidth, "px");
|
306
|
+
}
|
307
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
308
|
+
}, [dropdownRef.current, cell.column.totalWidth]);
|
302
309
|
var renderSelectCell = function renderSelectCell() {
|
303
310
|
var _ref6 = config || {},
|
304
311
|
inputProps = _ref6.inputProps;
|
@@ -308,9 +315,6 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
308
315
|
ariaLabel: cellLabel || 'Dropdown menu options'
|
309
316
|
}, inputProps, {
|
310
317
|
hideLabel: true,
|
311
|
-
style: {
|
312
|
-
width: cell.column.totalWidth
|
313
|
-
},
|
314
318
|
className: cx("".concat(blockClass, "__inline-edit--select"), _defineProperty({}, "".concat(blockClass, "__inline-edit--select-").concat(rowSize), rowSize)),
|
315
319
|
items: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.items) || [],
|
316
320
|
initialSelectedItem: cell.value,
|
@@ -363,20 +367,21 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
363
367
|
return Calendar;
|
364
368
|
}
|
365
369
|
};
|
366
|
-
var renderRegularCell = function renderRegularCell() {
|
367
|
-
return /*#__PURE__*/React__default.createElement("span", _extends({}, inputProps, {
|
368
|
-
id: cellId
|
369
|
-
}));
|
370
|
-
};
|
371
370
|
var renderDateCell = function renderDateCell() {
|
372
371
|
var _config$inputProps, _outerButtonElement$c;
|
373
372
|
var datePickerPreparedProps = prepareProps(config.inputProps, ['datePickerInputProps']);
|
374
373
|
var datePickerInputProps = config === null || config === void 0 || (_config$inputProps = config.inputProps) === null || _config$inputProps === void 0 ? void 0 : _config$inputProps.datePickerInputProps;
|
375
374
|
return /*#__PURE__*/React__default.createElement(DatePicker, _extends({}, datePickerPreparedProps, {
|
376
375
|
appendTo: outerButtonElement === null || outerButtonElement === void 0 || (_outerButtonElement$c = outerButtonElement.current) === null || _outerButtonElement$c === void 0 ? void 0 : _outerButtonElement$c.parentElement,
|
377
|
-
ref:
|
378
|
-
|
379
|
-
|
376
|
+
ref: function ref(el) {
|
377
|
+
if (el && el.style) {
|
378
|
+
el.style.width = "".concat(cell.column.totalWidth, "px");
|
379
|
+
var elementId = "".concat(blockClass, "__inline-edit--date-picker--").concat(cell.row.index);
|
380
|
+
var element = el.querySelector("input#".concat(elementId));
|
381
|
+
if (element) {
|
382
|
+
element.style.position = 'static';
|
383
|
+
}
|
384
|
+
}
|
380
385
|
},
|
381
386
|
datePickerType: "single",
|
382
387
|
className: cx("".concat(blockClass, "__inline-edit--date"), _defineProperty({}, "".concat(blockClass, "__inline-edit--date-").concat(rowSize), rowSize)),
|
@@ -399,9 +404,6 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
399
404
|
},
|
400
405
|
value: cell.value
|
401
406
|
}), /*#__PURE__*/React__default.createElement(DatePickerInput, _extends({}, datePickerInputProps, {
|
402
|
-
style: {
|
403
|
-
position: 'static'
|
404
|
-
},
|
405
407
|
placeholder: (datePickerInputProps === null || datePickerInputProps === void 0 ? void 0 : datePickerInputProps.placeholder) || 'mm/dd/yyyy',
|
406
408
|
labelText: (datePickerInputProps === null || datePickerInputProps === void 0 ? void 0 : datePickerInputProps.labelText) || cellLabel || 'Set date',
|
407
409
|
id: "".concat(blockClass, "__inline-edit--date-picker--").concat(cell.row.index),
|
@@ -524,7 +526,7 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
524
526
|
onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
|
525
527
|
onKeyDown: !nonEditCell ? handleKeyDown : null,
|
526
528
|
className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), _defineProperty(_defineProperty(_defineProperty(_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))
|
527
|
-
},
|
529
|
+
}, (!inEditMode || disabledCell) && type !== 'checkbox' && /*#__PURE__*/React__default.createElement(InlineEditButton, {
|
528
530
|
isActiveCell: cellId === activeCellId,
|
529
531
|
renderIcon: setRenderIcon(),
|
530
532
|
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;
|
@@ -43,10 +43,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
43
43
|
}, isFetching && /*#__PURE__*/React__default.createElement(IconSkeleton, {
|
44
44
|
className: "".concat(blockClass, "__actions-column-loading")
|
45
45
|
}), !isFetching && rowActions.length <= 2 && !isColumnSticky && /*#__PURE__*/React__default.createElement("div", {
|
46
|
-
className: "".concat(blockClass, "_actions-column")
|
47
|
-
style: {
|
48
|
-
display: 'flex'
|
49
|
-
}
|
46
|
+
className: "".concat(blockClass, "_actions-column")
|
50
47
|
}, rowActions.map(function (action, index) {
|
51
48
|
var preparedActionProps = prepareProps(action, ['isDelete']);
|
52
49
|
var align = preparedActionProps.align,
|
@@ -7,9 +7,18 @@
|
|
7
7
|
|
8
8
|
import { defineProperty as _defineProperty, slicedToArray as _slicedToArray, typeof as _typeof, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { useMemo } from 'react';
|
10
|
-
import {
|
10
|
+
import { RADIO, DATE, NUMBER, CHECKBOX, MULTISELECT, BATCH } from './Datagrid/addons/Filtering/constants.js';
|
11
11
|
import FilterFlyout from './Datagrid/addons/Filtering/FilterFlyout.js';
|
12
12
|
|
13
|
+
// This function was taken from https://github.com/TanStack/table/blob/v7/src/filterTypes.js
|
14
|
+
var exactText = function exactText(rows, ids, filterValue) {
|
15
|
+
return rows.filter(function (row) {
|
16
|
+
return ids.some(function (id) {
|
17
|
+
var rowValue = row.values[id];
|
18
|
+
return rowValue !== undefined ? String(rowValue).toLowerCase() === String(filterValue).toLowerCase() : true;
|
19
|
+
});
|
20
|
+
});
|
21
|
+
};
|
13
22
|
var handleMultiFilter = function handleMultiFilter(rows, id, value) {
|
14
23
|
// gets all the items that are selected and returns their value
|
15
24
|
var selectedItems = value.filter(function (item) {
|
@@ -30,7 +39,7 @@ var handleMultiFilter = function handleMultiFilter(rows, id, value) {
|
|
30
39
|
var useFiltering = function useFiltering(hooks) {
|
31
40
|
/* istanbul ignore next */
|
32
41
|
var filterTypes = useMemo(function () {
|
33
|
-
return _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, DATE, function (rows, id, _ref) {
|
42
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, DATE, function (rows, id, _ref) {
|
34
43
|
var _ref2 = _slicedToArray(_ref, 2),
|
35
44
|
startDate = _ref2[0],
|
36
45
|
endDate = _ref2[1];
|
@@ -60,6 +69,8 @@ var useFiltering = function useFiltering(hooks) {
|
|
60
69
|
return handleMultiFilter(rows, id, value);
|
61
70
|
}), MULTISELECT, function (rows, id, value) {
|
62
71
|
return handleMultiFilter(rows, id, value);
|
72
|
+
}), RADIO, function (rows, id, value) {
|
73
|
+
return exactText(rows, id, value);
|
63
74
|
});
|
64
75
|
}, []);
|
65
76
|
hooks.useInstance.push(function (instance) {
|
@@ -94,4 +105,4 @@ var useFiltering = function useFiltering(hooks) {
|
|
94
105
|
};
|
95
106
|
var useFiltering$1 = useFiltering;
|
96
107
|
|
97
|
-
export { useFiltering$1 as default };
|
108
|
+
export { useFiltering$1 as default, exactText };
|
@@ -95,12 +95,10 @@ var EditInPlace = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
95
95
|
};
|
96
96
|
var onSaveHandler = function onSaveHandler() {
|
97
97
|
setInitialValue(value);
|
98
|
-
setFocused(false);
|
99
98
|
setDirtyInput(false);
|
100
99
|
onSave();
|
101
100
|
};
|
102
101
|
var onCancelHandler = function onCancelHandler() {
|
103
|
-
setFocused(false);
|
104
102
|
setDirtyInput(false);
|
105
103
|
onCancel(initialValue);
|
106
104
|
};
|
@@ -131,17 +129,21 @@ var EditInPlace = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
131
129
|
var escapeHandler = function escapeHandler() {
|
132
130
|
onCancelHandler();
|
133
131
|
};
|
132
|
+
var removeFocus = function removeFocus() {
|
133
|
+
var _inputRef$current2;
|
134
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.blur();
|
135
|
+
setFocused(false);
|
136
|
+
};
|
134
137
|
var onKeyHandler = function onKeyHandler(e) {
|
135
|
-
var _inputRef$current2, _inputRef$current3;
|
136
138
|
// to prevent blur handler from being called twice add additional state to check if escape is being used
|
137
139
|
escaping.current = true;
|
138
140
|
switch (e.key) {
|
139
141
|
case 'Escape':
|
140
|
-
(
|
142
|
+
removeFocus();
|
141
143
|
escapeHandler();
|
142
144
|
break;
|
143
145
|
case 'Enter':
|
144
|
-
(
|
146
|
+
removeFocus();
|
145
147
|
returnHandler();
|
146
148
|
break;
|
147
149
|
}
|
@@ -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 {};
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import { Button, Toggle, Link, IconButton } from '@carbon/react';
|
9
|
+
import { usePrefix, Button, Toggle, Link, IconButton } from '@carbon/react';
|
10
10
|
import { Settings, ErrorFilled, CheckmarkFilled, WarningAltFilled, InformationSquareFilled, Close, ChevronDown } from '@carbon/react/icons';
|
11
11
|
import React__default, { useRef, useState, useEffect } from 'react';
|
12
12
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
@@ -16,12 +16,13 @@ import { pkg } from '../../settings.js';
|
|
16
16
|
import { prepareProps } from '../../global/js/utils/props-helper.js';
|
17
17
|
import { timeAgo } from './utils.js';
|
18
18
|
import usePrefersReducedMotion from '../../global/js/hooks/usePrefersReducedMotion.js';
|
19
|
+
import wrapFocus from '../../global/js/utils/wrapFocus.js';
|
19
20
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
20
21
|
import { useClickOutside } from '../../global/js/hooks/useClickOutside.js';
|
21
22
|
import { NotificationsEmptyState } from '../EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js';
|
22
23
|
|
23
24
|
var _Close;
|
24
|
-
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"];
|
25
|
+
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"];
|
25
26
|
|
26
27
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
28
|
var componentName = 'NotificationsPanel';
|
@@ -141,8 +142,12 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
141
142
|
yesterdayAtText = _ref$yesterdayAtText === void 0 ? defaults.yesterdayAtText : _ref$yesterdayAtText,
|
142
143
|
_ref$yesterdayLabel = _ref.yesterdayLabel,
|
143
144
|
yesterdayLabel = _ref$yesterdayLabel === void 0 ? defaults.yesterdayLabel : _ref$yesterdayLabel,
|
145
|
+
selectorsFloatingMenus = _ref.selectorsFloatingMenus,
|
144
146
|
rest = _objectWithoutProperties(_ref, _excluded);
|
145
|
-
var notificationPanelRef = useRef();
|
147
|
+
var notificationPanelRef = useRef(null);
|
148
|
+
var notificationPanelInnerRef = useRef(null);
|
149
|
+
var startSentinel = useRef(null);
|
150
|
+
var endSentinel = useRef(null);
|
146
151
|
var _useState = useState(open),
|
147
152
|
_useState2 = _slicedToArray(_useState, 2),
|
148
153
|
shouldRender = _useState2[0],
|
@@ -155,6 +160,7 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
155
160
|
open: open
|
156
161
|
});
|
157
162
|
var reducedMotion = usePrefersReducedMotion();
|
163
|
+
var carbonPrefix = usePrefix();
|
158
164
|
useEffect(function () {
|
159
165
|
// Set the notifications passed to the state within this component
|
160
166
|
setAllNotifications(data);
|
@@ -166,12 +172,56 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
166
172
|
// initialize the notification panel to open
|
167
173
|
if (open) {
|
168
174
|
setRender(true);
|
175
|
+
var observer = new MutationObserver(function () {
|
176
|
+
if (notificationPanelRef.current) {
|
177
|
+
var _querySelector;
|
178
|
+
var parentElement = notificationPanelRef.current;
|
179
|
+
parentElement === null || parentElement === void 0 || (_querySelector = parentElement.querySelector(".".concat(blockClass, "__dismiss-button"))) === null || _querySelector === void 0 || _querySelector.focus();
|
180
|
+
observer.disconnect();
|
181
|
+
}
|
182
|
+
});
|
183
|
+
if (notificationPanelRef.current) {
|
184
|
+
var parentElement = notificationPanelRef.current;
|
185
|
+
var button = parentElement === null || parentElement === void 0 ? void 0 : parentElement.querySelector(".".concat(blockClass, "__dismiss-button"));
|
186
|
+
button === null || button === void 0 || button.focus();
|
187
|
+
} else {
|
188
|
+
observer.observe(document.body, {
|
189
|
+
childList: true,
|
190
|
+
subtree: true
|
191
|
+
});
|
192
|
+
}
|
193
|
+
return function () {
|
194
|
+
return observer.disconnect();
|
195
|
+
};
|
169
196
|
}
|
170
197
|
}, [open]);
|
171
198
|
var onAnimationEnd = function onAnimationEnd() {
|
172
199
|
// initialize the notification panel to close
|
173
200
|
!open && setRender(false);
|
174
201
|
};
|
202
|
+
var handleBlur = function handleBlur(_ref2) {
|
203
|
+
var oldActiveNode = _ref2.target,
|
204
|
+
currentActiveNode = _ref2.relatedTarget;
|
205
|
+
if (open && currentActiveNode && oldActiveNode && notificationPanelInnerRef.current) {
|
206
|
+
var bodyNode = notificationPanelInnerRef.current;
|
207
|
+
var startSentinelNode = startSentinel.current;
|
208
|
+
var endSentinelNode = endSentinel.current;
|
209
|
+
wrapFocus({
|
210
|
+
bodyNode: bodyNode,
|
211
|
+
startTrapNode: startSentinelNode,
|
212
|
+
endTrapNode: endSentinelNode,
|
213
|
+
currentActiveNode: currentActiveNode,
|
214
|
+
oldActiveNode: oldActiveNode,
|
215
|
+
selectorsFloatingMenus: selectorsFloatingMenus === null || selectorsFloatingMenus === void 0 ? void 0 : selectorsFloatingMenus.filter(Boolean)
|
216
|
+
});
|
217
|
+
}
|
218
|
+
};
|
219
|
+
var handleKeydown = function handleKeydown(event) {
|
220
|
+
event.stopPropagation();
|
221
|
+
if (event.key === 'Escape') {
|
222
|
+
onClickOutside();
|
223
|
+
}
|
224
|
+
};
|
175
225
|
useEffect(function () {
|
176
226
|
if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion) {
|
177
227
|
setRender(false);
|
@@ -310,7 +360,17 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
310
360
|
onDismissSingleNotification(notification);
|
311
361
|
};
|
312
362
|
var mainSectionClassName = cx(["".concat(blockClass, "__main-section"), _defineProperty({}, "".concat(blockClass, "__main-section-empty"), allNotifications && !allNotifications.length)]);
|
313
|
-
return shouldRender ? /*#__PURE__*/React__default.createElement(
|
363
|
+
return shouldRender ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("button", {
|
364
|
+
type: "button",
|
365
|
+
className: "".concat(carbonPrefix, "--visually-hidden"),
|
366
|
+
ref: startSentinel
|
367
|
+
}, "Focus sentinel start"), /*#__PURE__*/React__default.createElement("div", _extends({
|
368
|
+
role: "dialog",
|
369
|
+
"aria-label": "Notification Panel",
|
370
|
+
onBlur: handleBlur,
|
371
|
+
tabIndex: 0,
|
372
|
+
onKeyDown: handleKeydown
|
373
|
+
}, rest, {
|
314
374
|
id: blockClass,
|
315
375
|
className: cx(blockClass, className, "".concat(blockClass, "__container")),
|
316
376
|
style: {
|
@@ -319,6 +379,8 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
319
379
|
onAnimationEnd: onAnimationEnd,
|
320
380
|
ref: ref || notificationPanelRef
|
321
381
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement("div", {
|
382
|
+
ref: notificationPanelInnerRef
|
383
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
322
384
|
className: "".concat(blockClass, "__header-container")
|
323
385
|
}, /*#__PURE__*/React__default.createElement("div", {
|
324
386
|
className: "".concat(blockClass, "__header-flex")
|
@@ -382,7 +444,11 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
382
444
|
onClick: function onClick() {
|
383
445
|
return onSettingsClick();
|
384
446
|
}
|
385
|
-
})) : null)
|
447
|
+
})) : null)), /*#__PURE__*/React__default.createElement("button", {
|
448
|
+
type: "button",
|
449
|
+
className: "".concat(carbonPrefix, "--visually-hidden"),
|
450
|
+
ref: endSentinel
|
451
|
+
}, "Focus sentinel end")) : null;
|
386
452
|
});
|
387
453
|
|
388
454
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -513,6 +579,10 @@ NotificationsPanel.propTypes = {
|
|
513
579
|
* Sets the `seconds ago` label text
|
514
580
|
*/
|
515
581
|
secondsAgoText: PropTypes.func,
|
582
|
+
/**
|
583
|
+
* Specify the CSS selectors that match the floating menus
|
584
|
+
*/
|
585
|
+
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string.isRequired),
|
516
586
|
/**
|
517
587
|
* Sets the settings icon description text
|
518
588
|
*/
|
@@ -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[];
|
@@ -18,7 +18,7 @@ import { isRequiredIf } from '../../global/js/utils/props-helper.js';
|
|
18
18
|
import { pkg } from '../../settings.js';
|
19
19
|
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
|
20
20
|
|
21
|
-
var _excluded = ["align", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "className", "containingElementRef", "items", "maxVisible", "measurementOffset", "multiline", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange", "showAllTagsLabel", "tagComponent"],
|
21
|
+
var _excluded = ["align", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "autoAlign", "className", "containingElementRef", "items", "maxVisible", "measurementOffset", "multiline", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange", "showAllTagsLabel", "tagComponent"],
|
22
22
|
_excluded2 = ["className", "id"],
|
23
23
|
_excluded3 = ["tagType"],
|
24
24
|
_excluded4 = ["id", "label", "tagType", "onClose"];
|
@@ -32,6 +32,7 @@ var TagOverflow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
32
32
|
allTagsModalSearchPlaceholderText = props.allTagsModalSearchPlaceholderText,
|
33
33
|
allTagsModalTarget = props.allTagsModalTarget,
|
34
34
|
allTagsModalTitle = props.allTagsModalTitle,
|
35
|
+
autoAlign = props.autoAlign,
|
35
36
|
className = props.className,
|
36
37
|
containingElementRef = props.containingElementRef,
|
37
38
|
items = props.items,
|
@@ -212,7 +213,8 @@ var TagOverflow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
212
213
|
key: "tag-overflow-popover",
|
213
214
|
ref: overflowRef,
|
214
215
|
popoverOpen: popoverOpen,
|
215
|
-
setPopoverOpen: setPopoverOpen
|
216
|
+
setPopoverOpen: setPopoverOpen,
|
217
|
+
autoAlign: autoAlign
|
216
218
|
}), /*#__PURE__*/React__default.createElement(TagOverflowModal, {
|
217
219
|
allTags: items,
|
218
220
|
open: showAllModalOpen,
|
@@ -266,6 +268,10 @@ TagOverflow.propTypes = {
|
|
266
268
|
* title for the show all modal. **Note: Required if more than 10 tags**
|
267
269
|
*/
|
268
270
|
allTagsModalTitle: string_required_if_more_than_10_tags,
|
271
|
+
/**
|
272
|
+
* Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
|
273
|
+
*/
|
274
|
+
autoAlign: PropTypes.bool,
|
269
275
|
/**
|
270
276
|
* Provide an optional class to be applied to the containing node.
|
271
277
|
*/
|
@@ -13,13 +13,14 @@ import { Popover, Tag, PopoverContent, Link } from '@carbon/react';
|
|
13
13
|
import { pkg } from '../../settings.js';
|
14
14
|
import { useClickOutside } from '../../global/js/hooks/useClickOutside.js';
|
15
15
|
|
16
|
-
var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"],
|
16
|
+
var _excluded = ["allTagsModalSearchThreshold", "autoAlign", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"],
|
17
17
|
_excluded2 = ["label", "id", "tagType", "filter", "onClose"];
|
18
18
|
var componentName = 'TagOverflowPopover';
|
19
19
|
var blockClass = "".concat(pkg.prefix, "--tag-overflow-popover");
|
20
20
|
var TagOverflowPopover = /*#__PURE__*/forwardRef(function (props, ref) {
|
21
21
|
var _overflowTags$length;
|
22
22
|
var allTagsModalSearchThreshold = props.allTagsModalSearchThreshold,
|
23
|
+
autoAlign = props.autoAlign,
|
23
24
|
className = props.className,
|
24
25
|
onShowAllClick = props.onShowAllClick,
|
25
26
|
overflowAlign = props.overflowAlign,
|
@@ -62,6 +63,7 @@ var TagOverflowPopover = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
62
63
|
ref: ref || localRef
|
63
64
|
}), /*#__PURE__*/React__default.createElement(Popover, {
|
64
65
|
align: overflowAlign,
|
66
|
+
autoAlign: autoAlign,
|
65
67
|
className: cx(className, "".concat(blockClass, "__el")),
|
66
68
|
dropShadow: true,
|
67
69
|
highContrast: true,
|
@@ -109,6 +111,10 @@ TagOverflowPopover.propTypes = {
|
|
109
111
|
* count of overflowTags over which a modal is offered
|
110
112
|
*/
|
111
113
|
allTagsModalSearchThreshold: PropTypes.number,
|
114
|
+
/**
|
115
|
+
* Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
|
116
|
+
*/
|
117
|
+
autoAlign: PropTypes.bool,
|
112
118
|
/**
|
113
119
|
* className
|
114
120
|
*/
|
@@ -69,7 +69,7 @@ var TagSetOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
69
69
|
return setPopoverOpen === null || setPopoverOpen === void 0 ? void 0 : setPopoverOpen(!popoverOpen);
|
70
70
|
},
|
71
71
|
className: cx("".concat(blockClass, "__popover-trigger"))
|
72
|
-
}, "+"
|
72
|
+
}, "+".concat(overflowTags.length)), /*#__PURE__*/React__default.createElement(PopoverContent, null, /*#__PURE__*/React__default.createElement("div", {
|
73
73
|
ref: overflowTagContent,
|
74
74
|
className: "".concat(blockClass, "__content")
|
75
75
|
}, /*#__PURE__*/React__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.
|
@@ -13,7 +13,7 @@ import cx from 'classnames';
|
|
13
13
|
import { pkg } from '../../settings.js';
|
14
14
|
import pconsole from '../../global/js/utils/pconsole.js';
|
15
15
|
import { getNodeTextContent } from '../../global/js/utils/getNodeTextContent.js';
|
16
|
-
import { Button, usePrefix, ComposedModal, ModalHeader, Layer } from '@carbon/react';
|
16
|
+
import { Button, usePrefix, unstable_FeatureFlags, ComposedModal, ModalHeader, Layer } from '@carbon/react';
|
17
17
|
import { ActionSet } from '../ActionSet/ActionSet.js';
|
18
18
|
import { Wrap } from '../../global/js/utils/Wrap.js';
|
19
19
|
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
|
@@ -245,7 +245,11 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
245
245
|
}
|
246
246
|
return _defineProperty(_defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), (width - 32) / width), "--".concat(bc, "--stacking-scale-factor-double"), (width - 64) / width);
|
247
247
|
};
|
248
|
-
return renderPortalUse( /*#__PURE__*/React__default.createElement(
|
248
|
+
return renderPortalUse( /*#__PURE__*/React__default.createElement(unstable_FeatureFlags, {
|
249
|
+
flags: {
|
250
|
+
'enable-experimental-focus-wrap-without-sentinels': true
|
251
|
+
}
|
252
|
+
}, /*#__PURE__*/React__default.createElement(ComposedModal, _extends({}, rest, {
|
249
253
|
"aria-label": ariaLabel || getNodeTextContent(title),
|
250
254
|
className: cx(bc, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(bc, "--stacked-").concat(position, "-of-").concat(depth),
|
251
255
|
// Don't apply this on the initial open of a single tearsheet.
|
@@ -312,7 +316,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
312
316
|
})))), /*#__PURE__*/React__default.createElement("div", {
|
313
317
|
className: "".concat(bc, "__resize-detector"),
|
314
318
|
ref: resizer
|
315
|
-
})));
|
319
|
+
}))));
|
316
320
|
} else {
|
317
321
|
pconsole.warn('Tearsheet not rendered: maximum stacking depth exceeded.');
|
318
322
|
return null;
|
@@ -13,8 +13,12 @@ export interface ToolbarButtonProps extends React.ComponentProps<typeof IconButt
|
|
13
13
|
caret?: boolean;
|
14
14
|
/** Provide an optional class to be applied to the containing node */
|
15
15
|
className?: string;
|
16
|
+
/**
|
17
|
+
* @deprecated use `label` instead
|
18
|
+
* Specifies the label for the icon button */
|
19
|
+
iconDescription?: string;
|
16
20
|
/** Specifies the label for the icon button */
|
17
|
-
|
21
|
+
label: string;
|
18
22
|
/** Specifies the icon to be used by the ToolbarButton component */
|
19
23
|
renderIcon: React.ElementType;
|
20
24
|
}
|
@@ -22,3 +26,10 @@ export interface ToolbarButtonProps extends React.ComponentProps<typeof IconButt
|
|
22
26
|
export declare let ToolbarButton: React.ForwardRefExoticComponent<ToolbarButtonProps & {
|
23
27
|
children?: React.ReactNode;
|
24
28
|
} & React.RefAttributes<unknown>>;
|
29
|
+
export declare const deprecatedProps: {
|
30
|
+
/**
|
31
|
+
* **Deprecated**
|
32
|
+
* Specifies the label for the icon button
|
33
|
+
* */
|
34
|
+
iconDescription: import("prop-types").Requireable<string>;
|
35
|
+
};
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
8
|
+
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { forwardRef, useContext } from 'react';
|
10
10
|
import { ToolbarContext, blockClass as blockClass$1 } from './Toolbar.js';
|
11
11
|
import { p as propTypesExports } from '../../node_modules/prop-types/index.js';
|
@@ -13,7 +13,7 @@ import { IconButton } from '@carbon/react';
|
|
13
13
|
import cx from 'classnames';
|
14
14
|
import { pkg } from '../../settings.js';
|
15
15
|
|
16
|
-
var _excluded = ["caret", "children", "className", "renderIcon", "iconDescription"];
|
16
|
+
var _excluded = ["caret", "children", "className", "renderIcon", "iconDescription", "label"];
|
17
17
|
var blockClass = "".concat(blockClass$1, "__button");
|
18
18
|
/** Toolbar buttons are common functions performed as part of a products interface or an open window. */
|
19
19
|
var ToolbarButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
@@ -24,13 +24,14 @@ var ToolbarButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
24
24
|
className = _ref.className,
|
25
25
|
renderIcon = _ref.renderIcon,
|
26
26
|
_ref$iconDescription = _ref.iconDescription,
|
27
|
-
|
27
|
+
deprecated_iconDescription = _ref$iconDescription === void 0 ? '' : _ref$iconDescription,
|
28
|
+
label = _ref.label,
|
28
29
|
rest = _objectWithoutProperties(_ref, _excluded);
|
29
30
|
var Icon = renderIcon;
|
30
31
|
return /*#__PURE__*/React__default.createElement(IconButton, _extends({
|
31
32
|
align: (_useContext = useContext(ToolbarContext)) !== null && _useContext !== void 0 && _useContext.vertical ? 'right' : 'top'
|
32
33
|
}, rest, {
|
33
|
-
label:
|
34
|
+
label: label !== null && label !== void 0 ? label : deprecated_iconDescription,
|
34
35
|
ref: ref,
|
35
36
|
className: cx(className, _defineProperty({}, "".concat(blockClass, "--caret"), caret)),
|
36
37
|
kind: "ghost",
|
@@ -41,7 +42,14 @@ var ToolbarButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
41
42
|
});
|
42
43
|
var componentName = 'ToolbarButton';
|
43
44
|
ToolbarButton.displayName = componentName;
|
44
|
-
|
45
|
+
var deprecatedProps = {
|
46
|
+
/**
|
47
|
+
* **Deprecated**
|
48
|
+
* Specifies the label for the icon button
|
49
|
+
* */
|
50
|
+
iconDescription: propTypesExports.string
|
51
|
+
};
|
52
|
+
ToolbarButton.propTypes = _objectSpread2({
|
45
53
|
/** Determines whether the caret is rendered */
|
46
54
|
caret: propTypesExports.bool,
|
47
55
|
/** Provide the content of the `ToolbarButton` */
|
@@ -49,10 +57,10 @@ ToolbarButton.propTypes = {
|
|
49
57
|
/** Provide an optional class to be applied to the containing node */
|
50
58
|
className: propTypesExports.string,
|
51
59
|
/** Specifies the label for the icon button */
|
52
|
-
|
60
|
+
label: propTypesExports.string.isRequired,
|
53
61
|
/** Specifies the icon to be used by the ToolbarButton component */
|
54
62
|
renderIcon: propTypesExports.func.isRequired
|
55
|
-
};
|
63
|
+
}, deprecatedProps);
|
56
64
|
ToolbarButton = pkg.checkComponentEnabled(ToolbarButton, componentName);
|
57
65
|
|
58
|
-
export { ToolbarButton, blockClass };
|
66
|
+
export { ToolbarButton, blockClass, deprecatedProps };
|
@@ -4,7 +4,7 @@ export function useFocus(modalRef: any, selectorPrimaryFocus: any): {
|
|
4
4
|
lastElement: any;
|
5
5
|
allElements: any;
|
6
6
|
specifiedElement: any;
|
7
|
-
keyDownListener: (event: any) => void
|
7
|
+
keyDownListener: (event: any) => Promise<void>;
|
8
8
|
getFocusable: () => {
|
9
9
|
first: any;
|
10
10
|
last: any;
|