@carbon/ibm-products 2.36.0-alpha.27 → 2.37.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 +5404 -5117
- 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 +4 -4
- 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 +820 -61
- 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 +329 -6
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/es/components/Carousel/Carousel.d.ts +46 -2
- package/es/components/Carousel/Carousel.js +36 -21
- package/es/components/Carousel/CarouselItem.d.ts +19 -2
- package/es/components/Carousel/CarouselItem.js +0 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +261 -0
- package/es/components/ConditionBuilder/ConditionBuilder.js +45 -16
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +74 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +112 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +151 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +59 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +52 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +162 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +82 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +85 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +145 -0
- package/es/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/es/components/ConditionBuilder/utils/util.js +16 -0
- package/es/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/es/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/es/components/Datagrid/useParentDimensions.js +1 -1
- package/es/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/es/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/es/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/es/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/es/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/es/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/es/components/InterstitialScreen/InterstitialScreen.js +25 -14
- package/es/components/Nav/NavItem.js +1 -1
- package/es/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/es/components/PageHeader/PageHeader.js +12 -3
- package/es/components/SidePanel/SidePanel.js +1 -1
- package/es/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/es/components/SimpleHeader/SimpleHeader.js +2 -4
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/es/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/es/components/Tearsheet/TearsheetShell.js +18 -8
- package/es/components/UserProfileImage/UserProfileImage.d.ts +66 -2
- package/es/components/UserProfileImage/UserProfileImage.js +5 -3
- package/es/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/es/components/WebTerminal/WebTerminal.js +2 -2
- package/es/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/es/global/js/hooks/usePrefersReducedMotion.js +28 -0
- package/es/global/js/utils/Wrap.d.ts +31 -2
- package/es/global/js/utils/Wrap.js +7 -9
- package/es/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/es/global/js/utils/getNodeTextContent.js +1 -1
- package/es/global/js/utils/window.d.ts +2 -0
- package/es/global/js/utils/window.js +12 -0
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2780 -0
- package/lib/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/lib/components/Carousel/Carousel.d.ts +46 -2
- package/lib/components/Carousel/Carousel.js +35 -20
- package/lib/components/Carousel/CarouselItem.d.ts +19 -2
- package/lib/components/Carousel/CarouselItem.js +0 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +270 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.js +46 -17
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +83 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +121 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +44 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +159 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +67 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +60 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +170 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +90 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +93 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +153 -0
- package/lib/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/lib/components/ConditionBuilder/utils/util.js +20 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/lib/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/lib/components/Datagrid/useParentDimensions.js +1 -1
- package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/lib/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/lib/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/lib/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.js +24 -13
- package/lib/components/Nav/NavItem.js +2 -2
- package/lib/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/lib/components/PageHeader/PageHeader.js +11 -2
- package/lib/components/SidePanel/SidePanel.js +1 -1
- package/lib/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/lib/components/SimpleHeader/SimpleHeader.js +2 -4
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/lib/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/lib/components/Tearsheet/TearsheetShell.js +16 -6
- package/lib/components/UserProfileImage/UserProfileImage.d.ts +66 -2
- package/lib/components/UserProfileImage/UserProfileImage.js +5 -3
- package/lib/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/lib/components/WebTerminal/WebTerminal.js +2 -2
- package/lib/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/lib/global/js/hooks/usePrefersReducedMotion.js +32 -0
- package/lib/global/js/utils/Wrap.d.ts +31 -2
- package/lib/global/js/utils/Wrap.js +7 -9
- package/lib/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/lib/global/js/utils/getNodeTextContent.js +1 -1
- package/lib/global/js/utils/window.d.ts +2 -0
- package/lib/global/js/utils/window.js +16 -0
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2912 -0
- package/package.json +5 -5
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -1
- package/scss/components/ConditionBuilder/_condition-builder.scss +26 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +46 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +194 -0
- package/scss/components/ConditionBuilder/styles/_index.scss +2 -0
- package/scss/components/Guidebanner/_guidebanner.scss +3 -0
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -6
- package/scss/components/Tearsheet/_tearsheet.scss +3 -1
- package/telemetry.yml +3 -0
- package/es/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/es/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/es/global/js/utils/keyboardNavigation.js +0 -33
- package/es/global/js/utils/wrapFocus.d.ts +0 -25
- package/es/global/js/utils/wrapFocus.js +0 -68
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
- package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/lib/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/lib/global/js/utils/keyboardNavigation.js +0 -39
- package/lib/global/js/utils/wrapFocus.d.ts +0 -25
- package/lib/global/js/utils/wrapFocus.js +0 -73
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
|
@@ -165,7 +165,7 @@ function _regeneratorRuntime() {
|
|
|
165
165
|
function makeInvokeMethod(e, r, n) {
|
|
166
166
|
var o = h;
|
|
167
167
|
return function (i, a) {
|
|
168
|
-
if (o === f) throw
|
|
168
|
+
if (o === f) throw Error("Generator is already running");
|
|
169
169
|
if (o === s) {
|
|
170
170
|
if ("throw" === i) throw a;
|
|
171
171
|
return {
|
|
@@ -307,7 +307,7 @@ function _regeneratorRuntime() {
|
|
|
307
307
|
} else if (c) {
|
|
308
308
|
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
309
309
|
} else {
|
|
310
|
-
if (!u) throw
|
|
310
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
311
311
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
@@ -347,7 +347,7 @@ function _regeneratorRuntime() {
|
|
|
347
347
|
return o;
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
throw
|
|
350
|
+
throw Error("illegal catch attempt");
|
|
351
351
|
},
|
|
352
352
|
delegateYield: function (e, r, n) {
|
|
353
353
|
return this.delegate = {
|
|
@@ -370,7 +370,7 @@ function _toPrimitive(t, r) {
|
|
|
370
370
|
}
|
|
371
371
|
function _toPropertyKey(t) {
|
|
372
372
|
var i = _toPrimitive(t, "string");
|
|
373
|
-
return "symbol" == typeof i ? i :
|
|
373
|
+
return "symbol" == typeof i ? i : i + "";
|
|
374
374
|
}
|
|
375
375
|
function _typeof(o) {
|
|
376
376
|
"@babel/helpers - typeof";
|
|
@@ -445,12 +445,11 @@ function _objectDestructuringEmpty(obj) {
|
|
|
445
445
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
446
446
|
if (source == null) return {};
|
|
447
447
|
var target = {};
|
|
448
|
-
var
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
target[key] = source[key];
|
|
448
|
+
for (var key in source) {
|
|
449
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
450
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
451
|
+
target[key] = source[key];
|
|
452
|
+
}
|
|
454
453
|
}
|
|
455
454
|
return target;
|
|
456
455
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export function BreadcrumbWithOverflow({ breadcrumbs, className, maxVisible, noTrailingSlash, overflowAriaLabel, ...other }: {
|
|
1
|
+
export function BreadcrumbWithOverflow({ breadcrumbs, className, maxVisible, noTrailingSlash, overflowAriaLabel, overflowTooltipAlign, ...other }: {
|
|
2
2
|
[x: string]: any;
|
|
3
3
|
breadcrumbs: any;
|
|
4
4
|
className: any;
|
|
5
5
|
maxVisible: any;
|
|
6
6
|
noTrailingSlash: any;
|
|
7
7
|
overflowAriaLabel: any;
|
|
8
|
+
overflowTooltipAlign: any;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export namespace BreadcrumbWithOverflow {
|
|
10
11
|
export namespace propTypes {
|
|
@@ -34,6 +35,7 @@ export namespace BreadcrumbWithOverflow {
|
|
|
34
35
|
let maxVisible: PropTypes.Requireable<number>;
|
|
35
36
|
let noTrailingSlash: PropTypes.Requireable<boolean>;
|
|
36
37
|
let overflowAriaLabel: any;
|
|
38
|
+
let overflowTooltipAlign: any;
|
|
37
39
|
}
|
|
38
40
|
export { componentName as displayName };
|
|
39
41
|
}
|
|
@@ -27,7 +27,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
27
27
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
28
28
|
|
|
29
29
|
var _TooltipTrigger;
|
|
30
|
-
var _excluded = ["breadcrumbs", "className", "maxVisible", "noTrailingSlash", "overflowAriaLabel"],
|
|
30
|
+
var _excluded = ["breadcrumbs", "className", "maxVisible", "noTrailingSlash", "overflowAriaLabel", "overflowTooltipAlign"],
|
|
31
31
|
_excluded2 = ["label", "key", "title", "id"],
|
|
32
32
|
_excluded3 = ["className", "key", "label", "title"];
|
|
33
33
|
|
|
@@ -47,6 +47,7 @@ exports.BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
|
|
|
47
47
|
maxVisible = _ref.maxVisible,
|
|
48
48
|
noTrailingSlash = _ref.noTrailingSlash,
|
|
49
49
|
overflowAriaLabel = _ref.overflowAriaLabel,
|
|
50
|
+
overflowTooltipAlign = _ref.overflowTooltipAlign,
|
|
50
51
|
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
51
52
|
var carbonPrefix = react.usePrefix();
|
|
52
53
|
var _useState = React.useState(3),
|
|
@@ -71,6 +72,7 @@ exports.BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
|
|
|
71
72
|
return /*#__PURE__*/React__default["default"].createElement(react.BreadcrumbItem, {
|
|
72
73
|
key: "breadcrumb-overflow-".concat(internalId.current)
|
|
73
74
|
}, /*#__PURE__*/React__default["default"].createElement(react.OverflowMenu, {
|
|
75
|
+
align: overflowTooltipAlign,
|
|
74
76
|
"aria-label": overflowAriaLabel,
|
|
75
77
|
iconDescription: overflowAriaLabel // also needs setting to avoid a11y "Accessible name does not match or contain the visible label text"
|
|
76
78
|
,
|
|
@@ -328,6 +330,10 @@ exports.BreadcrumbWithOverflow.propTypes = {
|
|
|
328
330
|
overflowAriaLabel: index["default"].string.isRequired.if(function (_ref6) {
|
|
329
331
|
var breadcrumbs = _ref6.breadcrumbs;
|
|
330
332
|
return breadcrumbs.length > 1;
|
|
331
|
-
})
|
|
333
|
+
}),
|
|
334
|
+
/**
|
|
335
|
+
* overflowTooltipAlign: align tooltip position
|
|
336
|
+
*/
|
|
337
|
+
overflowTooltipAlign: react.Tooltip.propTypes.align
|
|
332
338
|
};
|
|
333
339
|
exports.BreadcrumbWithOverflow.displayName = componentName;
|
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2023, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
8
|
+
interface CarouselProps {
|
|
9
|
+
/**
|
|
10
|
+
* Provide the contents of the Carousel.
|
|
11
|
+
*/
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Provide an optional class to be applied to the containing node.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Disables the ability of the Carousel to scroll
|
|
19
|
+
* use a keyboard's left and right arrow keys.
|
|
20
|
+
*/
|
|
21
|
+
disableArrowScroll?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Enables the edges of the component to have faded styling.
|
|
24
|
+
*
|
|
25
|
+
* Pass a single string (`$color`) to specify the same color for left and right.
|
|
26
|
+
*
|
|
27
|
+
* Or pass an object (`{ left: $color1, right: $color2 }`) to specify different colors.
|
|
28
|
+
*/
|
|
29
|
+
fadedEdgeColor?: string | {
|
|
30
|
+
left: string;
|
|
31
|
+
right: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* An optional callback function that returns `true`
|
|
35
|
+
* when the carousel has enough content to be scrollable,
|
|
36
|
+
* and `false` when there is not enough content.
|
|
37
|
+
*/
|
|
38
|
+
onChangeIsScrollable?: (isScrollable: boolean) => void;
|
|
39
|
+
/**
|
|
40
|
+
* An optional callback function that returns the scroll position as
|
|
41
|
+
* a value between 0 and 1.
|
|
42
|
+
*/
|
|
43
|
+
onScroll?: (scrollPercent: number) => void;
|
|
44
|
+
}
|
|
1
45
|
/**
|
|
2
46
|
* The Carousel acts as a scaffold for other Novice to Pro content.
|
|
3
47
|
*
|
|
@@ -14,5 +58,5 @@
|
|
|
14
58
|
* 2. From the right-aligned position, when scrolling left,
|
|
15
59
|
* the left-most item should again be left-aligned.
|
|
16
60
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
61
|
+
declare const Carousel: React.ForwardRefExoticComponent<CarouselProps & React.RefAttributes<HTMLDivElement>>;
|
|
62
|
+
export { Carousel };
|
|
@@ -23,7 +23,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
25
|
var _excluded = ["children", "className", "disableArrowScroll", "fadedEdgeColor", "onChangeIsScrollable", "onScroll"];
|
|
26
|
-
|
|
27
26
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
28
27
|
var blockClass = "".concat(settings.pkg.prefix, "--carousel");
|
|
29
28
|
var componentName = 'Carousel';
|
|
@@ -62,29 +61,31 @@ var Carousel = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
62
61
|
_ref$onScroll = _ref.onScroll,
|
|
63
62
|
onScroll = _ref$onScroll === void 0 ? defaults.onScroll : _ref$onScroll,
|
|
64
63
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
65
|
-
var carouselRef = React.useRef();
|
|
66
|
-
var scrollRef = React.useRef();
|
|
64
|
+
var carouselRef = React.useRef(null);
|
|
65
|
+
var scrollRef = React.useRef(null);
|
|
67
66
|
// Array of refs used to reference this component's children DOM elements
|
|
68
67
|
var childElementsRef = React.useRef(Array(React__default["default"].Children.count(children)).fill(React.useRef(null)));
|
|
69
|
-
var leftFadedEdgeColor = (fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.left
|
|
70
|
-
var rightFadedEdgeColor = (fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.right
|
|
68
|
+
var leftFadedEdgeColor = _rollupPluginBabelHelpers["typeof"](fadedEdgeColor) === 'object' ? fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.left : fadedEdgeColor;
|
|
69
|
+
var rightFadedEdgeColor = _rollupPluginBabelHelpers["typeof"](fadedEdgeColor) === 'object' ? fadedEdgeColor === null || fadedEdgeColor === void 0 ? void 0 : fadedEdgeColor.right : fadedEdgeColor;
|
|
71
70
|
|
|
72
71
|
// Trigger callbacks to report state of the carousel
|
|
73
72
|
var handleOnScroll = React.useCallback(function () {
|
|
73
|
+
var _scrollRef$current, _scrollRef$current2, _scrollRef$current3;
|
|
74
|
+
if (!scrollRef.current) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
74
78
|
// viewport's width
|
|
75
|
-
var clientWidth = scrollRef.current.clientWidth;
|
|
79
|
+
var clientWidth = (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.clientWidth;
|
|
76
80
|
// scroll position
|
|
77
|
-
var scrollLeft = parseInt(scrollRef.current.scrollLeft, 10);
|
|
81
|
+
var scrollLeft = parseInt("".concat((_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.scrollLeft), 10);
|
|
78
82
|
// scrollable width
|
|
79
|
-
var scrollWidth = scrollRef.current.scrollWidth;
|
|
83
|
+
var scrollWidth = (_scrollRef$current3 = scrollRef.current) === null || _scrollRef$current3 === void 0 ? void 0 : _scrollRef$current3.scrollWidth;
|
|
80
84
|
|
|
81
85
|
// The maximum scrollLeft achievable is the scrollable width - the viewport width.
|
|
82
86
|
var scrollLeftMax = scrollWidth - clientWidth;
|
|
83
87
|
// if isNaN(scrollLeft / scrollLeftMax), then set to zero
|
|
84
88
|
var scrollPercent = parseFloat((scrollLeft / scrollLeftMax).toFixed(2)) || 0;
|
|
85
|
-
if (!scrollRef.current) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
89
|
|
|
89
90
|
// Callback 1: Does the carousel have enough content to enable scrolling?
|
|
90
91
|
onChangeIsScrollable(scrollWidth > clientWidth);
|
|
@@ -104,7 +105,8 @@ var Carousel = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
104
105
|
|
|
105
106
|
// Get all elements that are visible in the container.
|
|
106
107
|
var getElementsInView = React.useCallback(function () {
|
|
107
|
-
var
|
|
108
|
+
var _scrollRef$current4;
|
|
109
|
+
var containerRect = scrollRef === null || scrollRef === void 0 || (_scrollRef$current4 = scrollRef.current) === null || _scrollRef$current4 === void 0 ? void 0 : _scrollRef$current4.getBoundingClientRect();
|
|
108
110
|
var inViewElements = childElementsRef.current.filter(function (el) {
|
|
109
111
|
return getElementInView(containerRect, el.getBoundingClientRect());
|
|
110
112
|
});
|
|
@@ -113,8 +115,9 @@ var Carousel = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
113
115
|
|
|
114
116
|
// Return container's and children's rect data
|
|
115
117
|
var getContainerAndChildRectData = React.useCallback(function () {
|
|
118
|
+
var _scrollRef$current5;
|
|
116
119
|
// Get the rect of the container
|
|
117
|
-
var containerRect = scrollRef.current.getBoundingClientRect();
|
|
120
|
+
var containerRect = scrollRef === null || scrollRef === void 0 || (_scrollRef$current5 = scrollRef.current) === null || _scrollRef$current5 === void 0 ? void 0 : _scrollRef$current5.getBoundingClientRect();
|
|
118
121
|
// Get all child elements that are in view of the container, and return their bounding rects.
|
|
119
122
|
var elementRectsInView = getElementsInView().map(function (el) {
|
|
120
123
|
return el.getBoundingClientRect();
|
|
@@ -132,27 +135,37 @@ var Carousel = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
132
135
|
};
|
|
133
136
|
}, [getElementsInView]);
|
|
134
137
|
var handleScrollNext = React.useCallback(function () {
|
|
138
|
+
if (!scrollRef.current) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
135
141
|
var _getContainerAndChild = getContainerAndChildRectData(),
|
|
136
142
|
containerRect = _getContainerAndChild.containerRect,
|
|
137
143
|
visibleWidth = _getContainerAndChild.visibleWidth;
|
|
138
144
|
// Set the scrollValue to the visibleWidth, but if the visibleWidth value is 0, set it to the container's width
|
|
139
|
-
var scrollValue = visibleWidth > 0 ? visibleWidth : containerRect.width;
|
|
145
|
+
var scrollValue = visibleWidth > 0 ? visibleWidth : containerRect === null || containerRect === void 0 ? void 0 : containerRect.width;
|
|
140
146
|
// Increment the scrollLeft of the container
|
|
141
147
|
scrollRef.current.scrollLeft += scrollValue;
|
|
142
148
|
}, [getContainerAndChildRectData]);
|
|
143
149
|
var handleScrollPrev = React.useCallback(function () {
|
|
150
|
+
var _containerRect$width, _containerRect$left;
|
|
151
|
+
if (!scrollRef.current) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
144
154
|
var _getContainerAndChild2 = getContainerAndChildRectData(),
|
|
145
155
|
containerRect = _getContainerAndChild2.containerRect,
|
|
146
156
|
elementRectsInView = _getContainerAndChild2.elementRectsInView,
|
|
147
157
|
visibleWidth = _getContainerAndChild2.visibleWidth;
|
|
148
158
|
// Set the scrollValue to the visibleWidth minus the first child's left value,
|
|
149
159
|
// but if the visibleWidth value is 0, set it to the container's width plus the container's left value
|
|
150
|
-
var scrollValue = visibleWidth > 0 ? visibleWidth - elementRectsInView[0].left : containerRect.width + containerRect.left;
|
|
160
|
+
var scrollValue = visibleWidth > 0 ? visibleWidth - elementRectsInView[0].left : ((_containerRect$width = containerRect === null || containerRect === void 0 ? void 0 : containerRect.width) !== null && _containerRect$width !== void 0 ? _containerRect$width : 0) + ((_containerRect$left = containerRect === null || containerRect === void 0 ? void 0 : containerRect.left) !== null && _containerRect$left !== void 0 ? _containerRect$left : 0);
|
|
151
161
|
|
|
152
162
|
// Decrement the scrollLeft of the container
|
|
153
163
|
scrollRef.current.scrollLeft -= scrollValue;
|
|
154
164
|
}, [getContainerAndChildRectData]);
|
|
155
165
|
var handleScrollReset = React.useCallback(function () {
|
|
166
|
+
if (!scrollRef.current) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
156
169
|
// This doesn't trigger "scrollend"...
|
|
157
170
|
scrollRef.current.scrollLeft = 0;
|
|
158
171
|
// ...so trigger a callback manually.
|
|
@@ -179,6 +192,9 @@ var Carousel = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
179
192
|
// On window.resize, reset carousel to zero.
|
|
180
193
|
React.useEffect(function () {
|
|
181
194
|
var handleWindowResize = function handleWindowResize() {
|
|
195
|
+
if (!scrollRef.current) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
182
198
|
scrollRef.current.scrollLeft = 0;
|
|
183
199
|
handleOnScroll();
|
|
184
200
|
};
|
|
@@ -194,9 +210,9 @@ var Carousel = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
194
210
|
handleOnScroll();
|
|
195
211
|
};
|
|
196
212
|
var scrollDiv = scrollRef.current;
|
|
197
|
-
scrollDiv.addEventListener('scrollend', handleScrollend);
|
|
213
|
+
scrollDiv === null || scrollDiv === void 0 || scrollDiv.addEventListener('scrollend', handleScrollend);
|
|
198
214
|
return function () {
|
|
199
|
-
return scrollDiv.removeEventListener('scrollend', handleScrollend);
|
|
215
|
+
return scrollDiv === null || scrollDiv === void 0 ? void 0 : scrollDiv.removeEventListener('scrollend', handleScrollend);
|
|
200
216
|
};
|
|
201
217
|
}, [handleOnScroll]);
|
|
202
218
|
|
|
@@ -216,9 +232,7 @@ var Carousel = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
216
232
|
passive: false
|
|
217
233
|
});
|
|
218
234
|
return function () {
|
|
219
|
-
scrollDiv.removeEventListener('wheel', handleWheel
|
|
220
|
-
passive: false
|
|
221
|
-
});
|
|
235
|
+
scrollDiv.removeEventListener('wheel', handleWheel);
|
|
222
236
|
};
|
|
223
237
|
}
|
|
224
238
|
}, []);
|
|
@@ -314,6 +328,7 @@ Carousel.propTypes = {
|
|
|
314
328
|
*
|
|
315
329
|
* Or pass an object (`{ left: $color1, right: $color2 }`) to specify different colors.
|
|
316
330
|
*/
|
|
331
|
+
/**@ts-ignore*/
|
|
317
332
|
fadedEdgeColor: index["default"].oneOfType([index["default"].string, index["default"].shape({
|
|
318
333
|
left: index["default"].string,
|
|
319
334
|
right: index["default"].string
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2023, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
8
|
+
interface CarouselItemProps {
|
|
9
|
+
/**
|
|
10
|
+
* Provide the contents of the CarouselItem.
|
|
11
|
+
*/
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Provide an optional class to be applied to the containing node.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
1
18
|
/**
|
|
2
19
|
* TODO: A description of the component.
|
|
3
20
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
21
|
+
declare const CarouselItem: React.ForwardRefExoticComponent<CarouselItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export { CarouselItem };
|
|
@@ -22,7 +22,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
22
22
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
23
23
|
|
|
24
24
|
var _excluded = ["children", "className"];
|
|
25
|
-
|
|
26
25
|
// Carbon and package components we use.
|
|
27
26
|
/* TODO: @import(s) of carbon components and other package components. */
|
|
28
27
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default ConditionBlock;
|
|
2
|
+
/**
|
|
3
|
+
* This component build each block of condition consisting of property, operator value and close button.
|
|
4
|
+
*/
|
|
5
|
+
declare function ConditionBlock(props: any): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare namespace ConditionBlock {
|
|
7
|
+
namespace propTypes {
|
|
8
|
+
let addConditionHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
|
+
let aria: PropTypes.Requireable<object>;
|
|
10
|
+
let conditionIndex: PropTypes.Requireable<number>;
|
|
11
|
+
let conjunction: PropTypes.Requireable<string>;
|
|
12
|
+
let group: PropTypes.Requireable<object>;
|
|
13
|
+
let isStatement: PropTypes.Requireable<boolean>;
|
|
14
|
+
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
+
let onConnectorOperatorChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
+
let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
let onStatementChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
let state: PropTypes.Requireable<object>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var React = require('react');
|
|
14
|
+
var icons = require('@carbon/react/icons');
|
|
15
|
+
var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
|
|
16
|
+
var index = require('../../../node_modules/prop-types/index.js');
|
|
17
|
+
var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
|
|
18
|
+
var ConditionBuilderItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js');
|
|
19
|
+
var cx = require('classnames');
|
|
20
|
+
var ConditionConnector = require('../ConditionConnector/ConditionConnector.js');
|
|
21
|
+
var ConditionBuilderItemNumber = require('../ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js');
|
|
22
|
+
var ConditionBuilderItemText = require('../ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js');
|
|
23
|
+
var ConditionBuilderItemDate = require('../ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js');
|
|
24
|
+
var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
|
|
25
|
+
var ConditionBuilderButton = require('../ConditionBuilderButton/ConditionBuilderButton.js');
|
|
26
|
+
var util = require('../utils/util.js');
|
|
27
|
+
var ConditionBuilderItemTime = require('../ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js');
|
|
28
|
+
var ConditionBuilderAdd = require('../ConditionBuilderAdd/ConditionBuilderAdd.js');
|
|
29
|
+
|
|
30
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
31
|
+
|
|
32
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* This component build each block of condition consisting of property, operator value and close button.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
var ConditionBlock = function ConditionBlock(props) {
|
|
40
|
+
var _props$state = props.state,
|
|
41
|
+
property = _props$state.property,
|
|
42
|
+
value = _props$state.value,
|
|
43
|
+
operator = _props$state.operator;
|
|
44
|
+
var onRemove = props.onRemove,
|
|
45
|
+
onChange = props.onChange,
|
|
46
|
+
state = props.state,
|
|
47
|
+
conjunction = props.conjunction,
|
|
48
|
+
onConnectorOperatorChange = props.onConnectorOperatorChange,
|
|
49
|
+
isStatement = props.isStatement,
|
|
50
|
+
group = props.group,
|
|
51
|
+
onStatementChange = props.onStatementChange,
|
|
52
|
+
addConditionHandler = props.addConditionHandler,
|
|
53
|
+
conditionIndex = props.conditionIndex;
|
|
54
|
+
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
|
55
|
+
inputConfig = _useContext.inputConfig;
|
|
56
|
+
var itemComponents = {
|
|
57
|
+
option: ConditionBuilderItemOption.ConditionBuilderItemOption,
|
|
58
|
+
text: ConditionBuilderItemText.ConditionBuilderItemText,
|
|
59
|
+
number: ConditionBuilderItemNumber.ConditionBuilderItemNumber,
|
|
60
|
+
date: ConditionBuilderItemDate.ConditionBuilderItemDate,
|
|
61
|
+
time: ConditionBuilderItemTime.ConditionBuilderItemTime
|
|
62
|
+
};
|
|
63
|
+
var _useState = React.useState(false),
|
|
64
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
65
|
+
showDeletionPreview = _useState2[0],
|
|
66
|
+
setShowDeletionPreview = _useState2[1];
|
|
67
|
+
|
|
68
|
+
//filtering the current property to access its properties and config options
|
|
69
|
+
var getCurrentConfig = function getCurrentConfig(property) {
|
|
70
|
+
var _inputConfig$properti, _inputConfig$properti2;
|
|
71
|
+
return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.filter(function (eachProperty) {
|
|
72
|
+
var _eachProperty$label;
|
|
73
|
+
return ((_eachProperty$label = eachProperty.label) === null || _eachProperty$label === void 0 ? void 0 : _eachProperty$label.toUpperCase()) == (property === null || property === void 0 ? void 0 : property.toUpperCase());
|
|
74
|
+
})[0]) !== null && _inputConfig$properti !== void 0 ? _inputConfig$properti : {};
|
|
75
|
+
};
|
|
76
|
+
var isLastCondition = function isLastCondition(conditionIndex, conditionArr) {
|
|
77
|
+
return conditionIndex + 1 >= conditionArr.length || conditionArr.length - 1 != conditionIndex && conditionArr[conditionIndex + 1].conditions;
|
|
78
|
+
};
|
|
79
|
+
var _getCurrentConfig = getCurrentConfig(property),
|
|
80
|
+
icon = _getCurrentConfig.icon,
|
|
81
|
+
type = _getCurrentConfig.type,
|
|
82
|
+
config = _getCurrentConfig.config,
|
|
83
|
+
label = _getCurrentConfig.label;
|
|
84
|
+
var ItemComponent = property ? itemComponents[type] : null;
|
|
85
|
+
var onStatementChangeHandler = function onStatementChangeHandler(v, e) {
|
|
86
|
+
util.focusThisField(e);
|
|
87
|
+
onStatementChange(v);
|
|
88
|
+
};
|
|
89
|
+
var onConnectorOperatorChangeHandler = function onConnectorOperatorChangeHandler(op) {
|
|
90
|
+
onConnectorOperatorChange(op);
|
|
91
|
+
};
|
|
92
|
+
var onPropertyChangeHandler = function onPropertyChangeHandler(newProperty) {
|
|
93
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
94
|
+
property: newProperty,
|
|
95
|
+
operator: undefined,
|
|
96
|
+
value: '',
|
|
97
|
+
popoverToOpen: 'operatorField'
|
|
98
|
+
}));
|
|
99
|
+
};
|
|
100
|
+
var onOperatorChangeHandler = function onOperatorChangeHandler(newOperator) {
|
|
101
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
102
|
+
operator: newOperator,
|
|
103
|
+
value: undefined,
|
|
104
|
+
popoverToOpen: 'valueField'
|
|
105
|
+
}));
|
|
106
|
+
};
|
|
107
|
+
var onValueChangeHandler = function onValueChangeHandler(newValue) {
|
|
108
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
109
|
+
value: newValue,
|
|
110
|
+
popoverToOpen: ''
|
|
111
|
+
}));
|
|
112
|
+
};
|
|
113
|
+
var handleShowDeletionPreview = function handleShowDeletionPreview() {
|
|
114
|
+
setShowDeletionPreview(true);
|
|
115
|
+
};
|
|
116
|
+
var handleHideDeletionPreview = function handleHideDeletionPreview() {
|
|
117
|
+
setShowDeletionPreview(false);
|
|
118
|
+
};
|
|
119
|
+
var getOperators = function getOperators() {
|
|
120
|
+
return DataConfigs.operatorConfig.filter(function (operator) {
|
|
121
|
+
return operator.type.indexOf(type) != -1 || operator.type == 'all';
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
125
|
+
className: cx__default["default"]("".concat(DataConfigs.blockClass, "__condition-block conditionBlockWrapper ").concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-bottom"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__condition-builder-condition__deletion-preview"), showDeletionPreview)),
|
|
126
|
+
key: conditionIndex,
|
|
127
|
+
role: "row",
|
|
128
|
+
"aria-label": DataConfigs.translateWithId('condition_row'),
|
|
129
|
+
tabIndex: -1
|
|
130
|
+
}, isStatement && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem
|
|
131
|
+
// open={false}
|
|
132
|
+
, {
|
|
133
|
+
label: group.statement,
|
|
134
|
+
title: DataConfigs.translateWithId('condition'),
|
|
135
|
+
"data-name": "connectorField",
|
|
136
|
+
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
|
137
|
+
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
|
138
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
|
|
139
|
+
conditionState: {
|
|
140
|
+
value: group.statement,
|
|
141
|
+
label: DataConfigs.translateWithId('condition')
|
|
142
|
+
},
|
|
143
|
+
onChange: onStatementChangeHandler,
|
|
144
|
+
config: {
|
|
145
|
+
options: DataConfigs.statementConfig
|
|
146
|
+
}
|
|
147
|
+
})), conjunction && /*#__PURE__*/React__default["default"].createElement(ConditionConnector["default"], {
|
|
148
|
+
className: "".concat(DataConfigs.blockClass, "__gap"),
|
|
149
|
+
operator: conjunction,
|
|
150
|
+
onChange: onConnectorOperatorChangeHandler
|
|
151
|
+
}), /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
|
152
|
+
label: label,
|
|
153
|
+
title: DataConfigs.translateWithId('property'),
|
|
154
|
+
renderIcon: icon !== null && icon !== void 0 ? icon : null,
|
|
155
|
+
className: "".concat(DataConfigs.blockClass, "__property-field"),
|
|
156
|
+
"data-name": "propertyField",
|
|
157
|
+
state: state,
|
|
158
|
+
type: type
|
|
159
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
|
|
160
|
+
conditionState: {
|
|
161
|
+
value: property,
|
|
162
|
+
label: DataConfigs.translateWithId('property')
|
|
163
|
+
},
|
|
164
|
+
onChange: onPropertyChangeHandler,
|
|
165
|
+
config: {
|
|
166
|
+
options: inputConfig.properties
|
|
167
|
+
}
|
|
168
|
+
})), property && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
|
169
|
+
label: operator,
|
|
170
|
+
title: DataConfigs.translateWithId('operator'),
|
|
171
|
+
"data-name": "operatorField",
|
|
172
|
+
state: state,
|
|
173
|
+
type: type
|
|
174
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
|
|
175
|
+
config: {
|
|
176
|
+
options: getOperators()
|
|
177
|
+
},
|
|
178
|
+
conditionState: {
|
|
179
|
+
value: operator,
|
|
180
|
+
label: DataConfigs.translateWithId('operator')
|
|
181
|
+
},
|
|
182
|
+
onChange: onOperatorChangeHandler
|
|
183
|
+
})), property && operator && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
|
184
|
+
label: value,
|
|
185
|
+
type: type,
|
|
186
|
+
title: label,
|
|
187
|
+
showToolTip: true,
|
|
188
|
+
"data-name": "valueField",
|
|
189
|
+
state: state,
|
|
190
|
+
config: config
|
|
191
|
+
}, /*#__PURE__*/React__default["default"].createElement(ItemComponent, {
|
|
192
|
+
conditionState: {
|
|
193
|
+
property: property,
|
|
194
|
+
operator: operator,
|
|
195
|
+
value: value
|
|
196
|
+
},
|
|
197
|
+
onChange: onValueChangeHandler,
|
|
198
|
+
config: config
|
|
199
|
+
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
200
|
+
role: "gridcell",
|
|
201
|
+
"aria-label": DataConfigs.translateWithId('remove_condition')
|
|
202
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
|
203
|
+
hideLabel: true,
|
|
204
|
+
label: DataConfigs.translateWithId('remove_condition'),
|
|
205
|
+
onClick: onRemove,
|
|
206
|
+
onMouseEnter: handleShowDeletionPreview,
|
|
207
|
+
onMouseLeave: handleHideDeletionPreview,
|
|
208
|
+
onFocus: handleShowDeletionPreview,
|
|
209
|
+
onBlur: handleHideDeletionPreview,
|
|
210
|
+
renderIcon: icons.Close,
|
|
211
|
+
className: "".concat(DataConfigs.blockClass, "__close-condition"),
|
|
212
|
+
"data-name": "closeCondition"
|
|
213
|
+
})), isLastCondition(conditionIndex, group.conditions) && /*#__PURE__*/React__default["default"].createElement(ConditionBuilderAdd["default"], {
|
|
214
|
+
onClick: function onClick() {
|
|
215
|
+
addConditionHandler(conditionIndex);
|
|
216
|
+
}
|
|
217
|
+
//addConditionSubGroupHandler={()=>{addConditionSubGroupHandler(conditionIndex)}}
|
|
218
|
+
,
|
|
219
|
+
className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__gap-left")
|
|
220
|
+
}));
|
|
221
|
+
};
|
|
222
|
+
var ConditionBlock$1 = ConditionBlock;
|
|
223
|
+
ConditionBlock.propTypes = {
|
|
224
|
+
/**
|
|
225
|
+
* callback to add a new condition
|
|
226
|
+
*/
|
|
227
|
+
addConditionHandler: index["default"].func,
|
|
228
|
+
/**
|
|
229
|
+
* object hold aria attributes
|
|
230
|
+
*/
|
|
231
|
+
aria: index["default"].object,
|
|
232
|
+
/**
|
|
233
|
+
* index of the current condition
|
|
234
|
+
*/
|
|
235
|
+
conditionIndex: index["default"].number,
|
|
236
|
+
/**
|
|
237
|
+
* string that decides to show the condition connector
|
|
238
|
+
*/
|
|
239
|
+
conjunction: index["default"].string,
|
|
240
|
+
/**
|
|
241
|
+
* object that hold the current group object where is condition is part of
|
|
242
|
+
*/
|
|
243
|
+
group: index["default"].object,
|
|
244
|
+
/**
|
|
245
|
+
* boolean that decides to show the statement(if/ excl.if)
|
|
246
|
+
*/
|
|
247
|
+
isStatement: index["default"].bool,
|
|
248
|
+
/**
|
|
249
|
+
* callback to update the current condition of the state tree
|
|
250
|
+
*/
|
|
251
|
+
onChange: index["default"].func,
|
|
252
|
+
/**
|
|
253
|
+
* callback to handle the connector(and/or) change
|
|
254
|
+
*/
|
|
255
|
+
onConnectorOperatorChange: index["default"].func,
|
|
256
|
+
/**
|
|
257
|
+
* callback for Remove a condition
|
|
258
|
+
*/
|
|
259
|
+
onRemove: index["default"].func,
|
|
260
|
+
/**
|
|
261
|
+
* callback to handle the statement(if/ excl.if) change
|
|
262
|
+
*/
|
|
263
|
+
onStatementChange: index["default"].func,
|
|
264
|
+
/**
|
|
265
|
+
* object that hold the current condition
|
|
266
|
+
*/
|
|
267
|
+
state: index["default"].object
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
exports["default"] = ConditionBlock$1;
|