@getflip/swirl-components 0.300.3 → 0.300.5

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": "2025-03-07T08:46:44",
2
+ "timestamp": "2025-03-10T10:36:50",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.18.1",
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1a9a1551.js');
6
- const utils = require('./utils-1a1dd8d3.js');
7
6
  const index$1 = require('./index-9f94303c.js');
7
+ const utils = require('./utils-1a1dd8d3.js');
8
8
 
9
- const swirlCarouselCss = ":host{--swirl-carousel-spacing:var(--s-space-16);position:relative;display:block;overflow:hidden;width:100%}:host(:hover) .carousel__previous-slide-button,:host(:hover) .carousel__next-slide-button{pointer-events:auto;opacity:1}:host *{box-sizing:border-box}.carousel{position:relative;overflow:hidden;width:100%}.carousel:before,.carousel:after{content:'';width:var(--s-space-32);height:100%;position:absolute;top:0;z-index:1;pointer-events:none;transition:opacity 0.2s;opacity:0}.carousel:before{left:0;background:linear-gradient(90deg, var(--s-background-default) 0%, transparent 100%)}.carousel:after{right:0;background:linear-gradient(270deg, var(--s-background-default) 0%, transparent 100%)}.carousel--fade:before,.carousel--fade:after{opacity:1}.carousel--is-at-start:before,.carousel--is-at-end:after{opacity:0}.carousel__slides{position:relative;display:flex;overflow-x:auto;overflow-y:hidden;width:100%;scrollbar-width:none;scroll-snap-type:x mandatory;scroll-behavior:smooth}.carousel__slides::-webkit-scrollbar{display:none}.carousel__slides ::slotted(*:not(:first-of-type)){margin-left:var(--swirl-carousel-spacing)}.carousel__slides ::slotted(*){flex-grow:0;flex-shrink:0;scroll-snap-align:start}.carousel__previous-slide-button,.carousel__next-slide-button{position:absolute;z-index:2;top:calc(50% - var(--s-space-12));visibility:hidden;transition:opacity 0.2s;transform:translateY(-50%) scale(0.72);pointer-events:none;opacity:0}@media (min-width: 768px){.carousel__previous-slide-button,.carousel__next-slide-button{visibility:visible}}.carousel__previous-slide-button{left:var(--s-space-4)}.carousel__next-slide-button{right:var(--s-space-4)}";
9
+ const swirlCarouselCss = ":host{--swirl-carousel-spacing:var(--s-space-16);position:relative;display:block;overflow:hidden;width:100%}:host(:hover) .carousel__previous-slide-button,:host(:hover) .carousel__next-slide-button{pointer-events:auto}:host *{box-sizing:border-box}.carousel{position:relative;overflow:hidden;width:100%}.carousel:before,.carousel:after{position:absolute;z-index:1;top:0;width:var(--s-space-32);height:100%;content:\"\";transition:opacity 0.2s;pointer-events:none;opacity:0}.carousel:before{left:0;background:linear-gradient(\n 90deg,\n var(--s-background-default) 0%,\n transparent 100%\n )}.carousel:after{right:0;background:linear-gradient(\n 270deg,\n var(--s-background-default) 0%,\n transparent 100%\n )}.carousel--fade:before,.carousel--fade:after{opacity:1}.carousel--is-at-start:before,.carousel--is-at-end:after{opacity:0}.carousel__slides{position:relative;display:flex;overflow-x:auto;overflow-y:hidden;width:100%;scrollbar-width:none;scroll-snap-type:x mandatory;scroll-behavior:smooth}.carousel__slides::-webkit-scrollbar{display:none}.carousel__slides ::slotted(*:not(:first-of-type)){margin-left:var(--swirl-carousel-spacing)}.carousel__slides ::slotted(*){flex-grow:0;flex-shrink:0;scroll-snap-align:start}.carousel__previous-slide-button,.carousel__next-slide-button{position:absolute;z-index:2;top:50%;transform:translateY(-50%) scale(0.72);pointer-events:none}.carousel__previous-slide-button{left:var(--s-space-4)}.carousel__next-slide-button{right:var(--s-space-4)}";
10
10
  const SwirlCarouselStyle0 = swirlCarouselCss;
11
11
 
12
12
  const SwirlCarousel = class {
@@ -31,6 +31,8 @@ const SwirlCarousel = class {
31
31
  this.onSlotChange = () => {
32
32
  // restore scroll position to active slide when slides are removed or added after first render
33
33
  this.activeSlides[0]?.scrollIntoView({ block: "nearest", inline: "start" });
34
+ this.checkScrollStatus();
35
+ this.checkScrollPosition();
34
36
  };
35
37
  this.onScroll = () => {
36
38
  this.updateActiveSlideReferences();
@@ -56,6 +58,9 @@ const SwirlCarousel = class {
56
58
  }
57
59
  componentDidLoad() {
58
60
  queueMicrotask(() => {
61
+ if (!this.el.isConnected) {
62
+ return;
63
+ }
59
64
  this.checkScrollStatus();
60
65
  this.checkScrollPosition();
61
66
  });
@@ -147,7 +152,7 @@ const SwirlCarousel = class {
147
152
  "carousel--is-at-start": this.isAtStart,
148
153
  "carousel--is-at-end": this.isAtEnd,
149
154
  });
150
- return (index.h(index.Host, { key: '1fa2ce01d868f592ea8101ef88f2769eddfcf0fa', "aria-label": this.label, "aria-roledescription": "carousel", role: "group" }, index.h("div", { key: '8c650518f2eb1b419f706a7e055f9edd49ad613e', class: className }, this.isScrollable && !this.isAtStart && (index.h("swirl-button", { key: '4a3f6b512d7f2ba3a564be80b94e3148241e63a5', class: "carousel__previous-slide-button", hideLabel: true, icon: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.previousSlideButtonLabel, onClick: this.onPreviousSlideButtonClick, pill: true, variant: "floating" })), this.isScrollable && !this.isAtEnd && (index.h("swirl-button", { key: 'c292c6470e30a50326186fc0b50b9621b2e60c80', class: "carousel__next-slide-button", hideLabel: true, icon: "<swirl-icon-arrow-forward></swirl-icon-arrow-forward>", label: this.nextSlideButtonLabel, onClick: this.onNextSlideButtonClick, pill: true, variant: "floating" })), index.h("div", { key: '3c507ac4ea5d2d23fbf095f3cca22cc20ce9911f', "aria-live": "polite", class: "carousel__slides", style: slidesStyles, onScroll: this.onScroll, ref: (el) => (this.slidesContainer = el) }, index.h("slot", { key: '3c3ab23d3bb493846d58f5c4fe04ede0fe42cd79', onSlotchange: this.onSlotChange })))));
155
+ return (index.h(index.Host, { key: '47aaf48b6caa091c30f11815fdaaafd74f1d680f', "aria-label": this.label, "aria-roledescription": "carousel", role: "group" }, index.h("div", { key: 'dd2411e2a9c5eaf75ec3be8993c84e33ea24b58b', class: className }, this.isScrollable && !this.isAtStart && (index.h("swirl-button", { key: '5e0b1d6a87bb64083e6af150e915f40c0d876c1f', class: "carousel__previous-slide-button", hideLabel: true, icon: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.previousSlideButtonLabel, onClick: this.onPreviousSlideButtonClick, pill: true, variant: "floating" })), this.isScrollable && !this.isAtEnd && (index.h("swirl-button", { key: '7f2a5cd69204b7c225c7c3bdf6379ddad1086070', class: "carousel__next-slide-button", hideLabel: true, icon: "<swirl-icon-arrow-forward></swirl-icon-arrow-forward>", label: this.nextSlideButtonLabel, onClick: this.onNextSlideButtonClick, pill: true, variant: "floating" })), index.h("div", { key: '2ac74f8d435e2ab59ce1d8e9f89a8c2e3348bfd4', "aria-live": "polite", class: "carousel__slides", style: slidesStyles, onScroll: this.onScroll, ref: (el) => (this.slidesContainer = el) }, index.h("slot", { key: '461cce12da0c3773bfa1b10c3c32105c801a68c4', onSlotchange: this.onSlotChange })))));
151
156
  }
152
157
  get el() { return index.getElement(this); }
153
158
  };
@@ -10,7 +10,6 @@
10
10
  :host(:hover) .carousel__previous-slide-button,
11
11
  :host(:hover) .carousel__next-slide-button {
12
12
  pointer-events: auto;
13
- opacity: 1;
14
13
  }
15
14
 
16
15
  :host * {
@@ -25,25 +24,33 @@
25
24
 
26
25
  .carousel:before,
27
26
  .carousel:after {
28
- content: '';
29
- width: var(--s-space-32);
30
- height: 100%;
31
27
  position: absolute;
32
- top: 0;
33
28
  z-index: 1;
34
- pointer-events: none;
29
+ top: 0;
30
+ width: var(--s-space-32);
31
+ height: 100%;
32
+ content: "";
35
33
  transition: opacity 0.2s;
34
+ pointer-events: none;
36
35
  opacity: 0;
37
36
  }
38
37
 
39
38
  .carousel:before {
40
39
  left: 0;
41
- background: linear-gradient(90deg, var(--s-background-default) 0%, transparent 100%);
40
+ background: linear-gradient(
41
+ 90deg,
42
+ var(--s-background-default) 0%,
43
+ transparent 100%
44
+ );
42
45
  }
43
46
 
44
47
  .carousel:after {
45
48
  right: 0;
46
- background: linear-gradient(270deg, var(--s-background-default) 0%, transparent 100%);
49
+ background: linear-gradient(
50
+ 270deg,
51
+ var(--s-background-default) 0%,
52
+ transparent 100%
53
+ );
47
54
  }
48
55
 
49
56
  .carousel--fade:before,
@@ -85,22 +92,11 @@
85
92
  .carousel__next-slide-button {
86
93
  position: absolute;
87
94
  z-index: 2;
88
- top: calc(50% - var(--s-space-12));
89
- visibility: hidden;
90
- transition: opacity 0.2s;
95
+ top: 50%;
91
96
  transform: translateY(-50%) scale(0.72);
92
97
  pointer-events: none;
93
- opacity: 0;
94
98
  }
95
99
 
96
- @media (min-width: 768px) {
97
-
98
- .carousel__previous-slide-button,
99
- .carousel__next-slide-button {
100
- visibility: visible
101
- }
102
- }
103
-
104
100
  .carousel__previous-slide-button {
105
101
  left: var(--s-space-4);
106
102
  }
@@ -1,6 +1,6 @@
1
1
  import { h, Host, } from "@stencil/core";
2
- import { debounce } from "../../utils";
3
2
  import classnames from "classnames";
3
+ import { debounce } from "../../utils";
4
4
  /**
5
5
  * slot - The slides
6
6
  */
@@ -24,6 +24,8 @@ export class SwirlCarousel {
24
24
  this.onSlotChange = () => {
25
25
  // restore scroll position to active slide when slides are removed or added after first render
26
26
  this.activeSlides[0]?.scrollIntoView({ block: "nearest", inline: "start" });
27
+ this.checkScrollStatus();
28
+ this.checkScrollPosition();
27
29
  };
28
30
  this.onScroll = () => {
29
31
  this.updateActiveSlideReferences();
@@ -49,6 +51,9 @@ export class SwirlCarousel {
49
51
  }
50
52
  componentDidLoad() {
51
53
  queueMicrotask(() => {
54
+ if (!this.el.isConnected) {
55
+ return;
56
+ }
52
57
  this.checkScrollStatus();
53
58
  this.checkScrollPosition();
54
59
  });
@@ -140,7 +145,7 @@ export class SwirlCarousel {
140
145
  "carousel--is-at-start": this.isAtStart,
141
146
  "carousel--is-at-end": this.isAtEnd,
142
147
  });
143
- return (h(Host, { key: '1fa2ce01d868f592ea8101ef88f2769eddfcf0fa', "aria-label": this.label, "aria-roledescription": "carousel", role: "group" }, h("div", { key: '8c650518f2eb1b419f706a7e055f9edd49ad613e', class: className }, this.isScrollable && !this.isAtStart && (h("swirl-button", { key: '4a3f6b512d7f2ba3a564be80b94e3148241e63a5', class: "carousel__previous-slide-button", hideLabel: true, icon: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.previousSlideButtonLabel, onClick: this.onPreviousSlideButtonClick, pill: true, variant: "floating" })), this.isScrollable && !this.isAtEnd && (h("swirl-button", { key: 'c292c6470e30a50326186fc0b50b9621b2e60c80', class: "carousel__next-slide-button", hideLabel: true, icon: "<swirl-icon-arrow-forward></swirl-icon-arrow-forward>", label: this.nextSlideButtonLabel, onClick: this.onNextSlideButtonClick, pill: true, variant: "floating" })), h("div", { key: '3c507ac4ea5d2d23fbf095f3cca22cc20ce9911f', "aria-live": "polite", class: "carousel__slides", style: slidesStyles, onScroll: this.onScroll, ref: (el) => (this.slidesContainer = el) }, h("slot", { key: '3c3ab23d3bb493846d58f5c4fe04ede0fe42cd79', onSlotchange: this.onSlotChange })))));
148
+ return (h(Host, { key: '47aaf48b6caa091c30f11815fdaaafd74f1d680f', "aria-label": this.label, "aria-roledescription": "carousel", role: "group" }, h("div", { key: 'dd2411e2a9c5eaf75ec3be8993c84e33ea24b58b', class: className }, this.isScrollable && !this.isAtStart && (h("swirl-button", { key: '5e0b1d6a87bb64083e6af150e915f40c0d876c1f', class: "carousel__previous-slide-button", hideLabel: true, icon: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.previousSlideButtonLabel, onClick: this.onPreviousSlideButtonClick, pill: true, variant: "floating" })), this.isScrollable && !this.isAtEnd && (h("swirl-button", { key: '7f2a5cd69204b7c225c7c3bdf6379ddad1086070', class: "carousel__next-slide-button", hideLabel: true, icon: "<swirl-icon-arrow-forward></swirl-icon-arrow-forward>", label: this.nextSlideButtonLabel, onClick: this.onNextSlideButtonClick, pill: true, variant: "floating" })), h("div", { key: '2ac74f8d435e2ab59ce1d8e9f89a8c2e3348bfd4', "aria-live": "polite", class: "carousel__slides", style: slidesStyles, onScroll: this.onScroll, ref: (el) => (this.slidesContainer = el) }, h("slot", { key: '461cce12da0c3773bfa1b10c3c32105c801a68c4', onSlotchange: this.onSlotChange })))));
144
149
  }
145
150
  static get is() { return "swirl-carousel"; }
146
151
  static get encapsulation() { return "shadow"; }