@momentum-design/components 0.127.8 → 0.127.9
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/dist/browser/index.js +5 -5
- package/dist/browser/index.js.map +3 -3
- package/dist/components/popover/popover.component.d.ts +31 -5
- package/dist/components/popover/popover.component.js +42 -14
- package/dist/components/popover/popover.stack.d.ts +2 -1
- package/dist/components/popover/popover.stack.js +2 -0
- package/dist/custom-elements.json +1017 -1042
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +4 -4
- package/dist/react/popover/index.d.ts +2 -2
- package/dist/react/popover/index.js +2 -2
- package/dist/utils/mixins/BackdropMixin.js +2 -2
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { Component } from '../../models';
|
|
|
3
3
|
import type { PopoverColor, PopoverPlacement, PopoverStrategy, PopoverTrigger } from './popover.types';
|
|
4
4
|
declare const Popover_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/BackdropMixin").BackdropMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/PreventScrollMixin").PreventScrollMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/FocusTrapMixin").FocusTrapClassInterface> & typeof Component;
|
|
5
5
|
/**
|
|
6
|
-
* Popover is
|
|
6
|
+
* Popover is generic overlay which can be triggered by any actionable element.
|
|
7
7
|
*
|
|
8
8
|
* It can be used for tooltips, dropdowns, menus or any showing any other contextual content.
|
|
9
9
|
*
|
|
@@ -19,7 +19,7 @@ declare const Popover_base: import("../../utils/mixins/index.types").Constructor
|
|
|
19
19
|
* aria-expanded and aria-haspopup attributes on the trigger.
|
|
20
20
|
*
|
|
21
21
|
* To prevent unexpected attribute changes on the trigger `disable-aria-expanded` attribute must be set on all linked
|
|
22
|
-
*
|
|
22
|
+
* Popovers except one.
|
|
23
23
|
*
|
|
24
24
|
* ### React Popover with append-to attribute
|
|
25
25
|
*
|
|
@@ -262,10 +262,22 @@ declare class Popover extends Popover_base {
|
|
|
262
262
|
*/
|
|
263
263
|
size: boolean;
|
|
264
264
|
/**
|
|
265
|
-
* The z-index of the popover.
|
|
266
|
-
*
|
|
265
|
+
* The effective z-index of the popover.
|
|
266
|
+
*
|
|
267
|
+
* If no explicit `z-index` value is provided, then we calculate
|
|
268
|
+
* z-index based on the popover’s nesting depth (`popoverDepth`)
|
|
269
|
+
* to ensure proper stacking order among multiple popovers.
|
|
270
|
+
*
|
|
271
|
+
* The formula used is: `DEFAULTS.Z_INDEX + (popoverDepth * 3)`.
|
|
272
|
+
* This approach guarantees that each nested popover appears above its parent.
|
|
273
|
+
* Ex: A root-level popover has a z-index of 1000,
|
|
274
|
+
* its first-level child popover will have a z-index of 1003,
|
|
275
|
+
* and a second-level child popover will have a z-index of 1006, and so on.
|
|
276
|
+
*
|
|
277
|
+
* When a value is explicitly set, it overrides the internally computed value.
|
|
267
278
|
*/
|
|
268
|
-
zIndex: number;
|
|
279
|
+
get zIndex(): number;
|
|
280
|
+
set zIndex(value: number);
|
|
269
281
|
/**
|
|
270
282
|
* Element ID that the popover append to.
|
|
271
283
|
* @default ''
|
|
@@ -345,6 +357,20 @@ declare class Popover extends Popover_base {
|
|
|
345
357
|
private floatingUICleanupFunction;
|
|
346
358
|
/** @internal */
|
|
347
359
|
protected shouldSuppressOpening: boolean;
|
|
360
|
+
/**
|
|
361
|
+
* The internal z-index of the popover.
|
|
362
|
+
* @internal
|
|
363
|
+
*/
|
|
364
|
+
private internalZIndex?;
|
|
365
|
+
/**
|
|
366
|
+
* At root-level popover starts with a depth of `0`. Each subsequent
|
|
367
|
+
* child popover increases the depth by one.
|
|
368
|
+
*
|
|
369
|
+
* This value is used to compute stacking order (z-index) dynamically,
|
|
370
|
+
* ensuring that nested popovers appear above their parent popovers.
|
|
371
|
+
* @internal
|
|
372
|
+
*/
|
|
373
|
+
private popoverDepth;
|
|
348
374
|
/** @internal */
|
|
349
375
|
private get connectedTooltip();
|
|
350
376
|
/**
|
|
@@ -22,7 +22,7 @@ import { popoverStack } from './popover.stack';
|
|
|
22
22
|
import styles from './popover.styles';
|
|
23
23
|
import { PopoverUtils } from './popover.utils';
|
|
24
24
|
/**
|
|
25
|
-
* Popover is
|
|
25
|
+
* Popover is generic overlay which can be triggered by any actionable element.
|
|
26
26
|
*
|
|
27
27
|
* It can be used for tooltips, dropdowns, menus or any showing any other contextual content.
|
|
28
28
|
*
|
|
@@ -38,7 +38,7 @@ import { PopoverUtils } from './popover.utils';
|
|
|
38
38
|
* aria-expanded and aria-haspopup attributes on the trigger.
|
|
39
39
|
*
|
|
40
40
|
* To prevent unexpected attribute changes on the trigger `disable-aria-expanded` attribute must be set on all linked
|
|
41
|
-
*
|
|
41
|
+
* Popovers except one.
|
|
42
42
|
*
|
|
43
43
|
* ### React Popover with append-to attribute
|
|
44
44
|
*
|
|
@@ -96,6 +96,30 @@ import { PopoverUtils } from './popover.utils';
|
|
|
96
96
|
* @csspart popover-hover-bridge - The hover bridge of the popover.
|
|
97
97
|
*/
|
|
98
98
|
class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component))) {
|
|
99
|
+
/**
|
|
100
|
+
* The effective z-index of the popover.
|
|
101
|
+
*
|
|
102
|
+
* If no explicit `z-index` value is provided, then we calculate
|
|
103
|
+
* z-index based on the popover’s nesting depth (`popoverDepth`)
|
|
104
|
+
* to ensure proper stacking order among multiple popovers.
|
|
105
|
+
*
|
|
106
|
+
* The formula used is: `DEFAULTS.Z_INDEX + (popoverDepth * 3)`.
|
|
107
|
+
* This approach guarantees that each nested popover appears above its parent.
|
|
108
|
+
* Ex: A root-level popover has a z-index of 1000,
|
|
109
|
+
* its first-level child popover will have a z-index of 1003,
|
|
110
|
+
* and a second-level child popover will have a z-index of 1006, and so on.
|
|
111
|
+
*
|
|
112
|
+
* When a value is explicitly set, it overrides the internally computed value.
|
|
113
|
+
*/
|
|
114
|
+
get zIndex() {
|
|
115
|
+
if (this.internalZIndex === undefined || !Number.isInteger(this.internalZIndex)) {
|
|
116
|
+
return DEFAULTS.Z_INDEX + this.popoverDepth * 3;
|
|
117
|
+
}
|
|
118
|
+
return this.internalZIndex;
|
|
119
|
+
}
|
|
120
|
+
set zIndex(value) {
|
|
121
|
+
this.internalZIndex = value;
|
|
122
|
+
}
|
|
99
123
|
/** @internal */
|
|
100
124
|
get connectedTooltip() {
|
|
101
125
|
const connectedTooltips = this.getRootNode().querySelectorAll(`mdc-tooltip[triggerID="${this.triggerID}"]`);
|
|
@@ -280,11 +304,6 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
280
304
|
* @default false
|
|
281
305
|
*/
|
|
282
306
|
this.size = DEFAULTS.SIZE;
|
|
283
|
-
/**
|
|
284
|
-
* The z-index of the popover.
|
|
285
|
-
* @default 1000
|
|
286
|
-
*/
|
|
287
|
-
this.zIndex = DEFAULTS.Z_INDEX;
|
|
288
307
|
/**
|
|
289
308
|
* aria-label attribute to be set for close button accessibility.
|
|
290
309
|
* @default null
|
|
@@ -357,6 +376,15 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
357
376
|
this.floatingUICleanupFunction = null;
|
|
358
377
|
/** @internal */
|
|
359
378
|
this.shouldSuppressOpening = false;
|
|
379
|
+
/**
|
|
380
|
+
* At root-level popover starts with a depth of `0`. Each subsequent
|
|
381
|
+
* child popover increases the depth by one.
|
|
382
|
+
*
|
|
383
|
+
* This value is used to compute stacking order (z-index) dynamically,
|
|
384
|
+
* ensuring that nested popovers appear above their parent popovers.
|
|
385
|
+
* @internal
|
|
386
|
+
*/
|
|
387
|
+
this.popoverDepth = 0;
|
|
360
388
|
this.parseTrigger = () => {
|
|
361
389
|
var _a;
|
|
362
390
|
const triggers = ((_a = this.trigger) === null || _a === void 0 ? void 0 : _a.split(' ')) || [];
|
|
@@ -684,7 +712,6 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
684
712
|
}
|
|
685
713
|
connectedCallback() {
|
|
686
714
|
super.connectedCallback();
|
|
687
|
-
this.style.zIndex = `${this.zIndex}`;
|
|
688
715
|
this.utils.setupAppendTo();
|
|
689
716
|
this.setupTriggerListeners();
|
|
690
717
|
}
|
|
@@ -729,9 +756,6 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
729
756
|
if (changedProperties.has('color')) {
|
|
730
757
|
this.setAttribute('color', Object.values(COLOR).includes(this.color) ? this.color : DEFAULTS.COLOR);
|
|
731
758
|
}
|
|
732
|
-
if (changedProperties.has('zIndex')) {
|
|
733
|
-
this.setAttribute('z-index', `${this.zIndex}`);
|
|
734
|
-
}
|
|
735
759
|
if (changedProperties.has('appendTo')) {
|
|
736
760
|
if (this.appendTo) {
|
|
737
761
|
this.utils.setupAppendTo();
|
|
@@ -787,7 +811,9 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
787
811
|
}
|
|
788
812
|
if (newValue && !this.shouldSuppressOpening) {
|
|
789
813
|
if (popoverStack.peek() !== this) {
|
|
790
|
-
popoverStack.push(this);
|
|
814
|
+
this.popoverDepth = popoverStack.push(this);
|
|
815
|
+
// request update to trigger zIndex recalculation
|
|
816
|
+
this.requestUpdate('zIndex');
|
|
791
817
|
}
|
|
792
818
|
if (!this.keepConnectedTooltipOpen) {
|
|
793
819
|
// If this popover gets visible and keepConnectedTooltipsClosed is true,
|
|
@@ -908,6 +934,7 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
908
934
|
}
|
|
909
935
|
}
|
|
910
936
|
render() {
|
|
937
|
+
this.style.zIndex = `${this.zIndex}`;
|
|
911
938
|
return html `
|
|
912
939
|
<div part="popover-hover-bridge"></div>
|
|
913
940
|
${this.closeButton
|
|
@@ -1034,8 +1061,9 @@ __decorate([
|
|
|
1034
1061
|
], Popover.prototype, "size", void 0);
|
|
1035
1062
|
__decorate([
|
|
1036
1063
|
property({ type: Number, reflect: true, attribute: 'z-index' }),
|
|
1037
|
-
__metadata("design:type", Number)
|
|
1038
|
-
|
|
1064
|
+
__metadata("design:type", Number),
|
|
1065
|
+
__metadata("design:paramtypes", [Number])
|
|
1066
|
+
], Popover.prototype, "zIndex", null);
|
|
1039
1067
|
__decorate([
|
|
1040
1068
|
property({ type: String, reflect: true, attribute: 'append-to' }),
|
|
1041
1069
|
__metadata("design:type", String)
|
|
@@ -15,8 +15,9 @@ declare class PopoverStack {
|
|
|
15
15
|
* Adds a popover to the stack
|
|
16
16
|
*
|
|
17
17
|
* @param popover - Popover instance
|
|
18
|
+
* @returns The new depth of the stack
|
|
18
19
|
*/
|
|
19
|
-
push(popover: Popover):
|
|
20
|
+
push(popover: Popover): number;
|
|
20
21
|
/**
|
|
21
22
|
* Removes the last popover from the stack
|
|
22
23
|
*
|
|
@@ -16,9 +16,11 @@ class PopoverStack {
|
|
|
16
16
|
* Adds a popover to the stack
|
|
17
17
|
*
|
|
18
18
|
* @param popover - Popover instance
|
|
19
|
+
* @returns The new depth of the stack
|
|
19
20
|
*/
|
|
20
21
|
push(popover) {
|
|
21
22
|
this.stack.push(popover);
|
|
23
|
+
return this.stack.length;
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* Removes the last popover from the stack
|