@carbon/ibm-products 2.73.1-rc.0 → 2.74.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +56 -6
- 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 +5 -1
- 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 +56 -6
- 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 +56 -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/components/AboutModal/AboutModal.d.ts +17 -23
- package/es/components/AboutModal/AboutModal.js +17 -23
- package/es/components/AddSelect/AddSelectBody.js +1 -1
- package/es/components/Carousel/Carousel.js +1 -1
- package/es/components/Coachmark/Coachmark.d.ts +4 -0
- package/es/components/Coachmark/Coachmark.js +9 -2
- package/es/components/Coachmark/CoachmarkDragbar.d.ts +0 -4
- package/es/components/Coachmark/CoachmarkDragbar.js +2 -6
- package/es/components/Coachmark/CoachmarkHeader.d.ts +0 -4
- package/es/components/Coachmark/CoachmarkHeader.js +2 -2
- package/es/components/Coachmark/CoachmarkTagline.js +5 -3
- package/es/components/Coachmark/next/Coachmark/Coachmark.d.ts +1 -22
- package/es/components/Coachmark/next/Coachmark/Coachmark.js +14 -29
- package/es/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts +1 -0
- package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +13 -2
- package/es/components/Coachmark/next/Coachmark/CoachmarkContent.js +2 -2
- package/es/components/Coachmark/next/Coachmark/ContentBody.js +1 -1
- package/es/components/Coachmark/next/Coachmark/ContentHeader.js +15 -1
- package/es/components/Coachmark/next/Coachmark/context.d.ts +25 -0
- package/es/components/Coachmark/next/Coachmark/context.js +28 -0
- package/es/components/Coachmark/utils/context.d.ts +2 -2
- package/es/components/CoachmarkFixed/CoachmarkFixed.d.ts +4 -0
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +6 -1
- package/es/components/CoachmarkStack/CoachmarkStack.d.ts +4 -0
- package/es/components/CoachmarkStack/CoachmarkStack.js +7 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +11 -7
- package/es/components/ConditionBuilder/ConditionBuilder.js +11 -2
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +10 -0
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +10 -5
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -3
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +5 -4
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +8 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +20 -4
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +1 -1
- package/es/components/ConditionBuilder/index.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +12 -7
- package/es/components/ConditionBuilder/utils/useDataConfigs.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/util.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/util.js +2 -2
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +1 -1
- package/es/components/EmptyStates/EmptyState.js +1 -1
- package/es/components/EmptyStates/{EmptyStateV2.js → EmptyStateV2.deprecated.js} +1 -1
- package/es/components/EmptyStates/index.d.ts +2 -2
- package/es/components/NotificationsPanel/NotificationsPanel.js +1 -1
- package/es/components/SidePanel/SidePanel.d.ts +1 -0
- package/es/components/SidePanel/SidePanel.js +1 -0
- package/es/components/StepFlow/StepContext.d.ts +14 -0
- package/es/components/StepFlow/StepGroup.d.ts +10 -0
- package/es/components/StepFlow/index.d.ts +9 -0
- package/es/components/StepFlow/story-assets/SidePanel/Example.d.ts +8 -0
- package/es/components/StepFlow/story-assets/SidePanel/StepSidePanel.d.ts +20 -0
- package/es/components/StepFlow/story-assets/StepActions.d.ts +23 -0
- package/es/components/StepFlow/story-assets/Tearsheet/Example.d.ts +8 -0
- package/es/components/StepFlow/story-assets/Tearsheet/StepTearsheet.d.ts +20 -0
- package/es/components/StepFlow/types.d.ts +22 -0
- package/es/components/TruncatedText/TruncatedText.js +4 -2
- package/es/global/js/utils/makeDraggable/makeDraggable.js +28 -0
- package/es/index.js +1 -1
- package/lib/components/AboutModal/AboutModal.d.ts +17 -23
- package/lib/components/AboutModal/AboutModal.js +17 -23
- package/lib/components/AddSelect/AddSelectBody.js +1 -1
- package/lib/components/Carousel/Carousel.js +1 -1
- package/lib/components/Coachmark/Coachmark.d.ts +4 -0
- package/lib/components/Coachmark/Coachmark.js +9 -2
- package/lib/components/Coachmark/CoachmarkDragbar.d.ts +0 -4
- package/lib/components/Coachmark/CoachmarkDragbar.js +2 -6
- package/lib/components/Coachmark/CoachmarkHeader.d.ts +0 -4
- package/lib/components/Coachmark/CoachmarkHeader.js +2 -2
- package/lib/components/Coachmark/CoachmarkTagline.js +5 -3
- package/lib/components/Coachmark/next/Coachmark/Coachmark.d.ts +1 -22
- package/lib/components/Coachmark/next/Coachmark/Coachmark.js +16 -33
- package/lib/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts +1 -0
- package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +13 -2
- package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.js +5 -5
- package/lib/components/Coachmark/next/Coachmark/ContentBody.js +2 -2
- package/lib/components/Coachmark/next/Coachmark/ContentHeader.js +17 -3
- package/lib/components/Coachmark/next/Coachmark/context.d.ts +25 -0
- package/lib/components/Coachmark/next/Coachmark/context.js +31 -0
- package/lib/components/Coachmark/utils/context.d.ts +2 -2
- package/lib/components/CoachmarkFixed/CoachmarkFixed.d.ts +4 -0
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +6 -1
- package/lib/components/CoachmarkStack/CoachmarkStack.d.ts +4 -0
- package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +11 -7
- package/lib/components/ConditionBuilder/ConditionBuilder.js +11 -2
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +10 -0
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +10 -5
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +5 -4
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +8 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +20 -4
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +1 -1
- package/lib/components/ConditionBuilder/index.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +11 -6
- package/lib/components/ConditionBuilder/utils/useDataConfigs.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/util.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/util.js +2 -2
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +1 -1
- package/lib/components/EmptyStates/EmptyState.js +2 -2
- package/lib/components/EmptyStates/{EmptyStateV2.js → EmptyStateV2.deprecated.js} +2 -2
- package/lib/components/EmptyStates/index.d.ts +2 -2
- package/lib/components/NotificationsPanel/NotificationsPanel.js +1 -1
- package/lib/components/SidePanel/SidePanel.d.ts +1 -0
- package/lib/components/SidePanel/SidePanel.js +1 -0
- package/lib/components/StepFlow/StepContext.d.ts +14 -0
- package/lib/components/StepFlow/StepGroup.d.ts +10 -0
- package/lib/components/StepFlow/index.d.ts +9 -0
- package/lib/components/StepFlow/story-assets/SidePanel/Example.d.ts +8 -0
- package/lib/components/StepFlow/story-assets/SidePanel/StepSidePanel.d.ts +20 -0
- package/lib/components/StepFlow/story-assets/StepActions.d.ts +23 -0
- package/lib/components/StepFlow/story-assets/Tearsheet/Example.d.ts +8 -0
- package/lib/components/StepFlow/story-assets/Tearsheet/StepTearsheet.d.ts +20 -0
- package/lib/components/StepFlow/types.d.ts +22 -0
- package/lib/components/TruncatedText/TruncatedText.js +4 -2
- package/lib/global/js/utils/makeDraggable/makeDraggable.js +28 -0
- package/lib/index.js +2 -2
- package/package.json +7 -7
- package/scss/components/Coachmark/_coachmark.scss +7 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +24 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +26 -12
- package/scss/components/SidePanel/_side-panel.scss +6 -1
- package/scss/components/Tearsheet/_tearsheet.scss +1 -0
- package/scss/components/TruncatedText/_truncated-text.scss +1 -0
- package/telemetry.yml +1 -1
- /package/es/components/EmptyStates/{EmptyStateIllustration.d.ts → EmptyStateIllustration.deprecated.d.ts} +0 -0
- /package/es/components/EmptyStates/{EmptyStateIllustration.js → EmptyStateIllustration.deprecated.js} +0 -0
- /package/es/components/EmptyStates/{EmptyStateV2.d.ts → EmptyStateV2.deprecated.d.ts} +0 -0
- /package/lib/components/EmptyStates/{EmptyStateIllustration.d.ts → EmptyStateIllustration.deprecated.d.ts} +0 -0
- /package/lib/components/EmptyStates/{EmptyStateIllustration.js → EmptyStateIllustration.deprecated.js} +0 -0
- /package/lib/components/EmptyStates/{EmptyStateV2.d.ts → EmptyStateV2.deprecated.d.ts} +0 -0
@@ -15,13 +15,13 @@ var icons = require('@carbon/react/icons');
|
|
15
15
|
var react = require('@carbon/react');
|
16
16
|
var devtools = require('../../global/js/utils/devtools.js');
|
17
17
|
var settings = require('../../settings.js');
|
18
|
+
var context = require('./utils/context.js');
|
18
19
|
|
19
20
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
20
21
|
const blockClass = `${settings.pkg.prefix}--coachmark-header`;
|
21
22
|
const overlayBlockClass = `${settings.pkg.prefix}--coachmark-overlay`;
|
22
23
|
const componentName = 'CoachmarkHeader';
|
23
24
|
const defaults = {
|
24
|
-
closeIconDescription: 'Close',
|
25
25
|
onClose: () => {},
|
26
26
|
showCloseButton: true,
|
27
27
|
theme: 'light'
|
@@ -32,13 +32,13 @@ const defaults = {
|
|
32
32
|
*/
|
33
33
|
exports.CoachmarkHeader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
34
34
|
let {
|
35
|
-
closeIconDescription = defaults.closeIconDescription,
|
36
35
|
onClose = defaults.onClose,
|
37
36
|
showCloseButton = defaults.showCloseButton,
|
38
37
|
theme = defaults.theme,
|
39
38
|
// Collect any other property values passed in.
|
40
39
|
...rest
|
41
40
|
} = _ref;
|
41
|
+
const closeIconDescription = context.useCoachmark()?.closeIconDescription;
|
42
42
|
return /*#__PURE__*/React.createElement("header", _rollupPluginBabelHelpers.extends({}, rest, {
|
43
43
|
className: cx(blockClass, `${blockClass}__${theme}`),
|
44
44
|
ref: ref
|
@@ -23,9 +23,9 @@ var _Idea;
|
|
23
23
|
const blockClass = `${settings.pkg.prefix}--coachmark-tagline`;
|
24
24
|
const componentName = 'CoachmarkTagline';
|
25
25
|
const defaults = {
|
26
|
-
closeIconDescription: 'Close',
|
27
26
|
onClose: () => {},
|
28
|
-
theme: 'light'
|
27
|
+
theme: 'light',
|
28
|
+
closeIconDescription: 'Close'
|
29
29
|
};
|
30
30
|
/**
|
31
31
|
* DO NOT USE. This component is for the exclusive use
|
@@ -40,6 +40,8 @@ exports.CoachmarkTagline = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
40
40
|
...rest
|
41
41
|
} = _ref;
|
42
42
|
const coachmark = context.useCoachmark();
|
43
|
+
const contextCloseIconDescription = context.useCoachmark()?.closeIconDescription;
|
44
|
+
const closeIconDesc = closeIconDescription ?? contextCloseIconDescription;
|
43
45
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
44
46
|
className: cx(blockClass, `${blockClass}__${theme}`, coachmark?.isOpen && `${blockClass}--is-open`),
|
45
47
|
ref: ref
|
@@ -57,7 +59,7 @@ exports.CoachmarkTagline = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
57
59
|
kind: "ghost",
|
58
60
|
size: "sm",
|
59
61
|
renderIcon: icons.Close,
|
60
|
-
iconDescription:
|
62
|
+
iconDescription: closeIconDesc,
|
61
63
|
hasIconOnly: true,
|
62
64
|
className: `${blockClass}--close-btn`,
|
63
65
|
onClick: onClose
|
@@ -4,10 +4,9 @@
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
|
-
import
|
7
|
+
import { FC, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
8
8
|
import { CoachmarkContentProps } from './CoachmarkContent';
|
9
9
|
import { NewPopoverAlignment } from '@carbon/react';
|
10
|
-
export declare const blockClass: string;
|
11
10
|
export interface CoachmarkProps {
|
12
11
|
/**
|
13
12
|
* Provide the contents of the Coachmark.
|
@@ -17,10 +16,6 @@ export interface CoachmarkProps {
|
|
17
16
|
* Provide an optional class to be applied to the containing node.
|
18
17
|
*/
|
19
18
|
className?: string;
|
20
|
-
/**
|
21
|
-
* The aria label applied to the Coachmark component
|
22
|
-
*/
|
23
|
-
ariaLabel?: string;
|
24
19
|
/**
|
25
20
|
* Specifies whether the component is currently open.
|
26
21
|
*/
|
@@ -48,25 +43,9 @@ export interface CoachmarkProps {
|
|
48
43
|
export type CoachmarkComponent = ForwardRefExoticComponent<CoachmarkProps & RefAttributes<HTMLDivElement>> & {
|
49
44
|
Content: FC<CoachmarkContentProps>;
|
50
45
|
};
|
51
|
-
interface CoachmarkContextType {
|
52
|
-
onClose?: () => void;
|
53
|
-
open?: boolean;
|
54
|
-
setOpen: (value: boolean) => void;
|
55
|
-
align?: NewPopoverAlignment;
|
56
|
-
triggerRef: RefObject<HTMLElement | null>;
|
57
|
-
position: {
|
58
|
-
x: number;
|
59
|
-
y: number;
|
60
|
-
};
|
61
|
-
contentRef: HTMLElement | null;
|
62
|
-
setContentRef: (value: any) => void;
|
63
|
-
floating?: boolean;
|
64
|
-
}
|
65
|
-
export declare const CoachmarkContext: React.Context<CoachmarkContextType>;
|
66
46
|
/**
|
67
47
|
* Coachmarks are used to call out specific functionality or concepts
|
68
48
|
* within the UI that may not be intuitive but are important for the
|
69
49
|
* user to gain understanding of the product's main value and discover new use cases.
|
70
50
|
*/
|
71
51
|
export declare const Coachmark: CoachmarkComponent;
|
72
|
-
export {};
|
@@ -12,12 +12,12 @@ var React = require('react');
|
|
12
12
|
var index = require('../../../../_virtual/index.js');
|
13
13
|
var cx = require('classnames');
|
14
14
|
var devtools = require('../../../../global/js/utils/devtools.js');
|
15
|
-
var
|
15
|
+
var context = require('./context.js');
|
16
16
|
var CoachmarkContent = require('./CoachmarkContent.js');
|
17
17
|
var useIsomorphicEffect = require('../../../../global/js/hooks/useIsomorphicEffect.js');
|
18
18
|
|
19
19
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
20
|
-
|
20
|
+
|
21
21
|
const componentName = 'Coachmark';
|
22
22
|
|
23
23
|
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
@@ -33,21 +33,6 @@ const componentName = 'Coachmark';
|
|
33
33
|
|
34
34
|
// Define the type for Coachmark, extending it to include Trigger and Content
|
35
35
|
|
36
|
-
const CoachmarkContext = /*#__PURE__*/React.createContext({
|
37
|
-
open: false,
|
38
|
-
setOpen: () => {},
|
39
|
-
align: 'bottom',
|
40
|
-
triggerRef: {
|
41
|
-
current: null
|
42
|
-
},
|
43
|
-
position: {
|
44
|
-
x: 0,
|
45
|
-
y: 0
|
46
|
-
},
|
47
|
-
contentRef: null,
|
48
|
-
setContentRef: value => {},
|
49
|
-
floating: false
|
50
|
-
});
|
51
36
|
/**
|
52
37
|
* Coachmarks are used to call out specific functionality or concepts
|
53
38
|
* within the UI that may not be intuitive but are important for the
|
@@ -57,7 +42,6 @@ const Coachmark = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
57
42
|
const {
|
58
43
|
children,
|
59
44
|
className,
|
60
|
-
ariaLabel,
|
61
45
|
onClose,
|
62
46
|
align = 'bottom',
|
63
47
|
open,
|
@@ -92,6 +76,12 @@ const Coachmark = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
92
76
|
triggerRef.current = firstFocusable;
|
93
77
|
}
|
94
78
|
}, [children]);
|
79
|
+
React.useEffect(() => {
|
80
|
+
const el = triggerRef.current;
|
81
|
+
if (el) {
|
82
|
+
el.setAttribute('aria-expanded', String(!!open));
|
83
|
+
}
|
84
|
+
}, [open]);
|
95
85
|
useIsomorphicEffect.useIsomorphicEffect(() => {
|
96
86
|
const {
|
97
87
|
x = 0,
|
@@ -110,7 +100,7 @@ const Coachmark = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
110
100
|
ref.current = node;
|
111
101
|
}
|
112
102
|
};
|
113
|
-
return /*#__PURE__*/React.createElement(CoachmarkContext.Provider, {
|
103
|
+
return /*#__PURE__*/React.createElement(context.CoachmarkContext.Provider, {
|
114
104
|
value: {
|
115
105
|
onClose,
|
116
106
|
open: currentOpen,
|
@@ -123,17 +113,16 @@ const Coachmark = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
123
113
|
floating
|
124
114
|
}
|
125
115
|
}, /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
126
|
-
className: cx(blockClass,
|
116
|
+
className: cx(context.blockClass,
|
127
117
|
// Apply the block class to the main HTML element
|
128
118
|
className,
|
129
119
|
// Apply any supplied class names to the main HTML element.
|
130
120
|
{
|
131
|
-
[`${blockClass}--floating`]: floating
|
121
|
+
[`${context.blockClass}--floating`]: floating
|
132
122
|
}),
|
133
|
-
"aria-label": ariaLabel,
|
134
123
|
ref: setRef
|
135
124
|
}, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement("div", {
|
136
|
-
className: `${blockClass}--container`
|
125
|
+
className: `${context.blockClass}--container`
|
137
126
|
}, children)));
|
138
127
|
});
|
139
128
|
Coachmark.Content = CoachmarkContent.default;
|
@@ -150,10 +139,6 @@ Coachmark.propTypes = {
|
|
150
139
|
* Where to render the Coachmark relative to its target.
|
151
140
|
*/
|
152
141
|
align: index.default.string,
|
153
|
-
/**
|
154
|
-
* The aria label applied to the Coachmark component
|
155
|
-
*/
|
156
|
-
ariaLabel: index.default.string,
|
157
142
|
/**
|
158
143
|
* Provide the contents of the CoachmarkV2.
|
159
144
|
*/
|
@@ -162,10 +147,6 @@ Coachmark.propTypes = {
|
|
162
147
|
* Provide an optional class to be applied to the containing node.
|
163
148
|
*/
|
164
149
|
className: index.default.string,
|
165
|
-
/**
|
166
|
-
* Specifies whether the component is currently open.
|
167
|
-
*/
|
168
|
-
defaultOpen: index.default.bool,
|
169
150
|
/**
|
170
151
|
* Specifies whether the component is floating or not.
|
171
152
|
*/
|
@@ -174,6 +155,10 @@ Coachmark.propTypes = {
|
|
174
155
|
* Function to call when the close button is clicked.
|
175
156
|
*/
|
176
157
|
onClose: index.default.func,
|
158
|
+
/**
|
159
|
+
* Specifies whether the component is currently open.
|
160
|
+
*/
|
161
|
+
open: index.default.bool,
|
177
162
|
/**
|
178
163
|
* Fine tune the position of the target in pixels. Applies only to Beacons.
|
179
164
|
*/
|
@@ -185,5 +170,3 @@ Coachmark.propTypes = {
|
|
185
170
|
};
|
186
171
|
|
187
172
|
exports.Coachmark = Coachmark;
|
188
|
-
exports.CoachmarkContext = CoachmarkContext;
|
189
|
-
exports.blockClass = blockClass;
|
@@ -15,7 +15,7 @@ var settings = require('../../../../../settings.js');
|
|
15
15
|
var floatingUi_reactDom = require('../../../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
|
16
16
|
var floatingUi_dom = require('../../../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
17
17
|
|
18
|
-
const CoachmarkBubble = /*#__PURE__*/React.forwardRef(props => {
|
18
|
+
const CoachmarkBubble = /*#__PURE__*/React.forwardRef((props, ref) => {
|
19
19
|
const {
|
20
20
|
children,
|
21
21
|
align,
|
@@ -37,6 +37,9 @@ const CoachmarkBubble = /*#__PURE__*/React.forwardRef(props => {
|
|
37
37
|
React.useLayoutEffect(() => {
|
38
38
|
if (target) {
|
39
39
|
if (typeof target === 'string') {
|
40
|
+
if (target === '#' || target.trim() === '') {
|
41
|
+
return;
|
42
|
+
}
|
40
43
|
targetRef.current = document.querySelector(target);
|
41
44
|
} else if ('current' in target) {
|
42
45
|
targetRef.current = target.current;
|
@@ -104,8 +107,16 @@ const CoachmarkBubble = /*#__PURE__*/React.forwardRef(props => {
|
|
104
107
|
if (!target) {
|
105
108
|
return null;
|
106
109
|
}
|
110
|
+
const mergedRefs = node => {
|
111
|
+
tooltipRef.current = node;
|
112
|
+
if (typeof ref === 'function') {
|
113
|
+
ref(node);
|
114
|
+
} else if (ref) {
|
115
|
+
ref.current = node;
|
116
|
+
}
|
117
|
+
};
|
107
118
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
108
|
-
ref:
|
119
|
+
ref: mergedRefs,
|
109
120
|
className: cx({
|
110
121
|
[`${carbonPrefix}--g100`]: theme === 'white' && highContrast || theme === 'g100' && !highContrast,
|
111
122
|
[`${carbonPrefix}--g90`]: theme === 'g10' && highContrast || theme === 'g90' && !highContrast,
|
@@ -13,7 +13,7 @@ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabel
|
|
13
13
|
var React = require('react');
|
14
14
|
var index = require('../../../../_virtual/index.js');
|
15
15
|
var settings = require('../../../../settings.js');
|
16
|
-
var
|
16
|
+
var context = require('./context.js');
|
17
17
|
var CoachmarkBubble = require('./CoachmarkBubble/CoachmarkBubble.js');
|
18
18
|
require('./CoachmarkBubble/CoachmarkBubbleHeader.js');
|
19
19
|
var ContentHeader = require('./ContentHeader.js');
|
@@ -28,8 +28,8 @@ const CoachmarkContent = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
28
28
|
dropShadow,
|
29
29
|
...rest
|
30
30
|
} = props;
|
31
|
-
const coachmarkContentBlockClass = `${
|
32
|
-
const contentBodyClass = `${
|
31
|
+
const coachmarkContentBlockClass = `${context.blockClass}--coachmark-content`;
|
32
|
+
const contentBodyClass = `${context.blockClass}--content-body`;
|
33
33
|
const {
|
34
34
|
align,
|
35
35
|
open,
|
@@ -37,14 +37,14 @@ const CoachmarkContent = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
37
37
|
triggerRef,
|
38
38
|
setContentRef,
|
39
39
|
floating
|
40
|
-
} = React.useContext(
|
40
|
+
} = React.useContext(context.CoachmarkContext);
|
41
41
|
const targetId = open ? triggerRef?.current?.id : null;
|
42
42
|
const handleRef = React.useRef(null);
|
43
43
|
const bubbleRef = ref && typeof ref !== 'function' ? ref : handleRef;
|
44
44
|
React.useEffect(() => {
|
45
45
|
if (open && bubbleRef.current) {
|
46
46
|
requestAnimationFrame(() => {
|
47
|
-
const contentBody = bubbleRef.current
|
47
|
+
const contentBody = bubbleRef.current?.querySelector(`.${contentBodyClass}`);
|
48
48
|
if (contentBody) {
|
49
49
|
const firstFocusable = Array.from(contentBody.querySelectorAll('*')).find(el => el.tabIndex >= 0);
|
50
50
|
firstFocusable?.focus();
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var React = require('react');
|
13
13
|
var index = require('../../../../_virtual/index.js');
|
14
14
|
var cx = require('classnames');
|
15
|
-
var
|
15
|
+
var context = require('./context.js');
|
16
16
|
|
17
17
|
const ContentBody = /*#__PURE__*/React.forwardRef((props, ref) => {
|
18
18
|
const {
|
@@ -20,7 +20,7 @@ const ContentBody = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
20
20
|
children,
|
21
21
|
...rest
|
22
22
|
} = props;
|
23
|
-
const ContentBodyBlockClass = `${
|
23
|
+
const ContentBodyBlockClass = `${context.blockClass}--content-body`;
|
24
24
|
return /*#__PURE__*/React.createElement("div", {
|
25
25
|
ref: ref,
|
26
26
|
className: cx(ContentBodyBlockClass, className)
|
@@ -14,7 +14,7 @@ var react = require('@carbon/react');
|
|
14
14
|
var React = require('react');
|
15
15
|
var index = require('../../../../_virtual/index.js');
|
16
16
|
var cx = require('classnames');
|
17
|
-
var
|
17
|
+
var context = require('./context.js');
|
18
18
|
require('./CoachmarkBubble/CoachmarkBubble.js');
|
19
19
|
var CoachmarkBubbleHeader = require('./CoachmarkBubble/CoachmarkBubbleHeader.js');
|
20
20
|
var icons = require('@carbon/react/icons');
|
@@ -33,11 +33,11 @@ const ContentHeader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
33
33
|
onClose,
|
34
34
|
contentRef,
|
35
35
|
floating
|
36
|
-
} = React.useContext(
|
36
|
+
} = React.useContext(context.CoachmarkContext);
|
37
37
|
const headerRef = React.useRef(null);
|
38
38
|
const dragRef = React.useRef(null);
|
39
39
|
const handleRef = ref || headerRef;
|
40
|
-
const contentHeaderBlockClass = `${
|
40
|
+
const contentHeaderBlockClass = `${context.blockClass}--content-header`;
|
41
41
|
const closeBubble = () => {
|
42
42
|
onClose?.();
|
43
43
|
setOpen(false);
|
@@ -49,6 +49,20 @@ const ContentHeader = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
49
49
|
dragHandle: handleRef.current,
|
50
50
|
focusableDragHandle: dragRef.current
|
51
51
|
});
|
52
|
+
const onDragStart = () => {
|
53
|
+
if (contentRef) {
|
54
|
+
contentRef.classList.add(`${contentHeaderBlockClass}--is-dragging`);
|
55
|
+
contentRef.setAttribute('aria-label', 'Coachmark is being dragged');
|
56
|
+
}
|
57
|
+
};
|
58
|
+
const onDragEnd = () => {
|
59
|
+
if (contentRef) {
|
60
|
+
contentRef.classList.remove(`${contentHeaderBlockClass}--is-dragging`);
|
61
|
+
contentRef.removeAttribute('aria-label');
|
62
|
+
}
|
63
|
+
};
|
64
|
+
contentRef.addEventListener('dragstart', onDragStart);
|
65
|
+
contentRef.addEventListener('dragend', onDragEnd);
|
52
66
|
}
|
53
67
|
});
|
54
68
|
return /*#__PURE__*/React.createElement(CoachmarkBubbleHeader.CoachmarkBubbleHeader, _rollupPluginBabelHelpers.extends({
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2025
|
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 { RefObject } from 'react';
|
8
|
+
import { NewPopoverAlignment } from '@carbon/react';
|
9
|
+
interface CoachmarkContextType {
|
10
|
+
onClose?: () => void;
|
11
|
+
open?: boolean;
|
12
|
+
setOpen: (value: boolean) => void;
|
13
|
+
align?: NewPopoverAlignment;
|
14
|
+
triggerRef: RefObject<HTMLElement | null>;
|
15
|
+
position: {
|
16
|
+
x: number;
|
17
|
+
y: number;
|
18
|
+
};
|
19
|
+
contentRef: HTMLElement | null;
|
20
|
+
setContentRef: (value: any) => void;
|
21
|
+
floating?: boolean;
|
22
|
+
}
|
23
|
+
export declare const CoachmarkContext: import("react").Context<CoachmarkContextType>;
|
24
|
+
export declare const blockClass: string;
|
25
|
+
export {};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2025
|
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
|
+
var React = require('react');
|
11
|
+
var settings = require('../../../../settings.js');
|
12
|
+
|
13
|
+
const CoachmarkContext = /*#__PURE__*/React.createContext({
|
14
|
+
open: false,
|
15
|
+
setOpen: () => {},
|
16
|
+
align: 'bottom',
|
17
|
+
triggerRef: {
|
18
|
+
current: null
|
19
|
+
},
|
20
|
+
position: {
|
21
|
+
x: 0,
|
22
|
+
y: 0
|
23
|
+
},
|
24
|
+
contentRef: null,
|
25
|
+
setContentRef: value => {},
|
26
|
+
floating: false
|
27
|
+
});
|
28
|
+
const blockClass = `${settings.pkg.prefix}--coachmark__next`;
|
29
|
+
|
30
|
+
exports.CoachmarkContext = CoachmarkContext;
|
31
|
+
exports.blockClass = blockClass;
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
import { PopoverAlignment } from '@carbon/react';
|
8
8
|
import { ButtonProps } from '@carbon/react';
|
9
|
-
interface CoachmarkContextType {
|
9
|
+
export interface CoachmarkContextType {
|
10
10
|
buttonProps: ButtonProps<React.ElementType>;
|
11
11
|
closeButtonProps: {
|
12
12
|
onClick: () => void;
|
@@ -22,7 +22,7 @@ interface CoachmarkContextType {
|
|
22
22
|
y: number;
|
23
23
|
};
|
24
24
|
isOpen: boolean;
|
25
|
+
closeIconDescription?: string;
|
25
26
|
}
|
26
27
|
export declare const CoachmarkContext: import("react").Context<CoachmarkContextType | null>;
|
27
28
|
export declare const useCoachmark: () => CoachmarkContextType | null;
|
28
|
-
export {};
|
@@ -37,6 +37,10 @@ export interface CoachmarkFixedProps {
|
|
37
37
|
* Determines the theme of the component.
|
38
38
|
*/
|
39
39
|
theme?: 'light' | 'dark';
|
40
|
+
/**
|
41
|
+
* Tooltip text and aria label for the Close button icon.
|
42
|
+
*/
|
43
|
+
closeIconDescription?: string;
|
40
44
|
}
|
41
45
|
/**
|
42
46
|
* Fixed coachmarks are used to call out specific functionality or concepts
|
@@ -49,6 +49,7 @@ exports.CoachmarkFixed = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
49
49
|
portalTarget,
|
50
50
|
tagline = defaults.tagline,
|
51
51
|
theme = defaults.theme,
|
52
|
+
closeIconDescription,
|
52
53
|
// Collect any other property values passed in.
|
53
54
|
...rest
|
54
55
|
} = _ref;
|
@@ -115,7 +116,7 @@ exports.CoachmarkFixed = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
115
116
|
targetRect: targetRect,
|
116
117
|
targetOffset: targetOffset,
|
117
118
|
isOpen: isOpen,
|
118
|
-
|
119
|
+
closeIconDescription
|
119
120
|
};
|
120
121
|
|
121
122
|
// instead of toggling on/off,
|
@@ -184,6 +185,10 @@ exports.CoachmarkFixed.propTypes = {
|
|
184
185
|
* Optional class name for this component.
|
185
186
|
*/
|
186
187
|
className: index.default.string,
|
188
|
+
/**
|
189
|
+
* Tooltip text and aria label for the Close button icon.
|
190
|
+
*/
|
191
|
+
closeIconDescription: index.default.string,
|
187
192
|
/**
|
188
193
|
* Function to call when the Coachmark closes.
|
189
194
|
*/
|
@@ -56,6 +56,10 @@ interface CoachmarkStackProps {
|
|
56
56
|
* Label's tooltip position
|
57
57
|
*/
|
58
58
|
tooltipAlign?: TooltipAlignment;
|
59
|
+
/**
|
60
|
+
* Tooltip text and aria label for the Close button icon.
|
61
|
+
*/
|
62
|
+
closeIconDescription?: string;
|
59
63
|
}
|
60
64
|
/**
|
61
65
|
* Stacked coachmarks are used to call out specific functionality or concepts
|
@@ -63,6 +63,7 @@ exports.CoachmarkStack = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
63
63
|
theme = defaults.theme,
|
64
64
|
title,
|
65
65
|
tooltipAlign,
|
66
|
+
closeIconDescription,
|
66
67
|
...rest
|
67
68
|
} = _ref;
|
68
69
|
const portalNode = React.useRef(null);
|
@@ -135,7 +136,8 @@ exports.CoachmarkStack = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
135
136
|
closeButtonProps: {
|
136
137
|
onClick: () => handleClose(false)
|
137
138
|
},
|
138
|
-
isOpen: isOpen
|
139
|
+
isOpen: isOpen,
|
140
|
+
closeIconDescription
|
139
141
|
};
|
140
142
|
React.useEffect(() => {
|
141
143
|
mountedRef.current = true;
|
@@ -236,6 +238,10 @@ exports.CoachmarkStack.propTypes = {
|
|
236
238
|
* The label for the button that will close the Stack
|
237
239
|
*/
|
238
240
|
closeButtonLabel: index.default.string,
|
241
|
+
/**
|
242
|
+
* Tooltip text and aria label for the Close button icon.
|
243
|
+
*/
|
244
|
+
closeIconDescription: index.default.string,
|
239
245
|
// Pass through to CoachmarkStackHome
|
240
246
|
/**
|
241
247
|
* The description of the Coachmark.
|
@@ -61,7 +61,8 @@ const ConditionBlock = props => {
|
|
61
61
|
const {
|
62
62
|
inputConfig,
|
63
63
|
variant,
|
64
|
-
conditionBuilderRef
|
64
|
+
conditionBuilderRef,
|
65
|
+
readOnly
|
65
66
|
} = React.useContext(ConditionBuilderProvider.ConditionBuilderContext);
|
66
67
|
const [showDeletionPreview, setShowDeletionPreview] = React.useState(false);
|
67
68
|
const [showAllActions, setShowAllActions] = React.useState(false);
|
@@ -181,7 +182,8 @@ const ConditionBlock = props => {
|
|
181
182
|
config: {
|
182
183
|
options: inputConfig?.properties
|
183
184
|
},
|
184
|
-
closePopover: closePopover
|
185
|
+
closePopover: closePopover,
|
186
|
+
group: group
|
185
187
|
});
|
186
188
|
};
|
187
189
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
@@ -209,7 +211,7 @@ const ConditionBlock = props => {
|
|
209
211
|
label: group.statement,
|
210
212
|
title: conditionText,
|
211
213
|
"data-name": "connectorField",
|
212
|
-
popOverClassName: `${util.blockClass}__gap`,
|
214
|
+
popOverClassName: `${util.blockClass}__gap ${util.blockClass}__connector`,
|
213
215
|
className: `${util.blockClass}__statement-button`,
|
214
216
|
tabIndex: 0
|
215
217
|
}, /*#__PURE__*/React.createElement(ItemOption.ItemOption, {
|
@@ -222,7 +224,9 @@ const ConditionBlock = props => {
|
|
222
224
|
options: statementConfig,
|
223
225
|
isStatement: true
|
224
226
|
}
|
225
|
-
})), /*#__PURE__*/React.createElement(
|
227
|
+
})), /*#__PURE__*/React.createElement("div", {
|
228
|
+
className: `${util.blockClass}__condition-inner-block`
|
229
|
+
}, /*#__PURE__*/React.createElement(ConditionBuilderItem.ConditionBuilderItem, {
|
226
230
|
label: label ?? condition?.property,
|
227
231
|
title: propertyText,
|
228
232
|
renderIcon: icon ?? undefined,
|
@@ -260,7 +264,7 @@ const ConditionBlock = props => {
|
|
260
264
|
config: config,
|
261
265
|
onChange: onValueChangeHandler,
|
262
266
|
renderChildren: renderChildren
|
263
|
-
}), /*#__PURE__*/React.createElement("span", {
|
267
|
+
})), !readOnly && /*#__PURE__*/React.createElement("span", {
|
264
268
|
role: "gridcell",
|
265
269
|
"aria-label": removeConditionText
|
266
270
|
}, /*#__PURE__*/React.createElement(ConditionBuilderButton.ConditionBuilderButton, {
|
@@ -275,7 +279,7 @@ const ConditionBlock = props => {
|
|
275
279
|
className: `${util.blockClass}__close-condition`,
|
276
280
|
"data-name": "closeCondition",
|
277
281
|
wrapperClassName: `${util.blockClass}__close-condition-wrapper`
|
278
|
-
})), manageActionButtons(conditionIndex, group.conditions)
|
282
|
+
})), !readOnly && manageActionButtons(conditionIndex, group.conditions) ? /*#__PURE__*/React.createElement(ConditionBuilderAdd.default, {
|
279
283
|
onClick: () => {
|
280
284
|
addConditionHandler?.(conditionIndex);
|
281
285
|
},
|
@@ -289,7 +293,7 @@ const ConditionBlock = props => {
|
|
289
293
|
hideConditionPreviewHandler: hideConditionPreviewHandler,
|
290
294
|
className: `${util.blockClass}__gap ${util.blockClass}__gap-left`,
|
291
295
|
group: group
|
292
|
-
}));
|
296
|
+
}) : null);
|
293
297
|
};
|
294
298
|
ConditionBlock.propTypes = {
|
295
299
|
/**
|
@@ -59,6 +59,7 @@ exports.ConditionBuilder = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
59
59
|
translateWithId,
|
60
60
|
statementConfigCustom,
|
61
61
|
onAddItem,
|
62
|
+
readOnly,
|
62
63
|
...rest
|
63
64
|
} = _ref;
|
64
65
|
const localRef = React.useRef(null);
|
@@ -74,14 +75,16 @@ exports.ConditionBuilder = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
74
75
|
translateWithId: translateWithId,
|
75
76
|
conditionBuilderRef: conditionBuilderRef,
|
76
77
|
statementConfigCustom: statementConfigCustom,
|
77
|
-
onAddItem: onAddItem
|
78
|
+
onAddItem: onAddItem,
|
79
|
+
readOnly: !!readOnly
|
78
80
|
}, /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
79
81
|
className: cx(util.blockClass,
|
80
82
|
// Apply the block class to the main HTML element
|
81
83
|
className,
|
82
84
|
// Apply any supplied class names to the main HTML element.
|
83
|
-
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
84
85
|
{
|
86
|
+
[`${util.blockClass}__readonly`]: readOnly
|
87
|
+
}, {
|
85
88
|
// switched classes dependant on props or state
|
86
89
|
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
87
90
|
}),
|
@@ -175,6 +178,8 @@ exports.ConditionBuilder.propTypes = {
|
|
175
178
|
type: index.default.oneOf(['text', 'textarea', 'number', 'date', 'option', 'time', 'custom']).isRequired,
|
176
179
|
description: index.default.string,
|
177
180
|
//will be displayed on hover of property field
|
181
|
+
getIsDisabled: index.default.func,
|
182
|
+
getIsHidden: index.default.func,
|
178
183
|
config: index.default.shape({
|
179
184
|
options: index.default.arrayOf(index.default.shape({
|
180
185
|
id: index.default.string.isRequired,
|
@@ -199,6 +204,10 @@ exports.ConditionBuilder.propTypes = {
|
|
199
204
|
* Provide an mandatory numeric value that will be used to enable search option in the popovers with list.
|
200
205
|
*/
|
201
206
|
popOverSearchThreshold: index.default.number.isRequired,
|
207
|
+
/**
|
208
|
+
* Whether the conditionBuilder should be readOnly
|
209
|
+
*/
|
210
|
+
readOnly: index.default.bool,
|
202
211
|
/**
|
203
212
|
* Provide a label to the button that starts condition builder
|
204
213
|
*/
|