@carbon/ibm-products 2.44.0-rc.2 → 2.45.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 +118 -15
- 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 +203 -5
- 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 +118 -15
- 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 +118 -15
- 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/Coachmark/Coachmark.js +12 -7
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/es/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +35 -22
- package/es/components/ConditionBuilder/ConditionBuilder.js +17 -7
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +23 -11
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +29 -16
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +23 -20
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +49 -23
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -9
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +70 -17
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
- package/es/components/ConditionBuilder/utils/util.js +1 -9
- package/es/components/CreateFullPage/CreateFullPage.js +2 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +25 -7
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/es/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/es/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/es/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/es/components/Datagrid/types/index.d.ts +28 -6
- package/es/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/es/components/Datagrid/useCustomizeColumns.js +4 -3
- package/es/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/es/components/Datagrid/useNestedRowExpander.js +1 -3
- package/es/components/Datagrid/useRowExpander.js +1 -3
- package/es/components/Datagrid/useSelectRows.js +2 -1
- package/es/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/es/components/Datagrid/useStickyColumn.js +12 -9
- package/es/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/es/components/EditInPlace/EditInPlace.js +21 -10
- package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/es/components/EditTearsheet/EditTearsheet.js +44 -9
- package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/es/components/Nav/NavItem.js +12 -3
- package/es/components/OptionsTile/OptionsTile.js +11 -6
- package/es/components/PageHeader/PageHeader.js +1 -0
- package/es/components/SearchBar/SearchBar.d.ts +1 -1
- package/es/components/SearchBar/SearchBar.js +2 -2
- package/es/components/SidePanel/SidePanel.js +17 -21
- package/es/components/SidePanel/motion/variants.d.ts +4 -6
- package/es/components/SidePanel/motion/variants.js +10 -11
- package/es/components/Tearsheet/TearsheetShell.js +3 -1
- package/es/components/WebTerminal/WebTerminal.js +10 -12
- package/es/global/js/hooks/usePrefersReducedMotion.js +14 -8
- package/es/global/js/package-settings.d.ts +1 -1
- package/es/global/js/package-settings.js +1 -1
- package/es/settings.d.ts +1 -1
- package/lib/components/Coachmark/Coachmark.js +12 -7
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
- package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +34 -21
- package/lib/components/ConditionBuilder/ConditionBuilder.js +17 -7
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +22 -10
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +28 -15
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +22 -20
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +48 -22
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -8
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +68 -15
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
- package/lib/components/ConditionBuilder/utils/util.js +0 -9
- package/lib/components/CreateFullPage/CreateFullPage.js +2 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +25 -7
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
- package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -8
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +8 -6
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
- package/lib/components/Datagrid/types/index.d.ts +28 -6
- package/lib/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/lib/components/Datagrid/useCustomizeColumns.js +4 -3
- package/lib/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/lib/components/Datagrid/useNestedRowExpander.js +1 -3
- package/lib/components/Datagrid/useRowExpander.js +1 -3
- package/lib/components/Datagrid/useSelectRows.js +2 -1
- package/lib/components/Datagrid/useStickyColumn.d.ts +8 -1
- package/lib/components/Datagrid/useStickyColumn.js +12 -9
- package/lib/components/EditInPlace/EditInPlace.d.ts +4 -0
- package/lib/components/EditInPlace/EditInPlace.js +21 -10
- package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
- package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
- package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
- package/lib/components/Nav/NavItem.js +10 -1
- package/lib/components/OptionsTile/OptionsTile.js +11 -6
- package/lib/components/PageHeader/PageHeader.js +1 -0
- package/lib/components/SearchBar/SearchBar.d.ts +1 -1
- package/lib/components/SearchBar/SearchBar.js +2 -2
- package/lib/components/SidePanel/SidePanel.js +16 -20
- package/lib/components/SidePanel/motion/variants.d.ts +4 -6
- package/lib/components/SidePanel/motion/variants.js +10 -11
- package/lib/components/Tearsheet/TearsheetShell.js +3 -1
- package/lib/components/WebTerminal/WebTerminal.js +10 -12
- package/lib/global/js/hooks/usePrefersReducedMotion.js +13 -7
- package/lib/global/js/package-settings.d.ts +1 -1
- package/lib/global/js/package-settings.js +1 -1
- package/lib/settings.d.ts +1 -1
- package/package.json +4 -4
- package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +8 -4
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +9 -2
- package/scss/components/Datagrid/_datagrid.scss +0 -4
- package/scss/components/HTTPErrors/_http-errors.scss +77 -0
- package/scss/components/OptionsTile/_options-tile.scss +6 -6
- package/scss/components/SidePanel/_side-panel.scss +1 -1
- package/scss/components/_index-released-only.scss +1 -0
- package/telemetry.yml +12 -2
- package/es/global/js/utils/window.d.ts +0 -2
- package/es/global/js/utils/window.js +0 -12
- package/lib/global/js/utils/window.d.ts +0 -2
- package/lib/global/js/utils/window.js +0 -16
@@ -21,6 +21,7 @@ var CoachmarkStackHome = require('./CoachmarkStackHome.js');
|
|
21
21
|
var CoachmarkTagline = require('../Coachmark/CoachmarkTagline.js');
|
22
22
|
var context = require('../Coachmark/utils/context.js');
|
23
23
|
var enums = require('../Coachmark/utils/enums.js');
|
24
|
+
var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
|
24
25
|
|
25
26
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
26
27
|
|
@@ -56,7 +57,6 @@ var defaults = {
|
|
56
57
|
* This variant allows the stacking of multiple coachmark overlays to be displayed by interacting with the tagline.
|
57
58
|
*/
|
58
59
|
exports.CoachmarkStack = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
59
|
-
var _document$querySelect;
|
60
60
|
var children = _ref.children,
|
61
61
|
className = _ref.className,
|
62
62
|
_ref$onClose = _ref.onClose,
|
@@ -72,7 +72,11 @@ exports.CoachmarkStack = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
72
72
|
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
73
73
|
title = _ref.title,
|
74
74
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
75
|
-
var portalNode =
|
75
|
+
var portalNode = React.useRef();
|
76
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
77
|
+
var _document$querySelect, _document, _document2, _document3;
|
78
|
+
portalNode.current = portalTarget ? (_document$querySelect = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector('body') : (_document3 = document) === null || _document3 === void 0 ? void 0 : _document3.querySelector('body');
|
79
|
+
}, [portalTarget]);
|
76
80
|
var stackHomeRef = React.useRef();
|
77
81
|
var stackedCoachmarkRefs = React.useRef([]);
|
78
82
|
var _useState = React.useState(false),
|
@@ -215,7 +219,7 @@ exports.CoachmarkStack = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
215
219
|
portalTarget: portalTarget,
|
216
220
|
closeButtonLabel: closeButtonLabel,
|
217
221
|
title: title
|
218
|
-
}), /*#__PURE__*/reactDom.createPortal(wrappedChildren, portalNode)));
|
222
|
+
}), portalNode !== null && portalNode !== void 0 && portalNode.current ? /*#__PURE__*/reactDom.createPortal(wrappedChildren, portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) : null));
|
219
223
|
});
|
220
224
|
|
221
225
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -20,6 +20,7 @@ var devtools = require('../../global/js/utils/devtools.js');
|
|
20
20
|
var settings = require('../../settings.js');
|
21
21
|
var reactDom = require('react-dom');
|
22
22
|
var CoachmarkHeader = require('../Coachmark/CoachmarkHeader.js');
|
23
|
+
var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
|
23
24
|
var SteppedAnimatedMedia = require('../SteppedAnimatedMedia/SteppedAnimatedMedia.js');
|
24
25
|
|
25
26
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
@@ -42,7 +43,6 @@ var componentName = 'CoachmarkStackHome';
|
|
42
43
|
* of other Onboarding components.
|
43
44
|
*/
|
44
45
|
exports.CoachmarkStackHome = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
45
|
-
var _document$querySelect;
|
46
46
|
var className = _ref.className,
|
47
47
|
description = _ref.description,
|
48
48
|
isOpen = _ref.isOpen,
|
@@ -66,11 +66,15 @@ exports.CoachmarkStackHome = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
66
66
|
}
|
67
67
|
}, 100);
|
68
68
|
}, [isOpen]);
|
69
|
+
var portalNode = React.useRef();
|
70
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
71
|
+
var _document$querySelect, _document, _document2, _document3;
|
72
|
+
portalNode.current = portalTarget ? (_document$querySelect = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector('body') : (_document3 = document) === null || _document3 === void 0 ? void 0 : _document3.querySelector('body');
|
73
|
+
}, [portalTarget]);
|
69
74
|
if (!navLinkLabels) {
|
70
75
|
return pconsole["default"].warn("".concat(componentName, " is an Onboarding internal component and is not intended for general use."));
|
71
76
|
}
|
72
|
-
|
73
|
-
return /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
77
|
+
return portalNode !== null && portalNode !== void 0 && portalNode.current ? /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
74
78
|
className: cx__default["default"](blockClass, className),
|
75
79
|
ref: ref,
|
76
80
|
role: "main"
|
@@ -112,7 +116,7 @@ exports.CoachmarkStackHome = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
112
116
|
setLinkFocusIndex(0);
|
113
117
|
_onClose();
|
114
118
|
}
|
115
|
-
}, closeButtonLabel))))), portalNode);
|
119
|
+
}, closeButtonLabel))))), portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) : null;
|
116
120
|
function renderNavLink(index, label) {
|
117
121
|
var ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
118
122
|
return /*#__PURE__*/React__default["default"].createElement("li", {
|
@@ -27,6 +27,7 @@ var ConditionBuilderItemTime = require('../ConditionBuilderItem/ConditionBuilder
|
|
27
27
|
var ConditionBuilderAdd = require('../ConditionBuilderAdd/ConditionBuilderAdd.js');
|
28
28
|
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
29
29
|
var ItemOptionForValueField = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js');
|
30
|
+
var useTranslations = require('../utils/useTranslations.js');
|
30
31
|
|
31
32
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
32
33
|
|
@@ -68,6 +69,13 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
68
69
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
69
70
|
showDeletionPreview = _useState2[0],
|
70
71
|
setShowDeletionPreview = _useState2[1];
|
72
|
+
var _useTranslations = useTranslations.useTranslations(['conditionRowText', 'conditionText', 'propertyText', 'operatorText', 'removeConditionText']),
|
73
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 5),
|
74
|
+
conditionRowText = _useTranslations2[0],
|
75
|
+
conditionText = _useTranslations2[1],
|
76
|
+
propertyText = _useTranslations2[2],
|
77
|
+
operatorText = _useTranslations2[3],
|
78
|
+
removeConditionText = _useTranslations2[4];
|
71
79
|
|
72
80
|
//filtering the current property to access its properties and config options
|
73
81
|
var getCurrentConfig = function getCurrentConfig(property) {
|
@@ -89,7 +97,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
89
97
|
date: ConditionBuilderItemDate.ConditionBuilderItemDate,
|
90
98
|
time: ConditionBuilderItemTime.ConditionBuilderItemTime,
|
91
99
|
option: ItemOptionForValueField.ItemOptionForValueField,
|
92
|
-
custom: config === null || config === void 0 ? void 0 : config.component
|
100
|
+
custom: config === null || config === void 0 ? void 0 : config.component,
|
101
|
+
textarea: ConditionBuilderItemText.ConditionBuilderItemText
|
93
102
|
};
|
94
103
|
var ItemComponent = property ? itemComponents[type] : null;
|
95
104
|
var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
|
@@ -139,11 +148,23 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
139
148
|
'aria-setsize': aria.setsize
|
140
149
|
} : {};
|
141
150
|
};
|
151
|
+
var renderChildren = function renderChildren(popoverRef) {
|
152
|
+
return /*#__PURE__*/React__default["default"].createElement(ItemComponent, {
|
153
|
+
conditionState: {
|
154
|
+
property: property,
|
155
|
+
operator: operator,
|
156
|
+
value: value
|
157
|
+
},
|
158
|
+
onChange: onValueChangeHandler,
|
159
|
+
config: config,
|
160
|
+
"data-name": "valueField",
|
161
|
+
parentRef: popoverRef
|
162
|
+
});
|
163
|
+
};
|
142
164
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
143
165
|
className: cx__default["default"]("".concat(DataConfigs.blockClass, "__condition-block"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__condition__deletion-preview"), showDeletionPreview), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__gap-bottom"), variant == 'tree' && !(conditionIndex + 1 >= group.conditions.length)), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"), variant == 'sentence')),
|
144
166
|
role: "row",
|
145
|
-
"aria-label":
|
146
|
-
tabIndex: -1
|
167
|
+
"aria-label": conditionRowText
|
147
168
|
}, getAriaAttributes()), conjunction ? /*#__PURE__*/React__default["default"].createElement(ConditionConnector["default"], {
|
148
169
|
className: "".concat(DataConfigs.blockClass, "__gap"),
|
149
170
|
operator: conjunction,
|
@@ -154,14 +175,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
154
175
|
role: "gridcell"
|
155
176
|
})), isStatement && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
156
177
|
label: group.statement,
|
157
|
-
title:
|
178
|
+
title: conditionText,
|
158
179
|
"data-name": "connectorField",
|
159
180
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
160
181
|
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
161
182
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
162
183
|
conditionState: {
|
163
184
|
value: group.statement,
|
164
|
-
label:
|
185
|
+
label: conditionText
|
165
186
|
},
|
166
187
|
onChange: onStatementChangeHandler,
|
167
188
|
config: {
|
@@ -169,7 +190,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
169
190
|
}
|
170
191
|
})), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
171
192
|
label: label,
|
172
|
-
title:
|
193
|
+
title: propertyText,
|
173
194
|
renderIcon: icon !== null && icon !== void 0 ? icon : null,
|
174
195
|
className: "".concat(DataConfigs.blockClass, "__property-field"),
|
175
196
|
"data-name": "propertyField",
|
@@ -178,7 +199,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
178
199
|
}, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
|
179
200
|
conditionState: {
|
180
201
|
value: property,
|
181
|
-
label:
|
202
|
+
label: propertyText
|
182
203
|
},
|
183
204
|
onChange: onPropertyChangeHandler,
|
184
205
|
config: {
|
@@ -186,7 +207,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
186
207
|
}
|
187
208
|
})), property && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
188
209
|
label: operator,
|
189
|
-
title:
|
210
|
+
title: operatorText,
|
190
211
|
"data-name": "operatorField",
|
191
212
|
condition: condition,
|
192
213
|
type: type
|
@@ -196,7 +217,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
196
217
|
},
|
197
218
|
conditionState: {
|
198
219
|
value: operator,
|
199
|
-
label:
|
220
|
+
label: operatorText
|
200
221
|
},
|
201
222
|
onChange: onOperatorChangeHandler
|
202
223
|
})), property && operator && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
@@ -206,22 +227,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
206
227
|
showToolTip: true,
|
207
228
|
"data-name": "valueField",
|
208
229
|
condition: condition,
|
209
|
-
config: config
|
210
|
-
}, /*#__PURE__*/React__default["default"].createElement(ItemComponent, {
|
211
|
-
conditionState: {
|
212
|
-
property: property,
|
213
|
-
operator: operator,
|
214
|
-
value: value
|
215
|
-
},
|
216
|
-
onChange: onValueChangeHandler,
|
217
230
|
config: config,
|
218
|
-
|
219
|
-
})
|
231
|
+
renderChildren: renderChildren
|
232
|
+
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
220
233
|
role: "gridcell",
|
221
|
-
"aria-label":
|
234
|
+
"aria-label": removeConditionText
|
222
235
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
223
236
|
hideLabel: true,
|
224
|
-
label:
|
237
|
+
label: removeConditionText,
|
225
238
|
onClick: onRemove,
|
226
239
|
onMouseEnter: handleShowDeletionPreview,
|
227
240
|
onMouseLeave: handleHideDeletionPreview,
|
@@ -26,7 +26,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
26
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
27
27
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
28
28
|
|
29
|
-
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions"];
|
29
|
+
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions", "translateWithId"];
|
30
30
|
|
31
31
|
// Carbon and package components we use.
|
32
32
|
/* TODO: @import(s) of carbon components and other package components. */
|
@@ -62,19 +62,22 @@ exports.ConditionBuilder = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
62
62
|
initialState = _ref.initialState,
|
63
63
|
getConditionState = _ref.getConditionState,
|
64
64
|
getActionsState = _ref.getActionsState,
|
65
|
-
variant = _ref.variant,
|
65
|
+
_ref$variant = _ref.variant,
|
66
|
+
variant = _ref$variant === void 0 ? 'sentence' : _ref$variant,
|
66
67
|
actions = _ref.actions,
|
68
|
+
translateWithId = _ref.translateWithId,
|
67
69
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
68
70
|
var localRef = React.useRef();
|
69
71
|
var conditionBuilderRef = ref || localRef;
|
70
72
|
var handleKeyDownHandler = function handleKeyDownHandler(evt) {
|
71
|
-
handleKeyboardEvents.handleKeyDown(evt, conditionBuilderRef);
|
73
|
+
handleKeyboardEvents.handleKeyDown(evt, conditionBuilderRef, variant);
|
72
74
|
};
|
73
75
|
return /*#__PURE__*/React__default["default"].createElement(ConditionBuilderProvider.ConditionBuilderProvider, {
|
74
76
|
inputConfig: inputConfig,
|
75
77
|
popOverSearchThreshold: popOverSearchThreshold,
|
76
78
|
getOptions: getOptions,
|
77
|
-
variant: variant
|
79
|
+
variant: variant,
|
80
|
+
translateWithId: translateWithId
|
78
81
|
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
79
82
|
className: cx__default["default"](DataConfigs.blockClass,
|
80
83
|
// Apply the block class to the main HTML element
|
@@ -115,7 +118,7 @@ exports.ConditionBuilder.propTypes = {
|
|
115
118
|
* optional array of actions
|
116
119
|
*/
|
117
120
|
actions: index["default"].arrayOf(index["default"].shape({
|
118
|
-
id: index["default"].oneOfType([index["default"].string
|
121
|
+
id: index["default"].oneOfType([index["default"].string, index["default"].number]).isRequired,
|
119
122
|
label: index["default"].string.isRequired
|
120
123
|
})),
|
121
124
|
/**
|
@@ -182,7 +185,7 @@ exports.ConditionBuilder.propTypes = {
|
|
182
185
|
id: index["default"].string.isRequired,
|
183
186
|
label: index["default"].string.isRequired,
|
184
187
|
icon: index["default"].oneOfType([index["default"].func, index["default"].object]),
|
185
|
-
type: index["default"].oneOf(['text', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
188
|
+
type: index["default"].oneOf(['text', 'textarea', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
186
189
|
config: index["default"].shape({
|
187
190
|
options: index["default"].arrayOf(index["default"].shape({
|
188
191
|
id: index["default"].string.isRequired,
|
@@ -205,9 +208,16 @@ exports.ConditionBuilder.propTypes = {
|
|
205
208
|
* Provide a label to the button that starts condition builder
|
206
209
|
*/
|
207
210
|
startConditionLabel: index["default"].string.isRequired,
|
211
|
+
/**
|
212
|
+
* Optional prop, if you need to pass translations to the texts on the component instead of the defined defaults.
|
213
|
+
* This callback function will receive the message id and you need to return the corresponding text for that id.
|
214
|
+
* The message id will be one of [ "ifText","addConditionText", "addConditionGroupText", "addSubgroupText", "conditionText", "propertyText", "operatorText", "valueText", "connectorText", "conditionRowText", "removeConditionText", "addConditionRowText", "startText", "endText", "clearSearchText", "actionsText", "then", "removeActionText", "addActionText", "invalidText", "invalidDateText", "invalidNumberWarnText"]
|
215
|
+
]
|
216
|
+
*/
|
217
|
+
translateWithId: index["default"].func,
|
208
218
|
/* TODO: add types and DocGen for all props. */
|
209
219
|
/**
|
210
220
|
* Provide the condition builder variant: sentence/ tree
|
211
221
|
*/
|
212
|
-
variant: index["default"].
|
222
|
+
variant: index["default"].oneOf(['tree', 'sentence'])
|
213
223
|
};
|
package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts
CHANGED
@@ -6,8 +6,8 @@ declare function ConditionBuilderActions({ actions, className }: {
|
|
6
6
|
declare namespace ConditionBuilderActions {
|
7
7
|
namespace propTypes {
|
8
8
|
let actions: PropTypes.Requireable<(PropTypes.InferProps<{
|
9
|
-
id: PropTypes.
|
10
|
-
label: PropTypes.
|
9
|
+
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
10
|
+
label: PropTypes.Validator<string>;
|
11
11
|
}> | null | undefined)[]>;
|
12
12
|
let className: PropTypes.Requireable<string>;
|
13
13
|
}
|
@@ -12,20 +12,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
13
|
var React = require('react');
|
14
14
|
var index = require('../../../node_modules/prop-types/index.js');
|
15
|
+
var cx = require('classnames');
|
15
16
|
var icons = require('@carbon/react/icons');
|
16
17
|
var react = require('@carbon/react');
|
17
18
|
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
18
19
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
19
|
-
var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
|
20
20
|
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
21
21
|
var ConditionBuilderAdd = require('../ConditionBuilderAdd/ConditionBuilderAdd.js');
|
22
22
|
var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
23
23
|
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
24
|
-
var
|
24
|
+
var useTranslations = require('../utils/useTranslations.js');
|
25
|
+
var ItemOptionForValueField = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js');
|
25
26
|
|
26
27
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
27
28
|
|
28
29
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
30
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
29
31
|
|
30
32
|
var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
31
33
|
var actions = _ref.actions,
|
@@ -33,90 +35,111 @@ var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
|
33
35
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
34
36
|
actionState = _useContext.actionState,
|
35
37
|
setActionState = _useContext.setActionState;
|
38
|
+
var _useState = React.useState(-1),
|
39
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
40
|
+
showDeletionPreview = _useState2[0],
|
41
|
+
setShowDeletionPreview = _useState2[1];
|
42
|
+
var _useTranslations = useTranslations.useTranslations(['actionsText', 'then', 'and', 'removeActionText', 'addActionText']),
|
43
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 5),
|
44
|
+
actionsText = _useTranslations2[0],
|
45
|
+
thenText = _useTranslations2[1],
|
46
|
+
andText = _useTranslations2[2],
|
47
|
+
removeActionText = _useTranslations2[3],
|
48
|
+
addActionText = _useTranslations2[4];
|
36
49
|
var addActionHandler = function addActionHandler() {
|
37
50
|
var action = {
|
38
51
|
id: uuidv4["default"](),
|
39
52
|
label: undefined,
|
40
|
-
popoverToOpen: '
|
53
|
+
popoverToOpen: 'valueField'
|
41
54
|
};
|
42
55
|
setActionState([].concat(_rollupPluginBabelHelpers.toConsumableArray(actionState), [action]));
|
43
56
|
};
|
44
|
-
var onchangeHandler = function onchangeHandler(
|
57
|
+
var onchangeHandler = function onchangeHandler(selectedId, actionIndex) {
|
45
58
|
var action = actions.find(function (action) {
|
46
59
|
return action.id === selectedId;
|
47
60
|
}); //fetch the selected action from the input action array
|
48
61
|
|
49
|
-
//if the action is duplicate, that action is added with a new id, else the same action is used.
|
50
62
|
// same actions can be added multiple times
|
51
|
-
var newAction =
|
52
|
-
id:
|
53
|
-
})
|
63
|
+
var newAction = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, action), {}, {
|
64
|
+
id: actionState[actionIndex].id
|
65
|
+
});
|
54
66
|
setActionState([].concat(_rollupPluginBabelHelpers.toConsumableArray(actionState.slice(0, actionIndex)), [newAction], _rollupPluginBabelHelpers.toConsumableArray(actionState.slice(actionIndex + 1))));
|
55
|
-
util.focusThisField(evt);
|
56
67
|
};
|
57
68
|
var onRemove = function onRemove(selectedId) {
|
58
69
|
setActionState(actionState.filter(function (action) {
|
59
70
|
return action.id !== selectedId;
|
60
71
|
}));
|
61
72
|
};
|
73
|
+
var handleShowDeletionPreview = function handleShowDeletionPreview(index) {
|
74
|
+
setShowDeletionPreview(index);
|
75
|
+
};
|
76
|
+
var handleHideDeletionPreview = function handleHideDeletionPreview() {
|
77
|
+
setShowDeletionPreview(-1);
|
78
|
+
};
|
62
79
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
63
|
-
className:
|
80
|
+
className: className
|
64
81
|
}, /*#__PURE__*/React__default["default"].createElement(react.Section, {
|
65
82
|
className: "".concat(DataConfigs.blockClass, "__heading"),
|
66
83
|
level: 4
|
67
|
-
}, /*#__PURE__*/React__default["default"].createElement(react.Heading, null,
|
68
|
-
className: "".concat(DataConfigs.blockClass, "__condition-wrapper")
|
84
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Heading, null, actionsText)), /*#__PURE__*/React__default["default"].createElement("div", {
|
85
|
+
className: "".concat(DataConfigs.blockClass, "__condition-wrapper"),
|
86
|
+
role: "grid"
|
69
87
|
}, actionState === null || actionState === void 0 ? void 0 : actionState.map(function (action, index) {
|
70
88
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
71
89
|
key: action.id,
|
72
|
-
"
|
73
|
-
className: "".concat(DataConfigs.blockClass, "__condition-block
|
90
|
+
role: "row",
|
91
|
+
className: cx__default["default"]("".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__condition__deletion-preview"), showDeletionPreview == index))
|
74
92
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
75
93
|
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
94
|
+
tabIndex: 0,
|
76
95
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
77
|
-
label: index === 0 ?
|
96
|
+
label: index === 0 ? thenText : andText
|
78
97
|
}), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
79
98
|
label: action.label,
|
80
|
-
title:
|
81
|
-
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
99
|
+
title: actionsText,
|
82
100
|
condition: action,
|
83
|
-
"data-name": "
|
84
|
-
|
101
|
+
"data-name": "valueField",
|
102
|
+
type: "option"
|
103
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemOptionForValueField.ItemOptionForValueField, {
|
85
104
|
conditionState: {
|
86
105
|
value: action.label
|
87
106
|
},
|
88
|
-
onChange: function onChange(
|
89
|
-
return onchangeHandler(
|
107
|
+
onChange: function onChange(selection) {
|
108
|
+
return onchangeHandler(selection.id, index);
|
90
109
|
},
|
91
110
|
config: {
|
92
111
|
options: actions
|
93
112
|
}
|
94
113
|
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
95
114
|
role: "gridcell",
|
96
|
-
"aria-label":
|
115
|
+
"aria-label": removeActionText
|
97
116
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
98
117
|
hideLabel: true,
|
99
|
-
label:
|
118
|
+
label: removeActionText,
|
100
119
|
onClick: function onClick() {
|
101
120
|
return onRemove(action.id);
|
102
|
-
}
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
121
|
+
},
|
122
|
+
onMouseEnter: function onMouseEnter() {
|
123
|
+
return handleShowDeletionPreview(index);
|
124
|
+
},
|
125
|
+
onMouseLeave: handleHideDeletionPreview,
|
126
|
+
onFocus: function onFocus() {
|
127
|
+
return handleShowDeletionPreview(index);
|
128
|
+
},
|
129
|
+
onBlur: handleHideDeletionPreview,
|
108
130
|
renderIcon: icons.Close,
|
109
131
|
className: "".concat(DataConfigs.blockClass, "__close-condition"),
|
110
132
|
"data-name": "closeCondition"
|
111
133
|
})), actionState.length === index + 1 && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
112
134
|
onClick: addActionHandler,
|
113
135
|
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-left"),
|
114
|
-
buttonLabel:
|
136
|
+
buttonLabel: addActionText
|
115
137
|
}));
|
116
138
|
}), actionState.length === 0 && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
117
139
|
onClick: addActionHandler,
|
118
140
|
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-left"),
|
119
|
-
buttonLabel:
|
141
|
+
buttonLabel: addActionText,
|
142
|
+
tabIndex: 0
|
120
143
|
})));
|
121
144
|
};
|
122
145
|
var ConditionBuilderActions$1 = ConditionBuilderActions;
|
@@ -125,8 +148,8 @@ ConditionBuilderActions.propTypes = {
|
|
125
148
|
* optional array of object that give the list of actions.
|
126
149
|
*/
|
127
150
|
actions: index["default"].arrayOf(index["default"].shape({
|
128
|
-
id: index["default"].number,
|
129
|
-
label: index["default"].string
|
151
|
+
id: index["default"].oneOfType([index["default"].string, index["default"].number]).isRequired,
|
152
|
+
label: index["default"].string.isRequired
|
130
153
|
})),
|
131
154
|
/**
|
132
155
|
* Provide an optional class to be applied to the containing node.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export default ConditionBuilderAdd;
|
2
|
-
declare function ConditionBuilderAdd({ className, onClick, addConditionSubGroupHandler, showConditionSubGroupPreviewHandler, hideConditionSubGroupPreviewHandler, showConditionPreviewHandler, hideConditionPreviewHandler, enableSubGroup, buttonLabel, }: {
|
2
|
+
declare function ConditionBuilderAdd({ className, onClick, addConditionSubGroupHandler, showConditionSubGroupPreviewHandler, hideConditionSubGroupPreviewHandler, showConditionPreviewHandler, hideConditionPreviewHandler, enableSubGroup, buttonLabel, tabIndex, }: {
|
3
3
|
className: any;
|
4
4
|
onClick: any;
|
5
5
|
addConditionSubGroupHandler: any;
|
@@ -9,6 +9,7 @@ declare function ConditionBuilderAdd({ className, onClick, addConditionSubGroupH
|
|
9
9
|
hideConditionPreviewHandler: any;
|
10
10
|
enableSubGroup: any;
|
11
11
|
buttonLabel: any;
|
12
|
+
tabIndex: any;
|
12
13
|
}): import("react/jsx-runtime").JSX.Element;
|
13
14
|
declare namespace ConditionBuilderAdd {
|
14
15
|
namespace propTypes {
|
@@ -21,6 +22,7 @@ declare namespace ConditionBuilderAdd {
|
|
21
22
|
let onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
22
23
|
let showConditionPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
23
24
|
let showConditionSubGroupPreviewHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
25
|
+
let tabIndex: PropTypes.Requireable<number>;
|
24
26
|
}
|
25
27
|
}
|
26
28
|
import PropTypes from 'prop-types';
|
@@ -16,6 +16,7 @@ var icons = require('@carbon/react/icons');
|
|
16
16
|
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
17
17
|
var index = require('../../../node_modules/prop-types/index.js');
|
18
18
|
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
19
|
+
var useTranslations = require('../utils/useTranslations.js');
|
19
20
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
22
|
|
@@ -31,11 +32,17 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
31
32
|
showConditionPreviewHandler = _ref.showConditionPreviewHandler,
|
32
33
|
hideConditionPreviewHandler = _ref.hideConditionPreviewHandler,
|
33
34
|
enableSubGroup = _ref.enableSubGroup,
|
34
|
-
buttonLabel = _ref.buttonLabel
|
35
|
+
buttonLabel = _ref.buttonLabel,
|
36
|
+
tabIndex = _ref.tabIndex;
|
35
37
|
var _useState = React.useState(false),
|
36
38
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
37
39
|
isAddSubgroup = _useState2[0],
|
38
40
|
setIsAddSubgroup = _useState2[1];
|
41
|
+
var _useTranslations = useTranslations.useTranslations(['addConditionText', 'addConditionRowText', 'addSubgroupText']),
|
42
|
+
_useTranslations2 = _rollupPluginBabelHelpers.slicedToArray(_useTranslations, 3),
|
43
|
+
addConditionText = _useTranslations2[0],
|
44
|
+
addConditionRowText = _useTranslations2[1],
|
45
|
+
addSubgroupText = _useTranslations2[2];
|
39
46
|
var showAddSubGroup = function showAddSubGroup() {
|
40
47
|
setIsAddSubgroup(true);
|
41
48
|
};
|
@@ -63,13 +70,13 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
63
70
|
};
|
64
71
|
};
|
65
72
|
var wrapperProps = enableSubGroup ? {
|
66
|
-
role: 'gridcell'
|
67
|
-
'aria-label':
|
73
|
+
role: 'gridcell'
|
74
|
+
// 'aria-label': addSubgroupText,
|
68
75
|
} : {};
|
69
76
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
70
77
|
className: "".concat(className, " ").concat(DataConfigs.blockClass, "__add-button-wrapper"),
|
71
78
|
role: !enableSubGroup ? 'gridcell' : 'none',
|
72
|
-
"aria-label": !enableSubGroup ?
|
79
|
+
"aria-label": !enableSubGroup ? addConditionRowText : undefined,
|
73
80
|
onMouseEnter: showAddSubGroup,
|
74
81
|
onMouseLeave: hideAddSubGroup,
|
75
82
|
onFocus: showAddSubGroup,
|
@@ -78,19 +85,20 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
78
85
|
renderIcon: icons.AddAlt,
|
79
86
|
onClick: onClickHandler
|
80
87
|
}, previewHandlers(), {
|
88
|
+
wrapperProps: wrapperProps,
|
81
89
|
className: "".concat(DataConfigs.blockClass, "__add-button"),
|
82
90
|
hideLabel: true,
|
83
91
|
"data-name": "addButton",
|
84
|
-
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel :
|
85
|
-
|
92
|
+
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : addConditionText,
|
93
|
+
tabIndex: tabIndex
|
86
94
|
})), enableSubGroup && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, _rollupPluginBabelHelpers["extends"]({
|
87
95
|
renderIcon: icons.TextNewLine,
|
88
96
|
onClick: addConditionSubGroupHandler,
|
89
|
-
className: cx__default["default"]("".concat(DataConfigs.blockClass, "
|
97
|
+
className: cx__default["default"]("".concat(DataConfigs.blockClass, "__add-condition-sub-group ").concat(DataConfigs.blockClass, "__gap-left")),
|
90
98
|
hideLabel: true,
|
91
|
-
label:
|
99
|
+
label: addSubgroupText,
|
92
100
|
wrapperProps: wrapperProps,
|
93
|
-
wrapperClassName: cx__default["default"]("".concat(DataConfigs.blockClass, "
|
101
|
+
wrapperClassName: cx__default["default"]("".concat(DataConfigs.blockClass, "__add-condition-sub-group-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__add-condition-sub-group-wrapper--show"), isAddSubgroup))
|
94
102
|
}, previewHandlersForSubgroup())));
|
95
103
|
};
|
96
104
|
var ConditionBuilderAdd$1 = ConditionBuilderAdd;
|
@@ -125,10 +133,14 @@ ConditionBuilderAdd.propTypes = {
|
|
125
133
|
*/
|
126
134
|
onClick: index["default"].func,
|
127
135
|
showConditionPreviewHandler: index["default"].func,
|
128
|
-
showConditionSubGroupPreviewHandler: index["default"].func
|
136
|
+
showConditionSubGroupPreviewHandler: index["default"].func,
|
129
137
|
/**
|
130
138
|
* handler for hiding sub group preview
|
131
139
|
*/
|
140
|
+
/**
|
141
|
+
* Tab index
|
142
|
+
*/
|
143
|
+
tabIndex: index["default"].number
|
132
144
|
};
|
133
145
|
|
134
146
|
exports["default"] = ConditionBuilderAdd$1;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip, wrapperProps, onBlur, onFocus, onMouseEnter, onMouseLeave, isInvalid, wrapperClassName, }: {
|
1
|
+
export function ConditionBuilderButton({ className, label, hideLabel, tooltipAlign, renderIcon: Icon, onClick, showToolTip, wrapperProps, onBlur, onFocus, onMouseEnter, onMouseLeave, isInvalid, wrapperClassName, tabIndex, ...rest }: {
|
2
|
+
[x: string]: any;
|
2
3
|
className: any;
|
3
4
|
label: any;
|
4
5
|
hideLabel: any;
|
@@ -13,6 +14,7 @@ export function ConditionBuilderButton({ className, label, hideLabel, tooltipAli
|
|
13
14
|
onMouseLeave: any;
|
14
15
|
isInvalid: any;
|
15
16
|
wrapperClassName: any;
|
17
|
+
tabIndex: any;
|
16
18
|
}): import("react/jsx-runtime").JSX.Element;
|
17
19
|
export namespace ConditionBuilderButton {
|
18
20
|
namespace propTypes {
|
@@ -27,6 +29,7 @@ export namespace ConditionBuilderButton {
|
|
27
29
|
let onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
28
30
|
let renderIcon: PropTypes.Requireable<object>;
|
29
31
|
let showToolTip: PropTypes.Requireable<boolean>;
|
32
|
+
let tabIndex: PropTypes.Requireable<number>;
|
30
33
|
let tooltipAlign: PropTypes.Requireable<string>;
|
31
34
|
let wrapperClassName: PropTypes.Requireable<string>;
|
32
35
|
let wrapperProps: PropTypes.Requireable<object>;
|