@carbon/ibm-products 2.92.1 → 2.93.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 +99 -20
- 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 +70 -20
- 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 +99 -20
- 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 +70 -20
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/Coachmark/next/Coachmark/Coachmark.d.ts +9 -12
- package/es/components/Coachmark/next/Coachmark/Coachmark.d.ts.map +1 -1
- package/es/components/Coachmark/next/Coachmark/Coachmark.js +16 -27
- package/es/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts +1 -1
- package/es/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts.map +1 -1
- package/es/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.js +3 -4
- package/es/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts +8 -4
- package/es/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts.map +1 -1
- package/es/components/Coachmark/next/Coachmark/CoachmarkContent.js +19 -5
- package/es/components/Coachmark/next/Coachmark/{ContentBody.d.ts → CoachmarkContentBody.d.ts} +5 -5
- package/es/components/Coachmark/next/Coachmark/CoachmarkContentBody.d.ts.map +1 -0
- package/es/components/Coachmark/next/Coachmark/{ContentBody.js → CoachmarkContentBody.js} +10 -6
- package/{lib/components/Coachmark/next/Coachmark/ContentHeader.d.ts → es/components/Coachmark/next/Coachmark/CoachmarkContentHeader.d.ts} +7 -3
- package/es/components/Coachmark/next/Coachmark/CoachmarkContentHeader.d.ts.map +1 -0
- package/es/components/Coachmark/next/Coachmark/{ContentHeader.js → CoachmarkContentHeader.js} +55 -12
- package/es/components/Coachmark/next/Coachmark/CoachmarkTagline/CoachmarkTagline.d.ts.map +1 -1
- package/es/components/Coachmark/next/Coachmark/CoachmarkTagline/CoachmarkTagline.js +2 -2
- package/es/components/Coachmark/next/Coachmark/index.d.ts +5 -4
- package/es/components/Coachmark/next/Coachmark/index.d.ts.map +1 -1
- package/es/components/ExpressiveCard/ExpressiveCard.d.ts +3 -3
- package/es/components/ExpressiveCard/ExpressiveCard.d.ts.map +1 -1
- package/es/components/ExpressiveCard/ExpressiveCard.js +3 -15
- package/es/components/InterstitialScreen/InterstitialScreenBody.js +1 -1
- package/es/components/PageHeader/next/PageHeader.d.ts.map +1 -1
- package/es/components/PageHeader/next/PageHeader.js +6 -2
- package/es/components/PageHeader/next/PageHeaderTabBar.d.ts +4 -0
- package/es/components/PageHeader/next/PageHeaderTabBar.d.ts.map +1 -1
- package/es/components/PageHeader/next/PageHeaderTabBar.js +7 -2
- package/es/components/PageHeader/next/context.d.ts +2 -0
- package/es/components/PageHeader/next/context.d.ts.map +1 -1
- package/es/components/PageHeader/next/context.js +3 -1
- package/es/components/ProductiveCard/ProductiveCard.d.ts +3 -3
- package/es/components/ProductiveCard/ProductiveCard.d.ts.map +1 -1
- package/es/components/ProductiveCard/ProductiveCard.js +3 -15
- package/es/components/Tearsheet/TearsheetShell.d.ts.map +1 -1
- package/es/components/Tearsheet/TearsheetShell.js +17 -8
- package/es/components/Tearsheet/next/Tearsheet.d.ts.map +1 -1
- package/es/components/Tearsheet/next/Tearsheet.js +21 -2
- package/es/components/Tearsheet/next/TearsheetBody.d.ts +16 -0
- package/es/components/Tearsheet/next/TearsheetBody.d.ts.map +1 -1
- package/es/components/Tearsheet/next/TearsheetBody.js +22 -4
- package/es/components/Tearsheet/next/TearsheetFooter.js +1 -1
- package/es/components/Tearsheet/next/TearsheetHeader.d.ts.map +1 -1
- package/es/components/Tearsheet/next/TearsheetHeader.js +3 -1
- package/es/components/Tearsheet/next/TearsheetHeaderActions.d.ts +1 -1
- package/es/components/Tearsheet/next/TearsheetHeaderActions.d.ts.map +1 -1
- package/es/components/Tearsheet/next/TearsheetHeaderActions.js +6 -3
- package/es/components/Tearsheet/next/TearsheetHeaderContent.d.ts.map +1 -1
- package/es/components/Tearsheet/next/TearsheetHeaderContent.js +9 -3
- package/es/components/Tearsheet/next/_story-assets/StepTearsheet.d.ts.map +1 -1
- package/es/components/Tearsheet/next/context.d.ts +1 -0
- package/es/components/Tearsheet/next/context.d.ts.map +1 -1
- package/es/components/Tearsheet/usePresence.d.ts.map +1 -1
- package/es/components/Tearsheet/usePresence.js +3 -2
- package/es/global/js/package-settings.d.ts +1 -0
- package/es/global/js/package-settings.d.ts.map +1 -1
- package/es/global/js/package-settings.js +1 -0
- package/es/global/js/utils/makeDraggable/makeDraggable.d.ts +8 -2
- package/es/global/js/utils/makeDraggable/makeDraggable.d.ts.map +1 -1
- package/es/global/js/utils/makeDraggable/makeDraggable.js +87 -17
- package/es/settings.d.ts +1 -0
- package/es/settings.d.ts.map +1 -1
- package/lib/components/Coachmark/next/Coachmark/Coachmark.d.ts +9 -12
- package/lib/components/Coachmark/next/Coachmark/Coachmark.d.ts.map +1 -1
- package/lib/components/Coachmark/next/Coachmark/Coachmark.js +16 -27
- package/lib/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts +1 -1
- package/lib/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.d.ts.map +1 -1
- package/lib/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.js +3 -4
- package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts +8 -4
- package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts.map +1 -1
- package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.js +19 -5
- package/lib/components/Coachmark/next/Coachmark/{ContentBody.d.ts → CoachmarkContentBody.d.ts} +5 -5
- package/lib/components/Coachmark/next/Coachmark/CoachmarkContentBody.d.ts.map +1 -0
- package/lib/components/Coachmark/next/Coachmark/{ContentBody.js → CoachmarkContentBody.js} +10 -6
- package/{es/components/Coachmark/next/Coachmark/ContentHeader.d.ts → lib/components/Coachmark/next/Coachmark/CoachmarkContentHeader.d.ts} +7 -3
- package/lib/components/Coachmark/next/Coachmark/CoachmarkContentHeader.d.ts.map +1 -0
- package/lib/components/Coachmark/next/Coachmark/{ContentHeader.js → CoachmarkContentHeader.js} +54 -11
- package/lib/components/Coachmark/next/Coachmark/CoachmarkTagline/CoachmarkTagline.d.ts.map +1 -1
- package/lib/components/Coachmark/next/Coachmark/CoachmarkTagline/CoachmarkTagline.js +2 -2
- package/lib/components/Coachmark/next/Coachmark/index.d.ts +5 -4
- package/lib/components/Coachmark/next/Coachmark/index.d.ts.map +1 -1
- package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +3 -3
- package/lib/components/ExpressiveCard/ExpressiveCard.d.ts.map +1 -1
- package/lib/components/ExpressiveCard/ExpressiveCard.js +3 -15
- package/lib/components/InterstitialScreen/InterstitialScreenBody.js +1 -1
- package/lib/components/PageHeader/next/PageHeader.d.ts.map +1 -1
- package/lib/components/PageHeader/next/PageHeader.js +6 -2
- package/lib/components/PageHeader/next/PageHeaderTabBar.d.ts +4 -0
- package/lib/components/PageHeader/next/PageHeaderTabBar.d.ts.map +1 -1
- package/lib/components/PageHeader/next/PageHeaderTabBar.js +6 -1
- package/lib/components/PageHeader/next/context.d.ts +2 -0
- package/lib/components/PageHeader/next/context.d.ts.map +1 -1
- package/lib/components/PageHeader/next/context.js +3 -1
- package/lib/components/ProductiveCard/ProductiveCard.d.ts +3 -3
- package/lib/components/ProductiveCard/ProductiveCard.d.ts.map +1 -1
- package/lib/components/ProductiveCard/ProductiveCard.js +3 -15
- package/lib/components/Tearsheet/TearsheetShell.d.ts.map +1 -1
- package/lib/components/Tearsheet/TearsheetShell.js +15 -6
- package/lib/components/Tearsheet/next/Tearsheet.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/Tearsheet.js +21 -2
- package/lib/components/Tearsheet/next/TearsheetBody.d.ts +16 -0
- package/lib/components/Tearsheet/next/TearsheetBody.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/TearsheetBody.js +22 -4
- package/lib/components/Tearsheet/next/TearsheetFooter.js +1 -1
- package/lib/components/Tearsheet/next/TearsheetHeader.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/TearsheetHeader.js +3 -1
- package/lib/components/Tearsheet/next/TearsheetHeaderActions.d.ts +1 -1
- package/lib/components/Tearsheet/next/TearsheetHeaderActions.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/TearsheetHeaderActions.js +5 -2
- package/lib/components/Tearsheet/next/TearsheetHeaderContent.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/TearsheetHeaderContent.js +9 -3
- package/lib/components/Tearsheet/next/_story-assets/StepTearsheet.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/context.d.ts +1 -0
- package/lib/components/Tearsheet/next/context.d.ts.map +1 -1
- package/lib/components/Tearsheet/usePresence.d.ts.map +1 -1
- package/lib/components/Tearsheet/usePresence.js +2 -1
- package/lib/global/js/package-settings.d.ts +1 -0
- package/lib/global/js/package-settings.d.ts.map +1 -1
- package/lib/global/js/package-settings.js +1 -0
- package/lib/global/js/utils/makeDraggable/makeDraggable.d.ts +8 -2
- package/lib/global/js/utils/makeDraggable/makeDraggable.d.ts.map +1 -1
- package/lib/global/js/utils/makeDraggable/makeDraggable.js +87 -17
- package/lib/settings.d.ts +1 -0
- package/lib/settings.d.ts.map +1 -1
- package/package.json +7 -7
- package/scss/components/Coachmark/_carbon-imports.scss +2 -1
- package/scss/components/Coachmark/_coachmark_next.scss +53 -0
- package/scss/components/Coachmark/_index.scss +4 -1
- package/scss/components/PageHeader/_page-header.scss +44 -8
- package/scss/components/Tearsheet/_tearsheet.scss +26 -2
- package/scss/components/Tearsheet/_tearsheet_next.scss +5 -0
- package/telemetry.yml +11 -3
- package/es/components/Coachmark/next/Coachmark/ContentBody.d.ts.map +0 -1
- package/es/components/Coachmark/next/Coachmark/ContentHeader.d.ts.map +0 -1
- package/lib/components/Coachmark/next/Coachmark/ContentBody.d.ts.map +0 -1
- package/lib/components/Coachmark/next/Coachmark/ContentHeader.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePresence.d.ts","sourceRoot":"","sources":["../../../src/components/Tearsheet/usePresence.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"usePresence.d.ts","sourceRoot":"","sources":["../../../src/components/Tearsheet/usePresence.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9D,eAAO,MAAM,WAAW,GACtB,KAAK,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,QAAQ,OAAO;IAgEb;;OAEG;;IAGH;;OAEG;;CAGN,CAAC"}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { pkg } from "../../settings.js";
|
|
9
|
-
import {
|
|
9
|
+
import { useIsomorphicEffect } from "../../global/js/hooks/useIsomorphicEffect.js";
|
|
10
|
+
import { useCallback, useState } from "react";
|
|
10
11
|
//#region src/components/Tearsheet/usePresence.ts
|
|
11
12
|
/**
|
|
12
13
|
* Copyright IBM Corp. 2025
|
|
@@ -22,7 +23,7 @@ const usePresence = (ref, isOpen) => {
|
|
|
22
23
|
const handleAnimationEnd = useCallback(() => {
|
|
23
24
|
setExitState("finished");
|
|
24
25
|
}, []);
|
|
25
|
-
|
|
26
|
+
useIsomorphicEffect(() => {
|
|
26
27
|
if (!ref.current || !isExiting) return;
|
|
27
28
|
if (!("getAnimations" in ref.current)) {
|
|
28
29
|
handleAnimationEnd();
|
|
@@ -108,6 +108,7 @@ declare namespace defaults {
|
|
|
108
108
|
let CoachmarkOverlayElement: boolean;
|
|
109
109
|
let CoachmarkOverlayElements: boolean;
|
|
110
110
|
let CoachmarkStack: boolean;
|
|
111
|
+
let CoachmarkTagline: boolean;
|
|
111
112
|
let Decorator: boolean;
|
|
112
113
|
let DecoratorLink: boolean;
|
|
113
114
|
let DecoratorSingleButton: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-settings.d.ts","sourceRoot":"","sources":["../../../src/global/js/package-settings.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-settings.d.ts","sourceRoot":"","sources":["../../../src/global/js/package-settings.js"],"names":[],"mappings":"AA8MA,0DAEC;AAJD,gCAAiC,yBAAyB,CAAC;;;;;;;;IAarC,mFAMnB;IAEkB,sFAOlB;IAEiB,6EAEjB;IAED,8EAOC;IAEgB,gFAKhB;IAEiB,qDAIjB;IAEe,mDAIf;IAEiB,mDAKjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA1FH;;;;;;;EAqBE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2025,
|
|
2
|
+
* Copyright IBM Corp. 2025, 2026
|
|
3
3
|
*
|
|
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.
|
|
@@ -30,10 +30,16 @@ interface DraggableProps {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Makes a given element draggable using a handle element.
|
|
33
|
-
|
|
33
|
+
* @param {object} draggable - Configuration object for draggable behavior
|
|
34
|
+
* @param {HTMLElement} draggable.el - The element to make draggable
|
|
35
|
+
* @param {HTMLElement} [draggable.dragHandle] - Optional handle element for dragging
|
|
36
|
+
* @param {boolean} [draggable.focusableDragHandle] - Whether the drag handle should be focusable
|
|
37
|
+
* @param {number} [draggable.dragStep] - Step size for keyboard dragging (default: 10)
|
|
38
|
+
* @param {number} [draggable.shiftDragStep] - Step size for keyboard dragging with Shift key (default: 50)
|
|
34
39
|
*/
|
|
35
40
|
export declare const makeDraggable: ({ el, dragHandle, focusableDragHandle, dragStep, shiftDragStep, }: DraggableProps) => {
|
|
36
41
|
cleanup: () => void;
|
|
42
|
+
init: () => void;
|
|
37
43
|
};
|
|
38
44
|
export {};
|
|
39
45
|
//# sourceMappingURL=makeDraggable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeDraggable.d.ts","sourceRoot":"","sources":["../../../../../src/global/js/utils/makeDraggable/makeDraggable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"makeDraggable.d.ts","sourceRoot":"","sources":["../../../../../src/global/js/utils/makeDraggable/makeDraggable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,UAAU,cAAc;IACtB;;OAEG;IACH,EAAE,EAAE,WAAW,CAAC;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB;;OAEG;IACH,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAQD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,mEAM3B,cAAc;;;CAqNhB,CAAC"}
|
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
//#region src/global/js/utils/makeDraggable/makeDraggable.ts
|
|
9
9
|
/**
|
|
10
10
|
* Makes a given element draggable using a handle element.
|
|
11
|
-
|
|
11
|
+
* @param {object} draggable - Configuration object for draggable behavior
|
|
12
|
+
* @param {HTMLElement} draggable.el - The element to make draggable
|
|
13
|
+
* @param {HTMLElement} [draggable.dragHandle] - Optional handle element for dragging
|
|
14
|
+
* @param {boolean} [draggable.focusableDragHandle] - Whether the drag handle should be focusable
|
|
15
|
+
* @param {number} [draggable.dragStep] - Step size for keyboard dragging (default: 10)
|
|
16
|
+
* @param {number} [draggable.shiftDragStep] - Step size for keyboard dragging with Shift key (default: 50)
|
|
12
17
|
*/
|
|
13
18
|
const makeDraggable = ({ el, dragHandle, focusableDragHandle, dragStep, shiftDragStep }) => {
|
|
14
19
|
if (dragHandle) {
|
|
@@ -20,6 +25,45 @@ const makeDraggable = ({ el, dragHandle, focusableDragHandle, dragStep, shiftDra
|
|
|
20
25
|
let currentY = 0;
|
|
21
26
|
let initialMouseX = 0;
|
|
22
27
|
let initialMouseY = 0;
|
|
28
|
+
let baseMatrix = null;
|
|
29
|
+
/**
|
|
30
|
+
* Syncs position and extracts base matrix from computed style.
|
|
31
|
+
* Reads from getComputedStyle() to include all transform sources (inline, classes, etc.).
|
|
32
|
+
*/
|
|
33
|
+
const syncTransformState = () => {
|
|
34
|
+
const transformString = window.getComputedStyle(el).transform;
|
|
35
|
+
if (!transformString || transformString === "none") {
|
|
36
|
+
currentX = 0;
|
|
37
|
+
currentY = 0;
|
|
38
|
+
baseMatrix = null;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const matrix = new DOMMatrix(transformString);
|
|
42
|
+
currentX = matrix.m41;
|
|
43
|
+
currentY = matrix.m42;
|
|
44
|
+
if (matrix.a === 1 && matrix.b === 0 && matrix.c === 0 && matrix.d === 1 && matrix.e === 0 && matrix.f === 0) baseMatrix = null;
|
|
45
|
+
else baseMatrix = new DOMMatrix([
|
|
46
|
+
matrix.a,
|
|
47
|
+
matrix.b,
|
|
48
|
+
matrix.c,
|
|
49
|
+
matrix.d,
|
|
50
|
+
0,
|
|
51
|
+
0
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
syncTransformState();
|
|
55
|
+
/**
|
|
56
|
+
* Applies transform by combining translation with base matrix using matrix multiplication.
|
|
57
|
+
*/
|
|
58
|
+
const applyTransform = (x, y) => {
|
|
59
|
+
if (baseMatrix) {
|
|
60
|
+
const translationMatrix = new DOMMatrix();
|
|
61
|
+
translationMatrix.m41 = x;
|
|
62
|
+
translationMatrix.m42 = y;
|
|
63
|
+
const combined = translationMatrix.multiply(baseMatrix);
|
|
64
|
+
el.style.transform = combined.toString();
|
|
65
|
+
} else el.style.transform = `translate(${x}px, ${y}px)`;
|
|
66
|
+
};
|
|
23
67
|
const dispatch = (type, detail) => {
|
|
24
68
|
const eventInit = {
|
|
25
69
|
detail,
|
|
@@ -28,13 +72,11 @@ const makeDraggable = ({ el, dragHandle, focusableDragHandle, dragStep, shiftDra
|
|
|
28
72
|
el.dispatchEvent(new CustomEvent(type, eventInit));
|
|
29
73
|
};
|
|
30
74
|
const onKeyDown = (e) => {
|
|
31
|
-
if (e.key === "Enter") {
|
|
75
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
76
|
+
e.preventDefault();
|
|
32
77
|
isDragging = !isDragging;
|
|
33
78
|
if (isDragging) {
|
|
34
|
-
|
|
35
|
-
const matrix = new DOMMatrix(style.transform);
|
|
36
|
-
currentX = matrix.m41;
|
|
37
|
-
currentY = matrix.m42;
|
|
79
|
+
syncTransformState();
|
|
38
80
|
dispatch("dragstart", { keyboard: true });
|
|
39
81
|
} else dispatch("dragend", { keyboard: true });
|
|
40
82
|
}
|
|
@@ -47,19 +89,35 @@ const makeDraggable = ({ el, dragHandle, focusableDragHandle, dragStep, shiftDra
|
|
|
47
89
|
break;
|
|
48
90
|
case "ArrowLeft":
|
|
49
91
|
currentX -= distance;
|
|
50
|
-
|
|
92
|
+
applyTransform(currentX, currentY);
|
|
93
|
+
dispatch("dragmove", {
|
|
94
|
+
direction: "left",
|
|
95
|
+
distance
|
|
96
|
+
});
|
|
51
97
|
break;
|
|
52
98
|
case "ArrowRight":
|
|
53
99
|
currentX += distance;
|
|
54
|
-
|
|
100
|
+
applyTransform(currentX, currentY);
|
|
101
|
+
dispatch("dragmove", {
|
|
102
|
+
direction: "right",
|
|
103
|
+
distance
|
|
104
|
+
});
|
|
55
105
|
break;
|
|
56
106
|
case "ArrowUp":
|
|
57
107
|
currentY -= distance;
|
|
58
|
-
|
|
108
|
+
applyTransform(currentX, currentY);
|
|
109
|
+
dispatch("dragmove", {
|
|
110
|
+
direction: "up",
|
|
111
|
+
distance
|
|
112
|
+
});
|
|
59
113
|
break;
|
|
60
114
|
case "ArrowDown":
|
|
61
115
|
currentY += distance;
|
|
62
|
-
|
|
116
|
+
applyTransform(currentX, currentY);
|
|
117
|
+
dispatch("dragmove", {
|
|
118
|
+
direction: "down",
|
|
119
|
+
distance
|
|
120
|
+
});
|
|
63
121
|
break;
|
|
64
122
|
}
|
|
65
123
|
};
|
|
@@ -67,10 +125,7 @@ const makeDraggable = ({ el, dragHandle, focusableDragHandle, dragStep, shiftDra
|
|
|
67
125
|
const target = e.target;
|
|
68
126
|
if (!(target instanceof Node)) return;
|
|
69
127
|
if (!(dragHandle ? dragHandle.contains(target) : el.contains(target))) return;
|
|
70
|
-
|
|
71
|
-
const matrix = new DOMMatrix(style.transform);
|
|
72
|
-
currentX = matrix.m41;
|
|
73
|
-
currentY = matrix.m42;
|
|
128
|
+
syncTransformState();
|
|
74
129
|
initialMouseX = e.clientX;
|
|
75
130
|
initialMouseY = e.clientY;
|
|
76
131
|
isDragging = true;
|
|
@@ -82,10 +137,14 @@ const makeDraggable = ({ el, dragHandle, focusableDragHandle, dragStep, shiftDra
|
|
|
82
137
|
if (!isDragging) return;
|
|
83
138
|
const dx = e.clientX - initialMouseX;
|
|
84
139
|
const dy = e.clientY - initialMouseY;
|
|
85
|
-
|
|
140
|
+
applyTransform(currentX + dx, currentY + dy);
|
|
86
141
|
};
|
|
87
|
-
const onMouseUp = () => {
|
|
142
|
+
const onMouseUp = (e) => {
|
|
88
143
|
if (!isDragging) return;
|
|
144
|
+
const dx = e.clientX - initialMouseX;
|
|
145
|
+
const dy = e.clientY - initialMouseY;
|
|
146
|
+
currentX += dx;
|
|
147
|
+
currentY += dy;
|
|
89
148
|
isDragging = false;
|
|
90
149
|
dispatch("dragend", { mouse: true });
|
|
91
150
|
document.removeEventListener("mousemove", onMouseMove);
|
|
@@ -100,7 +159,18 @@ const makeDraggable = ({ el, dragHandle, focusableDragHandle, dragStep, shiftDra
|
|
|
100
159
|
document.removeEventListener("mousemove", onMouseMove);
|
|
101
160
|
document.removeEventListener("mouseup", onMouseUp);
|
|
102
161
|
};
|
|
103
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Re-initialize the draggable position from the element's current computed transform.
|
|
164
|
+
* Call this if the element has been repositioned externally (e.g., via CSS animation,
|
|
165
|
+
* class changes, or other scripts) to prevent position jumps on the next drag.
|
|
166
|
+
*/
|
|
167
|
+
const init = () => {
|
|
168
|
+
syncTransformState();
|
|
169
|
+
};
|
|
170
|
+
return {
|
|
171
|
+
cleanup: draggableCleanup,
|
|
172
|
+
init
|
|
173
|
+
};
|
|
104
174
|
};
|
|
105
175
|
//#endregion
|
|
106
176
|
export { makeDraggable };
|
package/es/settings.d.ts
CHANGED
package/es/settings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.js"],"names":[],"mappings":";;;;AAmGA
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.js"],"names":[],"mappings":";;;;AAmGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA+B"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2024,
|
|
2
|
+
* Copyright IBM Corp. 2024, 2026
|
|
3
3
|
*
|
|
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 { FC, ForwardRefExoticComponent, ReactNode, RefAttributes
|
|
7
|
+
import { FC, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
8
8
|
import { CoachmarkContentProps } from './CoachmarkContent';
|
|
9
9
|
import { NewPopoverAlignment } from '@carbon/react';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { CoachmarkContentHeaderProps } from './CoachmarkContentHeader';
|
|
11
|
+
import { CoachmarkContentBodyProps } from './CoachmarkContentBody';
|
|
12
12
|
export interface CoachmarkPropsNext {
|
|
13
13
|
/**
|
|
14
14
|
* Provide the contents of the Coachmark.
|
|
@@ -59,16 +59,14 @@ export interface CoachmarkPropsNext {
|
|
|
59
59
|
*/
|
|
60
60
|
selectorPrimaryFocus?: string;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* Prevents the Coachmark from closing when clicking outside of it.
|
|
63
63
|
*/
|
|
64
|
-
|
|
64
|
+
preventCloseOnClickOutside?: boolean;
|
|
65
65
|
}
|
|
66
|
-
type CoachmarkContentComponent = FC<CoachmarkContentProps> & {
|
|
67
|
-
Header: FC<ContentHeaderProps>;
|
|
68
|
-
Body: FC<ContentBodyProps>;
|
|
69
|
-
};
|
|
70
66
|
export type CoachmarkComponent = ForwardRefExoticComponent<CoachmarkPropsNext & RefAttributes<HTMLDivElement>> & {
|
|
71
|
-
Content:
|
|
67
|
+
Content: FC<CoachmarkContentProps>;
|
|
68
|
+
ContentHeader: FC<CoachmarkContentHeaderProps>;
|
|
69
|
+
ContentBody: FC<CoachmarkContentBodyProps>;
|
|
72
70
|
};
|
|
73
71
|
/**
|
|
74
72
|
* Coachmarks are used to call out specific functionality or concepts
|
|
@@ -76,5 +74,4 @@ export type CoachmarkComponent = ForwardRefExoticComponent<CoachmarkPropsNext &
|
|
|
76
74
|
* user to gain understanding of the product's main value and discover new use cases.
|
|
77
75
|
*/
|
|
78
76
|
export declare const Coachmark: CoachmarkComponent;
|
|
79
|
-
export {};
|
|
80
77
|
//# sourceMappingURL=Coachmark.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Coachmark.d.ts","sourceRoot":"","sources":["../../../../../src/components/Coachmark/next/Coachmark/Coachmark.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EACZ,EAAE,EACF,yBAAyB,EACzB,SAAS,EACT,aAAa,
|
|
1
|
+
{"version":3,"file":"Coachmark.d.ts","sourceRoot":"","sources":["../../../../../src/components/Coachmark/next/Coachmark/Coachmark.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EACZ,EAAE,EACF,yBAAyB,EACzB,SAAS,EACT,aAAa,EAMd,MAAM,OAAO,CAAC;AAOf,OAAyB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAW,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAiBhC,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAGD,MAAM,MAAM,kBAAkB,GAAG,yBAAyB,CACxD,kBAAkB,GAAG,aAAa,CAAC,cAAc,CAAC,CACnD,GAAG;IACF,OAAO,EAAE,EAAE,CAAC,qBAAqB,CAAC,CAAC;IACnC,aAAa,EAAE,EAAE,CAAC,2BAA2B,CAAC,CAAC;IAC/C,WAAW,EAAE,EAAE,CAAC,yBAAyB,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EA4IjB,kBAAkB,CAAC"}
|
|
@@ -11,8 +11,8 @@ const require_useIsomorphicEffect = require("../../../../global/js/hooks/useIsom
|
|
|
11
11
|
const require_devtools = require("../../../../global/js/utils/devtools.js");
|
|
12
12
|
const require_context = require("./context.js");
|
|
13
13
|
const require_CoachmarkContent = require("./CoachmarkContent.js");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const require_CoachmarkContentHeader = require("./CoachmarkContentHeader.js");
|
|
15
|
+
const require_CoachmarkContentBody = require("./CoachmarkContentBody.js");
|
|
16
16
|
let react = require("react");
|
|
17
17
|
react = require_runtime.__toESM(react);
|
|
18
18
|
let prop_types = require("prop-types");
|
|
@@ -20,7 +20,7 @@ prop_types = require_runtime.__toESM(prop_types);
|
|
|
20
20
|
let _carbon_react = require("@carbon/react");
|
|
21
21
|
//#region src/components/Coachmark/next/Coachmark/Coachmark.tsx
|
|
22
22
|
/**
|
|
23
|
-
* Copyright IBM Corp. 2024,
|
|
23
|
+
* Copyright IBM Corp. 2024, 2026
|
|
24
24
|
*
|
|
25
25
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
26
26
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -36,12 +36,12 @@ const Coachmark = (0, react.forwardRef)((props, ref) => {
|
|
|
36
36
|
const { children, className, onClose, align = "bottom", open, position = {
|
|
37
37
|
x: 0,
|
|
38
38
|
y: 0
|
|
39
|
-
}, floating, dropShadow, highContrast, caret, selectorPrimaryFocus,
|
|
40
|
-
const
|
|
41
|
-
const triggerRef = triggerRefProp ?? internalTriggerRef;
|
|
39
|
+
}, floating, dropShadow, highContrast, caret, selectorPrimaryFocus, preventCloseOnClickOutside, ...rest } = props;
|
|
40
|
+
const triggerRef = (0, react.useRef)(null);
|
|
42
41
|
const internalRef = (0, react.useRef)(null);
|
|
43
42
|
const [contentRef, setContentRef] = (0, react.useState)(null);
|
|
44
43
|
const [openState, setOpenState] = (0, react.useState)(false);
|
|
44
|
+
const shouldPreventClose = preventCloseOnClickOutside !== void 0 ? preventCloseOnClickOutside : floating === true;
|
|
45
45
|
const setOpen = (value) => {
|
|
46
46
|
if (!value) onClose?.();
|
|
47
47
|
if (open === void 0) setOpenState(value);
|
|
@@ -49,16 +49,11 @@ const Coachmark = (0, react.forwardRef)((props, ref) => {
|
|
|
49
49
|
const currentOpen = open ?? openState;
|
|
50
50
|
const caretValue = caret !== void 0 ? caret : floating === true ? false : true;
|
|
51
51
|
(0, react.useEffect)(() => {
|
|
52
|
-
if (triggerRefProp?.current) return;
|
|
53
52
|
const container = internalRef.current;
|
|
54
53
|
if (!container) return;
|
|
55
54
|
const firstFocusable = Array.from(container.querySelectorAll("*")).find((el) => el.tabIndex >= 0 && !el.hasAttribute("disabled"));
|
|
56
55
|
if (firstFocusable) triggerRef.current = firstFocusable;
|
|
57
|
-
}, [
|
|
58
|
-
children,
|
|
59
|
-
triggerRef,
|
|
60
|
-
triggerRefProp
|
|
61
|
-
]);
|
|
56
|
+
}, [children, triggerRef]);
|
|
62
57
|
(0, react.useEffect)(() => {
|
|
63
58
|
const el = triggerRef.current;
|
|
64
59
|
if (el) el.setAttribute("aria-expanded", String(!!open));
|
|
@@ -84,8 +79,8 @@ const Coachmark = (0, react.forwardRef)((props, ref) => {
|
|
|
84
79
|
if (typeof ref === "function") ref(node);
|
|
85
80
|
else if (ref) ref.current = node;
|
|
86
81
|
};
|
|
87
|
-
const handleRequestClose = (
|
|
88
|
-
if (
|
|
82
|
+
const handleRequestClose = () => {
|
|
83
|
+
if (shouldPreventClose) return;
|
|
89
84
|
onClose?.();
|
|
90
85
|
setOpen(false);
|
|
91
86
|
};
|
|
@@ -112,17 +107,11 @@ const Coachmark = (0, react.forwardRef)((props, ref) => {
|
|
|
112
107
|
caret: caretValue,
|
|
113
108
|
highContrast: highContrast ?? true,
|
|
114
109
|
dropShadow
|
|
115
|
-
},
|
|
116
|
-
"aria-hidden": "true",
|
|
117
|
-
style: { display: "contents" },
|
|
118
|
-
ref: (node) => {
|
|
119
|
-
if (node && triggerRefProp.current) node.replaceWith(triggerRefProp.current);
|
|
120
|
-
}
|
|
121
|
-
}) : null, children)));
|
|
110
|
+
}, children)));
|
|
122
111
|
});
|
|
123
112
|
Coachmark.Content = require_CoachmarkContent.default;
|
|
124
|
-
Coachmark.
|
|
125
|
-
Coachmark.
|
|
113
|
+
Coachmark.ContentHeader = require_CoachmarkContentHeader.CoachmarkContentHeader;
|
|
114
|
+
Coachmark.ContentBody = require_CoachmarkContentBody.default;
|
|
126
115
|
Coachmark.displayName = componentName;
|
|
127
116
|
Coachmark.propTypes = {
|
|
128
117
|
/**
|
|
@@ -169,13 +158,13 @@ Coachmark.propTypes = {
|
|
|
169
158
|
y: prop_types.default.number
|
|
170
159
|
}),
|
|
171
160
|
/**
|
|
172
|
-
*
|
|
161
|
+
* Prevents the Coachmark from closing when clicking outside of it.
|
|
173
162
|
*/
|
|
174
|
-
|
|
163
|
+
preventCloseOnClickOutside: prop_types.default.bool,
|
|
175
164
|
/**
|
|
176
|
-
*
|
|
165
|
+
* CSS selector for the element that should receive focus when the coachmark opens.
|
|
177
166
|
*/
|
|
178
|
-
|
|
167
|
+
selectorPrimaryFocus: prop_types.default.string
|
|
179
168
|
};
|
|
180
169
|
//#endregion
|
|
181
170
|
exports.Coachmark = Coachmark;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoachmarkBeacon.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAc,MAAM,OAAO,CAAC;AAIvD,OAAO,EAAE,WAAW,EAAU,MAAM,eAAe,CAAC;AAMpD;;GAEG;AACH,oBAAY,WAAW;IACrB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW,CAAC,WAAW,CAAC;IACpE,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,aAAa,CAAC,IAAI,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AACD,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"CoachmarkBeacon.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAc,MAAM,OAAO,CAAC;AAIvD,OAAO,EAAE,WAAW,EAAU,MAAM,eAAe,CAAC;AAMpD;;GAEG;AACH,oBAAY,WAAW;IACrB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW,CAAC,WAAW,CAAC;IACpE,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,aAAa,CAAC,IAAI,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AACD,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,iGA8B1B,CAAC"}
|
|
@@ -16,7 +16,7 @@ prop_types = require_runtime.__toESM(prop_types);
|
|
|
16
16
|
let _carbon_react = require("@carbon/react");
|
|
17
17
|
//#region src/components/Coachmark/next/Coachmark/CoachmarkBeacon/CoachmarkBeacon.tsx
|
|
18
18
|
/**
|
|
19
|
-
* Copyright IBM Corp. 2024,
|
|
19
|
+
* Copyright IBM Corp. 2024, 2026
|
|
20
20
|
*
|
|
21
21
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
22
22
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -38,7 +38,8 @@ const CoachmarkBeacon = (0, react.forwardRef)((props, ref) => {
|
|
|
38
38
|
type: "button",
|
|
39
39
|
...buttonProps,
|
|
40
40
|
className: `${blockClass}__target`,
|
|
41
|
-
"aria-label": label
|
|
41
|
+
"aria-label": label,
|
|
42
|
+
title: label
|
|
42
43
|
}, /* @__PURE__ */ react.default.createElement("svg", {
|
|
43
44
|
className: `${blockClass}__center`,
|
|
44
45
|
"aria-hidden": "true",
|
|
@@ -55,9 +56,7 @@ CoachmarkBeacon.propTypes = {
|
|
|
55
56
|
* button props
|
|
56
57
|
*/
|
|
57
58
|
buttonProps: prop_types.default.shape({
|
|
58
|
-
/**@ts-ignore*/
|
|
59
59
|
..._carbon_react.Button.propTypes,
|
|
60
|
-
/**@ts-ignore*/
|
|
61
60
|
id: prop_types.default.string,
|
|
62
61
|
onClick: prop_types.default.func,
|
|
63
62
|
onDoubleClick: prop_types.default.func,
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { FC, ForwardRefExoticComponent, ReactElement, ReactNode, RefAttributes } from 'react';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { CoachmarkContentHeaderProps } from './CoachmarkContentHeader';
|
|
9
|
+
import { CoachmarkContentBodyProps } from './CoachmarkContentBody';
|
|
10
10
|
export interface CoachmarkContentProps {
|
|
11
11
|
/**
|
|
12
12
|
* Provide an optional class to be applied to the containing node.
|
|
@@ -17,10 +17,14 @@ export interface CoachmarkContentProps {
|
|
|
17
17
|
* It can be a single child or an array of children depending on your need
|
|
18
18
|
*/
|
|
19
19
|
children: ReactElement | ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Accessible label for the coachmark content region.
|
|
22
|
+
*/
|
|
23
|
+
'aria-label': string;
|
|
20
24
|
}
|
|
21
25
|
export type CoachmarkContentComponent = ForwardRefExoticComponent<CoachmarkContentProps & RefAttributes<HTMLDivElement>> & {
|
|
22
|
-
Header: FC<
|
|
23
|
-
Body: FC<
|
|
26
|
+
Header: FC<CoachmarkContentHeaderProps>;
|
|
27
|
+
Body: FC<CoachmarkContentBodyProps>;
|
|
24
28
|
};
|
|
25
29
|
declare const CoachmarkContent: CoachmarkContentComponent;
|
|
26
30
|
export default CoachmarkContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoachmarkContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/Coachmark/next/Coachmark/CoachmarkContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAc,EACZ,EAAE,EAEF,yBAAyB,EACzB,YAAY,EACZ,SAAS,EACT,aAAa,EAId,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CoachmarkContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/Coachmark/next/Coachmark/CoachmarkContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAc,EACZ,EAAE,EAEF,yBAAyB,EACzB,YAAY,EACZ,SAAS,EACT,aAAa,EAId,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAMnE,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IACnC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,yBAAyB,GAAG,yBAAyB,CAC/D,qBAAqB,GAAG,aAAa,CAAC,cAAc,CAAC,CACtD,GAAG;IACF,MAAM,EAAE,EAAE,CAAC,2BAA2B,CAAC,CAAC;IACxC,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,CAAC;CACrC,CAAC;AAEF,QAAA,MAAM,gBAAgB,EAwHjB,yBAAyB,CAAC;AAE/B,eAAe,gBAAgB,CAAC"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
|
|
9
9
|
const require_index = require("../../../../node_modules/classnames/index.js");
|
|
10
10
|
const require_settings = require("../../../../settings.js");
|
|
11
|
+
const require_devtools = require("../../../../global/js/utils/devtools.js");
|
|
11
12
|
const require_context = require("./context.js");
|
|
12
13
|
let react = require("react");
|
|
13
14
|
react = require_runtime.__toESM(react);
|
|
@@ -23,7 +24,7 @@ let _carbon_react = require("@carbon/react");
|
|
|
23
24
|
*/
|
|
24
25
|
var import_classnames = /* @__PURE__ */ require_runtime.__toESM(require_index.default);
|
|
25
26
|
const CoachmarkContent = (0, react.forwardRef)((props, ref) => {
|
|
26
|
-
const { className = "", children, ...rest } = props;
|
|
27
|
+
const { className = "", children, "aria-label": ariaLabel, ...rest } = props;
|
|
27
28
|
const coachmarkContentBlockClass = `${require_context.blockClass}--coachmark-content`;
|
|
28
29
|
const { open, setContentRef, onClose, setOpen, triggerRef, selectorPrimaryFocus } = (0, react.useContext)(require_context.CoachmarkContext);
|
|
29
30
|
const handleRef = (0, react.useRef)(null);
|
|
@@ -69,20 +70,33 @@ const CoachmarkContent = (0, react.forwardRef)((props, ref) => {
|
|
|
69
70
|
setOpen
|
|
70
71
|
]);
|
|
71
72
|
(0, react.useEffect)(() => {
|
|
72
|
-
if (open
|
|
73
|
+
if (open) setTimeout(() => {
|
|
73
74
|
requestAnimationFrame(() => {
|
|
74
|
-
|
|
75
|
+
let elementToFocus = null;
|
|
76
|
+
if (selectorPrimaryFocus) elementToFocus = document.querySelector(selectorPrimaryFocus);
|
|
77
|
+
if (!elementToFocus && contentRef && "current" in contentRef && contentRef.current) elementToFocus = contentRef.current.querySelector(`.${require_context.blockClass}--content-header--close-button`);
|
|
75
78
|
if (elementToFocus) elementToFocus.focus();
|
|
76
79
|
});
|
|
77
80
|
}, 100);
|
|
78
|
-
}, [
|
|
81
|
+
}, [
|
|
82
|
+
open,
|
|
83
|
+
selectorPrimaryFocus,
|
|
84
|
+
contentRef
|
|
85
|
+
]);
|
|
79
86
|
return /* @__PURE__ */ react.default.createElement(_carbon_react.PopoverContent, {
|
|
80
87
|
ref: contentRef,
|
|
81
88
|
className: (0, import_classnames.default)(coachmarkContentBlockClass, className) || "",
|
|
82
|
-
|
|
89
|
+
role: "region",
|
|
90
|
+
"aria-label": ariaLabel,
|
|
91
|
+
...rest,
|
|
92
|
+
...require_devtools.getDevtoolsProps("CoachmarkContent")
|
|
83
93
|
}, children);
|
|
84
94
|
});
|
|
85
95
|
CoachmarkContent.propTypes = {
|
|
96
|
+
/**
|
|
97
|
+
* Accessible label for the coachmark content region.
|
|
98
|
+
*/
|
|
99
|
+
"aria-label": prop_types.default.string.isRequired,
|
|
86
100
|
/**
|
|
87
101
|
* This is a required callback that has to return the content to render in the body section.
|
|
88
102
|
* It can be a single child or an array of children depending on your need
|
package/lib/components/Coachmark/next/Coachmark/{ContentBody.d.ts → CoachmarkContentBody.d.ts}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2024,
|
|
2
|
+
* Copyright IBM Corp. 2024, 2026
|
|
3
3
|
*
|
|
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
7
|
import React, { ReactNode } from 'react';
|
|
8
|
-
export interface
|
|
8
|
+
export interface CoachmarkContentBodyProps {
|
|
9
9
|
/**
|
|
10
10
|
* Provide the optional content for header section and will be render after header titles and before progress indicator.
|
|
11
11
|
* People can make use of this if they want to have custom header.
|
|
@@ -19,6 +19,6 @@ export interface ContentBodyProps {
|
|
|
19
19
|
export type EnrichedChildren = {
|
|
20
20
|
children: ReactNode;
|
|
21
21
|
};
|
|
22
|
-
export declare const
|
|
23
|
-
export default
|
|
24
|
-
//# sourceMappingURL=
|
|
22
|
+
export declare const CoachmarkContentBody: React.ForwardRefExoticComponent<CoachmarkContentBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
export default CoachmarkContentBody;
|
|
24
|
+
//# sourceMappingURL=CoachmarkContentBody.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoachmarkContentBody.d.ts","sourceRoot":"","sources":["../../../../../src/components/Coachmark/next/Coachmark/CoachmarkContentBody.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAMrD,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,oBAAoB,kGAgB/B,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
|
|
@@ -7,28 +7,32 @@
|
|
|
7
7
|
|
|
8
8
|
const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
|
|
9
9
|
const require_index = require("../../../../node_modules/classnames/index.js");
|
|
10
|
+
const require_devtools = require("../../../../global/js/utils/devtools.js");
|
|
10
11
|
const require_context = require("./context.js");
|
|
11
12
|
let react = require("react");
|
|
12
13
|
react = require_runtime.__toESM(react);
|
|
13
14
|
let prop_types = require("prop-types");
|
|
14
15
|
prop_types = require_runtime.__toESM(prop_types);
|
|
15
|
-
//#region src/components/Coachmark/next/Coachmark/
|
|
16
|
+
//#region src/components/Coachmark/next/Coachmark/CoachmarkContentBody.tsx
|
|
16
17
|
/**
|
|
17
|
-
* Copyright IBM Corp. 2024,
|
|
18
|
+
* Copyright IBM Corp. 2024, 2026
|
|
18
19
|
*
|
|
19
20
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
20
21
|
* LICENSE file in the root directory of this source tree.
|
|
21
22
|
*/
|
|
22
23
|
var import_classnames = /* @__PURE__ */ require_runtime.__toESM(require_index.default);
|
|
23
|
-
const
|
|
24
|
+
const CoachmarkContentBody = (0, react.forwardRef)((props, ref) => {
|
|
24
25
|
const { className = "", children, ...rest } = props;
|
|
25
26
|
const ContentBodyBlockClass = `${require_context.blockClass}--content-body`;
|
|
26
27
|
return /* @__PURE__ */ react.default.createElement("div", {
|
|
27
28
|
ref,
|
|
28
|
-
className: (0, import_classnames.default)(ContentBodyBlockClass, className)
|
|
29
|
+
className: (0, import_classnames.default)(ContentBodyBlockClass, className),
|
|
30
|
+
...rest,
|
|
31
|
+
...require_devtools.getDevtoolsProps("CoachmarkContentBody")
|
|
29
32
|
}, children);
|
|
30
33
|
});
|
|
31
|
-
|
|
34
|
+
CoachmarkContentBody.displayName = "CoachmarkContentBody";
|
|
35
|
+
CoachmarkContentBody.propTypes = {
|
|
32
36
|
/**
|
|
33
37
|
* Provide the optional content for header section and will be render after header titles and before progress indicator.
|
|
34
38
|
* People can make use of this if they want to have custom header.
|
|
@@ -40,4 +44,4 @@ ContentBody.propTypes = {
|
|
|
40
44
|
className: prop_types.default.string
|
|
41
45
|
};
|
|
42
46
|
//#endregion
|
|
43
|
-
exports.default =
|
|
47
|
+
exports.default = CoachmarkContentBody;
|