@momentum-design/components 0.27.6 → 0.28.1

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.
Files changed (41) hide show
  1. package/dist/browser/index.js +314 -131
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/button/button.styles.js +1 -0
  4. package/dist/components/buttonsimple/buttonsimple.component.d.ts +5 -0
  5. package/dist/components/buttonsimple/buttonsimple.component.js +10 -0
  6. package/dist/components/modalcontainer/modalcontainer.component.d.ts +9 -3
  7. package/dist/components/modalcontainer/modalcontainer.component.js +26 -15
  8. package/dist/components/modalcontainer/modalcontainer.constants.d.ts +2 -5
  9. package/dist/components/modalcontainer/modalcontainer.constants.js +3 -6
  10. package/dist/components/modalcontainer/modalcontainer.styles.js +6 -6
  11. package/dist/components/modalcontainer/modalcontainer.types.d.ts +1 -2
  12. package/dist/components/popover/index.d.ts +9 -0
  13. package/dist/components/popover/index.js +6 -0
  14. package/dist/components/popover/popover.component.d.ts +256 -0
  15. package/dist/components/popover/popover.component.js +675 -0
  16. package/dist/components/popover/popover.constants.d.ts +44 -0
  17. package/dist/components/popover/popover.constants.js +46 -0
  18. package/dist/components/popover/popover.events.d.ts +34 -0
  19. package/dist/components/popover/popover.events.js +47 -0
  20. package/dist/components/popover/popover.stack.d.ts +45 -0
  21. package/dist/components/popover/popover.stack.js +55 -0
  22. package/dist/components/popover/popover.styles.d.ts +2 -0
  23. package/dist/components/popover/popover.styles.js +109 -0
  24. package/dist/components/popover/popover.types.d.ts +4 -0
  25. package/dist/components/popover/popover.types.js +1 -0
  26. package/dist/components/popover/popover.utils.d.ts +48 -0
  27. package/dist/components/popover/popover.utils.js +156 -0
  28. package/dist/custom-elements.json +4135 -2187
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.js +2 -1
  31. package/dist/react/index.d.ts +2 -1
  32. package/dist/react/index.js +2 -1
  33. package/dist/react/popover/index.d.ts +24 -0
  34. package/dist/react/popover/index.js +33 -0
  35. package/dist/utils/mixins/DataAriaDescribedbyMixin.d.ts +6 -0
  36. package/dist/utils/mixins/DataAriaDescribedbyMixin.js +30 -0
  37. package/dist/utils/mixins/DataAriaLabelledbyMixin.d.ts +6 -0
  38. package/dist/utils/mixins/DataAriaLabelledbyMixin.js +29 -0
  39. package/dist/utils/mixins/FocusTrapMixin.d.ts +9 -0
  40. package/dist/utils/mixins/FocusTrapMixin.js +323 -0
  41. package/package.json +2 -1
@@ -0,0 +1,44 @@
1
+ declare const TAG_NAME: "mdc-popover";
2
+ declare const POPOVER_PLACEMENT: {
3
+ readonly LEFT_START: "left-start";
4
+ readonly LEFT: "left";
5
+ readonly LEFT_END: "left-end";
6
+ readonly RIGHT_START: "right-start";
7
+ readonly RIGHT: "right";
8
+ readonly RIGHT_END: "right-end";
9
+ readonly TOP_START: "top-start";
10
+ readonly TOP: "top";
11
+ readonly TOP_END: "top-end";
12
+ readonly BOTTOM_START: "bottom-start";
13
+ readonly BOTTOM: "bottom";
14
+ readonly BOTTOM_END: "bottom-end";
15
+ };
16
+ declare const TRIGGER: {
17
+ readonly CLICK: "click";
18
+ readonly MOUSEENTER: "mouseenter";
19
+ readonly FOCUSIN: "focusin";
20
+ readonly MANUAL: "manual";
21
+ };
22
+ declare const DEFAULTS: {
23
+ readonly PLACEMENT: "bottom";
24
+ readonly TRIGGER: "click";
25
+ readonly COLOR: "tonal";
26
+ readonly OFFSET: 4;
27
+ readonly VISIBLE: false;
28
+ readonly ARROW: false;
29
+ readonly CLOSE_BUTTON: false;
30
+ readonly FOCUS_TRAP: false;
31
+ readonly INTERACTIVE: false;
32
+ readonly PREVENT_SCROLL: false;
33
+ readonly HIDE_ON_ESCAPE: false;
34
+ readonly HIDE_ON_BLUR: false;
35
+ readonly HIDE_ON_CLICK_OUTSIDE: false;
36
+ readonly FOCUS_BACK: false;
37
+ readonly BACKDROP: false;
38
+ readonly FLIP: true;
39
+ readonly SIZE: false;
40
+ readonly DELAY: "0,0";
41
+ readonly ROLE: "dialog";
42
+ readonly Z_INDEX: 1000;
43
+ };
44
+ export { TAG_NAME, POPOVER_PLACEMENT, TRIGGER, DEFAULTS };
@@ -0,0 +1,46 @@
1
+ import utils from '../../utils/tag-name';
2
+ import { COLOR } from '../modalcontainer/modalcontainer.constants';
3
+ const TAG_NAME = utils.constructTagName('popover');
4
+ const POPOVER_PLACEMENT = {
5
+ LEFT_START: 'left-start',
6
+ LEFT: 'left',
7
+ LEFT_END: 'left-end',
8
+ RIGHT_START: 'right-start',
9
+ RIGHT: 'right',
10
+ RIGHT_END: 'right-end',
11
+ TOP_START: 'top-start',
12
+ TOP: 'top',
13
+ TOP_END: 'top-end',
14
+ BOTTOM_START: 'bottom-start',
15
+ BOTTOM: 'bottom',
16
+ BOTTOM_END: 'bottom-end',
17
+ };
18
+ const TRIGGER = {
19
+ CLICK: 'click',
20
+ MOUSEENTER: 'mouseenter',
21
+ FOCUSIN: 'focusin',
22
+ MANUAL: 'manual',
23
+ };
24
+ const DEFAULTS = {
25
+ PLACEMENT: POPOVER_PLACEMENT.BOTTOM,
26
+ TRIGGER: TRIGGER.CLICK,
27
+ COLOR: COLOR.TONAL,
28
+ OFFSET: 4,
29
+ VISIBLE: false,
30
+ ARROW: false,
31
+ CLOSE_BUTTON: false,
32
+ FOCUS_TRAP: false,
33
+ INTERACTIVE: false,
34
+ PREVENT_SCROLL: false,
35
+ HIDE_ON_ESCAPE: false,
36
+ HIDE_ON_BLUR: false,
37
+ HIDE_ON_CLICK_OUTSIDE: false,
38
+ FOCUS_BACK: false,
39
+ BACKDROP: false,
40
+ FLIP: true,
41
+ SIZE: false,
42
+ DELAY: '0,0',
43
+ ROLE: 'dialog',
44
+ Z_INDEX: 1000,
45
+ };
46
+ export { TAG_NAME, POPOVER_PLACEMENT, TRIGGER, DEFAULTS };
@@ -0,0 +1,34 @@
1
+ import type Popover from './popover.component';
2
+ export declare class PopoverEventManager {
3
+ /**
4
+ * Dispatches a custom event for the popover.
5
+ *
6
+ * @param eventName - The name of the event.
7
+ * @param instance - The popover instance.
8
+ */
9
+ static dispatchPopoverEvent(eventName: string, instance: Popover): void;
10
+ /**
11
+ * Custom event that is fired when the popover is shown.
12
+ *
13
+ * @param instance - The popover instance.
14
+ */
15
+ static onShowPopover(instance: Popover): void;
16
+ /**
17
+ * Custom event that is fired when the popover is hidden.
18
+ *
19
+ * @param instance - The popover instance.
20
+ */
21
+ static onHidePopover(instance: Popover): void;
22
+ /**
23
+ * Custom event that is fired when the popover is created.
24
+ *
25
+ * @param instance - The popover instance.
26
+ */
27
+ static onCreatedPopover(instance: Popover): void;
28
+ /**
29
+ * Custom event that is fired when the popover is destroyed.
30
+ *
31
+ * @param instance - The popover instance.
32
+ */
33
+ static onDestroyedPopover(instance: Popover): void;
34
+ }
@@ -0,0 +1,47 @@
1
+ export class PopoverEventManager {
2
+ /**
3
+ * Dispatches a custom event for the popover.
4
+ *
5
+ * @param eventName - The name of the event.
6
+ * @param instance - The popover instance.
7
+ */
8
+ static dispatchPopoverEvent(eventName, instance) {
9
+ instance.dispatchEvent(new CustomEvent(eventName, {
10
+ detail: { show: instance.visible },
11
+ composed: true,
12
+ bubbles: true,
13
+ }));
14
+ }
15
+ /**
16
+ * Custom event that is fired when the popover is shown.
17
+ *
18
+ * @param instance - The popover instance.
19
+ */
20
+ static onShowPopover(instance) {
21
+ this.dispatchPopoverEvent('popover-on-show', instance);
22
+ }
23
+ /**
24
+ * Custom event that is fired when the popover is hidden.
25
+ *
26
+ * @param instance - The popover instance.
27
+ */
28
+ static onHidePopover(instance) {
29
+ this.dispatchPopoverEvent('popover-on-hide', instance);
30
+ }
31
+ /**
32
+ * Custom event that is fired when the popover is created.
33
+ *
34
+ * @param instance - The popover instance.
35
+ */
36
+ static onCreatedPopover(instance) {
37
+ this.dispatchPopoverEvent('popover-on-created', instance);
38
+ }
39
+ /**
40
+ * Custom event that is fired when the popover is destroyed.
41
+ *
42
+ * @param instance - The popover instance.
43
+ */
44
+ static onDestroyedPopover(instance) {
45
+ this.dispatchPopoverEvent('popover-on-destroyed', instance);
46
+ }
47
+ }
@@ -0,0 +1,45 @@
1
+ import type Popover from './popover.component';
2
+ /**
3
+ * Manages a stack of popovers to control their order and lifecycle.
4
+ * This class allows adding, removing, and retrieving popovers
5
+ * while maintaining their stacking behavior.
6
+ *
7
+ */
8
+ declare class PopoverStack {
9
+ /**
10
+ * Stack to maintain the order of popovers
11
+ * @internal
12
+ */
13
+ private stack;
14
+ /**
15
+ * Adds a popover to the stack
16
+ *
17
+ * @param popover - Popover instance
18
+ */
19
+ push(popover: Popover): void;
20
+ /**
21
+ * Removes the last popover from the stack
22
+ *
23
+ * @returns The last popover in the stack
24
+ */
25
+ pop(): Popover | undefined;
26
+ /**
27
+ * Returns the last popover in the stack
28
+ * without removing it
29
+ *
30
+ * @returns The last popover in the stack
31
+ */
32
+ peek(): Popover | undefined;
33
+ /**
34
+ * Removes a popover from the stack
35
+ *
36
+ * @param popover - Popover instance
37
+ */
38
+ remove(popover: Popover): void;
39
+ /**
40
+ * Clears the stack
41
+ */
42
+ clear(): void;
43
+ }
44
+ export declare const popoverStack: PopoverStack;
45
+ export {};
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Manages a stack of popovers to control their order and lifecycle.
3
+ * This class allows adding, removing, and retrieving popovers
4
+ * while maintaining their stacking behavior.
5
+ *
6
+ */
7
+ class PopoverStack {
8
+ constructor() {
9
+ /**
10
+ * Stack to maintain the order of popovers
11
+ * @internal
12
+ */
13
+ this.stack = [];
14
+ }
15
+ /**
16
+ * Adds a popover to the stack
17
+ *
18
+ * @param popover - Popover instance
19
+ */
20
+ push(popover) {
21
+ this.stack.push(popover);
22
+ }
23
+ /**
24
+ * Removes the last popover from the stack
25
+ *
26
+ * @returns The last popover in the stack
27
+ */
28
+ pop() {
29
+ return this.stack.pop();
30
+ }
31
+ /**
32
+ * Returns the last popover in the stack
33
+ * without removing it
34
+ *
35
+ * @returns The last popover in the stack
36
+ */
37
+ peek() {
38
+ return this.stack[this.stack.length - 1];
39
+ }
40
+ /**
41
+ * Removes a popover from the stack
42
+ *
43
+ * @param popover - Popover instance
44
+ */
45
+ remove(popover) {
46
+ this.stack = this.stack.filter((item) => item !== popover);
47
+ }
48
+ /**
49
+ * Clears the stack
50
+ */
51
+ clear() {
52
+ this.stack = [];
53
+ }
54
+ }
55
+ export const popoverStack = new PopoverStack();
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,109 @@
1
+ import { css } from 'lit';
2
+ const styles = css `
3
+ :host {
4
+ --mdc-popover-arrow-border-radius: 0.1875rem;
5
+ --mdc-popover-arrow-border: 0.0625rem solid var(--mds-color-theme-outline-secondary-normal);
6
+
7
+ --mdc-popover-primary-background-color: var(--mds-color-theme-background-solid-primary-normal);
8
+ --mdc-popover-inverted-background-color: var(--mds-color-theme-inverted-background-normal);
9
+ --mdc-popover-inverted-border-color: var(--mds-color-theme-inverted-outline-primary-normal);
10
+ --mdc-popover-inverted-text-color: var(--mds-color-theme-inverted-text-primary-normal);
11
+ }
12
+
13
+ :host([color='contrast']) .popover-container {
14
+ .popover-arrow {
15
+ background-color: var(--mdc-popover-inverted-background-color);
16
+ border-color: var(--mdc-popover-inverted-border-color);
17
+ }
18
+
19
+ .popover-close {
20
+ color: var(--mdc-popover-inverted-text-color);
21
+ }
22
+ }
23
+
24
+ .popover-container {
25
+ display: none;
26
+ position: absolute;
27
+ box-sizing: content-box;
28
+ }
29
+
30
+ :host([visible]) .popover-container {
31
+ display: block;
32
+ }
33
+
34
+ .popover-container::part(container) {
35
+ padding: 0;
36
+ }
37
+
38
+ :host::part(popover-content) {
39
+ position: relative;
40
+ padding: 0.75rem;
41
+ overflow-y: auto;
42
+ min-width: max-content;
43
+ z-index: 9998;
44
+ }
45
+
46
+ .popover-backdrop {
47
+ z-index: 999;
48
+ position: fixed;
49
+ top: 0;
50
+ left: 0;
51
+ width: 100%;
52
+ height: 100%;
53
+ background: transparent;
54
+ }
55
+
56
+ .popover-hover-bridge {
57
+ position: absolute;
58
+ transform: translateX(-50%);
59
+ background: transparent;
60
+ pointer-events: auto;
61
+ }
62
+
63
+ .popover-arrow {
64
+ position: absolute;
65
+ width: 1rem;
66
+ height: 1rem;
67
+ background-color: var(--mdc-popover-primary-background-color);
68
+ transform: rotate(45deg);
69
+ pointer-events: none;
70
+ border: var(--mdc-popover-arrow-border);
71
+ }
72
+
73
+ .popover-close {
74
+ position: absolute;
75
+ right: 0.75rem;
76
+ top: 0.75rem;
77
+ cursor: pointer;
78
+ z-index: 9999;
79
+ }
80
+
81
+ .popover-arrow[data-side='top'] {
82
+ border-top: none;
83
+ border-left: none;
84
+ border-bottom-right-radius: var(--mdc-popover-arrow-border-radius);
85
+ border-top-left-radius: 100%;
86
+ }
87
+
88
+ .popover-arrow[data-side='bottom'] {
89
+ border-bottom: none;
90
+ border-right: none;
91
+ border-top-left-radius: var(--mdc-popover-arrow-border-radius);
92
+ border-bottom-right-radius: 100%;
93
+ }
94
+
95
+ .popover-arrow[data-side='right'] {
96
+ border-top: none;
97
+ border-right: none;
98
+ border-bottom-left-radius: var(--mdc-popover-arrow-border-radius);
99
+ border-top-right-radius: 100%;
100
+ }
101
+
102
+ .popover-arrow[data-side='left'] {
103
+ border-bottom: none;
104
+ border-left: none;
105
+ border-top-right-radius: var(--mdc-popover-arrow-border-radius);
106
+ border-bottom-left-radius: 100%;
107
+ }
108
+ `;
109
+ export default [styles];
@@ -0,0 +1,4 @@
1
+ import type { ValueOf } from '../../utils/types';
2
+ import { POPOVER_PLACEMENT, TRIGGER } from './popover.constants';
3
+ export type PopoverPlacement = ValueOf<typeof POPOVER_PLACEMENT>;
4
+ export type PopoverTrigger = ValueOf<typeof TRIGGER> | `${ValueOf<typeof TRIGGER>} ${ValueOf<typeof TRIGGER>}`;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,48 @@
1
+ import type Popover from './popover.component';
2
+ export declare class PopoverUtils {
3
+ /** @internal */
4
+ private popover;
5
+ /** @internal */
6
+ private arrowPixelChange;
7
+ constructor(popover: Popover);
8
+ /**
9
+ * Parses the delay string and sets the open and close delay values.
10
+ * If the delay string is invalid, the delay is set to 0.
11
+ * @returns An array containing the open and close delay values.
12
+ * @throws An error if the delay value is invalid.
13
+ */
14
+ setupDelay(): number[];
15
+ /**
16
+ * Sets up the hover bridge for the popover.
17
+ * The hover bridge is used to prevent the popover from closing when the mouse is over the popover.
18
+ *
19
+ * @param placement - The placement of the popover.
20
+ */
21
+ setupHoverBridge(placement: string): void;
22
+ /**
23
+ * If the `appendTo` property is set, finds the corresponding
24
+ * DOM element by its ID, and appends this popover as a child of that element.
25
+ */
26
+ setupAppendTo(): void;
27
+ /**
28
+ * Sets up the accessibility attributes for the popover.
29
+ */
30
+ setupAccessibility(): void;
31
+ /**
32
+ * Updates the arrow style based on the arrow data and placement.
33
+ *
34
+ * @param arrowData - The arrow data x and y.
35
+ * @param placement - The placement of the popover.
36
+ */
37
+ updateArrowStyle(arrowData: {
38
+ x?: number;
39
+ y?: number;
40
+ }, placement: string): void;
41
+ /**
42
+ * Updates the popover style based on the x and y position.
43
+ *
44
+ * @param x - The x position.
45
+ * @param y - The y position.
46
+ */
47
+ updatePopoverStyle(x: number, y: number): void;
48
+ }
@@ -0,0 +1,156 @@
1
+ export class PopoverUtils {
2
+ constructor(popover) {
3
+ /** @internal */
4
+ this.arrowPixelChange = false;
5
+ this.popover = popover;
6
+ }
7
+ /**
8
+ * Parses the delay string and sets the open and close delay values.
9
+ * If the delay string is invalid, the delay is set to 0.
10
+ * @returns An array containing the open and close delay values.
11
+ * @throws An error if the delay value is invalid.
12
+ */
13
+ setupDelay() {
14
+ try {
15
+ const [openDelay, closeDelay] = this.popover.delay.split(',').map((delay) => {
16
+ const parsed = parseInt(delay, 10);
17
+ if (Number.isNaN(parsed) || parsed < 0) {
18
+ throw new Error(`Invalid delay value: ${delay}`);
19
+ }
20
+ return parsed;
21
+ });
22
+ return [openDelay, closeDelay];
23
+ }
24
+ catch (error) {
25
+ this.popover.delay = '0,0';
26
+ return [0, 0];
27
+ }
28
+ }
29
+ /**
30
+ * Sets up the hover bridge for the popover.
31
+ * The hover bridge is used to prevent the popover from closing when the mouse is over the popover.
32
+ *
33
+ * @param placement - The placement of the popover.
34
+ */
35
+ setupHoverBridge(placement) {
36
+ var _a;
37
+ const hoverBridge = this.popover.renderRoot.querySelector('.popover-hover-bridge');
38
+ Object.assign(hoverBridge.style, {
39
+ top: '',
40
+ left: '',
41
+ right: '',
42
+ bottom: '',
43
+ });
44
+ const bridgeSize = `calc(${this.popover.showArrow ? '0.75rem + ' : ''}${this.popover.offset}px)`;
45
+ const modalContainer = (_a = this.popover.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('mdc-modalcontainer');
46
+ const popoverHeight = modalContainer.offsetHeight || 0;
47
+ const popoverWidth = modalContainer.offsetWidth || 0;
48
+ if (hoverBridge) {
49
+ const side = placement.split('-')[0];
50
+ switch (side) {
51
+ case 'top':
52
+ hoverBridge.style.height = bridgeSize;
53
+ hoverBridge.style.bottom = `calc(-1 * (${bridgeSize}))`;
54
+ hoverBridge.style.left = '50%';
55
+ hoverBridge.style.width = `${popoverWidth}px`;
56
+ break;
57
+ case 'left':
58
+ hoverBridge.style.height = `${popoverHeight}px`;
59
+ hoverBridge.style.width = bridgeSize;
60
+ hoverBridge.style.right = `calc(-1.5 * (${bridgeSize}))`;
61
+ break;
62
+ case 'right':
63
+ hoverBridge.style.height = `${popoverHeight}px`;
64
+ hoverBridge.style.width = bridgeSize;
65
+ hoverBridge.style.left = `calc(-0.5 * (${bridgeSize}))`;
66
+ break;
67
+ case 'bottom':
68
+ default:
69
+ hoverBridge.style.height = bridgeSize;
70
+ hoverBridge.style.top = `calc(-1 * (${bridgeSize}))`;
71
+ hoverBridge.style.left = '50%';
72
+ hoverBridge.style.width = `${popoverWidth}px`;
73
+ break;
74
+ }
75
+ }
76
+ }
77
+ /**
78
+ * If the `appendTo` property is set, finds the corresponding
79
+ * DOM element by its ID, and appends this popover as a child of that element.
80
+ */
81
+ setupAppendTo() {
82
+ if (this.popover.appendTo) {
83
+ const appendToElement = document.getElementById(this.popover.appendTo);
84
+ if (appendToElement) {
85
+ appendToElement.appendChild(this.popover);
86
+ }
87
+ }
88
+ }
89
+ /**
90
+ * Sets up the accessibility attributes for the popover.
91
+ */
92
+ setupAccessibility() {
93
+ var _a, _b, _c;
94
+ if (this.popover.interactive) {
95
+ if (!this.popover.dataAriaLabel) {
96
+ this.popover.dataAriaLabel = ((_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.ariaLabel)
97
+ || ((_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.textContent)
98
+ || '';
99
+ }
100
+ if (!this.popover.dataAriaLabelledby) {
101
+ this.popover.dataAriaLabelledby = ((_c = this.popover.triggerElement) === null || _c === void 0 ? void 0 : _c.id) || '';
102
+ }
103
+ }
104
+ }
105
+ /**
106
+ * Updates the arrow style based on the arrow data and placement.
107
+ *
108
+ * @param arrowData - The arrow data x and y.
109
+ * @param placement - The placement of the popover.
110
+ */
111
+ updateArrowStyle(arrowData, placement) {
112
+ var _a;
113
+ if (!this.popover.arrowElement)
114
+ return;
115
+ const side = placement.split('-')[0];
116
+ const staticSide = {
117
+ top: 'bottom',
118
+ right: 'left',
119
+ bottom: 'top',
120
+ left: 'right',
121
+ }[side];
122
+ const { x: arrowX, y: arrowY } = arrowData;
123
+ const rect = this.popover.arrowElement.getBoundingClientRect();
124
+ const parent = (_a = this.popover.arrowElement.offsetParent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
125
+ if (!this.arrowPixelChange) {
126
+ const pixelDiff = (parent === null || parent === void 0 ? void 0 : parent[staticSide]) ? 12 - Math.abs(rect[staticSide] - parent[staticSide]) : 0;
127
+ if (Math.round(pixelDiff) === 1) {
128
+ this.arrowPixelChange = true;
129
+ }
130
+ else {
131
+ this.arrowPixelChange = false;
132
+ }
133
+ }
134
+ const arrowPixelDiff = this.arrowPixelChange ? 0.5 : 0;
135
+ this.popover.arrowElement.setAttribute('data-side', side);
136
+ Object.assign(this.popover.arrowElement.style, {
137
+ left: arrowX != null ? `${arrowX}px` : '',
138
+ top: arrowY != null ? `${arrowY}px` : '',
139
+ [staticSide]: `${-this.popover.arrowElement.offsetHeight / 2 - arrowPixelDiff}px`,
140
+ });
141
+ }
142
+ /**
143
+ * Updates the popover style based on the x and y position.
144
+ *
145
+ * @param x - The x position.
146
+ * @param y - The y position.
147
+ */
148
+ updatePopoverStyle(x, y) {
149
+ if (!this.popover.containerElement)
150
+ return;
151
+ Object.assign(this.popover.containerElement.style, {
152
+ left: `${x}px`,
153
+ top: `${y}px`,
154
+ });
155
+ }
156
+ }