@getflip/swirl-components 0.118.1 → 0.118.3

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/components.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-12-01T15:29:32",
2
+ "timestamp": "2023-12-12T15:11:28",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "3.3.1",
@@ -105,7 +105,7 @@ const SwirlPopover = class {
105
105
  }
106
106
  }
107
107
  onWindowClick(event) {
108
- if (!this.active) {
108
+ if (!this.active || this.closing) {
109
109
  return;
110
110
  }
111
111
  const target = event.target;
@@ -115,7 +115,7 @@ const SwirlPopover = class {
115
115
  .some((el) => Boolean(el) && el instanceof Node
116
116
  ? this.el.contains(el)
117
117
  : false);
118
- const clickedTrigger = target === this.triggerEl;
118
+ const clickedTrigger = target === this.triggerEl || this.triggerEl.contains(target);
119
119
  if (!clickedChild && !clickedShadowChild && !clickedTrigger) {
120
120
  this.close();
121
121
  }
@@ -270,14 +270,12 @@ const swirlPopoverTriggerCss = ".sc-swirl-popover-trigger-h{display:contents}";
270
270
  const SwirlPopoverTrigger = class {
271
271
  constructor(hostRef) {
272
272
  index.registerInstance(this, hostRef);
273
- this.popoverOpen = false;
274
- this.onClick = (event) => {
275
- event.stopPropagation();
273
+ this.onClick = () => {
276
274
  const popoverEl = this.getPopoverEl();
277
275
  if (!Boolean(popoverEl)) {
278
276
  return;
279
277
  }
280
- if (this.popoverOpen) {
278
+ if (this.isPopoverOpen()) {
281
279
  popoverEl.close();
282
280
  return;
283
281
  }
@@ -287,11 +285,9 @@ const SwirlPopoverTrigger = class {
287
285
  }
288
286
  popoverEl.open(triggerEl);
289
287
  popoverEl.addEventListener("popoverOpen", () => {
290
- this.popoverOpen = true;
291
288
  this.updateTriggerElAriaAttributes(true);
292
289
  }, { once: true });
293
290
  popoverEl.addEventListener("popoverClose", () => {
294
- this.popoverOpen = false;
295
291
  this.updateTriggerElAriaAttributes(false);
296
292
  }, { once: true });
297
293
  };
@@ -332,6 +328,11 @@ const SwirlPopoverTrigger = class {
332
328
  }
333
329
  return this.el.children[0];
334
330
  }
331
+ isPopoverOpen() {
332
+ const popover = this.getPopoverEl();
333
+ const isActive = popover.shadowRoot.firstChild?.classList.contains("popover--active");
334
+ return isActive;
335
+ }
335
336
  render() {
336
337
  return (index.h(index.Host, { onClick: this.onClick }, index.h("slot", null)));
337
338
  }