@carbon/ibm-products-web-components 0.43.0 → 0.44.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/custom-elements.json +24 -0
- package/es/components/about-modal/about-modal.scss.js +1 -1
- package/es/components/action-set/action-set.scss.js +1 -1
- package/es/components/add-select/add-select-body.scss.js +1 -1
- package/es/components/add-select/add-select-content.scss.js +1 -1
- package/es/components/add-select/add-select-row.scss.js +1 -1
- package/es/components/add-select/add-select.scss.js +1 -1
- package/es/components/big-number/big-number.js +3 -3
- package/es/components/big-number/big-number.js.map +1 -1
- package/es/components/big-number/big-number.scss.js +1 -1
- package/es/components/coachmark/coachmark-header.d.ts.map +1 -1
- package/es/components/coachmark/coachmark-header.js +1 -0
- package/es/components/coachmark/coachmark-header.js.map +1 -1
- package/es/components/coachmark/coachmark.d.ts +13 -0
- package/es/components/coachmark/coachmark.d.ts.map +1 -1
- package/es/components/coachmark/coachmark.js +139 -15
- package/es/components/coachmark/coachmark.js.map +1 -1
- package/es/components/coachmark/coachmark.scss.js +1 -1
- package/es/components/coachmark/coachmark.scss.js.map +1 -1
- package/es/components/page-header/page-header-breadcrumbs-set/page-header-breadcrumbs-set.scss.js +1 -1
- package/es/components/page-header/page-header-tags-set/page-header-tags-set.scss.js +1 -1
- package/es/components/tearsheet/tearsheet.scss.js +1 -1
- package/es/components/tearsheet-preview/tearsheet-header-content.scss.js +1 -1
- package/es/components/tearsheet-preview/tearsheet-header.scss.js +1 -1
- package/es/components/tearsheet-preview/tearsheet-navigation-bar.scss.js +1 -1
- package/es/components/tearsheet-preview/tearsheet.scss.js +1 -1
- package/es/ibm-products-web-components/package.js +1 -1
- package/es/utilities/makeDraggable/makeDraggable.d.ts +8 -2
- package/es/utilities/makeDraggable/makeDraggable.d.ts.map +1 -1
- package/es/utilities/makeDraggable/makeDraggable.js +87 -17
- package/es/utilities/makeDraggable/makeDraggable.js.map +1 -1
- package/es-custom/components/about-modal/about-modal.scss.js +1 -1
- package/es-custom/components/action-set/action-set.scss.js +1 -1
- package/es-custom/components/add-select/add-select-body.scss.js +1 -1
- package/es-custom/components/add-select/add-select-content.scss.js +1 -1
- package/es-custom/components/add-select/add-select-row.scss.js +1 -1
- package/es-custom/components/add-select/add-select.scss.js +1 -1
- package/es-custom/components/big-number/big-number.js +3 -3
- package/es-custom/components/big-number/big-number.js.map +1 -1
- package/es-custom/components/big-number/big-number.scss.js +1 -1
- package/es-custom/components/coachmark/coachmark-header.js +1 -0
- package/es-custom/components/coachmark/coachmark-header.js.map +1 -1
- package/es-custom/components/coachmark/coachmark.js +139 -15
- package/es-custom/components/coachmark/coachmark.js.map +1 -1
- package/es-custom/components/coachmark/coachmark.scss.js +1 -1
- package/es-custom/components/coachmark/coachmark.scss.js.map +1 -1
- package/es-custom/components/page-header/page-header-breadcrumbs-set/page-header-breadcrumbs-set.scss.js +1 -1
- package/es-custom/components/page-header/page-header-tags-set/page-header-tags-set.scss.js +1 -1
- package/es-custom/components/tearsheet/tearsheet.scss.js +1 -1
- package/es-custom/components/tearsheet-preview/tearsheet-header-content.scss.js +1 -1
- package/es-custom/components/tearsheet-preview/tearsheet-header.scss.js +1 -1
- package/es-custom/components/tearsheet-preview/tearsheet-navigation-bar.scss.js +1 -1
- package/es-custom/components/tearsheet-preview/tearsheet.scss.js +1 -1
- package/es-custom/ibm-products-web-components/package.js +1 -1
- package/es-custom/utilities/makeDraggable/makeDraggable.js +87 -17
- package/es-custom/utilities/makeDraggable/makeDraggable.js.map +1 -1
- package/lib/components/coachmark/coachmark-header.d.ts.map +1 -1
- package/lib/components/coachmark/coachmark.d.ts +13 -0
- package/lib/components/coachmark/coachmark.d.ts.map +1 -1
- package/lib/utilities/makeDraggable/makeDraggable.d.ts +8 -2
- package/lib/utilities/makeDraggable/makeDraggable.d.ts.map +1 -1
- package/package.json +11 -11
- package/scss/components/coachmark/coachmark.scss +17 -1
- package/telemetry.yml +2 -1
|
@@ -11,7 +11,7 @@ import coachmark_default$1 from "./coachmark.scss.js";
|
|
|
11
11
|
import { makeDraggable } from "../../utilities/makeDraggable/makeDraggable.js";
|
|
12
12
|
import { resetCoachmarkDetailsSignal, updateCoachmarkDetailsSignal } from "./coachmark-context.js";
|
|
13
13
|
import { LitElement, html } from "lit";
|
|
14
|
-
import { property } from "lit/decorators.js";
|
|
14
|
+
import { property, state } from "lit/decorators.js";
|
|
15
15
|
import HostListenerMixin from "@carbon/web-components/es/globals/mixins/host-listener.js";
|
|
16
16
|
import { carbonElement } from "@carbon/web-components/es/globals/decorators/carbon-element.js";
|
|
17
17
|
import { SignalWatcher } from "@lit-labs/signals";
|
|
@@ -46,7 +46,12 @@ let CDSCoachmark = class CDSCoachmark extends SignalWatcher(HostListenerMixin(Li
|
|
|
46
46
|
this.highContrast = false;
|
|
47
47
|
this.dropShadow = false;
|
|
48
48
|
this.caret = false;
|
|
49
|
+
this.dragAriaLabel = "Picked up the draggable coachmark";
|
|
49
50
|
this.dragCleanup = null;
|
|
51
|
+
this.keydownHandler = null;
|
|
52
|
+
this.moveCounter = 0;
|
|
53
|
+
this.isDragging = null;
|
|
54
|
+
this.moveAnnouncement = "";
|
|
50
55
|
this.handlePopoverClosed = () => {
|
|
51
56
|
if (this.open) this.open = false;
|
|
52
57
|
};
|
|
@@ -54,46 +59,89 @@ let CDSCoachmark = class CDSCoachmark extends SignalWatcher(HostListenerMixin(Li
|
|
|
54
59
|
disconnectedCallback() {
|
|
55
60
|
super.disconnectedCallback();
|
|
56
61
|
if (this.dragCleanup) this.dragCleanup();
|
|
62
|
+
if (this.keydownHandler) document.removeEventListener("keydown", this.keydownHandler);
|
|
57
63
|
resetCoachmarkDetailsSignal();
|
|
58
64
|
}
|
|
59
|
-
setupDraggable() {
|
|
65
|
+
async setupDraggable() {
|
|
60
66
|
const popoverContent = (this.shadowRoot?.querySelector(`.${blockClass}--popover`)).querySelector("cds-popover-content");
|
|
61
67
|
const header = (popoverContent.querySelector(`.${blockClass}--wrapper`).querySelector("slot")?.assignedElements({ flatten: true }))?.find((el) => el.tagName.toLowerCase() === `c4p-coachmark-header`);
|
|
68
|
+
if (header?.updateComplete) await header.updateComplete;
|
|
62
69
|
requestAnimationFrame(() => {
|
|
63
70
|
const dragHandle = header.shadowRoot?.querySelector(`.c4p--coachmark-header-drag-handle`);
|
|
71
|
+
const dragInactiveInstruction = "Press Enter or Space to activate drag mode.";
|
|
72
|
+
const dragActiveInstruction = "Use arrow keys to move the coachmark. Press Enter or Space to exit drag mode.";
|
|
73
|
+
if (dragHandle) dragHandle.setAttribute("aria-label", dragInactiveInstruction);
|
|
64
74
|
const draggable = makeDraggable({
|
|
65
75
|
el: popoverContent,
|
|
66
76
|
dragHandle: header,
|
|
67
77
|
focusableDragHandle: dragHandle
|
|
68
78
|
});
|
|
69
79
|
const onDragStart = () => {
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
this.isDragging = true;
|
|
81
|
+
this.moveCounter = 0;
|
|
82
|
+
this.moveAnnouncement = "";
|
|
83
|
+
popoverContent.classList.add(`${blockClass}--is-dragging`);
|
|
84
|
+
if (this.dragAriaLabel) popoverContent.setAttribute("aria-label", this.dragAriaLabel);
|
|
85
|
+
if (dragHandle) dragHandle.setAttribute("aria-label", dragActiveInstruction);
|
|
86
|
+
updateCoachmarkDetailsSignal({
|
|
87
|
+
name: "isDragging",
|
|
88
|
+
detail: true
|
|
89
|
+
});
|
|
72
90
|
};
|
|
73
91
|
const onDragEnd = () => {
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
this.isDragging = false;
|
|
93
|
+
this.moveCounter = 0;
|
|
94
|
+
this.moveAnnouncement = "";
|
|
95
|
+
popoverContent.classList.remove(`${blockClass}--is-dragging`);
|
|
96
|
+
popoverContent.removeAttribute("aria-label");
|
|
97
|
+
if (dragHandle) dragHandle.setAttribute("aria-label", dragInactiveInstruction);
|
|
98
|
+
updateCoachmarkDetailsSignal({
|
|
99
|
+
name: "isDragging",
|
|
100
|
+
detail: false
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
const onDragMove = (event) => {
|
|
104
|
+
const { direction, distance } = event.detail;
|
|
105
|
+
this.moveCounter += 1;
|
|
106
|
+
const uniqueMarker = "".repeat(this.moveCounter);
|
|
107
|
+
this.moveAnnouncement = `Moved ${direction} ${distance} pixels${uniqueMarker}`;
|
|
76
108
|
};
|
|
77
109
|
popoverContent.addEventListener("dragstart", onDragStart);
|
|
78
110
|
popoverContent.addEventListener("dragend", onDragEnd);
|
|
111
|
+
popoverContent.addEventListener("dragmove", onDragMove);
|
|
79
112
|
this.dragCleanup = () => {
|
|
80
113
|
popoverContent.removeEventListener("dragstart", onDragStart);
|
|
81
114
|
popoverContent.removeEventListener("dragend", onDragEnd);
|
|
115
|
+
popoverContent.removeEventListener("dragmove", onDragMove);
|
|
82
116
|
draggable.cleanup?.();
|
|
83
117
|
};
|
|
84
118
|
});
|
|
85
119
|
}
|
|
86
120
|
firstUpdated() {
|
|
87
|
-
|
|
121
|
+
this.keydownHandler = (event) => {
|
|
122
|
+
if (event.key === "Escape" && this.open) this.open = false;
|
|
123
|
+
};
|
|
124
|
+
document.addEventListener("keydown", this.keydownHandler);
|
|
125
|
+
}
|
|
126
|
+
updated(changedProps) {
|
|
127
|
+
if (changedProps.has("floating")) if (this.floating) {
|
|
88
128
|
this.classList.add(`${blockClass}--floating`);
|
|
89
129
|
this.setupDraggable();
|
|
90
130
|
updateCoachmarkDetailsSignal({
|
|
91
131
|
name: "floating",
|
|
92
132
|
detail: this.floating
|
|
93
133
|
});
|
|
134
|
+
} else {
|
|
135
|
+
this.classList.remove(`${blockClass}--floating`);
|
|
136
|
+
if (this.dragCleanup) {
|
|
137
|
+
this.dragCleanup();
|
|
138
|
+
this.dragCleanup = null;
|
|
139
|
+
}
|
|
140
|
+
updateCoachmarkDetailsSignal({
|
|
141
|
+
name: "floating",
|
|
142
|
+
detail: false
|
|
143
|
+
});
|
|
94
144
|
}
|
|
95
|
-
}
|
|
96
|
-
updated(changedProps) {
|
|
97
145
|
if (changedProps.has("position")) {
|
|
98
146
|
const { x = 0, y = 0 } = this.position ?? {};
|
|
99
147
|
if (x !== 0 || y !== 0) this.style.transform = `translate(${x}px, ${y}px)`;
|
|
@@ -104,8 +152,49 @@ let CDSCoachmark = class CDSCoachmark extends SignalWatcher(HostListenerMixin(Li
|
|
|
104
152
|
composed: true,
|
|
105
153
|
detail: { open: this.open }
|
|
106
154
|
};
|
|
107
|
-
if (this.open)
|
|
108
|
-
|
|
155
|
+
if (this.open) {
|
|
156
|
+
this.dispatchEvent(new CustomEvent(this.constructor.eventOpen, init));
|
|
157
|
+
updateCoachmarkDetailsSignal({
|
|
158
|
+
name: "floating",
|
|
159
|
+
detail: this.floating ?? false
|
|
160
|
+
});
|
|
161
|
+
if (this.floating) {
|
|
162
|
+
if (this.dragCleanup) {
|
|
163
|
+
this.dragCleanup();
|
|
164
|
+
this.dragCleanup = null;
|
|
165
|
+
}
|
|
166
|
+
this.setupDraggable();
|
|
167
|
+
}
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
requestAnimationFrame(() => {
|
|
170
|
+
let elementToFocus = null;
|
|
171
|
+
if (this.selectorPrimaryFocus) {
|
|
172
|
+
const raw = this.selectorPrimaryFocus.trim();
|
|
173
|
+
const selector = raw.startsWith("#") || raw.startsWith(".") || raw.startsWith("[") ? raw : `.${raw}`;
|
|
174
|
+
const found = document.querySelector(selector);
|
|
175
|
+
elementToFocus = found?.shadowRoot?.querySelector("button, [tabindex]") ?? found;
|
|
176
|
+
}
|
|
177
|
+
if (!elementToFocus) {
|
|
178
|
+
const header = (this.shadowRoot?.querySelector(`.${blockClass}--popover cds-popover-content .${blockClass}--wrapper`))?.querySelector("slot")?.assignedElements({ flatten: true })?.find((el) => el.tagName.toLowerCase() === `c4p-coachmark-header`);
|
|
179
|
+
if (header?.shadowRoot) {
|
|
180
|
+
const dragButton = this.floating ? header.shadowRoot.querySelector(`.c4p--coachmark-header-drag-handle`) : null;
|
|
181
|
+
const closeButton = header.shadowRoot.querySelector(`.c4p--coachmark-header-close-button`);
|
|
182
|
+
elementToFocus = dragButton || closeButton;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (elementToFocus) elementToFocus.focus();
|
|
186
|
+
});
|
|
187
|
+
}, 100);
|
|
188
|
+
} else {
|
|
189
|
+
this.dispatchEvent(new CustomEvent(this.constructor.eventClose, init));
|
|
190
|
+
updateCoachmarkDetailsSignal({
|
|
191
|
+
name: "floating",
|
|
192
|
+
detail: false
|
|
193
|
+
});
|
|
194
|
+
requestAnimationFrame(() => {
|
|
195
|
+
((this.shadowRoot?.querySelector("slot[name=\"trigger\"]"))?.assignedElements({ flatten: true })[0])?.focus();
|
|
196
|
+
});
|
|
197
|
+
}
|
|
109
198
|
}
|
|
110
199
|
}
|
|
111
200
|
render() {
|
|
@@ -119,11 +208,27 @@ let CDSCoachmark = class CDSCoachmark extends SignalWatcher(HostListenerMixin(Li
|
|
|
119
208
|
.caret=${caretValue}
|
|
120
209
|
?highContrast=${this.highContrast}
|
|
121
210
|
align=${this.align}
|
|
122
|
-
|
|
211
|
+
.dropShadow=${this.dropShadow}
|
|
123
212
|
@cds-popover-closed=${this.handlePopoverClosed}
|
|
124
213
|
>
|
|
125
214
|
<slot name="trigger"></slot>
|
|
126
215
|
<cds-popover-content part="popover-content" exportparts="content">
|
|
216
|
+
<div
|
|
217
|
+
role="status"
|
|
218
|
+
aria-live="polite"
|
|
219
|
+
aria-atomic="true"
|
|
220
|
+
class="${"c4p"}--visually-hidden"
|
|
221
|
+
>
|
|
222
|
+
${this.floating ? this.isDragging === true ? "Drag mode active." : this.isDragging === false ? "Drag mode ended." : "" : ""}
|
|
223
|
+
</div>
|
|
224
|
+
<div
|
|
225
|
+
role="status"
|
|
226
|
+
aria-live="assertive"
|
|
227
|
+
aria-atomic="true"
|
|
228
|
+
class="${"c4p"}--visually-hidden"
|
|
229
|
+
>
|
|
230
|
+
${this.floating ? this.moveAnnouncement : ""}
|
|
231
|
+
</div>
|
|
127
232
|
<div class="${blockClass}--wrapper">
|
|
128
233
|
<slot></slot>
|
|
129
234
|
</div>
|
|
@@ -160,9 +265,28 @@ __decorate([property({
|
|
|
160
265
|
type: Boolean,
|
|
161
266
|
reflect: true
|
|
162
267
|
})], CDSCoachmark.prototype, "floating", void 0);
|
|
163
|
-
__decorate([property({
|
|
164
|
-
|
|
165
|
-
|
|
268
|
+
__decorate([property({
|
|
269
|
+
type: Boolean,
|
|
270
|
+
reflect: true
|
|
271
|
+
})], CDSCoachmark.prototype, "highContrast", void 0);
|
|
272
|
+
__decorate([property({
|
|
273
|
+
type: Boolean,
|
|
274
|
+
reflect: true
|
|
275
|
+
})], CDSCoachmark.prototype, "dropShadow", void 0);
|
|
276
|
+
__decorate([property({
|
|
277
|
+
type: Boolean,
|
|
278
|
+
reflect: true
|
|
279
|
+
})], CDSCoachmark.prototype, "caret", void 0);
|
|
280
|
+
__decorate([property({
|
|
281
|
+
attribute: "selector-primary-focus",
|
|
282
|
+
reflect: true
|
|
283
|
+
})], CDSCoachmark.prototype, "selectorPrimaryFocus", void 0);
|
|
284
|
+
__decorate([property({
|
|
285
|
+
attribute: "drag-aria-label",
|
|
286
|
+
reflect: true
|
|
287
|
+
})], CDSCoachmark.prototype, "dragAriaLabel", void 0);
|
|
288
|
+
__decorate([state()], CDSCoachmark.prototype, "isDragging", void 0);
|
|
289
|
+
__decorate([state()], CDSCoachmark.prototype, "moveAnnouncement", void 0);
|
|
166
290
|
CDSCoachmark = __decorate([carbonElement(`c4p-coachmark`)], CDSCoachmark);
|
|
167
291
|
var coachmark_default = CDSCoachmark;
|
|
168
292
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coachmark.js","names":["styles","customElement"],"sources":["../../../src/components/coachmark/coachmark.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\nimport styles from './coachmark.scss?lit';\nimport { SignalWatcher } from '@lit-labs/signals';\nimport '@carbon/web-components/es/components/popover/index.js';\nimport { POPOVER_ALIGNMENT } from '@carbon/web-components/es/components/popover/defs.js';\nimport { makeDraggable } from '../../utilities/makeDraggable/makeDraggable';\nimport {\n resetCoachmarkDetailsSignal,\n updateCoachmarkDetailsSignal,\n} from './coachmark-context';\n\nexport const blockClass = `${prefix}--coachmark`;\n\n/**\n * coachmark main component\n * @element c4p-coachmark\n * @fires c4p-coachmark-opened\n * The custom event fired when the coachmark is opened.\n * This event can be used to perform actions such as focusing elements when the coachmark becomes visible.\n * @fires c4p-coachmark-closed\n * The custom event fired when the coachmark is closed.\n * This event can be used to perform actions such as restoring focus when the coachmark is dismissed.\n */\n@customElement(`${prefix}-coachmark`)\nclass CDSCoachmark extends SignalWatcher(HostListenerMixin(LitElement)) {\n /**\n * Specifies whether the component is currently open.\n */\n @property({ type: Boolean, reflect: true })\n open: boolean = false;\n /**\n * Where to render the Coachmark relative to its target.\n */\n @property({ reflect: true, type: String })\n align?: string = POPOVER_ALIGNMENT.TOP;\n /**\n * Fine tune the position of the target in pixels.\n */\n @property({ type: Object })\n position?: { x: number; y: number };\n /**\n * Specifies whether the component is floating or not.\n */\n @property({ type: Boolean, reflect: true })\n floating?: boolean = false;\n /**\n * Specify whether the component should be rendered on high-contrast.\n */\n @property({ reflect: true })\n highContrast?: boolean = false;\n /**\n * Specify whether a drop shadow should be rendered on the popover.\n */\n @property({ reflect: true })\n dropShadow?: boolean = false;\n /**\n * Specify whether a caret should be rendered on the popover. This is intended to use only for coachmark patterns.\n */\n @property({ reflect: true })\n caret?: boolean = false;\n\n private dragCleanup: (() => void) | null = null;\n\n disconnectedCallback() {\n super.disconnectedCallback();\n if (this.dragCleanup) {\n this.dragCleanup();\n }\n resetCoachmarkDetailsSignal();\n }\n\n private setupDraggable() {\n const popover = this.shadowRoot?.querySelector(\n `.${blockClass}--popover`\n ) as HTMLElement;\n const popoverContent = popover.querySelector(\n 'cds-popover-content'\n ) as HTMLElement;\n const wrapper = popoverContent.querySelector(\n `.${blockClass}--wrapper`\n ) as HTMLElement;\n const slot = wrapper.querySelector('slot');\n const assignedElements = slot?.assignedElements({ flatten: true });\n const header = assignedElements?.find(\n (el) => el.tagName.toLowerCase() === `${prefix}-coachmark-header`\n ) as HTMLElement;\n requestAnimationFrame(() => {\n const dragHandle = header.shadowRoot?.querySelector(\n `.${prefix}--coachmark-header-drag-handle`\n ) as HTMLElement;\n\n const draggable = makeDraggable({\n el: popoverContent,\n dragHandle: header,\n focusableDragHandle: dragHandle,\n });\n\n const onDragStart = () => {\n popoverContent.classList.add('is-dragging');\n popoverContent.setAttribute(\n 'aria-label',\n 'Picked up the draggable popoverContent'\n );\n };\n const onDragEnd = () => {\n popoverContent.classList.remove('is-dragging');\n popoverContent.setAttribute(\n 'aria-label',\n 'Draggable popoverContent was dropped'\n );\n };\n\n popoverContent.addEventListener('dragstart', onDragStart);\n popoverContent.addEventListener('dragend', onDragEnd);\n\n // store cleanup\n this.dragCleanup = () => {\n popoverContent.removeEventListener('dragstart', onDragStart);\n popoverContent.removeEventListener('dragend', onDragEnd);\n draggable.cleanup?.();\n };\n });\n }\n\n firstUpdated() {\n if (this.floating) {\n this.classList.add(`${blockClass}--floating`);\n this.setupDraggable();\n updateCoachmarkDetailsSignal({\n name: 'floating',\n detail: this.floating,\n });\n }\n }\n\n updated(changedProps: Map<string, unknown>) {\n if (changedProps.has('position')) {\n const { x = 0, y = 0 } = this.position ?? {};\n if (x !== 0 || y !== 0) {\n this.style.transform = `translate(${x}px, ${y}px)`;\n }\n }\n\n // Dispatch custom events when coachmark opens or closes\n if (changedProps.has('open')) {\n const init = {\n bubbles: true,\n composed: true,\n detail: { open: this.open },\n };\n\n if (this.open) {\n this.dispatchEvent(\n new CustomEvent(\n (this.constructor as typeof CDSCoachmark).eventOpen,\n init\n )\n );\n } else {\n this.dispatchEvent(\n new CustomEvent(\n (this.constructor as typeof CDSCoachmark).eventClose,\n init\n )\n );\n }\n }\n }\n\n private handlePopoverClosed = () => {\n // Sync coachmark's open state when popover closes\n // This ensures the states stay in sync for outside clicks\n if (this.open) {\n this.open = false;\n }\n };\n\n render() {\n // Use explicit caret value if provided, otherwise derive from floating state\n const caretValue =\n this.caret !== undefined\n ? this.caret\n : this.floating === true\n ? false\n : true;\n\n return html`\n <cds-popover\n part=\"popover\"\n exportparts=\"popover-container\"\n class=\"${blockClass}--popover\"\n ?open=${this.open}\n .caret=${caretValue}\n ?highContrast=${this.highContrast}\n align=${this.align}\n ?dropShadow=${this.dropShadow}\n @cds-popover-closed=${this.handlePopoverClosed}\n >\n <slot name=\"trigger\"></slot>\n <cds-popover-content part=\"popover-content\" exportparts=\"content\">\n <div class=\"${blockClass}--wrapper\">\n <slot></slot>\n </div>\n </cds-popover-content>\n </cds-popover>\n `;\n }\n\n /**\n * The name of the custom event fired when this coachmark is opened.\n */\n static get eventOpen() {\n return `${prefix}-coachmark-opened`;\n }\n\n /**\n * The name of the custom event fired when this coachmark is closed.\n */\n static get eventClose() {\n return `${prefix}-coachmark-closed`;\n }\n\n static styles = styles;\n}\n\nexport default CDSCoachmark;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,aAAa;;;;;;;;;;;AAY1B,IAAA,eAAA,MACM,qBAAqB,cAAc,kBAAkB,WAAW,CAAC,CAAC;;;cAKtD;eAKC,kBAAkB;kBAUd;sBAKI;oBAKF;eAKL;qBAEyB;mCA4GP;AAGlC,OAAI,KAAK,KACP,MAAK,OAAO;;;CA9GhB,uBAAuB;AACrB,QAAM,sBAAsB;AAC5B,MAAI,KAAK,YACP,MAAK,aAAa;AAEpB,+BAA6B;;CAG/B,iBAAyB;EAI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D,KAAK,YAAoC,WAC1C,KACD,CACF;OAED,MAAK,cACH,IAAI,YACD,KAAK,YAAoC,YAC1C,KACD,CACF;;;CAaP,SAAS;EAEP,MAAM,aACJ,KAAK,UAAU,KAAA,IACX,KAAK,QACL,KAAK,aAAa,OAChB,QACA;AAER,SAAO,IAAI;;;;iBAIE,WAAW;gBACZ,KAAK,KAAK;iBACT,WAAW;wBACJ,KAAK,aAAa;gBAC1B,KAAK,MAAM;sBACL,KAAK,WAAW;8BACR,KAAK,oBAAoB;;;;wBAI/B,WAAW;;;;;;;;;;CAWjC,WAAW,YAAY;AACrB,SAAO;;;;;CAMT,WAAW,aAAa;AACtB,SAAO;;;gBAGOA;;;YAlMf,SAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,aAAA,WAAA,QAAA,KAAA,EAAA;YAK1C,SAAS;CAAE,SAAS;CAAM,MAAM;CAAQ,CAAC,CAAA,EAAA,aAAA,WAAA,SAAA,KAAA,EAAA;YAKzC,SAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,aAAA,WAAA,YAAA,KAAA,EAAA;YAK1B,SAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,aAAA,WAAA,YAAA,KAAA,EAAA;YAK1C,SAAS,EAAE,SAAS,MAAM,CAAC,CAAA,EAAA,aAAA,WAAA,gBAAA,KAAA,EAAA;YAK3B,SAAS,EAAE,SAAS,MAAM,CAAC,CAAA,EAAA,aAAA,WAAA,cAAA,KAAA,EAAA;YAK3B,SAAS,EAAE,SAAS,MAAM,CAAC,CAAA,EAAA,aAAA,WAAA,SAAA,KAAA,EAAA;2BAnC7BC,cAAc,gBAAsB,CAAA,EAAA,aAAA;AA0MrC,IAAA,oBAAe"}
|
|
1
|
+
{"version":3,"file":"coachmark.js","names":["customEvent","styles","customElement"],"sources":["../../../src/components/coachmark/coachmark.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\nimport styles from './coachmark.scss?lit';\nimport { SignalWatcher } from '@lit-labs/signals';\nimport '@carbon/web-components/es/components/popover/index.js';\nimport { POPOVER_ALIGNMENT } from '@carbon/web-components/es/components/popover/defs.js';\nimport { makeDraggable } from '../../utilities/makeDraggable/makeDraggable';\nimport {\n resetCoachmarkDetailsSignal,\n updateCoachmarkDetailsSignal,\n} from './coachmark-context';\n\nexport const blockClass = `${prefix}--coachmark`;\n\n/**\n * coachmark main component\n * @element c4p-coachmark\n * @fires c4p-coachmark-opened\n * The custom event fired when the coachmark is opened.\n * This event can be used to perform actions such as focusing elements when the coachmark becomes visible.\n * @fires c4p-coachmark-closed\n * The custom event fired when the coachmark is closed.\n * This event can be used to perform actions such as restoring focus when the coachmark is dismissed.\n */\n@customElement(`${prefix}-coachmark`)\nclass CDSCoachmark extends SignalWatcher(HostListenerMixin(LitElement)) {\n /**\n * Specifies whether the component is currently open.\n */\n @property({ type: Boolean, reflect: true })\n open: boolean = false;\n /**\n * Where to render the Coachmark relative to its target.\n */\n @property({ reflect: true, type: String })\n align?: string = POPOVER_ALIGNMENT.TOP;\n /**\n * Fine tune the position of the target in pixels.\n */\n @property({ type: Object })\n position?: { x: number; y: number };\n /**\n * Specifies whether the component is floating or not.\n */\n @property({ type: Boolean, reflect: true })\n floating?: boolean = false;\n /**\n * Specify whether the component should be rendered on high-contrast.\n */\n @property({ type: Boolean, reflect: true })\n highContrast?: boolean = false;\n /**\n * Specify whether a drop shadow should be rendered on the popover.\n */\n @property({ type: Boolean, reflect: true })\n dropShadow?: boolean = false;\n /**\n * Specify whether a caret should be rendered on the popover. This is intended to use only for coachmark patterns.\n */\n @property({ type: Boolean, reflect: true })\n caret?: boolean = false;\n /**\n * CSS selector for the element that should receive focus when the coachmark opens.\n * If not provided, no automatic focus management will occur.\n */\n @property({ attribute: 'selector-primary-focus', reflect: true })\n selectorPrimaryFocus?: string;\n /**\n * Aria label for when the floating coachmark is picked up for dragging.\n */\n @property({ attribute: 'drag-aria-label', reflect: true })\n dragAriaLabel?: string = 'Picked up the draggable coachmark';\n\n private dragCleanup: (() => void) | null = null;\n private keydownHandler: ((event: KeyboardEvent) => void) | null = null;\n private moveCounter: number = 0;\n @state() private isDragging: boolean | null = null;\n @state() private moveAnnouncement: string = '';\n\n disconnectedCallback() {\n super.disconnectedCallback();\n if (this.dragCleanup) {\n this.dragCleanup();\n }\n if (this.keydownHandler) {\n document.removeEventListener('keydown', this.keydownHandler);\n }\n resetCoachmarkDetailsSignal();\n }\n\n private async setupDraggable() {\n const popover = this.shadowRoot?.querySelector(\n `.${blockClass}--popover`\n ) as HTMLElement;\n const popoverContent = popover.querySelector(\n 'cds-popover-content'\n ) as HTMLElement;\n const wrapper = popoverContent.querySelector(\n `.${blockClass}--wrapper`\n ) as HTMLElement;\n const slot = wrapper.querySelector('slot');\n const assignedElements = slot?.assignedElements({ flatten: true });\n const header = assignedElements?.find(\n (el) => el.tagName.toLowerCase() === `${prefix}-coachmark-header`\n ) as LitElement & HTMLElement;\n // Wait for coachmark-header to finish rendering the drag handle\n // (it re-renders based on the signal updated just before this call)\n if (header?.updateComplete) {\n await header.updateComplete;\n }\n requestAnimationFrame(() => {\n const dragHandle = header.shadowRoot?.querySelector(\n `.${prefix}--coachmark-header-drag-handle`\n ) as HTMLElement;\n\n const dragInactiveInstruction =\n 'Press Enter or Space to activate drag mode.';\n const dragActiveInstruction =\n 'Use arrow keys to move the coachmark. Press Enter or Space to exit drag mode.';\n\n // Set initial instructions as aria-label so the screen reader announces\n // them when the drag handle is focused (aria-describedby cannot cross\n // shadow DOM boundaries, so we set the text directly on the element).\n if (dragHandle) {\n dragHandle.setAttribute('aria-label', dragInactiveInstruction);\n }\n\n const draggable = makeDraggable({\n el: popoverContent,\n dragHandle: header,\n focusableDragHandle: dragHandle,\n });\n\n const onDragStart = () => {\n this.isDragging = true;\n this.moveCounter = 0;\n this.moveAnnouncement = '';\n popoverContent.classList.add(`${blockClass}--is-dragging`);\n if (this.dragAriaLabel) {\n popoverContent.setAttribute('aria-label', this.dragAriaLabel);\n }\n if (dragHandle) {\n dragHandle.setAttribute('aria-label', dragActiveInstruction);\n }\n updateCoachmarkDetailsSignal({ name: 'isDragging', detail: true });\n };\n\n const onDragEnd = () => {\n this.isDragging = false;\n this.moveCounter = 0;\n this.moveAnnouncement = '';\n popoverContent.classList.remove(`${blockClass}--is-dragging`);\n popoverContent.removeAttribute('aria-label');\n if (dragHandle) {\n dragHandle.setAttribute('aria-label', dragInactiveInstruction);\n }\n updateCoachmarkDetailsSignal({ name: 'isDragging', detail: false });\n };\n\n const onDragMove = (event: Event) => {\n const customEvent = event as CustomEvent<{\n direction: string;\n distance: number;\n }>;\n const { direction, distance } = customEvent.detail;\n // Increment counter to make each announcement unique\n this.moveCounter += 1;\n // Add zero-width space multiplied by counter to make string unique without being announced\n const uniqueMarker = '\\u200B'.repeat(this.moveCounter);\n this.moveAnnouncement = `Moved ${direction} ${distance} pixels${uniqueMarker}`;\n };\n\n popoverContent.addEventListener('dragstart', onDragStart);\n popoverContent.addEventListener('dragend', onDragEnd);\n popoverContent.addEventListener('dragmove', onDragMove as EventListener);\n\n // store cleanup\n this.dragCleanup = () => {\n popoverContent.removeEventListener('dragstart', onDragStart);\n popoverContent.removeEventListener('dragend', onDragEnd);\n popoverContent.removeEventListener(\n 'dragmove',\n onDragMove as EventListener\n );\n draggable.cleanup?.();\n };\n });\n }\n\n firstUpdated() {\n // Setup Escape key handler\n this.keydownHandler = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && this.open) {\n this.open = false;\n }\n };\n document.addEventListener('keydown', this.keydownHandler);\n }\n\n updated(changedProps: Map<string, unknown>) {\n if (changedProps.has('floating')) {\n if (this.floating) {\n this.classList.add(`${blockClass}--floating`);\n this.setupDraggable();\n updateCoachmarkDetailsSignal({\n name: 'floating',\n detail: this.floating,\n });\n } else {\n this.classList.remove(`${blockClass}--floating`);\n if (this.dragCleanup) {\n this.dragCleanup();\n this.dragCleanup = null;\n }\n updateCoachmarkDetailsSignal({\n name: 'floating',\n detail: false,\n });\n }\n }\n\n if (changedProps.has('position')) {\n const { x = 0, y = 0 } = this.position ?? {};\n if (x !== 0 || y !== 0) {\n this.style.transform = `translate(${x}px, ${y}px)`;\n }\n }\n\n // Dispatch custom events when coachmark opens or closes\n if (changedProps.has('open')) {\n const init = {\n bubbles: true,\n composed: true,\n detail: { open: this.open },\n };\n\n if (this.open) {\n this.dispatchEvent(\n new CustomEvent(\n (this.constructor as typeof CDSCoachmark).eventOpen,\n init\n )\n );\n // Sync floating state into the signal so the header renders correctly\n updateCoachmarkDetailsSignal({\n name: 'floating',\n detail: this.floating ?? false,\n });\n // Re-create the draggable on every open so the isDragging closure\n // variable always starts as false (e.g. after Escape-while-dragging).\n if (this.floating) {\n if (this.dragCleanup) {\n this.dragCleanup();\n this.dragCleanup = null;\n }\n this.setupDraggable();\n }\n\n // Handle focus management when coachmark opens\n setTimeout(() => {\n requestAnimationFrame(() => {\n let elementToFocus: HTMLElement | null = null;\n\n if (this.selectorPrimaryFocus) {\n const raw = this.selectorPrimaryFocus.trim();\n const selector =\n raw.startsWith('#') ||\n raw.startsWith('.') ||\n raw.startsWith('[')\n ? raw\n : `.${raw}`;\n const found = document.querySelector<HTMLElement>(selector);\n elementToFocus =\n found?.shadowRoot?.querySelector<HTMLElement>(\n 'button, [tabindex]'\n ) ?? found;\n }\n\n if (!elementToFocus) {\n const wrapper = this.shadowRoot?.querySelector(\n `.${blockClass}--popover cds-popover-content .${blockClass}--wrapper`\n ) as HTMLElement;\n const header = wrapper\n ?.querySelector('slot')\n ?.assignedElements({ flatten: true })\n ?.find(\n (el) =>\n el.tagName.toLowerCase() === `${prefix}-coachmark-header`\n ) as HTMLElement;\n\n if (header?.shadowRoot) {\n // Try drag button for floating coachmarks, fallback to close button\n const dragButton = this.floating\n ? header.shadowRoot.querySelector<HTMLElement>(\n `.${prefix}--coachmark-header-drag-handle`\n )\n : null;\n const closeButton =\n header.shadowRoot.querySelector<HTMLElement>(\n `.${prefix}--coachmark-header-close-button`\n );\n elementToFocus = dragButton || closeButton;\n }\n }\n if (elementToFocus) {\n elementToFocus.focus();\n }\n });\n }, 100);\n } else {\n this.dispatchEvent(\n new CustomEvent(\n (this.constructor as typeof CDSCoachmark).eventClose,\n init\n )\n );\n // Clear floating from the signal so the header hides the drag button\n // while the popover is closed (signal persists across open/close cycles)\n updateCoachmarkDetailsSignal({\n name: 'floating',\n detail: false,\n });\n\n // Return focus to trigger element when coachmark closes\n requestAnimationFrame(() => {\n const triggerSlot = this.shadowRoot?.querySelector(\n 'slot[name=\"trigger\"]'\n ) as HTMLSlotElement;\n const triggerElement = triggerSlot?.assignedElements({\n flatten: true,\n })[0] as HTMLElement;\n triggerElement?.focus();\n });\n }\n }\n }\n\n private handlePopoverClosed = () => {\n // Sync coachmark's open state when popover closes\n // This ensures the states stay in sync for outside clicks\n if (this.open) {\n this.open = false;\n }\n };\n\n render() {\n // Use explicit caret value if provided, otherwise derive from floating state\n const caretValue =\n this.caret !== undefined\n ? this.caret\n : this.floating === true\n ? false\n : true;\n\n return html`\n <cds-popover\n part=\"popover\"\n exportparts=\"popover-container\"\n class=\"${blockClass}--popover\"\n ?open=${this.open}\n .caret=${caretValue}\n ?highContrast=${this.highContrast}\n align=${this.align}\n .dropShadow=${this.dropShadow}\n @cds-popover-closed=${this.handlePopoverClosed}\n >\n <slot name=\"trigger\"></slot>\n <cds-popover-content part=\"popover-content\" exportparts=\"content\">\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n class=\"${prefix}--visually-hidden\"\n >\n ${this.floating\n ? this.isDragging === true\n ? 'Drag mode active.'\n : this.isDragging === false\n ? 'Drag mode ended.'\n : ''\n : ''}\n </div>\n <div\n role=\"status\"\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n class=\"${prefix}--visually-hidden\"\n >\n ${this.floating ? this.moveAnnouncement : ''}\n </div>\n <div class=\"${blockClass}--wrapper\">\n <slot></slot>\n </div>\n </cds-popover-content>\n </cds-popover>\n `;\n }\n\n /**\n * The name of the custom event fired when this coachmark is opened.\n */\n static get eventOpen() {\n return `${prefix}-coachmark-opened`;\n }\n\n /**\n * The name of the custom event fired when this coachmark is closed.\n */\n static get eventClose() {\n return `${prefix}-coachmark-closed`;\n }\n\n static styles = styles;\n}\n\nexport default CDSCoachmark;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,aAAa;;;;;;;;;;;AAY1B,IAAA,eAAA,MACM,qBAAqB,cAAc,kBAAkB,WAAW,CAAC,CAAC;;;cAKtD;eAKC,kBAAkB;kBAUd;sBAKI;oBAKF;eAKL;uBAWO;qBAEkB;wBACuB;qBACpC;oBACgB;0BACF;mCAoQR;AAGlC,OAAI,KAAK,KACP,MAAK,OAAO;;;CAtQhB,uBAAuB;AACrB,QAAM,sBAAsB;AAC5B,MAAI,KAAK,YACP,MAAK,aAAa;AAEpB,MAAI,KAAK,eACP,UAAS,oBAAoB,WAAW,KAAK,eAAe;AAE9D,+BAA6B;;CAG/B,MAAc,iBAAiB;EAI7B,MAAM,kBAHU,KAAK,YAAY,cAC/B,IAAI,WAAW,WAChB,EAC8B,cAC7B,sBACD;EAMD,MAAM,UALU,eAAe,cAC7B,IAAI,WAAW,WAEG,CAAC,cAAc,OACN,EAAE,iBAAiB,EAAE,SAAS,MAAM,CAAC,GACjC,MAC9B,OAAO,GAAG,QAAQ,aAAa,KAAK,uBACtC;AAGD,MAAI,QAAQ,eACV,OAAM,OAAO;AAEf,8BAA4B;GAC1B,MAAM,aAAa,OAAO,YAAY,cACpC,qCACD;GAED,MAAM,0BACJ;GACF,MAAM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AA,WAAA,SAAA,KAAA,EAAA;YAKzC,SAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,aAAA,WAAA,YAAA,KAAA,EAAA;YAK1B,SAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,aAAA,WAAA,YAAA,KAAA,EAAA;YAK1C,SAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,aAAA,WAAA,gBAAA,KAAA,EAAA;YAK1C,SAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,aAAA,WAAA,cAAA,KAAA,EAAA;YAK1C,SAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,aAAA,WAAA,SAAA,KAAA,EAAA;YAM1C,SAAS;CAAE,WAAW;CAA0B,SAAS;CAAM,CAAC,CAAA,EAAA,aAAA,WAAA,wBAAA,KAAA,EAAA;YAKhE,SAAS;CAAE,WAAW;CAAmB,SAAS;CAAM,CAAC,CAAA,EAAA,aAAA,WAAA,iBAAA,KAAA,EAAA;YAMzD,OAAO,CAAA,EAAA,aAAA,WAAA,cAAA,KAAA,EAAA;YACP,OAAO,CAAA,EAAA,aAAA,WAAA,oBAAA,KAAA,EAAA;2BArDTC,cAAc,gBAAsB,CAAA,EAAA,aAAA;AAuYrC,IAAA,oBAAe"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { css } from "lit";
|
|
9
9
|
//#region src/components/coachmark/coachmark.scss?lit
|
|
10
|
-
var coachmark_default = css([".c4p--coachmark-beacon{position:relative}.c4p--coachmark-beacon-default .c4p--coachmark-beacon__target:before{display:none}.c4p--coachmark-beacon-default .c4p--coachmark-beacon__target:after{background-color:#4589ff;block-size:.75rem;border-radius:50%;content:\"\";inline-size:.75rem;inset-block-start:.625rem;inset-inline-start:.625rem;position:absolute}.c4p--coachmark-beacon-default .c4p--coachmark-beacon__target:focus{outline:transparent}.c4p--coachmark-beacon-default .c4p--coachmark-beacon__target:focus:before{block-size:18px;border-radius:100%;content:\"\";display:block;inline-size:18px;inset-block-start:7px;inset-inline-start:7px;outline:.125rem var(--cds-focus,#0f62fe) solid;position:absolute}.c4p--coachmark-beacon .c4p--coachmark-beacon__target{background-color:transparent;block-size:2rem;border:none;border-radius:50%;cursor:pointer;display:flex;inline-size:2rem;padding:0}.c4p--coachmark-beacon .c4p--coachmark-beacon__target[aria-expanded=true] circle{animation:none}.c4p--coachmark-beacon__center{block-size:5rem;inline-size:5rem;inset-block-start:-1.375rem;inset-inline-start:-1.375rem;pointer-events:none;position:absolute;z-index:6900}.c4p--coachmark-beacon__center circle{animation:ripple 2s infinite;fill:var(--cds-support-info,#0043ce);fill-opacity:0;-webkit-mask-image:none;mask-image:none;stroke:var(--cds-support-info,#0043ce);stroke-opacity:0;stroke-width:1px;transition-timing-function:motion exit,productive}@media (prefers-reduced-motion){.c4p--coachmark-beacon__center circle{animation:none}}@keyframes ripple{0%{fill-opacity:0;r:1px;stroke-opacity:0;transition-timing-function:cubic-bezier(0,0,.38,.9)}31%{fill-opacity:.2;stroke-opacity:1}62%{fill-opacity:0;r:32px;stroke-opacity:0}to{fill-opacity:0;r:32px;stroke-opacity:0}}@keyframes ring-ripple{0%{fill-opacity:0;r:12px;stroke-opacity:0;transition-timing-function:cubic-bezier(0,0,.38,.9)}31%{fill-opacity:.2;stroke-opacity:1}62%{fill-opacity:0;r:32px;stroke-opacity:0}to{fill-opacity:0;r:32px;stroke-opacity:0}}:host{display:inline-block}.c4p--coachmark--popover{position:fixed}.c4p--coachmark--popover cds-popover-content.is-dragging::part(content){border-radius:0;box-shadow:0 0 0 .125rem var(--cds-icon-inverse,#fff),0 0 0 .25rem var(--cds-background-inverse,#393939)}"]);
|
|
10
|
+
var coachmark_default = css([".c4p--coachmark-beacon{position:relative}.c4p--coachmark-beacon-default .c4p--coachmark-beacon__target:before{display:none}.c4p--coachmark-beacon-default .c4p--coachmark-beacon__target:after{background-color:#4589ff;block-size:.75rem;border-radius:50%;content:\"\";inline-size:.75rem;inset-block-start:.625rem;inset-inline-start:.625rem;position:absolute}.c4p--coachmark-beacon-default .c4p--coachmark-beacon__target:focus{outline:transparent}.c4p--coachmark-beacon-default .c4p--coachmark-beacon__target:focus:before{block-size:18px;border-radius:100%;content:\"\";display:block;inline-size:18px;inset-block-start:7px;inset-inline-start:7px;outline:.125rem var(--cds-focus,#0f62fe) solid;position:absolute}.c4p--coachmark-beacon .c4p--coachmark-beacon__target{background-color:transparent;block-size:2rem;border:none;border-radius:50%;cursor:pointer;display:flex;inline-size:2rem;padding:0}.c4p--coachmark-beacon .c4p--coachmark-beacon__target[aria-expanded=true] circle{animation:none}.c4p--coachmark-beacon__center{block-size:5rem;inline-size:5rem;inset-block-start:-1.375rem;inset-inline-start:-1.375rem;pointer-events:none;position:absolute;z-index:6900}.c4p--coachmark-beacon__center circle{animation:ripple 2s infinite;fill:var(--cds-support-info,#0043ce);fill-opacity:0;-webkit-mask-image:none;mask-image:none;stroke:var(--cds-support-info,#0043ce);stroke-opacity:0;stroke-width:1px;transition-timing-function:motion exit,productive}@media (prefers-reduced-motion){.c4p--coachmark-beacon__center circle{animation:none}}@keyframes ripple{0%{fill-opacity:0;r:1px;stroke-opacity:0;transition-timing-function:cubic-bezier(0,0,.38,.9)}31%{fill-opacity:.2;stroke-opacity:1}62%{fill-opacity:0;r:32px;stroke-opacity:0}to{fill-opacity:0;r:32px;stroke-opacity:0}}@keyframes ring-ripple{0%{fill-opacity:0;r:12px;stroke-opacity:0;transition-timing-function:cubic-bezier(0,0,.38,.9)}31%{fill-opacity:.2;stroke-opacity:1}62%{fill-opacity:0;r:32px;stroke-opacity:0}to{fill-opacity:0;r:32px;stroke-opacity:0}}:host{display:inline-block}.c4p--visually-hidden{block-size:1px;border:0;margin:-1px;overflow:hidden;padding:0;position:absolute;clip:rect(0,0,0,0);inline-size:1px;visibility:inherit;white-space:nowrap}.c4p--coachmark--popover{position:fixed}.c4p--coachmark--popover cds-popover-content.c4p--coachmark--is-dragging::part(content),.c4p--coachmark--popover cds-popover-content.is-dragging::part(content){border-radius:0;box-shadow:0 0 0 .125rem var(--cds-icon-inverse,#fff),0 0 0 .25rem var(--cds-background-inverse,#393939)}"]);
|
|
11
11
|
//#endregion
|
|
12
12
|
export { coachmark_default as default };
|
|
13
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coachmark.scss.js","names":[],"sources":["../../../src/components/coachmark/coachmark.scss?lit"],"sourcesContent":["//\n// Copyright IBM Corp. 2025\n//\n// This source code is licensed under the Apache-2.0 license found in the\n// LICENSE file in the root directory of this source tree.\n//\n\n$css--plex: true !default;\n\n@use '@carbon/styles/scss/spacing' as *;\n@use '@carbon/styles/scss/theme' as *;\n@use '@carbon/ibm-products-styles/scss/config';\n@use '@carbon/ibm-products-styles/scss/components/Coachmark/_coachmark-beacon';\n\n$prefix: config.$pkg-prefix;\n$carbon-prefix: config.$carbon-prefix;\n\n$block-class: #{$prefix}--coachmark;\n\n:host {\n display: inline-block;\n}\n\n.#{$block-class}--popover {\n position: fixed;\n\n /* stylelint-disable-next-line selector-type-no-unknown */\n #{$carbon-prefix}-popover-content.is-dragging::part(content) {\n border-radius: 0;\n box-shadow:\n 0 0 0 $spacing-01 $icon-inverse,\n 0 0 0 $spacing-02 $background-inverse;\n }\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"coachmark.scss.js","names":[],"sources":["../../../src/components/coachmark/coachmark.scss?lit"],"sourcesContent":["//\n// Copyright IBM Corp. 2025\n//\n// This source code is licensed under the Apache-2.0 license found in the\n// LICENSE file in the root directory of this source tree.\n//\n\n$css--plex: true !default;\n\n@use '@carbon/styles/scss/spacing' as *;\n@use '@carbon/styles/scss/theme' as *;\n@use '@carbon/ibm-products-styles/scss/config';\n@use '@carbon/ibm-products-styles/scss/components/Coachmark/_coachmark-beacon';\n\n$prefix: config.$pkg-prefix;\n$carbon-prefix: config.$carbon-prefix;\n\n$block-class: #{$prefix}--coachmark;\n\n:host {\n display: inline-block;\n}\n\n.#{$prefix}--visually-hidden {\n position: absolute;\n overflow: hidden;\n padding: 0;\n border: 0;\n margin: -1px;\n block-size: 1px;\n clip: rect(0, 0, 0, 0);\n inline-size: 1px;\n visibility: inherit;\n white-space: nowrap;\n}\n\n.#{$block-class}--popover {\n position: fixed;\n\n /* stylelint-disable-next-line selector-type-no-unknown */\n #{$carbon-prefix}-popover-content.is-dragging::part(content),\n #{$carbon-prefix}-popover-content.#{$block-class}--is-dragging::part(\n content\n ) {\n border-radius: 0;\n box-shadow:\n 0 0 0 $spacing-01 $icon-inverse,\n 0 0 0 $spacing-02 $background-inverse;\n }\n}\n"],"mappings":""}
|