@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
@@ -5,9 +5,11 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
+
import { asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
8
9
|
import { usePrefix } from '@carbon/react';
|
9
10
|
import { pkg } from '../../../settings.js';
|
10
11
|
import { useCallback, useEffect } from 'react';
|
12
|
+
import wait from '../utils/wait.js';
|
11
13
|
|
12
14
|
var getSpecificElement = function getSpecificElement(parentEl, elementId) {
|
13
15
|
var element = parentEl === null || parentEl === void 0 ? void 0 : parentEl.querySelector(elementId);
|
@@ -16,6 +18,7 @@ var getSpecificElement = function getSpecificElement(parentEl, elementId) {
|
|
16
18
|
var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
17
19
|
var carbonPrefix = usePrefix();
|
18
20
|
var tearsheetBaseClass = "".concat(pkg.prefix, "--tearsheet");
|
21
|
+
var sidePanelBaseClass = "".concat(pkg.prefix, "--side-panel");
|
19
22
|
// Querying focusable element in the modal
|
20
23
|
// Query to exclude hidden elements in the modal from querySelectorAll() method
|
21
24
|
// feel free to include more if needed :)
|
@@ -27,8 +30,9 @@ var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
|
27
30
|
var queryTextarea = "textarea".concat(notQuery);
|
28
31
|
var queryLink = "[href]".concat(notQuery);
|
29
32
|
var queryTabIndex = "[tabindex=\"0\"]".concat(notQuery);
|
33
|
+
var querySidePanelScroll = ".".concat(sidePanelBaseClass, "--scrolls");
|
30
34
|
// Final query
|
31
|
-
var query = "".concat(queryButton, ",").concat(queryLink, ",").concat(queryInput, ",").concat(querySelect, ",").concat(queryTextarea, ",
|
35
|
+
var query = "".concat(queryButton, ",").concat(queryLink, ",").concat(queryInput, ",").concat(querySelect, ",").concat(queryTextarea, ",").concat(queryTabIndex, ",").concat(querySidePanelScroll);
|
32
36
|
var modalEl = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current;
|
33
37
|
var getFocusable = useCallback(function () {
|
34
38
|
var _focusableElements, _focusableElements2, _focusableElements3, _focusableElements4;
|
@@ -54,30 +58,42 @@ var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
|
54
58
|
useEffect(function () {
|
55
59
|
getFocusable();
|
56
60
|
}, [getFocusable]);
|
57
|
-
var handleKeyDown = function
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
61
|
+
var handleKeyDown = /*#__PURE__*/function () {
|
62
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
63
|
+
var _document, _document2, _getFocusable, first, last, all;
|
64
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
65
|
+
while (1) switch (_context.prev = _context.next) {
|
66
|
+
case 0:
|
67
|
+
if (!(event.key === 'Tab')) {
|
68
|
+
_context.next = 5;
|
69
|
+
break;
|
70
|
+
}
|
71
|
+
// updating the focusable elements list
|
72
|
+
_getFocusable = getFocusable(), first = _getFocusable.first, last = _getFocusable.last, all = _getFocusable.all;
|
73
|
+
_context.next = 4;
|
74
|
+
return wait(1);
|
75
|
+
case 4:
|
76
|
+
if (event.shiftKey && !Array.prototype.includes.call(all, (_document = document) === null || _document === void 0 ? void 0 : _document.activeElement)) {
|
77
|
+
// Prevents the default "Tab" behavior
|
78
|
+
event.preventDefault();
|
79
|
+
// if the user press shift+tab and the current element not in focusable items
|
80
|
+
last === null || last === void 0 || last.focus();
|
81
|
+
} else if (!Array.prototype.includes.call(all, (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement)) {
|
82
|
+
event.preventDefault();
|
83
|
+
// user pressing tab key only then
|
84
|
+
// focusing the first element if the current element is not in focusable items
|
85
|
+
first === null || first === void 0 || first.focus();
|
86
|
+
}
|
87
|
+
case 5:
|
88
|
+
case "end":
|
89
|
+
return _context.stop();
|
77
90
|
}
|
78
|
-
},
|
79
|
-
}
|
80
|
-
|
91
|
+
}, _callee);
|
92
|
+
}));
|
93
|
+
return function handleKeyDown(_x) {
|
94
|
+
return _ref.apply(this, arguments);
|
95
|
+
};
|
96
|
+
}();
|
81
97
|
return {
|
82
98
|
firstElement: getFocusable().first,
|
83
99
|
lastElement: getFocusable().last,
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* Various utilities to help with a11y work
|
9
|
+
*/
|
10
|
+
/**
|
11
|
+
* A flag `node.compareDocumentPosition(target)` returns,
|
12
|
+
* that indicates `target` is located earlier than `node` in the document or `target` contains `node`.
|
13
|
+
*/
|
14
|
+
export const DOCUMENT_POSITION_BROAD_PRECEDING: number | false;
|
15
|
+
/**
|
16
|
+
* A flag `node.compareDocumentPosition(target)` returns,
|
17
|
+
* that indicates `target` is located later than `node` in the document or `node` contains `target`.
|
18
|
+
*/
|
19
|
+
export const DOCUMENT_POSITION_BROAD_FOLLOWING: number | false;
|
20
|
+
/**
|
21
|
+
* CSS selector that selects major nodes that are sequential-focusable.
|
22
|
+
*/
|
23
|
+
export const selectorTabbable: "\n a[href], area[href], input:not([disabled]):not([tabindex='-1']),\n button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']),\n textarea:not([disabled]):not([tabindex='-1']),\n iframe, object, embed, *[tabindex]:not([tabindex='-1']):not([disabled]), *[contenteditable=true]\n";
|
24
|
+
/**
|
25
|
+
* CSS selector that selects major nodes that are click focusable
|
26
|
+
*/
|
27
|
+
export const selectorFocusable: "\n a[href], area[href], input:not([disabled]),\n button:not([disabled]),select:not([disabled]),\n textarea:not([disabled]),\n iframe, object, embed, *[tabindex]:not([disabled]), *[contenteditable=true]\n";
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Various utilities to help with a11y work
|
10
|
+
*/
|
11
|
+
|
12
|
+
/**
|
13
|
+
* A flag `node.compareDocumentPosition(target)` returns,
|
14
|
+
* that indicates `target` is located earlier than `node` in the document or `target` contains `node`.
|
15
|
+
*/
|
16
|
+
var DOCUMENT_POSITION_BROAD_PRECEDING =
|
17
|
+
// Checks `typeof Node` for `react-docgen`
|
18
|
+
typeof Node !== 'undefined' &&
|
19
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
20
|
+
Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINS;
|
21
|
+
|
22
|
+
/**
|
23
|
+
* A flag `node.compareDocumentPosition(target)` returns,
|
24
|
+
* that indicates `target` is located later than `node` in the document or `node` contains `target`.
|
25
|
+
*/
|
26
|
+
var DOCUMENT_POSITION_BROAD_FOLLOWING =
|
27
|
+
// Checks `typeof Node` for `react-docgen`
|
28
|
+
typeof Node !== 'undefined' &&
|
29
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
30
|
+
Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* CSS selector that selects major nodes that are sequential-focusable.
|
34
|
+
*/
|
35
|
+
var selectorTabbable = "\n a[href], area[href], input:not([disabled]):not([tabindex='-1']),\n button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']),\n textarea:not([disabled]):not([tabindex='-1']),\n iframe, object, embed, *[tabindex]:not([tabindex='-1']):not([disabled]), *[contenteditable=true]\n";
|
36
|
+
|
37
|
+
export { DOCUMENT_POSITION_BROAD_FOLLOWING, DOCUMENT_POSITION_BROAD_PRECEDING, selectorTabbable };
|
@@ -0,0 +1,25 @@
|
|
1
|
+
export default wrapFocus;
|
2
|
+
/**
|
3
|
+
* @param {Node} node A DOM node.
|
4
|
+
* @param {string[]} selectorsFloatingMenus The CSS selectors that matches floating menus.
|
5
|
+
* @returns {boolean} `true` of the given `node` is in a floating menu.
|
6
|
+
*/
|
7
|
+
export function elementOrParentIsFloatingMenu(node: Node, selectorsFloatingMenus?: string[]): boolean;
|
8
|
+
/**
|
9
|
+
* Ensures the focus is kept in the given `modalNode`, implementing "focus-wrap" behavior.
|
10
|
+
* @param {object} options The options.
|
11
|
+
* @param {Node|null} options.bodyNode The DOM node of the inner modal.
|
12
|
+
* @param {Node|null} options.startTrapNode The DOM node of the focus sentinel the is placed earlier next to `modalNode`.
|
13
|
+
* @param {Node|null} options.endTrapNode The DOM node of the focus sentinel the is placed next to `modalNode`.
|
14
|
+
* @param {Node} options.currentActiveNode The DOM node that has focus.
|
15
|
+
* @param {Node} options.oldActiveNode The DOM node that previously had focus.
|
16
|
+
* @param {string[]} [options.selectorsFloatingMenus] The CSS selectors that matches floating menus
|
17
|
+
*/
|
18
|
+
declare function wrapFocus({ bodyNode, startTrapNode, endTrapNode, currentActiveNode, oldActiveNode, selectorsFloatingMenus, }: {
|
19
|
+
bodyNode: Node | null;
|
20
|
+
startTrapNode: Node | null;
|
21
|
+
endTrapNode: Node | null;
|
22
|
+
currentActiveNode: Node;
|
23
|
+
oldActiveNode: Node;
|
24
|
+
selectorsFloatingMenus?: string[] | undefined;
|
25
|
+
}): void;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { DOCUMENT_POSITION_BROAD_PRECEDING, selectorTabbable, DOCUMENT_POSITION_BROAD_FOLLOWING } from './keyboardNavigation.js';
|
9
|
+
import { carbon } from '../../../settings.js';
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @param {Node} node A DOM node.
|
13
|
+
* @param {string[]} selectorsFloatingMenus The CSS selectors that matches floating menus.
|
14
|
+
* @returns {boolean} `true` of the given `node` is in a floating menu.
|
15
|
+
*/
|
16
|
+
function elementOrParentIsFloatingMenu(node) {
|
17
|
+
var selectorsFloatingMenus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [".".concat(carbon.prefix, "--overflow-menu-options"), ".".concat(carbon.prefix, "--tooltip"), '.flatpickr-calendar'];
|
18
|
+
if (node && typeof node.closest === 'function') {
|
19
|
+
return selectorsFloatingMenus.some(function (selector) {
|
20
|
+
return node.closest(selector);
|
21
|
+
});
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Ensures the focus is kept in the given `modalNode`, implementing "focus-wrap" behavior.
|
27
|
+
* @param {object} options The options.
|
28
|
+
* @param {Node|null} options.bodyNode The DOM node of the inner modal.
|
29
|
+
* @param {Node|null} options.startTrapNode The DOM node of the focus sentinel the is placed earlier next to `modalNode`.
|
30
|
+
* @param {Node|null} options.endTrapNode The DOM node of the focus sentinel the is placed next to `modalNode`.
|
31
|
+
* @param {Node} options.currentActiveNode The DOM node that has focus.
|
32
|
+
* @param {Node} options.oldActiveNode The DOM node that previously had focus.
|
33
|
+
* @param {string[]} [options.selectorsFloatingMenus] The CSS selectors that matches floating menus
|
34
|
+
*/
|
35
|
+
function wrapFocus(_ref) {
|
36
|
+
var bodyNode = _ref.bodyNode,
|
37
|
+
startTrapNode = _ref.startTrapNode,
|
38
|
+
endTrapNode = _ref.endTrapNode,
|
39
|
+
currentActiveNode = _ref.currentActiveNode,
|
40
|
+
oldActiveNode = _ref.oldActiveNode,
|
41
|
+
selectorsFloatingMenus = _ref.selectorsFloatingMenus;
|
42
|
+
if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus)) {
|
43
|
+
var comparisonResult = oldActiveNode.compareDocumentPosition(currentActiveNode);
|
44
|
+
if (currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING) {
|
45
|
+
var arrayNodes = Array.from(bodyNode.querySelectorAll(selectorTabbable));
|
46
|
+
arrayNodes.reverse();
|
47
|
+
var tabbable = arrayNodes.find(function (elem) {
|
48
|
+
return Boolean(elem.offsetParent);
|
49
|
+
});
|
50
|
+
if (tabbable) {
|
51
|
+
tabbable.focus();
|
52
|
+
} else if (bodyNode !== oldActiveNode) {
|
53
|
+
bodyNode.focus();
|
54
|
+
}
|
55
|
+
} else if (currentActiveNode === endTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_FOLLOWING) {
|
56
|
+
var _tabbable = Array.prototype.find.call(bodyNode.querySelectorAll(selectorTabbable), function (elem) {
|
57
|
+
return Boolean(elem.offsetParent);
|
58
|
+
});
|
59
|
+
if (_tabbable) {
|
60
|
+
_tabbable.focus();
|
61
|
+
} else if (bodyNode !== oldActiveNode) {
|
62
|
+
bodyNode.focus();
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
export { wrapFocus as default, elementOrParentIsFloatingMenu };
|
@@ -144,7 +144,7 @@ interface APIKeyModalCommonProps {
|
|
144
144
|
/**
|
145
145
|
* The DOM node the tearsheet should be rendered within. Defaults to document.body.
|
146
146
|
*/
|
147
|
-
portalTarget
|
147
|
+
portalTarget?: ReactNode;
|
148
148
|
/**
|
149
149
|
* label text that's displayed when hovering over visibility toggler to show key
|
150
150
|
*/
|
@@ -245,7 +245,9 @@ var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
245
245
|
secondaryButtonText: secondaryButtonText
|
246
246
|
};
|
247
247
|
};
|
248
|
-
return /*#__PURE__*/React__default["default"].createElement("div",
|
248
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
249
|
+
"aria-disabled": disabled
|
250
|
+
}, getCardProps()), !getStarted && media && /*#__PURE__*/React__default["default"].createElement("div", {
|
249
251
|
className: "".concat(blockClass, "__media")
|
250
252
|
}, media), Pictogram && /*#__PURE__*/React__default["default"].createElement("div", {
|
251
253
|
className: "".concat(blockClass, "__pictogram")
|
@@ -1,28 +1,104 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import React from 'react';
|
8
|
+
import PropTypes from 'prop-types';
|
9
|
+
import { Condition, ConditionGroup, LogicalOperator } from '../ConditionBuilder.types';
|
2
10
|
/**
|
3
11
|
* This component build each block of condition consisting of property, operator value and close button.
|
4
12
|
*/
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
interface ConditionBlockProps {
|
14
|
+
condition?: Condition;
|
15
|
+
onRemove: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
16
|
+
onChange: (condition: Condition) => void;
|
17
|
+
onConnectorOperatorChange?: (op: string) => void;
|
18
|
+
onStatementChange?: (v: string) => void;
|
19
|
+
addConditionHandler?: (conditionIndex: number) => void;
|
20
|
+
addConditionSubGroupHandler?: (conditionIndex: number) => void;
|
21
|
+
hideConditionSubGroupPreviewHandler?: () => void;
|
22
|
+
showConditionSubGroupPreviewHandler?: () => void;
|
23
|
+
hideConditionPreviewHandler?: () => void;
|
24
|
+
showConditionPreviewHandler?: () => void;
|
25
|
+
conjunction?: LogicalOperator;
|
26
|
+
isStatement?: boolean;
|
27
|
+
group: ConditionGroup;
|
28
|
+
conditionIndex: number;
|
29
|
+
aria: {
|
30
|
+
level: number;
|
31
|
+
posinset: number;
|
32
|
+
setsize?: number;
|
33
|
+
};
|
34
|
+
isLastCondition: (index: number, conditions: (ConditionGroup | Condition)[]) => void;
|
27
35
|
}
|
28
|
-
|
36
|
+
declare const ConditionBlock: {
|
37
|
+
(props: ConditionBlockProps): import("react/jsx-runtime").JSX.Element;
|
38
|
+
propTypes: {
|
39
|
+
/**
|
40
|
+
* callback to add a new condition
|
41
|
+
*/
|
42
|
+
addConditionHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
43
|
+
/**
|
44
|
+
* callback to add a new condition subgroup
|
45
|
+
*/
|
46
|
+
addConditionSubGroupHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
47
|
+
/**
|
48
|
+
* object hold aria attributes
|
49
|
+
*/
|
50
|
+
aria: PropTypes.Requireable<object>;
|
51
|
+
condition: PropTypes.Requireable<object>;
|
52
|
+
conditionIndex: PropTypes.Requireable<number>;
|
53
|
+
/**
|
54
|
+
* string that decides to show the condition connector
|
55
|
+
*/
|
56
|
+
conjunction: PropTypes.Requireable<string>;
|
57
|
+
/**
|
58
|
+
* object that hold the current group object where is condition is part of
|
59
|
+
*/
|
60
|
+
group: PropTypes.Requireable<object>;
|
61
|
+
/**
|
62
|
+
* handler for hiding sub group preview
|
63
|
+
*/
|
64
|
+
hideConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
65
|
+
/**
|
66
|
+
* handler for hiding sub group preview
|
67
|
+
*/
|
68
|
+
hideConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
69
|
+
isLastCondition: PropTypes.Requireable<(...args: any[]) => any>;
|
70
|
+
/**
|
71
|
+
* boolean that decides to show the statement(if/ excl.if)
|
72
|
+
*/
|
73
|
+
isStatement: PropTypes.Requireable<boolean>;
|
74
|
+
/**
|
75
|
+
* callback to update the current condition of the state tree
|
76
|
+
*/
|
77
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
78
|
+
/**
|
79
|
+
* callback to handle the connector(and/or) change
|
80
|
+
*/
|
81
|
+
onConnectorOperatorChange: PropTypes.Requireable<(...args: any[]) => any>;
|
82
|
+
/**
|
83
|
+
* callback for Remove a condition
|
84
|
+
*/
|
85
|
+
onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
86
|
+
/**
|
87
|
+
* callback to handle the statement(if/ excl.if) change
|
88
|
+
*/
|
89
|
+
onStatementChange: PropTypes.Requireable<(...args: any[]) => any>;
|
90
|
+
/**
|
91
|
+
* handler for showing add condition preview
|
92
|
+
*/
|
93
|
+
showConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
94
|
+
/**
|
95
|
+
* handler for showing sub group preview
|
96
|
+
*/
|
97
|
+
showConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
98
|
+
/**
|
99
|
+
* object that hold the current condition
|
100
|
+
*/
|
101
|
+
state: PropTypes.Requireable<object>;
|
102
|
+
};
|
103
|
+
};
|
104
|
+
export default ConditionBlock;
|
@@ -14,7 +14,6 @@ var React = require('react');
|
|
14
14
|
var icons = require('@carbon/react/icons');
|
15
15
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
16
16
|
var index = require('../../../node_modules/prop-types/index.js');
|
17
|
-
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
18
17
|
var cx = require('classnames');
|
19
18
|
var ConditionConnector = require('../ConditionBuilderConnector/ConditionConnector.js');
|
20
19
|
var ConditionBuilderItemNumber = require('../ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js');
|
@@ -28,6 +27,7 @@ var ConditionBuilderAdd = require('../ConditionBuilderAdd/ConditionBuilderAdd.js
|
|
28
27
|
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
29
28
|
var ItemOptionForValueField = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js');
|
30
29
|
var useTranslations = require('../utils/useTranslations.js');
|
30
|
+
var useDataConfigs = require('../utils/useDataConfigs.js');
|
31
31
|
|
32
32
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
33
33
|
|
@@ -41,13 +41,10 @@ var _div;
|
|
41
41
|
*/
|
42
42
|
|
43
43
|
var ConditionBlock = function ConditionBlock(props) {
|
44
|
-
var _props$condition = props.condition,
|
45
|
-
property = _props$condition.property,
|
46
|
-
value = _props$condition.value,
|
47
|
-
operator = _props$condition.operator;
|
48
44
|
var onRemove = props.onRemove,
|
49
45
|
onChange = props.onChange,
|
50
|
-
condition = props.condition,
|
46
|
+
_props$condition = props.condition,
|
47
|
+
condition = _props$condition === void 0 ? {} : _props$condition,
|
51
48
|
conjunction = props.conjunction,
|
52
49
|
onConnectorOperatorChange = props.onConnectorOperatorChange,
|
53
50
|
isStatement = props.isStatement,
|
@@ -62,6 +59,9 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
62
59
|
hideConditionPreviewHandler = props.hideConditionPreviewHandler,
|
63
60
|
showConditionPreviewHandler = props.showConditionPreviewHandler,
|
64
61
|
isLastCondition = props.isLastCondition;
|
62
|
+
var property = condition.property,
|
63
|
+
value = condition.value,
|
64
|
+
operator = condition.operator;
|
65
65
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
66
66
|
inputConfig = _useContext.inputConfig,
|
67
67
|
variant = _useContext.variant,
|
@@ -81,19 +81,22 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
81
81
|
propertyText = _useTranslations2[2],
|
82
82
|
operatorText = _useTranslations2[3],
|
83
83
|
removeConditionText = _useTranslations2[4];
|
84
|
+
var _useDataConfigs = useDataConfigs.useDataConfigs(),
|
85
|
+
statementConfig = _useDataConfigs.statementConfig,
|
86
|
+
operatorConfig = _useDataConfigs.operatorConfig;
|
84
87
|
|
85
88
|
//filtering the current property to access its properties and config options
|
86
89
|
var getCurrentConfig = function getCurrentConfig(property) {
|
87
90
|
var _inputConfig$properti, _inputConfig$properti2;
|
88
|
-
return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.find(function (eachProperty) {
|
91
|
+
return (_inputConfig$properti = inputConfig === null || inputConfig === void 0 || (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.find(function (eachProperty) {
|
89
92
|
return eachProperty.id == property;
|
90
93
|
})) !== null && _inputConfig$properti !== void 0 ? _inputConfig$properti : {};
|
91
94
|
};
|
92
|
-
var
|
93
|
-
icon =
|
94
|
-
type =
|
95
|
-
config =
|
96
|
-
label =
|
95
|
+
var _ref = getCurrentConfig(property),
|
96
|
+
icon = _ref.icon,
|
97
|
+
type = _ref.type,
|
98
|
+
config = _ref.config,
|
99
|
+
label = _ref.label;
|
97
100
|
|
98
101
|
//Below possible input types expected for value field.
|
99
102
|
var itemComponents = {
|
@@ -105,7 +108,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
105
108
|
custom: config === null || config === void 0 ? void 0 : config.component,
|
106
109
|
textarea: ConditionBuilderItemText.ConditionBuilderItemText
|
107
110
|
};
|
108
|
-
var ItemComponent =
|
111
|
+
var ItemComponent = itemComponents[type];
|
109
112
|
var showAllActionsHandler = function showAllActionsHandler() {
|
110
113
|
setShowAllActions(true);
|
111
114
|
};
|
@@ -114,7 +117,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
114
117
|
};
|
115
118
|
var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
|
116
119
|
util.focusThisField(evt, conditionBuilderRef);
|
117
|
-
onStatementChange(v);
|
120
|
+
onStatementChange === null || onStatementChange === void 0 || onStatementChange(v);
|
118
121
|
};
|
119
122
|
var onPropertyChangeHandler = function onPropertyChangeHandler(newProperty) {
|
120
123
|
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, condition), {}, {
|
@@ -145,7 +148,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
145
148
|
setShowDeletionPreview(false);
|
146
149
|
};
|
147
150
|
var manageActionButtons = function manageActionButtons(conditionIndex, conditions) {
|
148
|
-
if (variant ===
|
151
|
+
if (variant === util.HIERARCHICAL_VARIANT) {
|
149
152
|
return true;
|
150
153
|
}
|
151
154
|
return isLastCondition(conditionIndex, conditions);
|
@@ -154,12 +157,12 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
154
157
|
if (config !== null && config !== void 0 && config.operators) {
|
155
158
|
return config.operators;
|
156
159
|
}
|
157
|
-
return
|
160
|
+
return operatorConfig.filter(function (operator) {
|
158
161
|
return operator.type.indexOf(type) != -1 || operator.type == 'all';
|
159
162
|
});
|
160
163
|
};
|
161
164
|
var getAriaAttributes = function getAriaAttributes() {
|
162
|
-
return variant ==
|
165
|
+
return variant == util.HIERARCHICAL_VARIANT ? {
|
163
166
|
'aria-level': aria.level,
|
164
167
|
'aria-posinset': aria.posinset,
|
165
168
|
'aria-setsize': aria.setsize
|
@@ -180,7 +183,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
180
183
|
});
|
181
184
|
};
|
182
185
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
183
|
-
className: cx__default["default"]("".concat(
|
186
|
+
className: cx__default["default"]("".concat(util.blockClass, "__condition-block"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(util.blockClass, "__condition__deletion-preview"), showDeletionPreview), _rollupPluginBabelHelpers.defineProperty({}, "".concat(util.blockClass, "__gap-bottom"), variant == util.HIERARCHICAL_VARIANT), _rollupPluginBabelHelpers.defineProperty({}, "".concat(util.blockClass, "__gap ").concat(util.blockClass, "__gap-bottom"), variant == util.NON_HIERARCHICAL_VARIANT), _rollupPluginBabelHelpers.defineProperty({}, "".concat(util.blockClass, "__condition--interacting"), showAllActions)),
|
184
187
|
role: "row",
|
185
188
|
"aria-label": conditionRowText
|
186
189
|
}, getAriaAttributes(), {
|
@@ -189,10 +192,10 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
189
192
|
onMouseLeave: hideAllActionsHandler,
|
190
193
|
onBlur: hideAllActionsHandler
|
191
194
|
}), conjunction ? /*#__PURE__*/React__default["default"].createElement(ConditionConnector["default"], {
|
192
|
-
className: "".concat(
|
195
|
+
className: "".concat(util.blockClass, "__gap"),
|
193
196
|
operator: conjunction,
|
194
197
|
onChange: function onChange(op) {
|
195
|
-
return onConnectorOperatorChange(op);
|
198
|
+
return onConnectorOperatorChange === null || onConnectorOperatorChange === void 0 ? void 0 : onConnectorOperatorChange(op);
|
196
199
|
}
|
197
200
|
}) : _div || (_div = /*#__PURE__*/React__default["default"].createElement("div", {
|
198
201
|
role: "gridcell"
|
@@ -200,8 +203,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
200
203
|
label: group.statement,
|
201
204
|
title: conditionText,
|
202
205
|
"data-name": "connectorField",
|
203
|
-
popOverClassName: "".concat(
|
204
|
-
className: "".concat(
|
206
|
+
popOverClassName: "".concat(util.blockClass, "__gap"),
|
207
|
+
className: "".concat(util.blockClass, "__statement-button"),
|
205
208
|
tabIndex: 0
|
206
209
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
207
210
|
conditionState: {
|
@@ -210,13 +213,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
210
213
|
},
|
211
214
|
onChange: onStatementChangeHandler,
|
212
215
|
config: {
|
213
|
-
options:
|
216
|
+
options: statementConfig,
|
217
|
+
isStatement: true
|
214
218
|
}
|
215
219
|
})), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
216
220
|
label: label !== null && label !== void 0 ? label : condition === null || condition === void 0 ? void 0 : condition.property,
|
217
221
|
title: propertyText,
|
218
|
-
renderIcon: icon !== null && icon !== void 0 ? icon :
|
219
|
-
className: "".concat(
|
222
|
+
renderIcon: icon !== null && icon !== void 0 ? icon : undefined,
|
223
|
+
className: "".concat(util.blockClass, "__property-field"),
|
220
224
|
"data-name": "propertyField",
|
221
225
|
condition: condition,
|
222
226
|
type: type,
|
@@ -228,7 +232,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
228
232
|
},
|
229
233
|
onChange: onPropertyChangeHandler,
|
230
234
|
config: {
|
231
|
-
options: inputConfig.properties
|
235
|
+
options: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.properties
|
232
236
|
}
|
233
237
|
})), util.checkIsValid(property) && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
234
238
|
label: operator,
|
@@ -268,24 +272,23 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
268
272
|
onFocus: handleShowDeletionPreview,
|
269
273
|
onBlur: handleHideDeletionPreview,
|
270
274
|
renderIcon: icons.Close,
|
271
|
-
className: "".concat(
|
275
|
+
className: "".concat(util.blockClass, "__close-condition"),
|
272
276
|
"data-name": "closeCondition"
|
273
277
|
})), manageActionButtons(conditionIndex, group.conditions) && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
274
278
|
onClick: function onClick() {
|
275
|
-
addConditionHandler(conditionIndex);
|
279
|
+
addConditionHandler === null || addConditionHandler === void 0 || addConditionHandler(conditionIndex);
|
276
280
|
},
|
277
281
|
addConditionSubGroupHandler: function addConditionSubGroupHandler() {
|
278
|
-
_addConditionSubGroupHandler(conditionIndex);
|
282
|
+
_addConditionSubGroupHandler === null || _addConditionSubGroupHandler === void 0 || _addConditionSubGroupHandler(conditionIndex);
|
279
283
|
},
|
280
284
|
showConditionSubGroupPreviewHandler: showConditionSubGroupPreviewHandler,
|
281
285
|
hideConditionSubGroupPreviewHandler: hideConditionSubGroupPreviewHandler,
|
282
|
-
enableSubGroup: variant ==
|
286
|
+
enableSubGroup: variant == util.HIERARCHICAL_VARIANT,
|
283
287
|
showConditionPreviewHandler: showConditionPreviewHandler,
|
284
288
|
hideConditionPreviewHandler: hideConditionPreviewHandler,
|
285
|
-
className: "".concat(
|
289
|
+
className: "".concat(util.blockClass, "__gap ").concat(util.blockClass, "__gap-left")
|
286
290
|
}));
|
287
291
|
};
|
288
|
-
var ConditionBlock$1 = ConditionBlock;
|
289
292
|
ConditionBlock.propTypes = {
|
290
293
|
/**
|
291
294
|
* callback to add a new condition
|
@@ -352,4 +355,4 @@ ConditionBlock.propTypes = {
|
|
352
355
|
state: index["default"].object
|
353
356
|
};
|
354
357
|
|
355
|
-
exports["default"] = ConditionBlock
|
358
|
+
exports["default"] = ConditionBlock;
|
@@ -1,5 +1,12 @@
|
|
1
1
|
/**
|
2
|
-
*
|
2
|
+
* Copyright IBM Corp. 2024, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
3
6
|
*/
|
4
|
-
export let ConditionBuilder: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
5
7
|
import React from 'react';
|
8
|
+
import { ConditionBuilderProps } from './ConditionBuilder.types';
|
9
|
+
/**
|
10
|
+
* TODO: A description of the component.
|
11
|
+
*/
|
12
|
+
export declare let ConditionBuilder: React.ForwardRefExoticComponent<ConditionBuilderProps & React.RefAttributes<HTMLDivElement>>;
|