@momentum-design/components 0.129.46 → 0.129.47

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 (27) hide show
  1. package/dist/browser/index.js +264 -264
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/combobox/combobox.component.d.ts +1 -1
  4. package/dist/components/combobox/combobox.component.js +2 -5
  5. package/dist/components/dialog/dialog.component.d.ts +19 -7
  6. package/dist/components/dialog/dialog.component.js +40 -14
  7. package/dist/components/menubar/menubar.component.d.ts +6 -0
  8. package/dist/components/menubar/menubar.component.js +30 -26
  9. package/dist/components/menupopover/menupopover.component.d.ts +1 -1
  10. package/dist/components/menupopover/menupopover.component.js +19 -24
  11. package/dist/components/popover/popover.component.d.ts +14 -25
  12. package/dist/components/popover/popover.component.js +23 -32
  13. package/dist/components/searchpopover/searchpopover.component.d.ts +1 -1
  14. package/dist/components/searchpopover/searchpopover.component.js +2 -2
  15. package/dist/components/select/select.component.d.ts +1 -1
  16. package/dist/components/select/select.component.js +5 -3
  17. package/dist/components/tooltip/tooltip.component.d.ts +1 -0
  18. package/dist/components/tooltip/tooltip.component.js +17 -0
  19. package/dist/custom-elements.json +42 -59
  20. package/dist/utils/controllers/DepthManager.d.ts +202 -0
  21. package/dist/utils/controllers/DepthManager.js +259 -0
  22. package/dist/utils/mixins/BackdropMixin.js +19 -2
  23. package/dist/utils/mixins/FocusTrapMixin.d.ts +0 -0
  24. package/dist/utils/mixins/FocusTrapMixin.js +1 -0
  25. package/package.json +1 -1
  26. package/dist/components/popover/popover.stack.d.ts +0 -53
  27. package/dist/components/popover/popover.stack.js +0 -66
@@ -92,7 +92,7 @@ declare class Searchpopover extends Searchfield {
92
92
  * Override this to make sure this stays on top of other components.
93
93
  * @default 1000
94
94
  */
95
- popoverZIndex: number;
95
+ popoverZIndex?: number;
96
96
  /**
97
97
  * The aria-label for the popover within Searchpopover.
98
98
  * Use to provide an accessible name for the popover i.e. "Search results".
@@ -13,7 +13,7 @@ import { property } from 'lit/decorators.js';
13
13
  import { ifDefined } from 'lit/directives/if-defined.js';
14
14
  import { live } from 'lit/directives/live.js';
15
15
  import Searchfield from '../searchfield/searchfield.component';
16
- import { POPOVER_PLACEMENT, DEFAULTS as POPOVER_DEFAULTS } from '../popover/popover.constants';
16
+ import { POPOVER_PLACEMENT } from '../popover/popover.constants';
17
17
  import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwrapper.constants';
18
18
  import { ROLE } from '../../utils/roles';
19
19
  import styles from './searchpopover.styles';
@@ -111,7 +111,7 @@ class Searchpopover extends Searchfield {
111
111
  * Override this to make sure this stays on top of other components.
112
112
  * @default 1000
113
113
  */
114
- this.popoverZIndex = POPOVER_DEFAULTS.Z_INDEX;
114
+ this.popoverZIndex = undefined;
115
115
  }
116
116
  renderInputElement() {
117
117
  var _a, _b;
@@ -114,7 +114,7 @@ declare class Select extends Select_base implements AssociatedFormControl {
114
114
  * Override this to make sure this stays on top of other components.
115
115
  * @default 1000
116
116
  */
117
- popoverZIndex: number;
117
+ popoverZIndex?: number;
118
118
  /**
119
119
  * Determines whether the dropdown should flip its position when it hits the boundary.
120
120
  * @default false
@@ -131,7 +131,7 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
131
131
  * Override this to make sure this stays on top of other components.
132
132
  * @default 1000
133
133
  */
134
- this.popoverZIndex = POPOVER_DEFAULTS.Z_INDEX;
134
+ this.popoverZIndex = undefined;
135
135
  /**
136
136
  * Determines whether the dropdown should flip its position when it hits the boundary.
137
137
  * @default false
@@ -704,8 +704,10 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
704
704
  boundary="${ifDefined(this.boundary)}"
705
705
  strategy="${ifDefined(this.strategy)}"
706
706
  placement="${this.placement}"
707
- @closebyescape="${() => {
708
- this.displayPopover = false;
707
+ @closebyescape="${(event) => {
708
+ if (event.target === event.currentTarget) {
709
+ this.displayPopover = false;
710
+ }
709
711
  }}"
710
712
  @closebyoutsideclick="${() => {
711
713
  this.displayPopover = false;
@@ -71,6 +71,7 @@ declare class Tooltip extends Popover {
71
71
  * @param changedProperties - The changed properties.
72
72
  */
73
73
  private onTooltipTypeUpdated;
74
+ protected isOpenUpdated(oldValue: boolean, newValue: boolean): Promise<void>;
74
75
  update(changedProperties: PropertyValues<this>): Promise<void>;
75
76
  show(): void;
76
77
  static styles: Array<CSSResult>;
@@ -164,6 +164,23 @@ class Tooltip extends Popover {
164
164
  }
165
165
  }
166
166
  }
167
+ async isOpenUpdated(oldValue, newValue) {
168
+ const { triggerElement } = this;
169
+ if (oldValue === newValue || !triggerElement) {
170
+ return;
171
+ }
172
+ if (!newValue) {
173
+ // Timing is critical when the popover pushed/popped from the stack.
174
+ //
175
+ // Timing here:
176
+ // Tooltip closes -> New Popover opens -> Tooltip popped from the stack -> it popes out the new popover as well.
177
+ //
178
+ // It happens because by default the popped element automatically pop the element above it in the stack.
179
+ // To avoid this, we explicitly remove the tooltip from the stack before it is popped.
180
+ this.depthManager.remove([this]);
181
+ }
182
+ await super.isOpenUpdated(oldValue, newValue);
183
+ }
167
184
  async update(changedProperties) {
168
185
  super.update(changedProperties);
169
186
  if (changedProperties.has('id')) {
@@ -2525,13 +2525,12 @@
2525
2525
  {
2526
2526
  "kind": "field",
2527
2527
  "name": "zIndex",
2528
+ "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - OVERLAY_BACKDROP_Z_INDEX_OFFSET`.\nThe trigger element of the backdrop will have a z-index of `zIndex - OVERLAY_TRIGGER_Z_INDEX_OFFSET`,\nto make sure that it is above the backdrop and clickable.",
2529
+ "attribute": "z-index",
2530
+ "reflects": true,
2528
2531
  "type": {
2529
2532
  "text": "number"
2530
2533
  },
2531
- "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - 2`.\nThe trigger element of the backdrop will have a z-index of `zIndex - 1`,\nto make sure that it is above the backdrop and clickable.",
2532
- "default": "1000",
2533
- "attribute": "z-index",
2534
- "reflects": true,
2535
2534
  "inheritedFrom": {
2536
2535
  "name": "Dialog",
2537
2536
  "module": "components/dialog/dialog.component.js"
@@ -2648,11 +2647,7 @@
2648
2647
  },
2649
2648
  {
2650
2649
  "name": "z-index",
2651
- "type": {
2652
- "text": "number"
2653
- },
2654
- "description": "The z-index of the dialog\n\nThe backdrop will have z-index of `zIndex - 1`",
2655
- "default": "1000",
2650
+ "description": "The effective z-index of the dialog.\n\nIf no explicit `z-index` value is provided, then it automatically calculated\nto ensure proper stacking order among multiple overlays.",
2656
2651
  "fieldName": "zIndex",
2657
2652
  "inheritedFrom": {
2658
2653
  "name": "Dialog",
@@ -12458,7 +12453,7 @@
12458
12453
  {
12459
12454
  "kind": "field",
12460
12455
  "name": "zIndex",
12461
- "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - 2`.\nThe trigger element of the backdrop will have a z-index of `zIndex - 1`,\nto make sure that it is above the backdrop and clickable.",
12456
+ "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - OVERLAY_BACKDROP_Z_INDEX_OFFSET`.\nThe trigger element of the backdrop will have a z-index of `zIndex - OVERLAY_TRIGGER_Z_INDEX_OFFSET`,\nto make sure that it is above the backdrop and clickable.",
12462
12457
  "attribute": "z-index",
12463
12458
  "reflects": true,
12464
12459
  "type": {
@@ -12862,7 +12857,7 @@
12862
12857
  },
12863
12858
  {
12864
12859
  "name": "z-index",
12865
- "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then we calculate\nz-index based on the popover’s nesting depth (`popoverDepth`)\nto ensure proper stacking order among multiple popovers.\n\nThe formula used is: `DEFAULTS.Z_INDEX + (popoverDepth * 3)`.\nThis approach guarantees that each nested popover appears above its parent.\nEx: A root-level popover has a z-index of 1000,\n its first-level child popover will have a z-index of 1003,\n and a second-level child popover will have a z-index of 1006, and so on.\n\nWhen a value is explicitly set, it overrides the internally computed value.",
12860
+ "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then it automatically calculated\nto ensure proper stacking order among multiple overlays.",
12866
12861
  "fieldName": "zIndex",
12867
12862
  "inheritedFrom": {
12868
12863
  "name": "Popover",
@@ -13666,10 +13661,10 @@
13666
13661
  "kind": "field",
13667
13662
  "name": "popoverZIndex",
13668
13663
  "type": {
13669
- "text": "number"
13664
+ "text": "number | undefined"
13670
13665
  },
13666
+ "default": "undefined",
13671
13667
  "description": "The z-index of the popover within Combobox.\n\nOverride this to make sure this stays on top of other components.",
13672
- "default": "1000",
13673
13668
  "attribute": "popover-z-index",
13674
13669
  "reflects": true
13675
13670
  },
@@ -14194,10 +14189,10 @@
14194
14189
  {
14195
14190
  "name": "popover-z-index",
14196
14191
  "type": {
14197
- "text": "number"
14192
+ "text": "number | undefined"
14198
14193
  },
14194
+ "default": "undefined",
14199
14195
  "description": "The z-index of the popover within Combobox.\n\nOverride this to make sure this stays on top of other components.",
14200
- "default": "1000",
14201
14196
  "fieldName": "popoverZIndex"
14202
14197
  },
14203
14198
  {
@@ -14877,8 +14872,7 @@
14877
14872
  "type": {
14878
14873
  "text": "number"
14879
14874
  },
14880
- "description": "The z-index of the dialog\n\nThe backdrop will have z-index of `zIndex - 1`",
14881
- "default": "1000",
14875
+ "description": "The effective z-index of the dialog.\n\nIf no explicit `z-index` value is provided, then it automatically calculated\nto ensure proper stacking order among multiple overlays.",
14882
14876
  "attribute": "z-index",
14883
14877
  "reflects": true,
14884
14878
  "inheritedFrom": {
@@ -14944,11 +14938,7 @@
14944
14938
  },
14945
14939
  {
14946
14940
  "name": "z-index",
14947
- "type": {
14948
- "text": "number"
14949
- },
14950
- "description": "The z-index of the dialog\n\nThe backdrop will have z-index of `zIndex - 1`",
14951
- "default": "1000",
14941
+ "description": "The effective z-index of the dialog.\n\nIf no explicit `z-index` value is provided, then it automatically calculated\nto ensure proper stacking order among multiple overlays.",
14952
14942
  "fieldName": "zIndex"
14953
14943
  },
14954
14944
  {
@@ -22677,27 +22667,16 @@
22677
22667
  ]
22678
22668
  },
22679
22669
  {
22680
- "kind": "method",
22670
+ "kind": "field",
22681
22671
  "name": "handleClick",
22682
22672
  "privacy": "private",
22683
- "return": {
22684
- "type": {
22685
- "text": "void"
22686
- }
22687
- },
22673
+ "description": "Closes all other submenus on the top level.\nThis method is used to ensure that only one topolevel submenu is open at a time.\nIt finds all other menu items with submenus and closes their submenus.",
22688
22674
  "parameters": [
22689
- {
22690
- "name": "event",
22691
- "type": {
22692
- "text": "MouseEvent"
22693
- }
22694
- },
22695
22675
  {
22696
22676
  "description": "The target menu item that was clicked.",
22697
22677
  "name": "target"
22698
22678
  }
22699
- ],
22700
- "description": "Closes all other submenus on the top level.\nThis method is used to ensure that only one topolevel submenu is open at a time.\nIt finds all other menu items with submenus and closes their submenus."
22679
+ ]
22701
22680
  },
22702
22681
  {
22703
22682
  "kind": "method",
@@ -26272,7 +26251,7 @@
26272
26251
  "description": "The popover to close until."
26273
26252
  }
26274
26253
  ],
26275
- "description": "Closes all menu popovers in the stack.\nThis method is used to ensure that when a menu item is clicked,\nall other open popovers are closed, maintaining a clean user interface.\nIt iterates through the `popoverStack` and hides each popover until the stack is empty."
26254
+ "description": "Closes all menu popovers in the stack.\nThis method is used to ensure that when a menu item is clicked,\nall other open popovers are closed, maintaining a clean user interface.\nIt iterates through the overlay stack and hides each popover until the stack is empty."
26276
26255
  },
26277
26256
  {
26278
26257
  "kind": "field",
@@ -26548,7 +26527,7 @@
26548
26527
  {
26549
26528
  "name": "event",
26550
26529
  "type": {
26551
- "text": "MouseEvent"
26530
+ "text": "Event"
26552
26531
  },
26553
26532
  "description": "The mouse event that triggered the click."
26554
26533
  }
@@ -27012,7 +26991,7 @@
27012
26991
  {
27013
26992
  "kind": "field",
27014
26993
  "name": "zIndex",
27015
- "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - 2`.\nThe trigger element of the backdrop will have a z-index of `zIndex - 1`,\nto make sure that it is above the backdrop and clickable.",
26994
+ "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - OVERLAY_BACKDROP_Z_INDEX_OFFSET`.\nThe trigger element of the backdrop will have a z-index of `zIndex - OVERLAY_TRIGGER_Z_INDEX_OFFSET`,\nto make sure that it is above the backdrop and clickable.",
27016
26995
  "attribute": "z-index",
27017
26996
  "reflects": true,
27018
26997
  "type": {
@@ -27413,7 +27392,7 @@
27413
27392
  },
27414
27393
  {
27415
27394
  "name": "z-index",
27416
- "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then we calculate\nz-index based on the popover’s nesting depth (`popoverDepth`)\nto ensure proper stacking order among multiple popovers.\n\nThe formula used is: `DEFAULTS.Z_INDEX + (popoverDepth * 3)`.\nThis approach guarantees that each nested popover appears above its parent.\nEx: A root-level popover has a z-index of 1000,\n its first-level child popover will have a z-index of 1003,\n and a second-level child popover will have a z-index of 1006, and so on.\n\nWhen a value is explicitly set, it overrides the internally computed value.",
27395
+ "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then it automatically calculated\nto ensure proper stacking order among multiple overlays.",
27417
27396
  "fieldName": "zIndex",
27418
27397
  "inheritedFrom": {
27419
27398
  "name": "Popover",
@@ -32569,7 +32548,7 @@
32569
32548
  "type": {
32570
32549
  "text": "number"
32571
32550
  },
32572
- "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then we calculate\nz-index based on the popover’s nesting depth (`popoverDepth`)\nto ensure proper stacking order among multiple popovers.\n\nThe formula used is: `DEFAULTS.Z_INDEX + (popoverDepth * 3)`.\nThis approach guarantees that each nested popover appears above its parent.\nEx: A root-level popover has a z-index of 1000,\n its first-level child popover will have a z-index of 1003,\n and a second-level child popover will have a z-index of 1006, and so on.\n\nWhen a value is explicitly set, it overrides the internally computed value.",
32551
+ "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then it automatically calculated\nto ensure proper stacking order among multiple overlays.",
32573
32552
  "attribute": "z-index",
32574
32553
  "reflects": true,
32575
32554
  "inheritedFrom": {
@@ -32837,7 +32816,7 @@
32837
32816
  },
32838
32817
  {
32839
32818
  "name": "z-index",
32840
- "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then we calculate\nz-index based on the popover’s nesting depth (`popoverDepth`)\nto ensure proper stacking order among multiple popovers.\n\nThe formula used is: `DEFAULTS.Z_INDEX + (popoverDepth * 3)`.\nThis approach guarantees that each nested popover appears above its parent.\nEx: A root-level popover has a z-index of 1000,\n its first-level child popover will have a z-index of 1003,\n and a second-level child popover will have a z-index of 1006, and so on.\n\nWhen a value is explicitly set, it overrides the internally computed value.",
32819
+ "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then it automatically calculated\nto ensure proper stacking order among multiple overlays.",
32841
32820
  "fieldName": "zIndex"
32842
32821
  },
32843
32822
  {
@@ -38815,10 +38794,10 @@
38815
38794
  "kind": "field",
38816
38795
  "name": "popoverZIndex",
38817
38796
  "type": {
38818
- "text": "number"
38797
+ "text": "number | undefined"
38819
38798
  },
38799
+ "default": "undefined",
38820
38800
  "description": "The z-index of the popover within Searchpopover.\n\nOverride this to make sure this stays on top of other components.",
38821
- "default": "1000",
38822
38801
  "attribute": "popover-z-index",
38823
38802
  "reflects": true
38824
38803
  },
@@ -39287,10 +39266,10 @@
39287
39266
  {
39288
39267
  "name": "popover-z-index",
39289
39268
  "type": {
39290
- "text": "number"
39269
+ "text": "number | undefined"
39291
39270
  },
39271
+ "default": "undefined",
39292
39272
  "description": "The z-index of the popover within Searchpopover.\n\nOverride this to make sure this stays on top of other components.",
39293
- "default": "1000",
39294
39273
  "fieldName": "popoverZIndex"
39295
39274
  },
39296
39275
  {
@@ -40362,10 +40341,10 @@
40362
40341
  "kind": "field",
40363
40342
  "name": "popoverZIndex",
40364
40343
  "type": {
40365
- "text": "number"
40344
+ "text": "number | undefined"
40366
40345
  },
40346
+ "default": "undefined",
40367
40347
  "description": "The z-index of the popover within Select.\n\nOverride this to make sure this stays on top of other components.",
40368
- "default": "1000",
40369
40348
  "attribute": "popover-z-index",
40370
40349
  "reflects": true
40371
40350
  },
@@ -40840,10 +40819,10 @@
40840
40819
  {
40841
40820
  "name": "popover-z-index",
40842
40821
  "type": {
40843
- "text": "number"
40822
+ "text": "number | undefined"
40844
40823
  },
40824
+ "default": "undefined",
40845
40825
  "description": "The z-index of the popover within Select.\n\nOverride this to make sure this stays on top of other components.",
40846
- "default": "1000",
40847
40826
  "fieldName": "popoverZIndex"
40848
40827
  },
40849
40828
  {
@@ -48279,7 +48258,7 @@
48279
48258
  "type": {
48280
48259
  "text": "number"
48281
48260
  },
48282
- "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - 2`.\nThe trigger element of the backdrop will have a z-index of `zIndex - 1`,\nto make sure that it is above the backdrop and clickable.",
48261
+ "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - OVERLAY_BACKDROP_Z_INDEX_OFFSET`.\nThe trigger element of the backdrop will have a z-index of `zIndex - OVERLAY_TRIGGER_Z_INDEX_OFFSET`,\nto make sure that it is above the backdrop and clickable.",
48283
48262
  "attribute": "z-index",
48284
48263
  "reflects": true,
48285
48264
  "inheritedFrom": {
@@ -48675,7 +48654,7 @@
48675
48654
  },
48676
48655
  {
48677
48656
  "name": "z-index",
48678
- "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then we calculate\nz-index based on the popover’s nesting depth (`popoverDepth`)\nto ensure proper stacking order among multiple popovers.\n\nThe formula used is: `DEFAULTS.Z_INDEX + (popoverDepth * 3)`.\nThis approach guarantees that each nested popover appears above its parent.\nEx: A root-level popover has a z-index of 1000,\n its first-level child popover will have a z-index of 1003,\n and a second-level child popover will have a z-index of 1006, and so on.\n\nWhen a value is explicitly set, it overrides the internally computed value.",
48657
+ "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then it automatically calculated\nto ensure proper stacking order among multiple overlays.",
48679
48658
  "fieldName": "zIndex",
48680
48659
  "inheritedFrom": {
48681
48660
  "name": "Popover",
@@ -49412,15 +49391,13 @@
49412
49391
  "name": "oldValue",
49413
49392
  "type": {
49414
49393
  "text": "boolean"
49415
- },
49416
- "description": "The old value of the visible property."
49394
+ }
49417
49395
  },
49418
49396
  {
49419
49397
  "name": "newValue",
49420
49398
  "type": {
49421
49399
  "text": "boolean"
49422
- },
49423
- "description": "The new value of the visible property."
49400
+ }
49424
49401
  }
49425
49402
  ],
49426
49403
  "description": "Handles the popover visibility change and position the popover.\nHandles the exit event to close the popover.",
@@ -49741,7 +49718,7 @@
49741
49718
  "type": {
49742
49719
  "text": "number"
49743
49720
  },
49744
- "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - 2`.\nThe trigger element of the backdrop will have a z-index of `zIndex - 1`,\nto make sure that it is above the backdrop and clickable.",
49721
+ "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - OVERLAY_BACKDROP_Z_INDEX_OFFSET`.\nThe trigger element of the backdrop will have a z-index of `zIndex - OVERLAY_TRIGGER_Z_INDEX_OFFSET`,\nto make sure that it is above the backdrop and clickable.",
49745
49722
  "attribute": "z-index",
49746
49723
  "reflects": true,
49747
49724
  "inheritedFrom": {
@@ -50147,7 +50124,7 @@
50147
50124
  },
50148
50125
  {
50149
50126
  "name": "z-index",
50150
- "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then we calculate\nz-index based on the popover’s nesting depth (`popoverDepth`)\nto ensure proper stacking order among multiple popovers.\n\nThe formula used is: `DEFAULTS.Z_INDEX + (popoverDepth * 3)`.\nThis approach guarantees that each nested popover appears above its parent.\nEx: A root-level popover has a z-index of 1000,\n its first-level child popover will have a z-index of 1003,\n and a second-level child popover will have a z-index of 1006, and so on.\n\nWhen a value is explicitly set, it overrides the internally computed value.",
50127
+ "description": "The effective z-index of the popover.\n\nIf no explicit `z-index` value is provided, then it automatically calculated\nto ensure proper stacking order among multiple overlays.",
50151
50128
  "fieldName": "zIndex",
50152
50129
  "inheritedFrom": {
50153
50130
  "name": "Popover",
@@ -51468,7 +51445,7 @@
51468
51445
  "type": {
51469
51446
  "text": "number"
51470
51447
  },
51471
- "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - 2`.\nThe trigger element of the backdrop will have a z-index of `zIndex - 1`,\nto make sure that it is above the backdrop and clickable."
51448
+ "description": "IMPLEMENT THIS IN YOUR COMPONENT.\n\nThe z-index of the component where the backdrop will be attached to.\n\nThe backdrop itself will have a z-index of `zIndex - OVERLAY_BACKDROP_Z_INDEX_OFFSET`.\nThe trigger element of the backdrop will have a z-index of `zIndex - OVERLAY_TRIGGER_Z_INDEX_OFFSET`,\nto make sure that it is above the backdrop and clickable."
51472
51449
  }
51473
51450
  ],
51474
51451
  "parameters": [
@@ -52395,6 +52372,12 @@
52395
52372
  }
52396
52373
  ]
52397
52374
  },
52375
+ {
52376
+ "kind": "javascript-module",
52377
+ "path": "utils/mixins/FocusTrapMixin.js",
52378
+ "declarations": [],
52379
+ "exports": []
52380
+ },
52398
52381
  {
52399
52382
  "kind": "javascript-module",
52400
52383
  "path": "utils/mixins/FooterMixin.js",
@@ -0,0 +1,202 @@
1
+ import { ReactiveController } from 'lit';
2
+ import type { Component } from '../../models';
3
+ /**
4
+ * Types of changes that can occur in the stack
5
+ *
6
+ * - 'added': An element was added to the stack, e.g.: pushed
7
+ * - 'removed': An element was removed from the stack, e.g.: popped or removed
8
+ * - 'moved': An element's position in the stack changed e.g.: another element above it was removed
9
+ */
10
+ export type StackChange = 'added' | 'removed' | 'moved';
11
+ /**
12
+ * A component that can be managed by the DepthManager stack.
13
+ *
14
+ * These elements can receive notifications when their position in the stack changes
15
+ * if they implement the `onComponentStackChanged` callback.
16
+ */
17
+ export interface StackedOverlayComponent extends Component {
18
+ /**
19
+ * Callback invoked when the component's position in the stack changes.
20
+ *
21
+ * @param change - The type of change that occurred in the stack.
22
+ */
23
+ onComponentStackChanged?: (change: StackChange) => void;
24
+ /**
25
+ * ID of the trigger element associated with this overlay component
26
+ */
27
+ triggerID?: string;
28
+ }
29
+ /**
30
+ * Predicate function used to determine whether to pop an item from the stack.
31
+ * - Returns true to pop the item.
32
+ * - Returns false to stop popping items.
33
+ * - Returns 'skip' to skip the item without popping it.
34
+ */
35
+ type PopPredicateFn = (item: StackedOverlayComponent, idx: number) => true | false | 'skip';
36
+ export declare const OVERLAY_BACKDROP_Z_INDEX_OFFSET = -2;
37
+ export declare const OVERLAY_TRIGGER_Z_INDEX_OFFSET = -1;
38
+ /**
39
+ * DepthManager is a controller that manages a stack of elements to control their depth (z-index).
40
+ *
41
+ * It uses a global stack to keep track of the order of elements, allowing for proper layering of overlays.
42
+ *
43
+ * ## Use Case
44
+ *
45
+ * ### Pop single overlay
46
+ *
47
+ * The easiest one, usually the host removes itself from the stack when it is closed, with the `popHost` method.
48
+ *
49
+ * ### Pop until specific overlay
50
+ *
51
+ * When the chain of nested popover (e.g.: submenus) opened and the user closes other than the last one,
52
+ * we have to close all overlays stacked above the specific one. In this case, the `popItem` or directly the `pupUntil` method is used.
53
+ *
54
+ * ### Closing "sibling" overlays
55
+ *
56
+ * In some cases, multiple overlays can be opened from the same trigger (e.g.: tooltip, context menu, etc.), we can not close
57
+ * all overlays above the specific one, because they independently opened.
58
+ *
59
+ * `popUntil` method can handle this case by skipping the overlays which share the same trigger ID as the specified one.
60
+ *
61
+ * ### Manually removing overlays
62
+ *
63
+ * When the user switch from one sub-menu to another, we need to close all sub-menus from common parent menu.
64
+ * DepthManager does not have built-in solution for this case. The host component need to make sure the submenu
65
+ * hide before the new one is shown.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * // Add and remove item based on the disabled state
70
+ * class Container extends Component {
71
+ * private this.depthManager = new DepthManager<>(this);
72
+ *
73
+ * constructor() {
74
+ * super();
75
+ * this.addEventListener('modified', this.handleModifiedEvent);
76
+ * }
77
+ *
78
+ * openOverlay() {
79
+ * this.depthManager.pushHost()
80
+ * }
81
+ *
82
+ * closeOverlay() {
83
+ * this.depthManager.popHost()
84
+ * }
85
+ *
86
+ * onComponentStackChanged (change: StackChange) {
87
+ * switch (change) {
88
+ * case 'added':
89
+ * return;
90
+ * case 'removed':
91
+ * return this.closeOverlay()
92
+ * case 'moved':
93
+ * return this.requestUpdate('zIndex');
94
+ * }
95
+ * }
96
+ * }
97
+ * ```
98
+ */
99
+ export declare class DepthManager implements ReactiveController {
100
+ private readonly host;
101
+ /**
102
+ * Creates an instance of DepthManager.
103
+ */
104
+ constructor(host: StackedOverlayComponent);
105
+ hostConnected(): void;
106
+ hostDisconnected(): void;
107
+ /**
108
+ * Gets the total number of elements in the stack
109
+ */
110
+ get length(): number;
111
+ /**
112
+ * Adds host element to the stack
113
+ *
114
+ * @returns push was successful (true) or not (false)
115
+ */
116
+ pushHost(): boolean;
117
+ /**
118
+ * Pops all the items above the host and then pops the host itself
119
+ *
120
+ * @returns The host if it was in the stack, undefined otherwise
121
+ */
122
+ popHost(): StackedOverlayComponent | undefined;
123
+ /**
124
+ * Pops all the items above the specified item and then pops the item itself
125
+ *
126
+ * @param item - The item to pop
127
+ * @returns The item if it was in the stack, undefined otherwise
128
+ */
129
+ popItem(item: StackedOverlayComponent): StackedOverlayComponent | undefined;
130
+ /**
131
+ * Removes the last element from the stack
132
+ *
133
+ * @returns The last element in the stack
134
+ */
135
+ pop(): StackedOverlayComponent | undefined;
136
+ /**
137
+ * Removes elements from the stack until the predicate function returns false
138
+ *
139
+ * Note: it will remove the
140
+ *
141
+ * @param predicateFn - The predicate function to test each element
142
+ * @returns The removed elements
143
+ */
144
+ popUntil(predicateFn: PopPredicateFn): StackedOverlayComponent[];
145
+ /**
146
+ * Returns the last element in the stack
147
+ * without removing it
148
+ *
149
+ * @returns The last element in the stack
150
+ */
151
+ peek(): StackedOverlayComponent | undefined;
152
+ /**
153
+ * Removes one or more elements from the stack without popping others.
154
+ *
155
+ * It notifies the elements on the stack which were removed and those which changed position.
156
+ * Items removed in bach, notify moved items only once.
157
+ *
158
+ * @param elements - Popover instance
159
+ * @returns undefined when the element was not found, the removed element otherwise
160
+ */
161
+ remove(elements: StackedOverlayComponent[]): StackedOverlayComponent[];
162
+ /**
163
+ * Checks if the stack has a specific element
164
+ *
165
+ * @param element - Popover instance
166
+ * @returns True if the stack has the element, false otherwise
167
+ */
168
+ has(element: StackedOverlayComponent): boolean;
169
+ /**
170
+ * Gets the depth of the host element in the stack
171
+ */
172
+ getHostDepth(): number;
173
+ /**
174
+ * Gets the depth of the element in the stack
175
+ * @param element - The element to get the depth of
176
+ */
177
+ getElementDepth(element: StackedOverlayComponent): number;
178
+ /**
179
+ * Gets the z-index of the host element in the stack
180
+ */
181
+ getHostZIndex(): number;
182
+ /**
183
+ * Gets the z-index of the element in the stack
184
+ * @param element - The element to get the z-index of
185
+ *
186
+ * @returns The z-index of the element if found, otherwise returns -1
187
+ */
188
+ getItemZIndex(element: StackedOverlayComponent): number;
189
+ /**
190
+ * Checks if host is at the top of the stack
191
+ *
192
+ * @returns True if host is on top, false otherwise
193
+ */
194
+ isHostOnTop(): boolean;
195
+ /**
196
+ * Clears the stack
197
+ *
198
+ * Pops all elements from the stack one-by-one.
199
+ */
200
+ clear(): void;
201
+ }
202
+ export {};