@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
@@ -7,65 +7,59 @@
|
|
7
7
|
import React, { ReactNode } from 'react';
|
8
8
|
export interface AboutModalProps {
|
9
9
|
/**
|
10
|
-
*
|
11
|
-
*
|
12
|
-
* Additional information will be displayed in the footer.
|
10
|
+
* Provide additional detail for the modal footer, such as logos of
|
11
|
+
* technologies used in the product, legally required for some products
|
13
12
|
*/
|
14
13
|
additionalInfo?: ReactNode;
|
15
14
|
/**
|
16
|
-
*
|
15
|
+
* Specify an optional className to be applied to the modal root node
|
17
16
|
*/
|
18
17
|
className?: string;
|
19
18
|
/**
|
20
|
-
*
|
19
|
+
* Provide an accessible name for the close icon
|
21
20
|
*/
|
22
21
|
closeIconDescription: string;
|
23
22
|
/**
|
24
|
-
*
|
25
|
-
* legal information (optional)
|
23
|
+
* Provide any relevant product disclaimers or legal information
|
26
24
|
*/
|
27
25
|
content?: ReactNode;
|
28
26
|
/**
|
29
|
-
*
|
30
|
-
* product release to current year.
|
27
|
+
* Specify the first year of product release to the current year
|
31
28
|
*/
|
32
29
|
copyrightText: string;
|
33
30
|
/**
|
34
|
-
*
|
35
|
-
*
|
36
|
-
* the product information and not where users go to find help (optional)
|
31
|
+
* Provide an array of Carbon `Link`s for additional detail about the
|
32
|
+
* product
|
37
33
|
*/
|
38
34
|
links?: ReactNode[];
|
39
35
|
/**
|
40
|
-
*
|
36
|
+
* Provide a visual representation of the product
|
41
37
|
*/
|
42
38
|
logo: ReactNode;
|
43
39
|
/**
|
44
|
-
*
|
40
|
+
* Specify an aria-label for the modal
|
45
41
|
*/
|
46
42
|
modalAriaLabel?: string;
|
47
43
|
/**
|
48
|
-
*
|
49
|
-
*
|
44
|
+
* Specify an optional handler for closing modal. Returning `false`
|
45
|
+
* prevents the modal from closing
|
50
46
|
*/
|
51
47
|
onClose?: () => void | boolean;
|
52
48
|
/**
|
53
|
-
*
|
49
|
+
* Specify whether the modal is currently open
|
54
50
|
*/
|
55
51
|
open?: boolean;
|
56
52
|
/**
|
57
|
-
*
|
53
|
+
* Provide the DOM node where the modal should be rendered.
|
54
|
+
* Defaults to `document.body`
|
58
55
|
*/
|
59
56
|
portalTarget?: ReactNode;
|
60
57
|
/**
|
61
|
-
*
|
62
|
-
* consists of two discrete, but required, elements: the iconic
|
63
|
-
* IBM 8-bar logo represented alongside the IBM Services logotype.
|
64
|
-
* Please follow these guidelines to ensure proper execution.
|
58
|
+
* Provide the product name for the modal header
|
65
59
|
*/
|
66
60
|
title: ReactNode;
|
67
61
|
/**
|
68
|
-
*
|
62
|
+
* Provide the product’s version number
|
69
63
|
*/
|
70
64
|
version: string;
|
71
65
|
}
|
@@ -118,65 +118,59 @@ AboutModal.displayName = componentName;
|
|
118
118
|
// See https://www.npmjs.com/package/prop-types#usage.
|
119
119
|
AboutModal.propTypes = {
|
120
120
|
/**
|
121
|
-
*
|
122
|
-
*
|
123
|
-
* Additional information will be displayed in the footer.
|
121
|
+
* Provide additional detail for the modal footer, such as logos of
|
122
|
+
* technologies used in the product, legally required for some products
|
124
123
|
*/
|
125
124
|
additionalInfo: PropTypes.node,
|
126
125
|
/**
|
127
|
-
*
|
126
|
+
* Specify an optional className to be applied to the modal root node
|
128
127
|
*/
|
129
128
|
className: PropTypes.string,
|
130
129
|
/**
|
131
|
-
*
|
130
|
+
* Provide an accessible name for the close icon
|
132
131
|
*/
|
133
132
|
closeIconDescription: PropTypes.string.isRequired,
|
134
133
|
/**
|
135
|
-
*
|
136
|
-
* legal information (optional)
|
134
|
+
* Provide any relevant product disclaimers or legal information
|
137
135
|
*/
|
138
136
|
content: PropTypes.node,
|
139
137
|
/**
|
140
|
-
*
|
141
|
-
* product release to current year.
|
138
|
+
* Specify the first year of product release to the current year
|
142
139
|
*/
|
143
140
|
copyrightText: PropTypes.string.isRequired,
|
144
141
|
/**
|
145
|
-
*
|
146
|
-
*
|
147
|
-
* the product information and not where users go to find help (optional)
|
142
|
+
* Provide an array of Carbon `Link`s for additional detail about the
|
143
|
+
* product
|
148
144
|
*/
|
149
145
|
links: PropTypes.arrayOf(PropTypes.element),
|
150
146
|
/**
|
151
|
-
*
|
147
|
+
* Provide a visual representation of the product
|
152
148
|
*/
|
153
149
|
logo: PropTypes.node.isRequired,
|
154
150
|
/**
|
155
|
-
*
|
151
|
+
* Specify an aria-label for the modal
|
156
152
|
*/
|
157
153
|
modalAriaLabel: PropTypes.string,
|
158
154
|
/**
|
159
|
-
*
|
160
|
-
*
|
155
|
+
* Specify an optional handler for closing modal. Returning `false`
|
156
|
+
* prevents the modal from closing
|
161
157
|
*/
|
162
158
|
onClose: PropTypes.func,
|
163
159
|
/**
|
164
|
-
*
|
160
|
+
* Specify whether the modal is currently open
|
165
161
|
*/
|
166
162
|
open: PropTypes.bool,
|
167
163
|
/**
|
168
|
-
*
|
164
|
+
* Provide the DOM node where the modal should be rendered.
|
165
|
+
* Defaults to `document.body`
|
169
166
|
*/
|
170
167
|
portalTarget: PropTypes.node,
|
171
168
|
/**
|
172
|
-
*
|
173
|
-
* consists of two discrete, but required, elements: the iconic
|
174
|
-
* IBM 8-bar logo represented alongside the IBM Services logotype.
|
175
|
-
* Please follow these guidelines to ensure proper execution.
|
169
|
+
* Provide the product name for the modal header
|
176
170
|
*/
|
177
171
|
title: PropTypes.node.isRequired,
|
178
172
|
/**
|
179
|
-
*
|
173
|
+
* Provide the product’s version number
|
180
174
|
*/
|
181
175
|
version: PropTypes.string.isRequired
|
182
176
|
};
|
@@ -13,7 +13,7 @@ import { Tag } from '@carbon/react';
|
|
13
13
|
import { Tearsheet } from '../Tearsheet/Tearsheet.js';
|
14
14
|
import { TearsheetNarrow } from '../Tearsheet/TearsheetNarrow.js';
|
15
15
|
import '../EmptyStates/EmptyState.js';
|
16
|
-
import '../EmptyStates/EmptyStateV2.js';
|
16
|
+
import '../EmptyStates/EmptyStateV2.deprecated.js';
|
17
17
|
import '../EmptyStates/ErrorEmptyState/ErrorEmptyState.js';
|
18
18
|
import '../EmptyStates/NoDataEmptyState/NoDataEmptyState.js';
|
19
19
|
import '../EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js';
|
@@ -160,7 +160,7 @@ const Carousel = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
160
160
|
}, [handleOnScroll]);
|
161
161
|
const handleScrollToView = useCallback(itemNumber => {
|
162
162
|
updateAriaHiddenTabIndex(itemNumber);
|
163
|
-
childElementsRef.current[itemNumber]
|
163
|
+
childElementsRef.current[itemNumber]?.scrollIntoView();
|
164
164
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
165
165
|
}, []);
|
166
166
|
const getFocusableElements = container => {
|
@@ -78,6 +78,10 @@ export interface CoachmarkProps {
|
|
78
78
|
* Does nothing if `overlayKind=stacked`.
|
79
79
|
*/
|
80
80
|
isOpenByDefault?: boolean;
|
81
|
+
/**
|
82
|
+
* Tooltip text and aria label for the Close button icon.
|
83
|
+
*/
|
84
|
+
closeIconDescription?: string;
|
81
85
|
}
|
82
86
|
/**
|
83
87
|
* Coachmarks are used to call out specific functionality or concepts
|
@@ -29,7 +29,8 @@ const defaults = {
|
|
29
29
|
onClose: () => {},
|
30
30
|
overlayKind: 'tooltip',
|
31
31
|
theme: 'light',
|
32
|
-
isOpenByDefault: false
|
32
|
+
isOpenByDefault: false,
|
33
|
+
closeIconDescription: ''
|
33
34
|
};
|
34
35
|
/**
|
35
36
|
* Coachmarks are used to call out specific functionality or concepts
|
@@ -52,6 +53,7 @@ let Coachmark = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
52
53
|
target,
|
53
54
|
theme = defaults.theme,
|
54
55
|
isOpenByDefault = defaults.isOpenByDefault,
|
56
|
+
closeIconDescription = defaults.closeIconDescription,
|
55
57
|
// Collect any other property values passed in.
|
56
58
|
...rest
|
57
59
|
} = _ref;
|
@@ -132,7 +134,8 @@ let Coachmark = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
132
134
|
targetOffset: targetOffset,
|
133
135
|
align: align,
|
134
136
|
positionTune: positionTune,
|
135
|
-
isOpen: isOpen
|
137
|
+
isOpen: isOpen,
|
138
|
+
closeIconDescription
|
136
139
|
};
|
137
140
|
const handleResize = throttle(() => {
|
138
141
|
closeOverlay();
|
@@ -280,6 +283,10 @@ Coachmark.propTypes = {
|
|
280
283
|
* Optional class name for this component.
|
281
284
|
*/
|
282
285
|
className: PropTypes.string,
|
286
|
+
/**
|
287
|
+
* Tooltip text and aria label for the Close button icon.
|
288
|
+
*/
|
289
|
+
closeIconDescription: PropTypes.string,
|
283
290
|
/**
|
284
291
|
* Determines if the coachmark is open by default.
|
285
292
|
* Does nothing if `overlayKind=stacked`.
|
@@ -10,10 +10,6 @@ interface CoachmarkDragbarProps {
|
|
10
10
|
* Handler to manage keyboard interactions with the dragbar.
|
11
11
|
*/
|
12
12
|
a11yKeyboardHandler: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
13
|
-
/**
|
14
|
-
* Tooltip text and aria label for the Close button icon.
|
15
|
-
*/
|
16
|
-
closeIconDescription?: string;
|
17
13
|
/**
|
18
14
|
* Function to call when the close button is clicked.
|
19
15
|
*/
|
@@ -13,6 +13,7 @@ import { Draggable, Close } from '@carbon/react/icons';
|
|
13
13
|
import { Button } from '@carbon/react';
|
14
14
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
15
15
|
import { pkg } from '../../settings.js';
|
16
|
+
import { useCoachmark } from './utils/context.js';
|
16
17
|
|
17
18
|
var _Draggable;
|
18
19
|
|
@@ -24,7 +25,6 @@ const blockClass = `${pkg.prefix}--coachmark-dragbar`;
|
|
24
25
|
const overlayBlockClass = `${pkg.prefix}--coachmark-overlay`;
|
25
26
|
const componentName = 'CoachmarkDragbar';
|
26
27
|
const defaults = {
|
27
|
-
closeIconDescription: 'Close',
|
28
28
|
onDrag: () => {},
|
29
29
|
onClose: () => {},
|
30
30
|
showCloseButton: true,
|
@@ -37,7 +37,6 @@ const defaults = {
|
|
37
37
|
let CoachmarkDragbar = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
38
38
|
let {
|
39
39
|
a11yKeyboardHandler,
|
40
|
-
closeIconDescription = defaults.closeIconDescription,
|
41
40
|
onClose = defaults.onClose,
|
42
41
|
onDrag = defaults.onDrag,
|
43
42
|
showCloseButton = defaults.showCloseButton,
|
@@ -64,6 +63,7 @@ let CoachmarkDragbar = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
64
63
|
};
|
65
64
|
}, [isDragging, onDrag]);
|
66
65
|
const handleDragStart = () => setIsDragging(true);
|
66
|
+
const closeIconDescription = useCoachmark()?.closeIconDescription;
|
67
67
|
return /*#__PURE__*/React__default.createElement("header", _extends({}, rest, {
|
68
68
|
className: cx(blockClass,
|
69
69
|
// Apply the block class to the main HTML element
|
@@ -110,10 +110,6 @@ CoachmarkDragbar.propTypes = {
|
|
110
110
|
* Handler to manage keyboard interactions with the dragbar.
|
111
111
|
*/
|
112
112
|
a11yKeyboardHandler: PropTypes.func.isRequired,
|
113
|
-
/**
|
114
|
-
* Tooltip text and aria label for the Close button icon.
|
115
|
-
*/
|
116
|
-
closeIconDescription: PropTypes.string,
|
117
113
|
/**
|
118
114
|
* Function to call when the close button is clicked.
|
119
115
|
*/
|
@@ -13,13 +13,13 @@ import { Close } from '@carbon/react/icons';
|
|
13
13
|
import { Button } from '@carbon/react';
|
14
14
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
15
15
|
import { pkg } from '../../settings.js';
|
16
|
+
import { useCoachmark } from './utils/context.js';
|
16
17
|
|
17
18
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
18
19
|
const blockClass = `${pkg.prefix}--coachmark-header`;
|
19
20
|
const overlayBlockClass = `${pkg.prefix}--coachmark-overlay`;
|
20
21
|
const componentName = 'CoachmarkHeader';
|
21
22
|
const defaults = {
|
22
|
-
closeIconDescription: 'Close',
|
23
23
|
onClose: () => {},
|
24
24
|
showCloseButton: true,
|
25
25
|
theme: 'light'
|
@@ -30,13 +30,13 @@ const defaults = {
|
|
30
30
|
*/
|
31
31
|
let CoachmarkHeader = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
32
32
|
let {
|
33
|
-
closeIconDescription = defaults.closeIconDescription,
|
34
33
|
onClose = defaults.onClose,
|
35
34
|
showCloseButton = defaults.showCloseButton,
|
36
35
|
theme = defaults.theme,
|
37
36
|
// Collect any other property values passed in.
|
38
37
|
...rest
|
39
38
|
} = _ref;
|
39
|
+
const closeIconDescription = useCoachmark()?.closeIconDescription;
|
40
40
|
return /*#__PURE__*/React__default.createElement("header", _extends({}, rest, {
|
41
41
|
className: cx(blockClass, `${blockClass}__${theme}`),
|
42
42
|
ref: ref
|
@@ -21,9 +21,9 @@ var _Idea;
|
|
21
21
|
const blockClass = `${pkg.prefix}--coachmark-tagline`;
|
22
22
|
const componentName = 'CoachmarkTagline';
|
23
23
|
const defaults = {
|
24
|
-
closeIconDescription: 'Close',
|
25
24
|
onClose: () => {},
|
26
|
-
theme: 'light'
|
25
|
+
theme: 'light',
|
26
|
+
closeIconDescription: 'Close'
|
27
27
|
};
|
28
28
|
/**
|
29
29
|
* DO NOT USE. This component is for the exclusive use
|
@@ -38,6 +38,8 @@ let CoachmarkTagline = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
38
38
|
...rest
|
39
39
|
} = _ref;
|
40
40
|
const coachmark = useCoachmark();
|
41
|
+
const contextCloseIconDescription = useCoachmark()?.closeIconDescription;
|
42
|
+
const closeIconDesc = closeIconDescription ?? contextCloseIconDescription;
|
41
43
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
42
44
|
className: cx(blockClass, `${blockClass}__${theme}`, coachmark?.isOpen && `${blockClass}--is-open`),
|
43
45
|
ref: ref
|
@@ -55,7 +57,7 @@ let CoachmarkTagline = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
55
57
|
kind: "ghost",
|
56
58
|
size: "sm",
|
57
59
|
renderIcon: Close,
|
58
|
-
iconDescription:
|
60
|
+
iconDescription: closeIconDesc,
|
59
61
|
hasIconOnly: true,
|
60
62
|
className: `${blockClass}--close-btn`,
|
61
63
|
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 {};
|
@@ -6,16 +6,16 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, {
|
9
|
+
import React__default, { forwardRef, useRef, useState, useEffect } from 'react';
|
10
10
|
import PropTypes from '../../../../_virtual/index.js';
|
11
11
|
import cx from 'classnames';
|
12
12
|
import { getDevtoolsProps } from '../../../../global/js/utils/devtools.js';
|
13
|
-
import {
|
13
|
+
import { CoachmarkContext, blockClass } from './context.js';
|
14
14
|
import CoachmarkContent from './CoachmarkContent.js';
|
15
15
|
import { useIsomorphicEffect } from '../../../../global/js/hooks/useIsomorphicEffect.js';
|
16
16
|
|
17
17
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
18
|
-
|
18
|
+
|
19
19
|
const componentName = 'Coachmark';
|
20
20
|
|
21
21
|
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
@@ -31,21 +31,6 @@ const componentName = 'Coachmark';
|
|
31
31
|
|
32
32
|
// Define the type for Coachmark, extending it to include Trigger and Content
|
33
33
|
|
34
|
-
const CoachmarkContext = /*#__PURE__*/createContext({
|
35
|
-
open: false,
|
36
|
-
setOpen: () => {},
|
37
|
-
align: 'bottom',
|
38
|
-
triggerRef: {
|
39
|
-
current: null
|
40
|
-
},
|
41
|
-
position: {
|
42
|
-
x: 0,
|
43
|
-
y: 0
|
44
|
-
},
|
45
|
-
contentRef: null,
|
46
|
-
setContentRef: value => {},
|
47
|
-
floating: false
|
48
|
-
});
|
49
34
|
/**
|
50
35
|
* Coachmarks are used to call out specific functionality or concepts
|
51
36
|
* within the UI that may not be intuitive but are important for the
|
@@ -55,7 +40,6 @@ const Coachmark = /*#__PURE__*/forwardRef((props, ref) => {
|
|
55
40
|
const {
|
56
41
|
children,
|
57
42
|
className,
|
58
|
-
ariaLabel,
|
59
43
|
onClose,
|
60
44
|
align = 'bottom',
|
61
45
|
open,
|
@@ -90,6 +74,12 @@ const Coachmark = /*#__PURE__*/forwardRef((props, ref) => {
|
|
90
74
|
triggerRef.current = firstFocusable;
|
91
75
|
}
|
92
76
|
}, [children]);
|
77
|
+
useEffect(() => {
|
78
|
+
const el = triggerRef.current;
|
79
|
+
if (el) {
|
80
|
+
el.setAttribute('aria-expanded', String(!!open));
|
81
|
+
}
|
82
|
+
}, [open]);
|
93
83
|
useIsomorphicEffect(() => {
|
94
84
|
const {
|
95
85
|
x = 0,
|
@@ -128,7 +118,6 @@ const Coachmark = /*#__PURE__*/forwardRef((props, ref) => {
|
|
128
118
|
{
|
129
119
|
[`${blockClass}--floating`]: floating
|
130
120
|
}),
|
131
|
-
"aria-label": ariaLabel,
|
132
121
|
ref: setRef
|
133
122
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement("div", {
|
134
123
|
className: `${blockClass}--container`
|
@@ -148,10 +137,6 @@ Coachmark.propTypes = {
|
|
148
137
|
* Where to render the Coachmark relative to its target.
|
149
138
|
*/
|
150
139
|
align: PropTypes.string,
|
151
|
-
/**
|
152
|
-
* The aria label applied to the Coachmark component
|
153
|
-
*/
|
154
|
-
ariaLabel: PropTypes.string,
|
155
140
|
/**
|
156
141
|
* Provide the contents of the CoachmarkV2.
|
157
142
|
*/
|
@@ -160,10 +145,6 @@ Coachmark.propTypes = {
|
|
160
145
|
* Provide an optional class to be applied to the containing node.
|
161
146
|
*/
|
162
147
|
className: PropTypes.string,
|
163
|
-
/**
|
164
|
-
* Specifies whether the component is currently open.
|
165
|
-
*/
|
166
|
-
defaultOpen: PropTypes.bool,
|
167
148
|
/**
|
168
149
|
* Specifies whether the component is floating or not.
|
169
150
|
*/
|
@@ -172,6 +153,10 @@ Coachmark.propTypes = {
|
|
172
153
|
* Function to call when the close button is clicked.
|
173
154
|
*/
|
174
155
|
onClose: PropTypes.func,
|
156
|
+
/**
|
157
|
+
* Specifies whether the component is currently open.
|
158
|
+
*/
|
159
|
+
open: PropTypes.bool,
|
175
160
|
/**
|
176
161
|
* Fine tune the position of the target in pixels. Applies only to Beacons.
|
177
162
|
*/
|
@@ -182,4 +167,4 @@ Coachmark.propTypes = {
|
|
182
167
|
})
|
183
168
|
};
|
184
169
|
|
185
|
-
export { Coachmark
|
170
|
+
export { Coachmark };
|
@@ -13,7 +13,7 @@ import { pkg } from '../../../../../settings.js';
|
|
13
13
|
import { offset, flip, shift, arrow } from '../../../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js';
|
14
14
|
import { autoUpdate, computePosition } from '../../../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
|
15
15
|
|
16
|
-
const CoachmarkBubble = /*#__PURE__*/forwardRef(props => {
|
16
|
+
const CoachmarkBubble = /*#__PURE__*/forwardRef((props, ref) => {
|
17
17
|
const {
|
18
18
|
children,
|
19
19
|
align,
|
@@ -35,6 +35,9 @@ const CoachmarkBubble = /*#__PURE__*/forwardRef(props => {
|
|
35
35
|
useLayoutEffect(() => {
|
36
36
|
if (target) {
|
37
37
|
if (typeof target === 'string') {
|
38
|
+
if (target === '#' || target.trim() === '') {
|
39
|
+
return;
|
40
|
+
}
|
38
41
|
targetRef.current = document.querySelector(target);
|
39
42
|
} else if ('current' in target) {
|
40
43
|
targetRef.current = target.current;
|
@@ -102,8 +105,16 @@ const CoachmarkBubble = /*#__PURE__*/forwardRef(props => {
|
|
102
105
|
if (!target) {
|
103
106
|
return null;
|
104
107
|
}
|
108
|
+
const mergedRefs = node => {
|
109
|
+
tooltipRef.current = node;
|
110
|
+
if (typeof ref === 'function') {
|
111
|
+
ref(node);
|
112
|
+
} else if (ref) {
|
113
|
+
ref.current = node;
|
114
|
+
}
|
115
|
+
};
|
105
116
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
106
|
-
ref:
|
117
|
+
ref: mergedRefs,
|
107
118
|
className: cx({
|
108
119
|
[`${carbonPrefix}--g100`]: theme === 'white' && highContrast || theme === 'g100' && !highContrast,
|
109
120
|
[`${carbonPrefix}--g90`]: theme === 'g10' && highContrast || theme === 'g90' && !highContrast,
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelp
|
|
9
9
|
import React__default, { forwardRef, useContext, useRef, useEffect } from 'react';
|
10
10
|
import PropTypes from '../../../../_virtual/index.js';
|
11
11
|
import { pkg } from '../../../../settings.js';
|
12
|
-
import { CoachmarkContext, blockClass } from './
|
12
|
+
import { CoachmarkContext, blockClass } from './context.js';
|
13
13
|
import { CoachmarkBubble } from './CoachmarkBubble/CoachmarkBubble.js';
|
14
14
|
import './CoachmarkBubble/CoachmarkBubbleHeader.js';
|
15
15
|
import ContentHeader from './ContentHeader.js';
|
@@ -40,7 +40,7 @@ const CoachmarkContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
40
40
|
useEffect(() => {
|
41
41
|
if (open && bubbleRef.current) {
|
42
42
|
requestAnimationFrame(() => {
|
43
|
-
const contentBody = bubbleRef.current
|
43
|
+
const contentBody = bubbleRef.current?.querySelector(`.${contentBodyClass}`);
|
44
44
|
if (contentBody) {
|
45
45
|
const firstFocusable = Array.from(contentBody.querySelectorAll('*')).find(el => el.tabIndex >= 0);
|
46
46
|
firstFocusable?.focus();
|
@@ -8,7 +8,7 @@
|
|
8
8
|
import React__default, { forwardRef } from 'react';
|
9
9
|
import PropTypes from '../../../../_virtual/index.js';
|
10
10
|
import cx from 'classnames';
|
11
|
-
import { blockClass } from './
|
11
|
+
import { blockClass } from './context.js';
|
12
12
|
|
13
13
|
const ContentBody = /*#__PURE__*/forwardRef((props, ref) => {
|
14
14
|
const {
|
@@ -10,7 +10,7 @@ import { Button } from '@carbon/react';
|
|
10
10
|
import React__default, { forwardRef, useContext, useRef, useEffect } from 'react';
|
11
11
|
import PropTypes from '../../../../_virtual/index.js';
|
12
12
|
import cx from 'classnames';
|
13
|
-
import { CoachmarkContext, blockClass } from './
|
13
|
+
import { CoachmarkContext, blockClass } from './context.js';
|
14
14
|
import './CoachmarkBubble/CoachmarkBubble.js';
|
15
15
|
import { CoachmarkBubbleHeader } from './CoachmarkBubble/CoachmarkBubbleHeader.js';
|
16
16
|
import { Draggable, Close } from '@carbon/react/icons';
|
@@ -45,6 +45,20 @@ const ContentHeader = /*#__PURE__*/forwardRef((props, ref) => {
|
|
45
45
|
dragHandle: handleRef.current,
|
46
46
|
focusableDragHandle: dragRef.current
|
47
47
|
});
|
48
|
+
const onDragStart = () => {
|
49
|
+
if (contentRef) {
|
50
|
+
contentRef.classList.add(`${contentHeaderBlockClass}--is-dragging`);
|
51
|
+
contentRef.setAttribute('aria-label', 'Coachmark is being dragged');
|
52
|
+
}
|
53
|
+
};
|
54
|
+
const onDragEnd = () => {
|
55
|
+
if (contentRef) {
|
56
|
+
contentRef.classList.remove(`${contentHeaderBlockClass}--is-dragging`);
|
57
|
+
contentRef.removeAttribute('aria-label');
|
58
|
+
}
|
59
|
+
};
|
60
|
+
contentRef.addEventListener('dragstart', onDragStart);
|
61
|
+
contentRef.addEventListener('dragend', onDragEnd);
|
48
62
|
}
|
49
63
|
});
|
50
64
|
return /*#__PURE__*/React__default.createElement(CoachmarkBubbleHeader, _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 {};
|