@carbon/ibm-products 2.43.2-canary.53 → 2.43.2-canary.55
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 +8 -2
- 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.css +8 -2
- 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 +8 -2
- 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 +21 -11
- package/es/components/ConditionBuilder/ConditionBuilder.js +15 -5
- 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 +21 -9
- 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 +19 -10
- 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 +18 -17
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +36 -39
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +36 -38
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +20 -12
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +8 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +9 -7
- 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/ConditionGroupBuilder/ConditionGroupBuilder.js +23 -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/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/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/es/components/Datagrid/useSelectRows.js +2 -1
- package/es/components/Nav/NavItem.js +12 -3
- package/es/components/OptionsTile/OptionsTile.js +4 -5
- package/es/components/SidePanel/SidePanel.js +17 -20
- 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/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 +20 -10
- package/lib/components/ConditionBuilder/ConditionBuilder.js +15 -5
- 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 +20 -8
- 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 +18 -9
- 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 +17 -17
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +36 -39
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +36 -38
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +19 -11
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +8 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +8 -6
- 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/ConditionGroupBuilder/ConditionGroupBuilder.js +21 -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/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/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
- package/lib/components/Datagrid/useSelectRows.js +2 -1
- package/lib/components/Nav/NavItem.js +10 -1
- package/lib/components/OptionsTile/OptionsTile.js +4 -5
- package/lib/components/SidePanel/SidePanel.js +16 -19
- 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/package.json +3 -3
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +3 -1
- 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
@@ -16,6 +16,8 @@ import { CoachmarkOverlay } from '../Coachmark/CoachmarkOverlay.js';
|
|
16
16
|
import { CoachmarkTagline } from '../Coachmark/CoachmarkTagline.js';
|
17
17
|
import { CoachmarkContext } from '../Coachmark/utils/context.js';
|
18
18
|
import { COACHMARK_OVERLAY_KIND } from '../Coachmark/utils/enums.js';
|
19
|
+
import { useReducedMotion } from 'framer-motion';
|
20
|
+
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
19
21
|
|
20
22
|
var _excluded = ["children", "className", "onClose", "portalTarget", "tagline", "theme"];
|
21
23
|
// Carbon and package components we use.
|
@@ -39,7 +41,6 @@ var defaults = {
|
|
39
41
|
* This variant allows the a coachmark overlay to be displayed by interacting with the tagline.
|
40
42
|
*/
|
41
43
|
var CoachmarkFixed = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
42
|
-
var _document$querySelect;
|
43
44
|
var children = _ref.children,
|
44
45
|
className = _ref.className,
|
45
46
|
_ref$onClose = _ref.onClose,
|
@@ -51,7 +52,7 @@ var CoachmarkFixed = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
51
52
|
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
52
53
|
rest = _objectWithoutProperties(_ref, _excluded);
|
53
54
|
var overlayRef = useRef(null);
|
54
|
-
var portalNode =
|
55
|
+
var portalNode = useRef(null);
|
55
56
|
var _useState = useState(false),
|
56
57
|
_useState2 = _slicedToArray(_useState, 2),
|
57
58
|
isOpen = _useState2[0],
|
@@ -75,17 +76,19 @@ var CoachmarkFixed = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
75
76
|
_useState10 = _slicedToArray(_useState9, 2),
|
76
77
|
fixedIsVisible = _useState10[0],
|
77
78
|
setFixedIsVisible = _useState10[1];
|
78
|
-
var
|
79
|
+
var shouldReduceMotion = useReducedMotion();
|
80
|
+
useIsomorphicEffect(function () {
|
81
|
+
var _document$querySelect, _document, _document2, _document3;
|
82
|
+
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');
|
83
|
+
}, [portalTarget]);
|
79
84
|
var handleClose = useCallback(function () {
|
80
|
-
|
81
|
-
if (prefersReducedMotion.matches) {
|
85
|
+
if (shouldReduceMotion) {
|
82
86
|
setIsOpen(false);
|
83
87
|
} else {
|
84
88
|
setFixedIsVisible(false);
|
85
89
|
}
|
86
|
-
}, [
|
90
|
+
}, [shouldReduceMotion]);
|
87
91
|
var handleTransitionEnd = function handleTransitionEnd(e) {
|
88
|
-
console.log('Here at transition end... ', e.propertyName === 'transform' && !fixedIsVisible);
|
89
92
|
if (e.propertyName === 'transform' && !fixedIsVisible) {
|
90
93
|
setIsOpen(false);
|
91
94
|
onClose();
|
@@ -164,7 +167,7 @@ var CoachmarkFixed = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
164
167
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement(CoachmarkTagline, {
|
165
168
|
title: tagline,
|
166
169
|
onClose: onClose
|
167
|
-
}), isOpen && /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement(CoachmarkOverlay, {
|
170
|
+
}), isOpen && (portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) && /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement(CoachmarkOverlay, {
|
168
171
|
ref: overlayRef,
|
169
172
|
fixedIsVisible: fixedIsVisible,
|
170
173
|
kind: COACHMARK_OVERLAY_KIND.FIXED,
|
@@ -172,9 +175,8 @@ var CoachmarkFixed = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
172
175
|
onTransitionEnd: handleTransitionEnd,
|
173
176
|
theme: theme,
|
174
177
|
className: cx(fixedIsVisible && "".concat(overlayBlockClass, "--is-visible"), overlayBlockClass)
|
175
|
-
}, children),
|
176
|
-
|
177
|
-
portalNode || document.body)));
|
178
|
+
}, children), // Default to `document.body` when `portalNode` is `null`
|
179
|
+
portalNode === null || portalNode === void 0 ? void 0 : portalNode.current)));
|
178
180
|
});
|
179
181
|
|
180
182
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -17,6 +17,7 @@ import { CoachmarkStackHome } from './CoachmarkStackHome.js';
|
|
17
17
|
import { CoachmarkTagline } from '../Coachmark/CoachmarkTagline.js';
|
18
18
|
import { CoachmarkContext } from '../Coachmark/utils/context.js';
|
19
19
|
import { COACHMARK_OVERLAY_KIND } from '../Coachmark/utils/enums.js';
|
20
|
+
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
20
21
|
|
21
22
|
var _excluded = ["children", "className", "onClose", "description", "media", "navLinkLabels", "portalTarget", "closeButtonLabel", "tagline", "theme", "title"];
|
22
23
|
|
@@ -47,7 +48,6 @@ var defaults = {
|
|
47
48
|
* This variant allows the stacking of multiple coachmark overlays to be displayed by interacting with the tagline.
|
48
49
|
*/
|
49
50
|
var CoachmarkStack = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
50
|
-
var _document$querySelect;
|
51
51
|
var children = _ref.children,
|
52
52
|
className = _ref.className,
|
53
53
|
_ref$onClose = _ref.onClose,
|
@@ -63,7 +63,11 @@ var CoachmarkStack = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
63
63
|
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
64
64
|
title = _ref.title,
|
65
65
|
rest = _objectWithoutProperties(_ref, _excluded);
|
66
|
-
var portalNode =
|
66
|
+
var portalNode = useRef();
|
67
|
+
useIsomorphicEffect(function () {
|
68
|
+
var _document$querySelect, _document, _document2, _document3;
|
69
|
+
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');
|
70
|
+
}, [portalTarget]);
|
67
71
|
var stackHomeRef = useRef();
|
68
72
|
var stackedCoachmarkRefs = useRef([]);
|
69
73
|
var _useState = useState(false),
|
@@ -206,7 +210,7 @@ var CoachmarkStack = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
206
210
|
portalTarget: portalTarget,
|
207
211
|
closeButtonLabel: closeButtonLabel,
|
208
212
|
title: title
|
209
|
-
}), /*#__PURE__*/createPortal(wrappedChildren, portalNode)));
|
213
|
+
}), portalNode !== null && portalNode !== void 0 && portalNode.current ? /*#__PURE__*/createPortal(wrappedChildren, portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) : null));
|
210
214
|
});
|
211
215
|
|
212
216
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -16,6 +16,7 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
|
16
16
|
import { pkg } from '../../settings.js';
|
17
17
|
import { createPortal } from 'react-dom';
|
18
18
|
import { CoachmarkHeader } from '../Coachmark/CoachmarkHeader.js';
|
19
|
+
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
19
20
|
import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia/SteppedAnimatedMedia.js';
|
20
21
|
|
21
22
|
var _excluded = ["className", "description", "isOpen", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
|
@@ -33,7 +34,6 @@ var componentName = 'CoachmarkStackHome';
|
|
33
34
|
* of other Onboarding components.
|
34
35
|
*/
|
35
36
|
var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
36
|
-
var _document$querySelect;
|
37
37
|
var className = _ref.className,
|
38
38
|
description = _ref.description,
|
39
39
|
isOpen = _ref.isOpen,
|
@@ -57,11 +57,15 @@ var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
57
57
|
}
|
58
58
|
}, 100);
|
59
59
|
}, [isOpen]);
|
60
|
+
var portalNode = useRef();
|
61
|
+
useIsomorphicEffect(function () {
|
62
|
+
var _document$querySelect, _document, _document2, _document3;
|
63
|
+
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');
|
64
|
+
}, [portalTarget]);
|
60
65
|
if (!navLinkLabels) {
|
61
66
|
return pconsole.warn("".concat(componentName, " is an Onboarding internal component and is not intended for general use."));
|
62
67
|
}
|
63
|
-
|
64
|
-
return /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
68
|
+
return portalNode !== null && portalNode !== void 0 && portalNode.current ? /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
65
69
|
className: cx(blockClass, className),
|
66
70
|
ref: ref,
|
67
71
|
role: "main"
|
@@ -103,7 +107,7 @@ var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
103
107
|
setLinkFocusIndex(0);
|
104
108
|
_onClose();
|
105
109
|
}
|
106
|
-
}, closeButtonLabel))))), portalNode);
|
110
|
+
}, closeButtonLabel))))), portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) : null;
|
107
111
|
function renderNavLink(index, label) {
|
108
112
|
var ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
109
113
|
return /*#__PURE__*/React__default.createElement("li", {
|
@@ -10,7 +10,7 @@ import React__default, { useContext, useState } from 'react';
|
|
10
10
|
import { Close } from '@carbon/react/icons';
|
11
11
|
import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
|
12
12
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
13
|
-
import { blockClass,
|
13
|
+
import { blockClass, statementConfig, operatorConfig } from '../ConditionBuilderContext/DataConfigs.js';
|
14
14
|
import cx from 'classnames';
|
15
15
|
import ConditionConnector from '../ConditionBuilderConnector/ConditionConnector.js';
|
16
16
|
import { ConditionBuilderItemNumber } from '../ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js';
|
@@ -23,6 +23,7 @@ import { ConditionBuilderItemTime } from '../ConditionBuilderItem/ConditionBuild
|
|
23
23
|
import ConditionBuilderAdd from '../ConditionBuilderAdd/ConditionBuilderAdd.js';
|
24
24
|
import { ItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js';
|
25
25
|
import { ItemOptionForValueField } from '../ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js';
|
26
|
+
import { useTranslations } from '../utils/useTranslations.js';
|
26
27
|
|
27
28
|
var _div;
|
28
29
|
|
@@ -59,6 +60,13 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
59
60
|
_useState2 = _slicedToArray(_useState, 2),
|
60
61
|
showDeletionPreview = _useState2[0],
|
61
62
|
setShowDeletionPreview = _useState2[1];
|
63
|
+
var _useTranslations = useTranslations(['conditionRowText', 'conditionText', 'propertyText', 'operatorText', 'removeConditionText']),
|
64
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 5),
|
65
|
+
conditionRowText = _useTranslations2[0],
|
66
|
+
conditionText = _useTranslations2[1],
|
67
|
+
propertyText = _useTranslations2[2],
|
68
|
+
operatorText = _useTranslations2[3],
|
69
|
+
removeConditionText = _useTranslations2[4];
|
62
70
|
|
63
71
|
//filtering the current property to access its properties and config options
|
64
72
|
var getCurrentConfig = function getCurrentConfig(property) {
|
@@ -80,7 +88,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
80
88
|
date: ConditionBuilderItemDate,
|
81
89
|
time: ConditionBuilderItemTime,
|
82
90
|
option: ItemOptionForValueField,
|
83
|
-
custom: config === null || config === void 0 ? void 0 : config.component
|
91
|
+
custom: config === null || config === void 0 ? void 0 : config.component,
|
92
|
+
textarea: ConditionBuilderItemText
|
84
93
|
};
|
85
94
|
var ItemComponent = property ? itemComponents[type] : null;
|
86
95
|
var onStatementChangeHandler = function onStatementChangeHandler(v, evt) {
|
@@ -133,7 +142,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
133
142
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
134
143
|
className: cx("".concat(blockClass, "__condition-block"), _defineProperty({}, "".concat(blockClass, "__condition__deletion-preview"), showDeletionPreview), _defineProperty({}, "".concat(blockClass, "__gap-bottom"), variant == 'tree' && !(conditionIndex + 1 >= group.conditions.length)), _defineProperty({}, "".concat(blockClass, "__gap ").concat(blockClass, "__gap-bottom"), variant == 'sentence')),
|
135
144
|
role: "row",
|
136
|
-
"aria-label":
|
145
|
+
"aria-label": conditionRowText,
|
137
146
|
tabIndex: -1
|
138
147
|
}, getAriaAttributes()), conjunction ? /*#__PURE__*/React__default.createElement(ConditionConnector, {
|
139
148
|
className: "".concat(blockClass, "__gap"),
|
@@ -145,14 +154,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
145
154
|
role: "gridcell"
|
146
155
|
})), isStatement && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
147
156
|
label: group.statement,
|
148
|
-
title:
|
157
|
+
title: conditionText,
|
149
158
|
"data-name": "connectorField",
|
150
159
|
popOverClassName: "".concat(blockClass, "__gap"),
|
151
160
|
className: "".concat(blockClass, "__statement-button")
|
152
161
|
}, /*#__PURE__*/React__default.createElement(ItemOption, {
|
153
162
|
conditionState: {
|
154
163
|
value: group.statement,
|
155
|
-
label:
|
164
|
+
label: conditionText
|
156
165
|
},
|
157
166
|
onChange: onStatementChangeHandler,
|
158
167
|
config: {
|
@@ -160,7 +169,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
160
169
|
}
|
161
170
|
})), /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
162
171
|
label: label,
|
163
|
-
title:
|
172
|
+
title: propertyText,
|
164
173
|
renderIcon: icon !== null && icon !== void 0 ? icon : null,
|
165
174
|
className: "".concat(blockClass, "__property-field"),
|
166
175
|
"data-name": "propertyField",
|
@@ -169,7 +178,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
169
178
|
}, /*#__PURE__*/React__default.createElement(ItemOption, {
|
170
179
|
conditionState: {
|
171
180
|
value: property,
|
172
|
-
label:
|
181
|
+
label: propertyText
|
173
182
|
},
|
174
183
|
onChange: onPropertyChangeHandler,
|
175
184
|
config: {
|
@@ -177,7 +186,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
177
186
|
}
|
178
187
|
})), property && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
179
188
|
label: operator,
|
180
|
-
title:
|
189
|
+
title: operatorText,
|
181
190
|
"data-name": "operatorField",
|
182
191
|
condition: condition,
|
183
192
|
type: type
|
@@ -187,7 +196,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
187
196
|
},
|
188
197
|
conditionState: {
|
189
198
|
value: operator,
|
190
|
-
label:
|
199
|
+
label: operatorText
|
191
200
|
},
|
192
201
|
onChange: onOperatorChangeHandler
|
193
202
|
})), property && operator && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
@@ -206,13 +215,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
206
215
|
},
|
207
216
|
onChange: onValueChangeHandler,
|
208
217
|
config: config,
|
218
|
+
type: type,
|
209
219
|
"data-name": "valueField"
|
210
220
|
})), /*#__PURE__*/React__default.createElement("span", {
|
211
221
|
role: "gridcell",
|
212
|
-
"aria-label":
|
222
|
+
"aria-label": removeConditionText
|
213
223
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, {
|
214
224
|
hideLabel: true,
|
215
|
-
label:
|
225
|
+
label: removeConditionText,
|
216
226
|
onClick: onRemove,
|
217
227
|
onMouseEnter: handleShowDeletionPreview,
|
218
228
|
onMouseLeave: handleHideDeletionPreview,
|
@@ -17,7 +17,7 @@ import { pkg } from '../../settings.js';
|
|
17
17
|
import { blockClass } from './ConditionBuilderContext/DataConfigs.js';
|
18
18
|
import { handleKeyDown } from './utils/handleKeyboardEvents.js';
|
19
19
|
|
20
|
-
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions"];
|
20
|
+
var _excluded = ["className", "inputConfig", "startConditionLabel", "popOverSearchThreshold", "getOptions", "initialState", "getConditionState", "getActionsState", "variant", "actions", "translateWithId"];
|
21
21
|
|
22
22
|
// Carbon and package components we use.
|
23
23
|
/* TODO: @import(s) of carbon components and other package components. */
|
@@ -53,8 +53,10 @@ var ConditionBuilder = /*#__PURE__*/React__default.forwardRef(function (_ref, re
|
|
53
53
|
initialState = _ref.initialState,
|
54
54
|
getConditionState = _ref.getConditionState,
|
55
55
|
getActionsState = _ref.getActionsState,
|
56
|
-
variant = _ref.variant,
|
56
|
+
_ref$variant = _ref.variant,
|
57
|
+
variant = _ref$variant === void 0 ? 'sentence' : _ref$variant,
|
57
58
|
actions = _ref.actions,
|
59
|
+
translateWithId = _ref.translateWithId,
|
58
60
|
rest = _objectWithoutProperties(_ref, _excluded);
|
59
61
|
var localRef = useRef();
|
60
62
|
var conditionBuilderRef = ref || localRef;
|
@@ -65,7 +67,8 @@ var ConditionBuilder = /*#__PURE__*/React__default.forwardRef(function (_ref, re
|
|
65
67
|
inputConfig: inputConfig,
|
66
68
|
popOverSearchThreshold: popOverSearchThreshold,
|
67
69
|
getOptions: getOptions,
|
68
|
-
variant: variant
|
70
|
+
variant: variant,
|
71
|
+
translateWithId: translateWithId
|
69
72
|
}, /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
70
73
|
className: cx(blockClass,
|
71
74
|
// Apply the block class to the main HTML element
|
@@ -173,7 +176,7 @@ ConditionBuilder.propTypes = {
|
|
173
176
|
id: PropTypes.string.isRequired,
|
174
177
|
label: PropTypes.string.isRequired,
|
175
178
|
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
176
|
-
type: PropTypes.oneOf(['text', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
179
|
+
type: PropTypes.oneOf(['text', 'textarea', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
177
180
|
config: PropTypes.shape({
|
178
181
|
options: PropTypes.arrayOf(PropTypes.shape({
|
179
182
|
id: PropTypes.string.isRequired,
|
@@ -196,11 +199,18 @@ ConditionBuilder.propTypes = {
|
|
196
199
|
* Provide a label to the button that starts condition builder
|
197
200
|
*/
|
198
201
|
startConditionLabel: PropTypes.string.isRequired,
|
202
|
+
/**
|
203
|
+
* Optional prop, if you need to pass translations to the texts on the component instead of the defined defaults.
|
204
|
+
* This callback function will receive the message id and you need to return the corresponding text for that id.
|
205
|
+
* 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", "invalidNumberWarnText"]
|
206
|
+
]
|
207
|
+
*/
|
208
|
+
translateWithId: PropTypes.func,
|
199
209
|
/* TODO: add types and DocGen for all props. */
|
200
210
|
/**
|
201
211
|
* Provide the condition builder variant: sentence/ tree
|
202
212
|
*/
|
203
|
-
variant: PropTypes.
|
213
|
+
variant: PropTypes.oneOf(['tree', 'sentence'])
|
204
214
|
};
|
205
215
|
|
206
216
|
export { ConditionBuilder };
|
@@ -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
|
}
|
@@ -5,19 +5,20 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { toConsumableArray as _toConsumableArray, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, { useContext } from 'react';
|
8
|
+
import { slicedToArray as _slicedToArray, defineProperty as _defineProperty, toConsumableArray as _toConsumableArray, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default, { useContext, useState } from 'react';
|
10
10
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
11
|
+
import cx from 'classnames';
|
11
12
|
import { Close } from '@carbon/react/icons';
|
12
13
|
import { Section, Heading } from '@carbon/react';
|
13
14
|
import { ConditionBuilderItem } from '../ConditionBuilderItem/ConditionBuilderItem.js';
|
14
|
-
import { blockClass
|
15
|
-
import { ItemOption } from '../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js';
|
15
|
+
import { blockClass } from '../ConditionBuilderContext/DataConfigs.js';
|
16
16
|
import { ConditionBuilderContext } from '../ConditionBuilderContext/ConditionBuilderProvider.js';
|
17
17
|
import ConditionBuilderAdd from '../ConditionBuilderAdd/ConditionBuilderAdd.js';
|
18
18
|
import uuidv4 from '../../../global/js/utils/uuidv4.js';
|
19
19
|
import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
|
20
|
-
import {
|
20
|
+
import { useTranslations } from '../utils/useTranslations.js';
|
21
|
+
import { ItemOptionForValueField } from '../ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js';
|
21
22
|
|
22
23
|
var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
23
24
|
var actions = _ref.actions,
|
@@ -25,90 +26,111 @@ var ConditionBuilderActions = function ConditionBuilderActions(_ref) {
|
|
25
26
|
var _useContext = useContext(ConditionBuilderContext),
|
26
27
|
actionState = _useContext.actionState,
|
27
28
|
setActionState = _useContext.setActionState;
|
29
|
+
var _useState = useState(-1),
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
31
|
+
showDeletionPreview = _useState2[0],
|
32
|
+
setShowDeletionPreview = _useState2[1];
|
33
|
+
var _useTranslations = useTranslations(['actionsText', 'then', 'and', 'removeActionText', 'addActionText']),
|
34
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 5),
|
35
|
+
actionsText = _useTranslations2[0],
|
36
|
+
thenText = _useTranslations2[1],
|
37
|
+
andText = _useTranslations2[2],
|
38
|
+
removeActionText = _useTranslations2[3],
|
39
|
+
addActionText = _useTranslations2[4];
|
28
40
|
var addActionHandler = function addActionHandler() {
|
29
41
|
var action = {
|
30
42
|
id: uuidv4(),
|
31
43
|
label: undefined,
|
32
|
-
popoverToOpen: '
|
44
|
+
popoverToOpen: 'valueField'
|
33
45
|
};
|
34
46
|
setActionState([].concat(_toConsumableArray(actionState), [action]));
|
35
47
|
};
|
36
|
-
var onchangeHandler = function onchangeHandler(
|
48
|
+
var onchangeHandler = function onchangeHandler(selectedId, actionIndex) {
|
37
49
|
var action = actions.find(function (action) {
|
38
50
|
return action.id === selectedId;
|
39
51
|
}); //fetch the selected action from the input action array
|
40
52
|
|
41
|
-
//if the action is duplicate, that action is added with a new id, else the same action is used.
|
42
53
|
// same actions can be added multiple times
|
43
|
-
var newAction =
|
44
|
-
id:
|
45
|
-
})
|
54
|
+
var newAction = _objectSpread2(_objectSpread2({}, action), {}, {
|
55
|
+
id: actionState[actionIndex].id
|
56
|
+
});
|
46
57
|
setActionState([].concat(_toConsumableArray(actionState.slice(0, actionIndex)), [newAction], _toConsumableArray(actionState.slice(actionIndex + 1))));
|
47
|
-
focusThisField(evt);
|
48
58
|
};
|
49
59
|
var onRemove = function onRemove(selectedId) {
|
50
60
|
setActionState(actionState.filter(function (action) {
|
51
61
|
return action.id !== selectedId;
|
52
62
|
}));
|
53
63
|
};
|
64
|
+
var handleShowDeletionPreview = function handleShowDeletionPreview(index) {
|
65
|
+
setShowDeletionPreview(index);
|
66
|
+
};
|
67
|
+
var handleHideDeletionPreview = function handleHideDeletionPreview() {
|
68
|
+
setShowDeletionPreview(-1);
|
69
|
+
};
|
54
70
|
return /*#__PURE__*/React__default.createElement("div", {
|
55
|
-
className:
|
71
|
+
className: className
|
56
72
|
}, /*#__PURE__*/React__default.createElement(Section, {
|
57
73
|
className: "".concat(blockClass, "__heading"),
|
58
74
|
level: 4
|
59
|
-
}, /*#__PURE__*/React__default.createElement(Heading, null,
|
60
|
-
className: "".concat(blockClass, "__condition-wrapper")
|
75
|
+
}, /*#__PURE__*/React__default.createElement(Heading, null, actionsText)), /*#__PURE__*/React__default.createElement("div", {
|
76
|
+
className: "".concat(blockClass, "__condition-wrapper"),
|
77
|
+
role: "grid"
|
61
78
|
}, actionState === null || actionState === void 0 ? void 0 : actionState.map(function (action, index) {
|
62
79
|
return /*#__PURE__*/React__default.createElement("div", {
|
63
80
|
key: action.id,
|
64
|
-
"
|
65
|
-
className: "".concat(blockClass, "__condition-block
|
81
|
+
role: "row",
|
82
|
+
className: cx("".concat(blockClass, "__condition-block ").concat(blockClass, "__gap ").concat(blockClass, "__gap-bottom"), _defineProperty({}, "".concat(blockClass, "__condition__deletion-preview"), showDeletionPreview == index))
|
66
83
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
67
84
|
className: "".concat(blockClass, "__statement-button"),
|
85
|
+
tabIndex: 0,
|
68
86
|
popOverClassName: "".concat(blockClass, "__gap"),
|
69
|
-
label: index === 0 ?
|
87
|
+
label: index === 0 ? thenText : andText
|
70
88
|
}), /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
71
89
|
label: action.label,
|
72
|
-
title:
|
73
|
-
popOverClassName: "".concat(blockClass, "__gap"),
|
90
|
+
title: actionsText,
|
74
91
|
condition: action,
|
75
|
-
"data-name": "
|
76
|
-
|
92
|
+
"data-name": "valueField",
|
93
|
+
type: "option"
|
94
|
+
}, /*#__PURE__*/React__default.createElement(ItemOptionForValueField, {
|
77
95
|
conditionState: {
|
78
96
|
value: action.label
|
79
97
|
},
|
80
|
-
onChange: function onChange(
|
81
|
-
return onchangeHandler(
|
98
|
+
onChange: function onChange(selection) {
|
99
|
+
return onchangeHandler(selection.id, index);
|
82
100
|
},
|
83
101
|
config: {
|
84
102
|
options: actions
|
85
103
|
}
|
86
104
|
})), /*#__PURE__*/React__default.createElement("span", {
|
87
105
|
role: "gridcell",
|
88
|
-
"aria-label":
|
106
|
+
"aria-label": removeActionText
|
89
107
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, {
|
90
108
|
hideLabel: true,
|
91
|
-
label:
|
109
|
+
label: removeActionText,
|
92
110
|
onClick: function onClick() {
|
93
111
|
return onRemove(action.id);
|
94
|
-
}
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
112
|
+
},
|
113
|
+
onMouseEnter: function onMouseEnter() {
|
114
|
+
return handleShowDeletionPreview(index);
|
115
|
+
},
|
116
|
+
onMouseLeave: handleHideDeletionPreview,
|
117
|
+
onFocus: function onFocus() {
|
118
|
+
return handleShowDeletionPreview(index);
|
119
|
+
},
|
120
|
+
onBlur: handleHideDeletionPreview,
|
100
121
|
renderIcon: Close,
|
101
122
|
className: "".concat(blockClass, "__close-condition"),
|
102
123
|
"data-name": "closeCondition"
|
103
124
|
})), actionState.length === index + 1 && /*#__PURE__*/React__default.createElement(ConditionBuilderAdd, {
|
104
125
|
onClick: addActionHandler,
|
105
126
|
className: "".concat(blockClass, "__gap ").concat(blockClass, "__gap-left"),
|
106
|
-
buttonLabel:
|
127
|
+
buttonLabel: addActionText
|
107
128
|
}));
|
108
129
|
}), actionState.length === 0 && /*#__PURE__*/React__default.createElement(ConditionBuilderAdd, {
|
109
130
|
onClick: addActionHandler,
|
110
131
|
className: "".concat(blockClass, "__gap ").concat(blockClass, "__gap-left"),
|
111
|
-
buttonLabel:
|
132
|
+
buttonLabel: addActionText,
|
133
|
+
tabIndex: 0
|
112
134
|
})));
|
113
135
|
};
|
114
136
|
var ConditionBuilderActions$1 = ConditionBuilderActions;
|
@@ -117,8 +139,8 @@ ConditionBuilderActions.propTypes = {
|
|
117
139
|
* optional array of object that give the list of actions.
|
118
140
|
*/
|
119
141
|
actions: PropTypes.arrayOf(PropTypes.shape({
|
120
|
-
id: PropTypes.number,
|
121
|
-
label: PropTypes.string
|
142
|
+
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
143
|
+
label: PropTypes.string.isRequired
|
122
144
|
})),
|
123
145
|
/**
|
124
146
|
* 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';
|
@@ -11,7 +11,8 @@ import cx from 'classnames';
|
|
11
11
|
import { AddAlt, TextNewLine } from '@carbon/react/icons';
|
12
12
|
import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
|
13
13
|
import PropTypes from '../../../node_modules/prop-types/index.js';
|
14
|
-
import {
|
14
|
+
import { blockClass } from '../ConditionBuilderContext/DataConfigs.js';
|
15
|
+
import { useTranslations } from '../utils/useTranslations.js';
|
15
16
|
|
16
17
|
var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
17
18
|
var className = _ref.className,
|
@@ -22,11 +23,17 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
22
23
|
showConditionPreviewHandler = _ref.showConditionPreviewHandler,
|
23
24
|
hideConditionPreviewHandler = _ref.hideConditionPreviewHandler,
|
24
25
|
enableSubGroup = _ref.enableSubGroup,
|
25
|
-
buttonLabel = _ref.buttonLabel
|
26
|
+
buttonLabel = _ref.buttonLabel,
|
27
|
+
tabIndex = _ref.tabIndex;
|
26
28
|
var _useState = useState(false),
|
27
29
|
_useState2 = _slicedToArray(_useState, 2),
|
28
30
|
isAddSubgroup = _useState2[0],
|
29
31
|
setIsAddSubgroup = _useState2[1];
|
32
|
+
var _useTranslations = useTranslations(['addConditionText', 'addConditionRowText', 'addSubgroupText']),
|
33
|
+
_useTranslations2 = _slicedToArray(_useTranslations, 3),
|
34
|
+
addConditionText = _useTranslations2[0],
|
35
|
+
addConditionRowText = _useTranslations2[1],
|
36
|
+
addSubgroupText = _useTranslations2[2];
|
30
37
|
var showAddSubGroup = function showAddSubGroup() {
|
31
38
|
setIsAddSubgroup(true);
|
32
39
|
};
|
@@ -54,13 +61,13 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
54
61
|
};
|
55
62
|
};
|
56
63
|
var wrapperProps = enableSubGroup ? {
|
57
|
-
role: 'gridcell'
|
58
|
-
'aria-label':
|
64
|
+
role: 'gridcell'
|
65
|
+
// 'aria-label': addSubgroupText,
|
59
66
|
} : {};
|
60
67
|
return /*#__PURE__*/React__default.createElement("div", {
|
61
68
|
className: "".concat(className, " ").concat(blockClass, "__add-button-wrapper"),
|
62
69
|
role: !enableSubGroup ? 'gridcell' : 'none',
|
63
|
-
"aria-label": !enableSubGroup ?
|
70
|
+
"aria-label": !enableSubGroup ? addConditionRowText : undefined,
|
64
71
|
onMouseEnter: showAddSubGroup,
|
65
72
|
onMouseLeave: hideAddSubGroup,
|
66
73
|
onFocus: showAddSubGroup,
|
@@ -69,17 +76,18 @@ var ConditionBuilderAdd = function ConditionBuilderAdd(_ref) {
|
|
69
76
|
renderIcon: AddAlt,
|
70
77
|
onClick: onClickHandler
|
71
78
|
}, previewHandlers(), {
|
79
|
+
wrapperProps: wrapperProps,
|
72
80
|
className: "".concat(blockClass, "__add-button"),
|
73
81
|
hideLabel: true,
|
74
82
|
"data-name": "addButton",
|
75
|
-
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel :
|
76
|
-
|
83
|
+
label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : addConditionText,
|
84
|
+
tabIndex: tabIndex
|
77
85
|
})), enableSubGroup && /*#__PURE__*/React__default.createElement(ConditionBuilderButton, _extends({
|
78
86
|
renderIcon: TextNewLine,
|
79
87
|
onClick: addConditionSubGroupHandler,
|
80
88
|
className: cx("".concat(blockClass, "__add_condition_group ").concat(blockClass, "__gap-left")),
|
81
89
|
hideLabel: true,
|
82
|
-
label:
|
90
|
+
label: addSubgroupText,
|
83
91
|
wrapperProps: wrapperProps,
|
84
92
|
wrapperClassName: cx("".concat(blockClass, "__add_condition_group-wrapper"), _defineProperty({}, "".concat(blockClass, "__add_condition_group-wrapper--show"), isAddSubgroup))
|
85
93
|
}, previewHandlersForSubgroup())));
|
@@ -116,10 +124,14 @@ ConditionBuilderAdd.propTypes = {
|
|
116
124
|
*/
|
117
125
|
onClick: PropTypes.func,
|
118
126
|
showConditionPreviewHandler: PropTypes.func,
|
119
|
-
showConditionSubGroupPreviewHandler: PropTypes.func
|
127
|
+
showConditionSubGroupPreviewHandler: PropTypes.func,
|
120
128
|
/**
|
121
129
|
* handler for hiding sub group preview
|
122
130
|
*/
|
131
|
+
/**
|
132
|
+
* Tab index
|
133
|
+
*/
|
134
|
+
tabIndex: PropTypes.number
|
123
135
|
};
|
124
136
|
|
125
137
|
export { ConditionBuilderAdd$1 as default };
|