@carbon/ibm-products 2.44.0 → 2.45.0-rc.1
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 +27 -12
- 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 +27 -12
- 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
@@ -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) {
|
@@ -130,11 +139,23 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
130
139
|
'aria-setsize': aria.setsize
|
131
140
|
} : {};
|
132
141
|
};
|
142
|
+
var renderChildren = function renderChildren(popoverRef) {
|
143
|
+
return /*#__PURE__*/React__default.createElement(ItemComponent, {
|
144
|
+
conditionState: {
|
145
|
+
property: property,
|
146
|
+
operator: operator,
|
147
|
+
value: value
|
148
|
+
},
|
149
|
+
onChange: onValueChangeHandler,
|
150
|
+
config: config,
|
151
|
+
"data-name": "valueField",
|
152
|
+
parentRef: popoverRef
|
153
|
+
});
|
154
|
+
};
|
133
155
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
134
156
|
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
157
|
role: "row",
|
136
|
-
"aria-label":
|
137
|
-
tabIndex: -1
|
158
|
+
"aria-label": conditionRowText
|
138
159
|
}, getAriaAttributes()), conjunction ? /*#__PURE__*/React__default.createElement(ConditionConnector, {
|
139
160
|
className: "".concat(blockClass, "__gap"),
|
140
161
|
operator: conjunction,
|
@@ -145,14 +166,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
145
166
|
role: "gridcell"
|
146
167
|
})), isStatement && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
147
168
|
label: group.statement,
|
148
|
-
title:
|
169
|
+
title: conditionText,
|
149
170
|
"data-name": "connectorField",
|
150
171
|
popOverClassName: "".concat(blockClass, "__gap"),
|
151
172
|
className: "".concat(blockClass, "__statement-button")
|
152
173
|
}, /*#__PURE__*/React__default.createElement(ItemOption, {
|
153
174
|
conditionState: {
|
154
175
|
value: group.statement,
|
155
|
-
label:
|
176
|
+
label: conditionText
|
156
177
|
},
|
157
178
|
onChange: onStatementChangeHandler,
|
158
179
|
config: {
|
@@ -160,7 +181,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
160
181
|
}
|
161
182
|
})), /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
162
183
|
label: label,
|
163
|
-
title:
|
184
|
+
title: propertyText,
|
164
185
|
renderIcon: icon !== null && icon !== void 0 ? icon : null,
|
165
186
|
className: "".concat(blockClass, "__property-field"),
|
166
187
|
"data-name": "propertyField",
|
@@ -169,7 +190,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
169
190
|
}, /*#__PURE__*/React__default.createElement(ItemOption, {
|
170
191
|
conditionState: {
|
171
192
|
value: property,
|
172
|
-
label:
|
193
|
+
label: propertyText
|
173
194
|
},
|
174
195
|
onChange: onPropertyChangeHandler,
|
175
196
|
config: {
|
@@ -177,7 +198,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
177
198
|
}
|
178
199
|
})), property && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
179
200
|
label: operator,
|
180
|
-
title:
|
201
|
+
title: operatorText,
|
181
202
|
"data-name": "operatorField",
|
182
203
|
condition: condition,
|
183
204
|
type: type
|
@@ -187,7 +208,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
187
208
|
},
|
188
209
|
conditionState: {
|
189
210
|
value: operator,
|
190
|
-
label:
|
211
|
+
label: operatorText
|
191
212
|
},
|
192
213
|
onChange: onOperatorChangeHandler
|
193
214
|
})), property && operator && /*#__PURE__*/React__default.createElement(ConditionBuilderItem, {
|
@@ -197,22 +218,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
197
218
|
showToolTip: true,
|
198
219
|
"data-name": "valueField",
|
199
220
|
condition: condition,
|
200
|
-
config: config
|
201
|
-
}, /*#__PURE__*/React__default.createElement(ItemComponent, {
|
202
|
-
conditionState: {
|
203
|
-
property: property,
|
204
|
-
operator: operator,
|
205
|
-
value: value
|
206
|
-
},
|
207
|
-
onChange: onValueChangeHandler,
|
208
221
|
config: config,
|
209
|
-
|
210
|
-
})
|
222
|
+
renderChildren: renderChildren
|
223
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
211
224
|
role: "gridcell",
|
212
|
-
"aria-label":
|
225
|
+
"aria-label": removeConditionText
|
213
226
|
}, /*#__PURE__*/React__default.createElement(ConditionBuilderButton, {
|
214
227
|
hideLabel: true,
|
215
|
-
label:
|
228
|
+
label: removeConditionText,
|
216
229
|
onClick: onRemove,
|
217
230
|
onMouseEnter: handleShowDeletionPreview,
|
218
231
|
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,19 +53,22 @@ 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;
|
61
63
|
var handleKeyDownHandler = function handleKeyDownHandler(evt) {
|
62
|
-
handleKeyDown(evt, conditionBuilderRef);
|
64
|
+
handleKeyDown(evt, conditionBuilderRef, variant);
|
63
65
|
};
|
64
66
|
return /*#__PURE__*/React__default.createElement(ConditionBuilderProvider, {
|
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
|
@@ -106,7 +109,7 @@ ConditionBuilder.propTypes = {
|
|
106
109
|
* optional array of actions
|
107
110
|
*/
|
108
111
|
actions: PropTypes.arrayOf(PropTypes.shape({
|
109
|
-
id: PropTypes.oneOfType([PropTypes.string
|
112
|
+
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
110
113
|
label: PropTypes.string.isRequired
|
111
114
|
})),
|
112
115
|
/**
|
@@ -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", "invalidDateText", "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';
|