@carbon/ibm-products 2.37.0 → 2.38.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-without-carbon-released-only.css +218 -0
- 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.css +218 -0
- 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/ActionSet/ActionSet.js +3 -2
- package/es/components/Checklist/Checklist.js +10 -10
- package/es/components/Checklist/ChecklistChart.d.ts +1 -1
- package/es/components/Checklist/ChecklistChart.js +6 -30
- package/es/components/Coachmark/Coachmark.d.ts +65 -2
- package/es/components/Coachmark/Coachmark.js +7 -10
- package/es/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
- package/es/components/Coachmark/CoachmarkDragbar.js +3 -1
- package/es/components/Coachmark/CoachmarkHeader.d.ts +27 -2
- package/es/components/Coachmark/CoachmarkHeader.js +0 -1
- package/es/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
- package/es/components/Coachmark/CoachmarkOverlay.js +18 -15
- package/es/components/Coachmark/CoachmarkTagline.d.ts +27 -2
- package/es/components/Coachmark/CoachmarkTagline.js +0 -1
- package/es/components/Coachmark/utils/enums.d.ts +20 -20
- package/es/components/Coachmark/utils/enums.js +22 -20
- package/es/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +14 -24
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +14 -8
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -2
- package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridContent.d.ts +1 -0
- package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -0
- package/es/components/Datagrid/useSkeletonRows.d.ts +1 -1
- package/es/components/Datagrid/useSkeletonRows.js +11 -3
- package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
- package/es/components/SearchBar/SearchBar.d.ts +10 -1
- package/es/components/SearchBar/SearchBar.js +26 -20
- package/es/components/TagSet/TagSet.d.ts +87 -3
- package/es/components/TagSet/TagSet.js +20 -9
- package/es/components/TagSet/TagSetModal.d.ts +32 -26
- package/es/components/TagSet/TagSetModal.js +5 -5
- package/es/components/TagSet/TagSetOverflow.d.ts +45 -2
- package/es/components/TagSet/TagSetOverflow.js +14 -12
- package/es/components/WebTerminal/WebTerminal.js +2 -2
- package/es/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
- package/es/components/WebTerminal/hooks/index.d.ts +16 -11
- package/es/components/WebTerminal/hooks/index.js +1 -1
- package/es/global/js/package-settings.d.ts +1 -1
- package/es/global/js/package-settings.js +1 -1
- package/es/node_modules/@carbon/colors/es/index.js +4 -1
- package/es/settings.d.ts +1 -1
- package/lib/components/ActionSet/ActionSet.js +2 -1
- package/lib/components/Checklist/Checklist.js +10 -10
- package/lib/components/Checklist/ChecklistChart.d.ts +1 -1
- package/lib/components/Checklist/ChecklistChart.js +6 -30
- package/lib/components/Coachmark/Coachmark.d.ts +65 -2
- package/lib/components/Coachmark/Coachmark.js +6 -9
- package/lib/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
- package/lib/components/Coachmark/CoachmarkDragbar.js +3 -1
- package/lib/components/Coachmark/CoachmarkHeader.d.ts +27 -2
- package/lib/components/Coachmark/CoachmarkHeader.js +0 -1
- package/lib/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
- package/lib/components/Coachmark/CoachmarkOverlay.js +18 -15
- package/lib/components/Coachmark/CoachmarkTagline.d.ts +27 -2
- package/lib/components/Coachmark/CoachmarkTagline.js +0 -1
- package/lib/components/Coachmark/utils/enums.d.ts +20 -20
- package/lib/components/Coachmark/utils/enums.js +22 -20
- package/lib/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +13 -23
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +13 -7
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -2
- package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +1 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -0
- package/lib/components/Datagrid/useSkeletonRows.d.ts +1 -1
- package/lib/components/Datagrid/useSkeletonRows.js +11 -3
- package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
- package/lib/components/SearchBar/SearchBar.d.ts +10 -1
- package/lib/components/SearchBar/SearchBar.js +26 -18
- package/lib/components/TagSet/TagSet.d.ts +87 -3
- package/lib/components/TagSet/TagSet.js +20 -9
- package/lib/components/TagSet/TagSetModal.d.ts +32 -26
- package/lib/components/TagSet/TagSetModal.js +3 -3
- package/lib/components/TagSet/TagSetOverflow.d.ts +45 -2
- package/lib/components/TagSet/TagSetOverflow.js +14 -12
- package/lib/components/WebTerminal/WebTerminal.js +2 -2
- package/lib/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
- package/lib/components/WebTerminal/hooks/index.d.ts +16 -11
- package/lib/components/WebTerminal/hooks/index.js +1 -1
- package/lib/global/js/package-settings.d.ts +1 -1
- package/lib/global/js/package-settings.js +1 -1
- package/lib/node_modules/@carbon/colors/es/index.js +6 -0
- package/lib/settings.d.ts +1 -1
- package/package.json +5 -3
- package/scss/components/Checklist/_carbon-imports.scss +2 -2
- package/scss/components/_index-released-only-with-carbon.scss +2 -1
- package/scss/components/_index-released-only.scss +2 -1
- package/scss/components/_index-with-carbon.scss +1 -0
- package/telemetry.yml +936 -683
@@ -1,6 +1,46 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import React, { ReactNode } from 'react';
|
8
|
+
import { COACHMARK_OVERLAY_KIND } from './utils/enums';
|
9
|
+
interface CoachmarkOverlayProps {
|
10
|
+
/**
|
11
|
+
* The CoachmarkOverlayElements child components.
|
12
|
+
* Validation is handled in the parent Coachmark component.
|
13
|
+
*/
|
14
|
+
children: ReactNode;
|
15
|
+
/**
|
16
|
+
* Optional class name for this component.
|
17
|
+
*/
|
18
|
+
className?: string;
|
19
|
+
/**
|
20
|
+
* The visibility of CoachmarkOverlay is
|
21
|
+
* managed in the parent Coachmark component.
|
22
|
+
*/
|
23
|
+
fixedIsVisible: boolean;
|
24
|
+
/**
|
25
|
+
* What kind or style of Coachmark to render.
|
26
|
+
*/
|
27
|
+
kind?: COACHMARK_OVERLAY_KIND;
|
28
|
+
/**
|
29
|
+
* Function to call when the Coachmark closes.
|
30
|
+
*/
|
31
|
+
onClose: () => void;
|
32
|
+
/**
|
33
|
+
* Determines the theme of the component.
|
34
|
+
*/
|
35
|
+
theme?: 'light' | 'dark';
|
36
|
+
/**
|
37
|
+
* Additional props passed to the component.
|
38
|
+
*/
|
39
|
+
[key: string]: any;
|
40
|
+
}
|
1
41
|
/**
|
2
42
|
* DO NOT USE. This component is for the exclusive use
|
3
43
|
* of other Novice to Pro components.
|
4
44
|
*/
|
5
|
-
export let CoachmarkOverlay: React.ForwardRefExoticComponent<React.RefAttributes<
|
6
|
-
|
45
|
+
export declare let CoachmarkOverlay: React.ForwardRefExoticComponent<Omit<CoachmarkOverlayProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
46
|
+
export {};
|
@@ -39,7 +39,6 @@ var defaults = {
|
|
39
39
|
kind: enums.COACHMARK_OVERLAY_KIND.FLOATING,
|
40
40
|
theme: 'light'
|
41
41
|
};
|
42
|
-
|
43
42
|
/**
|
44
43
|
* DO NOT USE. This component is for the exclusive use
|
45
44
|
* of other Novice to Pro components.
|
@@ -61,7 +60,7 @@ exports.CoachmarkOverlay = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
61
60
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
62
61
|
a11yDragMode = _useState2[0],
|
63
62
|
setA11yDragMode = _useState2[1];
|
64
|
-
var overlayRef = React.useRef();
|
63
|
+
var overlayRef = React.useRef(null);
|
65
64
|
var coachmark = context.useCoachmark();
|
66
65
|
var isBeacon = kind === enums.COACHMARK_OVERLAY_KIND.TOOLTIP;
|
67
66
|
var isDraggable = kind === enums.COACHMARK_OVERLAY_KIND.FLOATING;
|
@@ -94,20 +93,21 @@ exports.CoachmarkOverlay = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
94
93
|
var styledTune = {};
|
95
94
|
if (isBeacon || isDraggable) {
|
96
95
|
if (coachmark.targetRect) {
|
97
|
-
styledTune =
|
98
|
-
|
99
|
-
top: coachmark.targetRect.y + window.scrollY
|
100
|
-
};
|
96
|
+
styledTune.left = coachmark.targetRect.x + window.scrollX;
|
97
|
+
styledTune.top = coachmark.targetRect.y + window.scrollY;
|
101
98
|
}
|
102
|
-
if (
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
99
|
+
if (styledTune.left && styledTune.top) {
|
100
|
+
if (isBeacon) {
|
101
|
+
// Compensate for radius of beacon
|
102
|
+
styledTune.left += 16;
|
103
|
+
styledTune.top += 16;
|
104
|
+
}
|
105
|
+
if (isDraggable) {
|
106
|
+
// Compensate for width and height of target element
|
107
|
+
var offsetTune = constants.getOffsetTune(coachmark, kind);
|
108
|
+
styledTune.left += offsetTune.left;
|
109
|
+
styledTune.top += offsetTune.top;
|
110
|
+
}
|
111
111
|
}
|
112
112
|
}
|
113
113
|
function handleDragBounds(x, y) {
|
@@ -132,6 +132,9 @@ exports.CoachmarkOverlay = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
132
132
|
}
|
133
133
|
function handleDrag(movementX, movementY) {
|
134
134
|
var overlay = overlayRef.current;
|
135
|
+
if (!overlay) {
|
136
|
+
return;
|
137
|
+
}
|
135
138
|
var _overlay$getBoundingC = overlay.getBoundingClientRect(),
|
136
139
|
x = _overlay$getBoundingC.x,
|
137
140
|
y = _overlay$getBoundingC.y;
|
@@ -1,6 +1,31 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import React from 'react';
|
8
|
+
interface CoachmarkTaglineProps {
|
9
|
+
/**
|
10
|
+
* Tooltip text and aria label for the Close button icon.
|
11
|
+
*/
|
12
|
+
closeIconDescription?: string;
|
13
|
+
/**
|
14
|
+
* Function to call when the close button is clicked.
|
15
|
+
*/
|
16
|
+
onClose?: () => void;
|
17
|
+
/**
|
18
|
+
* Determines the theme of the component.
|
19
|
+
*/
|
20
|
+
theme?: 'light' | 'dark';
|
21
|
+
/**
|
22
|
+
* The title of the tagline.
|
23
|
+
*/
|
24
|
+
title: string;
|
25
|
+
}
|
1
26
|
/**
|
2
27
|
* DO NOT USE. This component is for the exclusive use
|
3
28
|
* of other Novice to Pro components.
|
4
29
|
*/
|
5
|
-
export let CoachmarkTagline: React.ForwardRefExoticComponent<React.RefAttributes<
|
6
|
-
|
30
|
+
export declare let CoachmarkTagline: React.ForwardRefExoticComponent<CoachmarkTaglineProps & React.RefAttributes<HTMLDivElement>>;
|
31
|
+
export {};
|
@@ -11,27 +11,27 @@ export declare enum BEACON_KIND {
|
|
11
11
|
* @param FIXED is fixed to the bottom-right of the viewport.
|
12
12
|
* @param STACKED is fixed to the bottom-right of the viewport, includes links to show more, stackable Coachmarks if included.
|
13
13
|
*/
|
14
|
-
export declare
|
15
|
-
TOOLTIP
|
16
|
-
FLOATING
|
17
|
-
FIXED
|
18
|
-
STACKED
|
19
|
-
}
|
14
|
+
export declare enum COACHMARK_OVERLAY_KIND {
|
15
|
+
TOOLTIP = "tooltip",
|
16
|
+
FLOATING = "floating",
|
17
|
+
FIXED = "fixed",
|
18
|
+
STACKED = "stacked"
|
19
|
+
}
|
20
20
|
/**
|
21
21
|
* Where to render the Coachmark relative to its target.
|
22
22
|
* Applies only to Floating and Tooltip Coachmarks.
|
23
23
|
*/
|
24
|
-
export declare
|
25
|
-
BOTTOM
|
26
|
-
BOTTOM_LEFT
|
27
|
-
BOTTOM_RIGHT
|
28
|
-
LEFT
|
29
|
-
LEFT_TOP
|
30
|
-
LEFT_BOTTOM
|
31
|
-
RIGHT
|
32
|
-
RIGHT_TOP
|
33
|
-
RIGHT_BOTTOM
|
34
|
-
TOP
|
35
|
-
TOP_LEFT
|
36
|
-
TOP_RIGHT
|
37
|
-
}
|
24
|
+
export declare enum COACHMARK_ALIGNMENT {
|
25
|
+
BOTTOM = "bottom",
|
26
|
+
BOTTOM_LEFT = "bottom-left",
|
27
|
+
BOTTOM_RIGHT = "bottom-right",
|
28
|
+
LEFT = "left",
|
29
|
+
LEFT_TOP = "left-top",
|
30
|
+
LEFT_BOTTOM = "left-bottom",
|
31
|
+
RIGHT = "right",
|
32
|
+
RIGHT_TOP = "right-top",
|
33
|
+
RIGHT_BOTTOM = "right-bottom",
|
34
|
+
TOP = "top",
|
35
|
+
TOP_LEFT = "top-left",
|
36
|
+
TOP_RIGHT = "top-right"
|
37
|
+
}
|
@@ -18,30 +18,32 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
18
18
|
* @param FIXED is fixed to the bottom-right of the viewport.
|
19
19
|
* @param STACKED is fixed to the bottom-right of the viewport, includes links to show more, stackable Coachmarks if included.
|
20
20
|
*/
|
21
|
-
var COACHMARK_OVERLAY_KIND = {
|
22
|
-
TOOLTIP
|
23
|
-
FLOATING
|
24
|
-
FIXED
|
25
|
-
STACKED
|
26
|
-
|
21
|
+
var COACHMARK_OVERLAY_KIND = /*#__PURE__*/function (COACHMARK_OVERLAY_KIND) {
|
22
|
+
COACHMARK_OVERLAY_KIND["TOOLTIP"] = "tooltip";
|
23
|
+
COACHMARK_OVERLAY_KIND["FLOATING"] = "floating";
|
24
|
+
COACHMARK_OVERLAY_KIND["FIXED"] = "fixed";
|
25
|
+
COACHMARK_OVERLAY_KIND["STACKED"] = "stacked";
|
26
|
+
return COACHMARK_OVERLAY_KIND;
|
27
|
+
}({});
|
27
28
|
/**
|
28
29
|
* Where to render the Coachmark relative to its target.
|
29
30
|
* Applies only to Floating and Tooltip Coachmarks.
|
30
31
|
*/
|
31
|
-
var COACHMARK_ALIGNMENT = {
|
32
|
-
BOTTOM
|
33
|
-
BOTTOM_LEFT
|
34
|
-
BOTTOM_RIGHT
|
35
|
-
LEFT
|
36
|
-
LEFT_TOP
|
37
|
-
LEFT_BOTTOM
|
38
|
-
RIGHT
|
39
|
-
RIGHT_TOP
|
40
|
-
RIGHT_BOTTOM
|
41
|
-
TOP
|
42
|
-
TOP_LEFT
|
43
|
-
TOP_RIGHT
|
44
|
-
|
32
|
+
var COACHMARK_ALIGNMENT = /*#__PURE__*/function (COACHMARK_ALIGNMENT) {
|
33
|
+
COACHMARK_ALIGNMENT["BOTTOM"] = "bottom";
|
34
|
+
COACHMARK_ALIGNMENT["BOTTOM_LEFT"] = "bottom-left";
|
35
|
+
COACHMARK_ALIGNMENT["BOTTOM_RIGHT"] = "bottom-right";
|
36
|
+
COACHMARK_ALIGNMENT["LEFT"] = "left";
|
37
|
+
COACHMARK_ALIGNMENT["LEFT_TOP"] = "left-top";
|
38
|
+
COACHMARK_ALIGNMENT["LEFT_BOTTOM"] = "left-bottom";
|
39
|
+
COACHMARK_ALIGNMENT["RIGHT"] = "right";
|
40
|
+
COACHMARK_ALIGNMENT["RIGHT_TOP"] = "right-top";
|
41
|
+
COACHMARK_ALIGNMENT["RIGHT_BOTTOM"] = "right-bottom";
|
42
|
+
COACHMARK_ALIGNMENT["TOP"] = "top";
|
43
|
+
COACHMARK_ALIGNMENT["TOP_LEFT"] = "top-left";
|
44
|
+
COACHMARK_ALIGNMENT["TOP_RIGHT"] = "top-right";
|
45
|
+
return COACHMARK_ALIGNMENT;
|
46
|
+
}({});
|
45
47
|
|
46
48
|
exports.COACHMARK_ALIGNMENT = COACHMARK_ALIGNMENT;
|
47
49
|
exports.COACHMARK_OVERLAY_KIND = COACHMARK_OVERLAY_KIND;
|
@@ -1,8 +1,48 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import React, { ReactNode } from 'react';
|
8
|
+
interface CoachmarkFixedProps {
|
9
|
+
/**
|
10
|
+
* CoachmarkFixed should use a single CoachmarkOverlayElements component as a child.
|
11
|
+
*/
|
12
|
+
children: ReactNode;
|
13
|
+
/**
|
14
|
+
* Optional class name for this component.
|
15
|
+
*/
|
16
|
+
className?: string;
|
17
|
+
/**
|
18
|
+
* Function to call when the Coachmark closes.
|
19
|
+
*/
|
20
|
+
onClose?: () => void;
|
21
|
+
/**
|
22
|
+
* By default, the Coachmark will be appended to the end of `document.body`.
|
23
|
+
* The Coachmark will remain persistent as the user navigates the app until
|
24
|
+
* the user closes the Coachmark.
|
25
|
+
*
|
26
|
+
* Alternatively, the app developer can tightly couple the Coachmark to a DOM
|
27
|
+
* element or other component by specifying a CSS selector. The Coachmark will
|
28
|
+
* remain visible as long as that element remains visible or mounted. When the
|
29
|
+
* element is hidden or component is unmounted, the Coachmark will disappear.
|
30
|
+
*/
|
31
|
+
portalTarget?: string;
|
32
|
+
/**
|
33
|
+
* The tagline title which will be fixed to the bottom right of the window and will serve as the display trigger.
|
34
|
+
*/
|
35
|
+
tagline: string;
|
36
|
+
/**
|
37
|
+
* Determines the theme of the component.
|
38
|
+
*/
|
39
|
+
theme?: 'light' | 'dark';
|
40
|
+
}
|
1
41
|
/**
|
2
42
|
* Fixed coachmarks are used to call out specific functionality or concepts
|
3
43
|
* within the UI that may not be intuitive but are important for the
|
4
44
|
* user to gain understanding of the product's main value and discover new use cases.
|
5
45
|
* This variant allows the a coachmark overlay to be displayed by interacting with the tagline.
|
6
46
|
*/
|
7
|
-
export let CoachmarkFixed: React.ForwardRefExoticComponent<React.RefAttributes<
|
8
|
-
|
47
|
+
export declare let CoachmarkFixed: React.ForwardRefExoticComponent<CoachmarkFixedProps & React.RefAttributes<HTMLDivElement>>;
|
48
|
+
export {};
|
@@ -59,7 +59,7 @@ exports.CoachmarkFixed = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
59
59
|
_ref$theme = _ref.theme,
|
60
60
|
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
61
61
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
62
|
-
var overlayRef = React.useRef();
|
62
|
+
var overlayRef = React.useRef(null);
|
63
63
|
var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
|
64
64
|
var _useState = React.useState(false),
|
65
65
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
@@ -181,7 +181,9 @@ exports.CoachmarkFixed = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
181
181
|
onTransitionEnd: handleTransitionEnd,
|
182
182
|
theme: theme,
|
183
183
|
className: cx__default["default"](fixedIsVisible && "".concat(overlayBlockClass, "--is-visible"), overlayBlockClass)
|
184
|
-
}, children),
|
184
|
+
}, children),
|
185
|
+
// Default to `document.body` when `portalNode` is `null`
|
186
|
+
portalNode || document.body)));
|
185
187
|
});
|
186
188
|
|
187
189
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -7,15 +7,16 @@ declare namespace ConditionBlock {
|
|
7
7
|
namespace propTypes {
|
8
8
|
let addConditionHandler: PropTypes.Requireable<(...args: any[]) => any>;
|
9
9
|
let aria: PropTypes.Requireable<object>;
|
10
|
+
let condition: PropTypes.Requireable<object>;
|
10
11
|
let conditionIndex: PropTypes.Requireable<number>;
|
11
12
|
let conjunction: PropTypes.Requireable<string>;
|
12
13
|
let group: PropTypes.Requireable<object>;
|
14
|
+
let isLastCondition: PropTypes.Requireable<(...args: any[]) => any>;
|
13
15
|
let isStatement: PropTypes.Requireable<boolean>;
|
14
16
|
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
15
17
|
let onConnectorOperatorChange: PropTypes.Requireable<(...args: any[]) => any>;
|
16
18
|
let onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
17
19
|
let onStatementChange: PropTypes.Requireable<(...args: any[]) => any>;
|
18
|
-
let state: PropTypes.Requireable<object>;
|
19
20
|
}
|
20
21
|
}
|
21
22
|
import PropTypes from 'prop-types';
|
@@ -37,20 +37,21 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
37
37
|
*/
|
38
38
|
|
39
39
|
var ConditionBlock = function ConditionBlock(props) {
|
40
|
-
var _props$
|
41
|
-
property = _props$
|
42
|
-
value = _props$
|
43
|
-
operator = _props$
|
40
|
+
var _props$condition = props.condition,
|
41
|
+
property = _props$condition.property,
|
42
|
+
value = _props$condition.value,
|
43
|
+
operator = _props$condition.operator;
|
44
44
|
var onRemove = props.onRemove,
|
45
45
|
onChange = props.onChange,
|
46
|
-
|
46
|
+
condition = props.condition,
|
47
47
|
conjunction = props.conjunction,
|
48
48
|
onConnectorOperatorChange = props.onConnectorOperatorChange,
|
49
49
|
isStatement = props.isStatement,
|
50
50
|
group = props.group,
|
51
51
|
onStatementChange = props.onStatementChange,
|
52
52
|
addConditionHandler = props.addConditionHandler,
|
53
|
-
conditionIndex = props.conditionIndex
|
53
|
+
conditionIndex = props.conditionIndex,
|
54
|
+
isLastCondition = props.isLastCondition;
|
54
55
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
55
56
|
inputConfig = _useContext.inputConfig;
|
56
57
|
var itemComponents = {
|
@@ -69,13 +70,9 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
69
70
|
var getCurrentConfig = function getCurrentConfig(property) {
|
70
71
|
var _inputConfig$properti, _inputConfig$properti2;
|
71
72
|
return (_inputConfig$properti = (_inputConfig$properti2 = inputConfig.properties) === null || _inputConfig$properti2 === void 0 ? void 0 : _inputConfig$properti2.filter(function (eachProperty) {
|
72
|
-
|
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());
|
73
|
+
return eachProperty.id == property;
|
74
74
|
})[0]) !== null && _inputConfig$properti !== void 0 ? _inputConfig$properti : {};
|
75
75
|
};
|
76
|
-
var isLastCondition = function isLastCondition(conditionIndex, conditionArr) {
|
77
|
-
return conditionIndex + 1 >= conditionArr.length || conditionArr.length - 1 != conditionIndex && conditionArr[conditionIndex + 1].conditions;
|
78
|
-
};
|
79
76
|
var _getCurrentConfig = getCurrentConfig(property),
|
80
77
|
icon = _getCurrentConfig.icon,
|
81
78
|
type = _getCurrentConfig.type,
|
@@ -90,7 +87,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
90
87
|
onConnectorOperatorChange(op);
|
91
88
|
};
|
92
89
|
var onPropertyChangeHandler = function onPropertyChangeHandler(newProperty) {
|
93
|
-
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({},
|
90
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, condition), {}, {
|
94
91
|
property: newProperty,
|
95
92
|
operator: undefined,
|
96
93
|
value: '',
|
@@ -98,14 +95,14 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
98
95
|
}));
|
99
96
|
};
|
100
97
|
var onOperatorChangeHandler = function onOperatorChangeHandler(newOperator) {
|
101
|
-
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({},
|
98
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, condition), {}, {
|
102
99
|
operator: newOperator,
|
103
100
|
value: undefined,
|
104
101
|
popoverToOpen: 'valueField'
|
105
102
|
}));
|
106
103
|
};
|
107
104
|
var onValueChangeHandler = function onValueChangeHandler(newValue) {
|
108
|
-
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({},
|
105
|
+
onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, condition), {}, {
|
109
106
|
value: newValue,
|
110
107
|
popoverToOpen: ''
|
111
108
|
}));
|
@@ -134,7 +131,8 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
134
131
|
title: DataConfigs.translateWithId('condition'),
|
135
132
|
"data-name": "connectorField",
|
136
133
|
popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
|
137
|
-
className: "".concat(DataConfigs.blockClass, "__statement-button")
|
134
|
+
className: "".concat(DataConfigs.blockClass, "__statement-button"),
|
135
|
+
tabIndex: 0
|
138
136
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
|
139
137
|
conditionState: {
|
140
138
|
value: group.statement,
|
@@ -154,7 +152,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
154
152
|
renderIcon: icon !== null && icon !== void 0 ? icon : null,
|
155
153
|
className: "".concat(DataConfigs.blockClass, "__property-field"),
|
156
154
|
"data-name": "propertyField",
|
157
|
-
|
155
|
+
condition: condition,
|
158
156
|
type: type
|
159
157
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
|
160
158
|
conditionState: {
|
@@ -169,7 +167,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
169
167
|
label: operator,
|
170
168
|
title: DataConfigs.translateWithId('operator'),
|
171
169
|
"data-name": "operatorField",
|
172
|
-
|
170
|
+
condition: condition,
|
173
171
|
type: type
|
174
172
|
}, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
|
175
173
|
config: {
|
@@ -186,7 +184,7 @@ var ConditionBlock = function ConditionBlock(props) {
|
|
186
184
|
title: label,
|
187
185
|
showToolTip: true,
|
188
186
|
"data-name": "valueField",
|
189
|
-
|
187
|
+
condition: condition,
|
190
188
|
config: config
|
191
189
|
}, /*#__PURE__*/React__default["default"].createElement(ItemComponent, {
|
192
190
|
conditionState: {
|
@@ -229,6 +227,10 @@ ConditionBlock.propTypes = {
|
|
229
227
|
* object hold aria attributes
|
230
228
|
*/
|
231
229
|
aria: index["default"].object,
|
230
|
+
/**
|
231
|
+
* object that hold the current condition
|
232
|
+
*/
|
233
|
+
condition: index["default"].object,
|
232
234
|
/**
|
233
235
|
* index of the current condition
|
234
236
|
*/
|
@@ -241,6 +243,10 @@ ConditionBlock.propTypes = {
|
|
241
243
|
* object that hold the current group object where is condition is part of
|
242
244
|
*/
|
243
245
|
group: index["default"].object,
|
246
|
+
/**
|
247
|
+
* callback to add a new condition
|
248
|
+
*/
|
249
|
+
isLastCondition: index["default"].func,
|
244
250
|
/**
|
245
251
|
* boolean that decides to show the statement(if/ excl.if)
|
246
252
|
*/
|
@@ -260,11 +266,7 @@ ConditionBlock.propTypes = {
|
|
260
266
|
/**
|
261
267
|
* callback to handle the statement(if/ excl.if) change
|
262
268
|
*/
|
263
|
-
onStatementChange: index["default"].func
|
264
|
-
/**
|
265
|
-
* object that hold the current condition
|
266
|
-
*/
|
267
|
-
state: index["default"].object
|
269
|
+
onStatementChange: index["default"].func
|
268
270
|
};
|
269
271
|
|
270
272
|
exports["default"] = ConditionBlock$1;
|
@@ -33,13 +33,13 @@ var ConditionBuilderButton = function ConditionBuilderButton(_ref) {
|
|
33
33
|
showToolTip = _ref.showToolTip,
|
34
34
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
35
35
|
var Button = function Button() {
|
36
|
-
return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
|
36
|
+
return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
|
37
37
|
// role={'gridcell'}
|
38
38
|
tabIndex: -1,
|
39
39
|
className: cx__default["default"]([className, "".concat(DataConfigs.blockClass, "__condition-builder-button"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__text-ellipsis"), showToolTip && !hideLabel)]),
|
40
40
|
type: "button",
|
41
41
|
onClick: onClick
|
42
|
-
}), Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && label);
|
42
|
+
}, rest), Icon && (_Icon || (_Icon = /*#__PURE__*/React__default["default"].createElement(Icon, null))), !hideLabel && label);
|
43
43
|
};
|
44
44
|
return hideLabel || showToolTip ? /*#__PURE__*/React__default["default"].createElement(react.Tooltip, _rollupPluginBabelHelpers["extends"]({
|
45
45
|
label: label,
|
@@ -31,16 +31,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
31
31
|
var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
|
32
32
|
rootState = _useContext.rootState,
|
33
33
|
setRootState = _useContext.setRootState;
|
34
|
-
var _useState = React.useState(
|
34
|
+
var _useState = React.useState(false),
|
35
35
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
36
36
|
isConditionBuilderActive = _useState2[0],
|
37
37
|
setIsConditionBuilderActive = _useState2[1];
|
38
38
|
React.useEffect(function () {
|
39
39
|
var _rootState$groups;
|
40
40
|
if (rootState !== null && rootState !== void 0 && (_rootState$groups = rootState.groups) !== null && _rootState$groups !== void 0 && _rootState$groups.length) {
|
41
|
-
setIsConditionBuilderActive(false);
|
42
|
-
} else {
|
43
41
|
setIsConditionBuilderActive(true);
|
42
|
+
} else {
|
43
|
+
setIsConditionBuilderActive(false);
|
44
44
|
}
|
45
45
|
if (getConditionState) {
|
46
46
|
getConditionState(rootState);
|
@@ -48,26 +48,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
48
48
|
|
49
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
50
50
|
}, [rootState, conditionBuilderRef]);
|
51
|
-
React.useEffect(function () {
|
52
|
-
if (isConditionBuilderActive == false) {
|
53
|
-
if (conditionBuilderRef.current) {
|
54
|
-
var initial = conditionBuilderRef.current.querySelector('[role="gridcell"] button');
|
55
|
-
if (initial) {
|
56
|
-
initial.setAttribute('tabindex', '0');
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}, [isConditionBuilderActive, conditionBuilderRef]);
|
61
51
|
var onStartConditionBuilder = function onStartConditionBuilder() {
|
62
52
|
//when add condition button is clicked.
|
63
|
-
setIsConditionBuilderActive(
|
53
|
+
setIsConditionBuilderActive(true);
|
64
54
|
setRootState(initialState !== null && initialState !== void 0 ? initialState : ConditionBuilderProvider.emptyState); //here we can set an empty skeleton object for an empty condition builder,
|
65
55
|
//or we can even pre-populate some existing builder and continue editing
|
66
56
|
};
|
67
|
-
var _onRemove = React.useCallback(function (
|
57
|
+
var _onRemove = React.useCallback(function (groupId) {
|
68
58
|
setRootState(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rootState), {}, {
|
69
|
-
groups: rootState.groups.filter(function (group
|
70
|
-
return
|
59
|
+
groups: rootState.groups.filter(function (group) {
|
60
|
+
return groupId !== group.id;
|
71
61
|
})
|
72
62
|
}));
|
73
63
|
}, [setRootState, rootState]);
|
@@ -76,16 +66,15 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
76
66
|
* This method is triggered from inner components. This will be called every time when any change is to be updated in the rootState.
|
77
67
|
* This gets the updated group as argument.
|
78
68
|
*/
|
69
|
+
var groups = [].concat(_rollupPluginBabelHelpers.toConsumableArray(rootState.groups.slice(0, groupIndex)), [updatedGroup], _rollupPluginBabelHelpers.toConsumableArray(rootState.groups.slice(groupIndex + 1)));
|
79
70
|
setRootState(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rootState), {}, {
|
80
|
-
groups:
|
81
|
-
return groupIndex === gIndex ? updatedGroup : group;
|
82
|
-
})
|
71
|
+
groups: groups
|
83
72
|
}));
|
84
73
|
};
|
85
74
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
86
75
|
className: "".concat(DataConfigs.blockClass, "__content-container"),
|
87
76
|
tabIndex: -1
|
88
|
-
}, isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Button, {
|
77
|
+
}, !isConditionBuilderActive && /*#__PURE__*/React__default["default"].createElement(react.Button, {
|
89
78
|
className: "".concat(DataConfigs.blockClass, "__condition-builder"),
|
90
79
|
renderIcon: function renderIcon(props) {
|
91
80
|
return /*#__PURE__*/React__default["default"].createElement(icons.Add, _rollupPluginBabelHelpers["extends"]({
|
@@ -98,15 +87,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
|
|
98
87
|
onClick: onStartConditionBuilder
|
99
88
|
}, startConditionLabel), rootState && (rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.map(function (eachGroup, groupIndex) {
|
100
89
|
return /*#__PURE__*/React__default["default"].createElement(ConditionGroupBuilder["default"], {
|
90
|
+
className: "".concat(DataConfigs.blockClass, "__condition-builder__group"),
|
101
91
|
key: groupIndex,
|
102
92
|
aria: {
|
103
93
|
level: 1,
|
104
94
|
posinset: groupIndex * 2 + 1,
|
105
95
|
setsize: rootState.groups.length * 2
|
106
96
|
},
|
107
|
-
|
97
|
+
group: eachGroup,
|
108
98
|
onRemove: function onRemove() {
|
109
|
-
_onRemove(
|
99
|
+
_onRemove(eachGroup.id);
|
110
100
|
},
|
111
101
|
onChange: function onChange(updatedGroup) {
|
112
102
|
onChangeHandler(updatedGroup, groupIndex);
|
package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts
CHANGED
@@ -3,11 +3,13 @@ export namespace emptyState {
|
|
3
3
|
groupSeparateOperator: null;
|
4
4
|
groupOperator: string;
|
5
5
|
statement: string;
|
6
|
+
id: any;
|
6
7
|
conditions: {
|
7
8
|
property: undefined;
|
8
9
|
operator: string;
|
9
10
|
value: string;
|
10
11
|
popoverToOpen: string;
|
12
|
+
id: any;
|
11
13
|
}[];
|
12
14
|
}[];
|
13
15
|
}
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
13
|
var React = require('react');
|
14
14
|
var index = require('../../../node_modules/prop-types/index.js');
|
15
|
+
var uuidv4 = require('../../../global/js/utils/uuidv4.js');
|
15
16
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
17
18
|
|
@@ -22,11 +23,13 @@ var emptyState = {
|
|
22
23
|
groupSeparateOperator: null,
|
23
24
|
groupOperator: 'and',
|
24
25
|
statement: 'if',
|
26
|
+
id: uuidv4["default"](),
|
25
27
|
conditions: [{
|
26
28
|
property: undefined,
|
27
29
|
operator: '',
|
28
30
|
value: '',
|
29
|
-
popoverToOpen: 'propertyField'
|
31
|
+
popoverToOpen: 'propertyField',
|
32
|
+
id: uuidv4["default"]()
|
30
33
|
}]
|
31
34
|
}]
|
32
35
|
};
|