@momentum-design/components 0.129.40 → 0.129.42

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.
@@ -441,9 +441,8 @@ declare class Popover extends Popover_base {
441
441
  */
442
442
  private handleMouseLeave;
443
443
  /**
444
- * Handles focus out event on the trigger element.
445
- * This method checks if the popover is not hovered and hides the popover.
446
- * If the popover is hovered, it will not hide the popover.
444
+ * Handles focus out event on the trigger element.
445
+ * Closes based on hideOnBlur property or hover state.
447
446
  */
448
447
  private handleFocusOut;
449
448
  /**
@@ -415,6 +415,9 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
415
415
  this.setupTriggerListeners = () => {
416
416
  if (this.trigger.includes('click')) {
417
417
  document.addEventListener('click', this.togglePopoverVisible, { capture: true });
418
+ if (this.hideOnBlur) {
419
+ document.addEventListener('focusout', this.handleFocusOut, { capture: true });
420
+ }
418
421
  }
419
422
  if (this.trigger.includes('mouseenter')) {
420
423
  const hoverBridge = this.renderRoot.querySelector('div[part="popover-hover-bridge"]');
@@ -531,13 +534,20 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
531
534
  this.startCloseDelay();
532
535
  };
533
536
  /**
534
- * Handles focus out event on the trigger element.
535
- * This method checks if the popover is not hovered and hides the popover.
536
- * If the popover is hovered, it will not hide the popover.
537
+ * Handles focus out event on the trigger element.
538
+ * Closes based on hideOnBlur property or hover state.
537
539
  */
538
540
  this.handleFocusOut = (event) => {
539
541
  if (!this.isEventFromTrigger(event))
540
542
  return;
543
+ if (this.hideOnBlur) {
544
+ const { relatedTarget } = event;
545
+ // Don't hide if focus moves within the component
546
+ if (!this.contains(relatedTarget)) {
547
+ this.hide();
548
+ }
549
+ return;
550
+ }
541
551
  if (!this.isHovered) {
542
552
  this.hide();
543
553
  }
@@ -577,7 +577,7 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
577
577
  break;
578
578
  }
579
579
  default: {
580
- if (event.key.length === 1) {
580
+ if (event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {
581
581
  this.displayPopover = true;
582
582
  this.handleSelectedOptionByKeyInput(event.key);
583
583
  event.preventDefault();
@@ -12373,7 +12373,7 @@
12373
12373
  "kind": "field",
12374
12374
  "name": "handleFocusOut",
12375
12375
  "privacy": "private",
12376
- "description": "Handles focus out event on the trigger element.\nThis method checks if the popover is not hovered and hides the popover.\nIf the popover is hovered, it will not hide the popover.",
12376
+ "description": "Handles focus out event on the trigger element.\nCloses based on hideOnBlur property or hover state.",
12377
12377
  "inheritedFrom": {
12378
12378
  "name": "Popover",
12379
12379
  "module": "components/popover/popover.component.js"
@@ -27692,7 +27692,7 @@
27692
27692
  "kind": "field",
27693
27693
  "name": "handleFocusOut",
27694
27694
  "privacy": "private",
27695
- "description": "Handles focus out event on the trigger element.\nThis method checks if the popover is not hovered and hides the popover.\nIf the popover is hovered, it will not hide the popover.",
27695
+ "description": "Handles focus out event on the trigger element.\nCloses based on hideOnBlur property or hover state.",
27696
27696
  "inheritedFrom": {
27697
27697
  "name": "Popover",
27698
27698
  "module": "components/popover/popover.component.js"
@@ -34063,7 +34063,7 @@
34063
34063
  "kind": "field",
34064
34064
  "name": "handleFocusOut",
34065
34065
  "privacy": "private",
34066
- "description": "Handles focus out event on the trigger element.\nThis method checks if the popover is not hovered and hides the popover.\nIf the popover is hovered, it will not hide the popover."
34066
+ "description": "Handles focus out event on the trigger element.\nCloses based on hideOnBlur property or hover state."
34067
34067
  },
34068
34068
  {
34069
34069
  "kind": "field",
@@ -49941,7 +49941,7 @@
49941
49941
  "kind": "field",
49942
49942
  "name": "handleFocusOut",
49943
49943
  "privacy": "private",
49944
- "description": "Handles focus out event on the trigger element.\nThis method checks if the popover is not hovered and hides the popover.\nIf the popover is hovered, it will not hide the popover.",
49944
+ "description": "Handles focus out event on the trigger element.\nCloses based on hideOnBlur property or hover state.",
49945
49945
  "inheritedFrom": {
49946
49946
  "name": "Popover",
49947
49947
  "module": "components/popover/popover.component.js"
@@ -51985,7 +51985,7 @@
51985
51985
  "kind": "field",
51986
51986
  "name": "handleFocusOut",
51987
51987
  "privacy": "private",
51988
- "description": "Handles focus out event on the trigger element.\nThis method checks if the popover is not hovered and hides the popover.\nIf the popover is hovered, it will not hide the popover.",
51988
+ "description": "Handles focus out event on the trigger element.\nCloses based on hideOnBlur property or hover state.",
51989
51989
  "inheritedFrom": {
51990
51990
  "name": "Popover",
51991
51991
  "module": "components/popover/popover.component.js"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.129.40",
4
+ "version": "0.129.42",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"