@proximus/lavender-carousel 1.4.1 → 1.4.2-beta.1

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 (2) hide show
  1. package/dist/index.es.js +47 -42
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -2,8 +2,8 @@ var q = (r) => {
2
2
  throw TypeError(r);
3
3
  };
4
4
  var O = (r, t, e) => t.has(r) || q("Cannot " + e);
5
- var d = (r, t, e) => (O(r, t, "read from private field"), e ? e.call(r) : t.get(r)), m = (r, t, e) => t.has(r) ? q("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), C = (r, t, e, i) => (O(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e);
6
- import { WithExtraAttributes as T, AttributeBreakpointHandlerDelegate as F, gapValues as B, checkName as rt, backgroundColorValues as st, PxElement as ot, transferAccessibilityAttributes as at, iconSizeValuesKC as nt, cssTokenBreakpoints as lt } from "@proximus/lavender-common";
5
+ var d = (r, t, e) => (O(r, t, "read from private field"), e ? e.call(r) : t.get(r)), m = (r, t, e) => t.has(r) ? q("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), z = (r, t, e, i) => (O(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e);
6
+ import { WithExtraAttributes as E, AttributeBreakpointHandlerDelegate as F, gapValues as B, checkName as rt, backgroundColorValues as st, PxElement as ot, transferAccessibilityAttributes as at, iconSizeValuesKC as nt, cssTokenBreakpoints as lt } from "@proximus/lavender-common";
7
7
  const ct = ":host{display:block}:host *{box-sizing:border-box}.carousel{overflow:hidden;display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scroll-behavior:smooth;-webkit-overflow-scrolling:touch;gap:var(--px-spacing-default-desktop)}@media only screen and (max-width: 768px){.carousel{gap:var(--px-spacing-default-mobile)}}#appleseed-container{margin-inline:var(--px-spacing-s-mobile)}@media only screen and (max-width: 768px){#button-icons{display:none}}.carousel::-webkit-scrollbar{display:none}", dt = "::slotted(*){border-radius:var(--px-radius-main);height:100%}.carousel-item{height:100%}:host{scroll-snap-align:start;align-items:center;justify-content:center;flex:1 0 var( --px-carousel-min-width-desktop, var(--px-carousel-min-width-all-desktop) );border-radius:var(--px-radius-main);background:#fff;overflow:hidden}@media screen and (max-width: 768px){:host{scroll-snap-align:center;flex:1 0 var( --px-carousel-min-width-mobile, var(--px-carousel-min-width-all-mobile) )!important}}@media screen and (min-width: 768px) and (max-width: 1024px){:host{flex:1 0 var( --px-carousel-min-width-tablet, var(--px-carousel-min-width-all-tablet) )!important}}", pt = ':host{display:block}:host([overflow-x="auto"]){margin:calc(calc(var(--px-focus-outline-mobile) + var(--px-focus-offset-mobile)) * -1)}:host([overflow-x="auto"]) .flex-container{padding:calc(var(--px-focus-outline-mobile) + var(--px-focus-offset-mobile))}.flex-container{display:flex;height:100%;width:100%;box-sizing:border-box;flex-direction:var(--flex-direction--mobile-value);gap:var(--flex-gap--mobile-value);flex-wrap:var(--flex-wrap--mobile-value);justify-content:var(--flex-justify-content--mobile-value);align-items:var(--flex-align-items--mobile-value);overflow-x:var(--overflow-x-all)}@media only screen and (max-width: 47.9375em){.flex-container{overflow-x:var(--overflow-x-all-mobile, var(--overflow-x-all));scrollbar-width:none}.flex-container::-webkit-scrollbar{display:none}}@media only screen and (min-width: 48em){.flex-container{flex-direction:var(--flex-direction--tablet-value);gap:var(--flex-gap--tablet-value);flex-wrap:var(--flex-wrap--tablet-value);justify-content:var(--flex-justify-content--tablet-value);align-items:var(--flex-align-items--tablet-value)}:host([overflow-x="auto"]){margin:calc(calc(var(--px-focus-outline-tablet) + var(--px-focus-offset-tablet)) * -1)}:host([overflow-x="auto"]) .flex-container{padding:calc(var(--px-focus-outline-tablet) + var(--px-focus-offset-tablet))}}@media only screen and (min-width: 48em) and (max-width: 64em){.flex-container{overflow-x:var(--overflow-x-all-tablet, var(--overflow-x-all));scrollbar-width:none}.flex-container::-webkit-scrollbar{display:none}}@media only screen and (min-width: 64.0625em){.flex-container{flex-direction:var(--flex-direction--laptop-value);gap:var(--flex-gap--laptop-value);flex-wrap:var(--flex-wrap--laptop-value);justify-content:var(--flex-justify-content--laptop-value);align-items:var(--flex-align-items--laptop-value)}:host([overflow-x="auto"]){margin:calc(calc(var(--px-focus-outline-laptop) + var(--px-focus-offset-laptop)) * -1)}:host([overflow-x="auto"]) .flex-container{padding:calc(var(--px-focus-outline-laptop) + var(--px-focus-offset-laptop))}}@media only screen and (min-width: 64.0625em) and (max-width: 90em){.flex-container{overflow-x:var(--overflow-x-all-laptop, var(--overflow-x-all))}}@media only screen and (min-width: 90.0625em){.flex-container{flex-direction:var(--flex-direction--desktop-value);gap:var(--flex-gap--desktop-value);flex-wrap:var(--flex-wrap--desktop-value);justify-content:var(--flex-justify-content--desktop-value);align-items:var(--flex-align-items--desktop-value);overflow-x:var(--overflow-x-all-desktop, var(--overflow-x-all))}:host([overflow-x="auto"]){margin:calc(calc(var(--px-focus-outline-desktop) + var(--px-focus-offset-desktop)) * -1)}:host([overflow-x="auto"]) .flex-container{padding:calc(var(--px-focus-outline-desktop) + var(--px-focus-offset-desktop))}}', G = new CSSStyleSheet();
8
8
  G.replaceSync(pt);
9
9
  const ut = [
@@ -31,7 +31,7 @@ const ut = [
31
31
  "space-around",
32
32
  "space-evenly"
33
33
  ], gt = ["", "default", "nowrap", "wrap", "wrap-reverse"], vt = ["", "visible", "hidden", "scroll", "auto"];
34
- class E extends T {
34
+ class I extends E {
35
35
  constructor() {
36
36
  super(G), this.overflowXAttributeDelegate = new F(
37
37
  this,
@@ -350,8 +350,8 @@ class E extends T {
350
350
  return this.shadowRoot.querySelector(".flex-container");
351
351
  }
352
352
  }
353
- customElements.get("px-stack") || customElements.define("px-stack", E);
354
- class ft extends E {
353
+ customElements.get("px-stack") || customElements.define("px-stack", I);
354
+ class ft extends I {
355
355
  constructor() {
356
356
  super();
357
357
  }
@@ -360,7 +360,7 @@ class ft extends E {
360
360
  }
361
361
  }
362
362
  customElements.get("px-vstack") || customElements.define("px-vstack", ft);
363
- class xt extends E {
363
+ class xt extends I {
364
364
  constructor() {
365
365
  super();
366
366
  }
@@ -374,15 +374,15 @@ class mt extends HTMLElement {
374
374
  super(), this.isZeroSized = !1, this.growValue = "1", this.isVertical = !1;
375
375
  }
376
376
  static get observedAttributes() {
377
- return ["grow"];
377
+ return ["grow", "nogap"];
378
378
  }
379
379
  attributeChangedCallback(t, e, i) {
380
380
  t === "grow" && (this.growValue = i || "1", this.isZeroSized || (this.style.flexGrow = this.growValue), this.scheduleRecheck());
381
381
  }
382
382
  connectedCallback() {
383
- this.growValue = this.getAttribute("grow") || "1", this.style.flexGrow = this.growValue, this.resizeObserver = new ResizeObserver(() => {
383
+ this.growValue = this.getAttribute("grow") || "1", this.style.flexGrow = this.growValue, this.nogap && (this.resizeObserver = new ResizeObserver(() => {
384
384
  this.handleSizeChange();
385
- }), this.isVertical = this.parentElement.localName === "px-vstack" || this.parentElement.style.flexDirection === "column", this.resizeObserver.observe(this), this.scheduleRecheck();
385
+ }), this.isVertical = this.parentElement.localName === "px-vstack" || this.parentElement.style.flexDirection === "column", this.resizeObserver.observe(this), this.scheduleRecheck());
386
386
  }
387
387
  disconnectedCallback() {
388
388
  var t;
@@ -409,11 +409,17 @@ class mt extends HTMLElement {
409
409
  updateParticipation() {
410
410
  this.isZeroSized ? (this.style.display = "none", this.style.flexGrow = "0") : (this.style.display = "", this.style.flexGrow = this.growValue);
411
411
  }
412
+ get nogap() {
413
+ return this.hasAttribute("nogap");
414
+ }
415
+ set nogap(t) {
416
+ t ? this.setAttribute("nogap", "") : this.removeAttribute("nogap");
417
+ }
412
418
  }
413
419
  customElements.get("px-spacer") || customElements.define("px-spacer", mt);
414
420
  const kt = ":host{display:block;box-sizing:border-box}slot[name=body-container]{min-height:100vh}#image-sticky-box{margin-top:-2.5em}", Z = new CSSStyleSheet();
415
421
  Z.replaceSync(kt);
416
- class yt extends T {
422
+ class yt extends E {
417
423
  constructor() {
418
424
  super(Z), this.template = (t) => `
419
425
  <px-container border-radius="none" padding="none">
@@ -620,10 +626,10 @@ const At = ["", "default", "small"], $t = [
620
626
  "default",
621
627
  "secondary",
622
628
  "naked"
623
- ], R = class R extends ot {
629
+ ], w = class w extends ot {
624
630
  constructor() {
625
631
  super(_), this.template = () => "<slot></slot>";
626
- const t = document.createElement(this.nativeName);
632
+ const t = document.createElement(w.nativeName);
627
633
  t.classList.add("btn-icon"), t.innerHTML = this.template(), this.shadowRoot.appendChild(t);
628
634
  }
629
635
  static get observedAttributes() {
@@ -637,7 +643,6 @@ const At = ["", "default", "small"], $t = [
637
643
  ];
638
644
  }
639
645
  connectedCallback() {
640
- super.connectedCallback();
641
646
  const t = this.querySelector("px-icon");
642
647
  if (t) {
643
648
  const e = t.getAttribute("size"), i = t.getAttribute("color");
@@ -710,9 +715,9 @@ const At = ["", "default", "small"], $t = [
710
715
  t ? this.setAttribute("aria-expanded", t) : this.removeAttribute("aria-expanded");
711
716
  }
712
717
  };
713
- R.nativeName = "button";
714
- let L = R;
715
- customElements.get("px-button-icon") || customElements.define("px-button-icon", L);
718
+ w.nativeName = "button";
719
+ let T = w;
720
+ customElements.get("px-button-icon") || customElements.define("px-button-icon", T);
716
721
  class St extends HTMLElement {
717
722
  constructor() {
718
723
  super();
@@ -773,17 +778,17 @@ const Lt = [
773
778
  "from",
774
779
  "disabled"
775
780
  ];
776
- var h, p, w;
777
- class Tt extends T {
781
+ var h, p, A;
782
+ class Tt extends E {
778
783
  constructor(...e) {
779
784
  var i;
780
785
  super(...e, U);
781
786
  m(this, h);
782
787
  m(this, p);
783
- m(this, w, () => `<svg aria-hidden="true">
788
+ m(this, A, () => `<svg aria-hidden="true">
784
789
  <use xlink:href="#icon-${this.name}"></use>
785
790
  </svg>`);
786
- this.shadowRoot.innerHTML = d(this, w).call(this), this.role = "img", C(this, p, (i = this.attachInternals) == null ? void 0 : i.call(this)), d(this, p) && (d(this, p).role = "img");
791
+ this.shadowRoot.innerHTML = d(this, A).call(this), this.role = "img", z(this, p, (i = this.attachInternals) == null ? void 0 : i.call(this)), d(this, p) && (d(this, p).role = "img");
787
792
  }
788
793
  static get observedAttributes() {
789
794
  return [...super.observedAttributes, ...Lt];
@@ -818,7 +823,7 @@ class Tt extends T {
818
823
  console.error("Icon name or src not found");
819
824
  continue;
820
825
  }
821
- i.getAttribute("name") === this.from && i.getAttribute("type") !== "font" && (C(this, h, i.getAttribute("src")), this.$el.firstElementChild.setAttribute(
826
+ i.getAttribute("name") === this.from && i.getAttribute("type") !== "font" && (z(this, h, i.getAttribute("src")), this.$el.firstElementChild.setAttribute(
822
827
  "xlink:href",
823
828
  `${d(this, h)}#icon-${this.name}`
824
829
  ));
@@ -880,7 +885,7 @@ class Tt extends T {
880
885
  this.setAttribute("disabled", e);
881
886
  }
882
887
  }
883
- h = new WeakMap(), p = new WeakMap(), w = new WeakMap();
888
+ h = new WeakMap(), p = new WeakMap(), A = new WeakMap();
884
889
  customElements.get("px-icon") || customElements.define("px-icon", Tt);
885
890
  const Et = ":host{--px-appleseed-size-l: 14px;--px-appleseed-size-m: 10px;--px-appleseed-size-s: 6px;--px-appleseed-size-xs: 4px}.container{display:flex}.container:has(#seed-0.appleseed-6-plus[active]) :nth-child(4)>div,.container:has(#seed-1.appleseed-6-plus[active]) :nth-child(4)>div{width:var(--px-appleseed-size-s);height:var(--px-appleseed-size-s)}.container:has(#seed-0.appleseed-6-plus[active]) :nth-child(5)>div,.container:has(#seed-1.appleseed-6-plus[active]) :nth-child(5)>div{width:var(--px-appleseed-size-xs);height:var(--px-appleseed-size-xs)}.container:has(#seed-2.appleseed-6-plus[active]) :nth-child(2)>div,.container:has(#seed-2.appleseed-6-plus[active]) :nth-child(4)>div{width:var(--px-appleseed-size-s);height:var(--px-appleseed-size-s)}.container:has(#seed-2.appleseed-6-plus[active]) :nth-child(1)>div,.container:has(#seed-2.appleseed-6-plus[active]) :nth-child(5)>div{width:var(--px-appleseed-size-xs);height:var(--px-appleseed-size-xs)}.container:has(#seed-3.appleseed-6-plus[active]) :nth-child(1)>div{width:var(--px-appleseed-size-xs);height:var(--px-appleseed-size-xs)}.container:has(#seed-3.appleseed-6-plus[active]) :nth-child(2)>div{width:var(--px-appleseed-size-s);height:var(--px-appleseed-size-s)}.container:has(#seed-3.appleseed-6-plus[active]) :nth-child(5)>div{width:var(--px-appleseed-size-xs);height:var(--px-appleseed-size-xs)}.container:has(#seed-4.appleseed-6-plus[active]) :nth-child(1)>div{width:var(--px-appleseed-size-xs);height:var(--px-appleseed-size-xs)}.container:has(#seed-4.appleseed-6-plus[active]) :nth-child(2)>div{width:var(--px-appleseed-size-s);height:var(--px-appleseed-size-s)}.appleseed{width:var(--px-size-icon-m);height:var(--px-size-icon-m);display:flex;justify-content:center;align-items:center}@media only screen and (max-width: 47.938em){.appleseed{width:var(--px-size-icon-s);height:var(--px-size-icon-s)}}.appleseed-6-plus>div,.appleseed-6-minus>div{box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-brand-default);border-radius:var(--px-radius-main);height:var(--px-appleseed-size-m);width:var(--px-appleseed-size-m)}.appleseed-6-plus[active]>div,.appleseed-6-minus[active]>div{width:var(--px-appleseed-size-l);height:var(--px-appleseed-size-l);background-color:var(--px-color-icon-brand-default)}", K = new CSSStyleSheet();
886
891
  K.replaceSync(Et);
@@ -931,7 +936,7 @@ function k(r) {
931
936
  var t = typeof r;
932
937
  return r != null && (t == "object" || t == "function");
933
938
  }
934
- var Rt = typeof global == "object" && global && global.Object === Object && global, Mt = typeof self == "object" && self && self.Object === Object && self, J = Rt || Mt || Function("return this")(), z = function() {
939
+ var Rt = typeof global == "object" && global && global.Object === Object && global, Mt = typeof self == "object" && self && self.Object === Object && self, J = Rt || Mt || Function("return this")(), j = function() {
935
940
  return J.Date.now();
936
941
  }, Ht = /\s/;
937
942
  function Pt(r) {
@@ -987,16 +992,16 @@ function X(r) {
987
992
  }
988
993
  var ee = "Expected a function", ie = Math.max, re = Math.min;
989
994
  function se(r, t, e) {
990
- var i, s, n, l, a, c, b = 0, M = !1, g = !1, A = !0;
995
+ var i, s, n, l, a, c, b = 0, M = !1, g = !1, $ = !0;
991
996
  if (typeof r != "function")
992
997
  throw new TypeError(ee);
993
- t = X(t) || 0, k(e) && (M = !!e.leading, g = "maxWait" in e, n = g ? ie(X(e.maxWait) || 0, t) : n, A = "trailing" in e ? !!e.trailing : A);
994
- function $(o) {
998
+ t = X(t) || 0, k(e) && (M = !!e.leading, g = "maxWait" in e, n = g ? ie(X(e.maxWait) || 0, t) : n, $ = "trailing" in e ? !!e.trailing : $);
999
+ function S(o) {
995
1000
  var u = i, v = s;
996
1001
  return i = s = void 0, b = o, l = r.apply(v, u), l;
997
1002
  }
998
1003
  function V(o) {
999
- return b = o, a = setTimeout(x, t), M ? $(o) : l;
1004
+ return b = o, a = setTimeout(x, t), M ? S(o) : l;
1000
1005
  }
1001
1006
  function tt(o) {
1002
1007
  var u = o - c, v = o - b, D = t - u;
@@ -1007,31 +1012,31 @@ function se(r, t, e) {
1007
1012
  return c === void 0 || u >= t || u < 0 || g && v >= n;
1008
1013
  }
1009
1014
  function x() {
1010
- var o = z();
1015
+ var o = j();
1011
1016
  if (H(o))
1012
1017
  return P(o);
1013
1018
  a = setTimeout(x, tt(o));
1014
1019
  }
1015
1020
  function P(o) {
1016
- return a = void 0, A && i ? $(o) : (i = s = void 0, l);
1021
+ return a = void 0, $ && i ? S(o) : (i = s = void 0, l);
1017
1022
  }
1018
1023
  function et() {
1019
1024
  a !== void 0 && clearTimeout(a), b = 0, i = c = s = a = void 0;
1020
1025
  }
1021
1026
  function it() {
1022
- return a === void 0 ? l : P(z());
1027
+ return a === void 0 ? l : P(j());
1023
1028
  }
1024
- function S() {
1025
- var o = z(), u = H(o);
1029
+ function C() {
1030
+ var o = j(), u = H(o);
1026
1031
  if (i = arguments, s = this, c = o, u) {
1027
1032
  if (a === void 0)
1028
1033
  return V(c);
1029
1034
  if (g)
1030
- return clearTimeout(a), a = setTimeout(x, t), $(c);
1035
+ return clearTimeout(a), a = setTimeout(x, t), S(c);
1031
1036
  }
1032
1037
  return a === void 0 && (a = setTimeout(x, t)), l;
1033
1038
  }
1034
- return S.cancel = et, S.flush = it, S;
1039
+ return C.cancel = et, C.flush = it, C;
1035
1040
  }
1036
1041
  var oe = "Expected a function";
1037
1042
  function ae(r, t, e) {
@@ -1044,15 +1049,15 @@ function ae(r, t, e) {
1044
1049
  trailing: s
1045
1050
  });
1046
1051
  }
1047
- const I = new CSSStyleSheet();
1048
- I.replaceSync(ct);
1049
- const ne = (r, t, e) => `:host([${r}${e ? `--${e}` : ""}='${t}']) .carousel`, le = "px-spacing", j = (r) => (t, e) => `calc(((100% - ${Math.max(parseInt(t), 2)} * ( var(--px-spacing-${r}-${e}))) / ${t}) - ( 64px / ${Math.max(parseInt(t), 2)}))`;
1052
+ const R = new CSSStyleSheet();
1053
+ R.replaceSync(ct);
1054
+ const ne = (r, t, e) => `:host([${r}${e ? `--${e}` : ""}='${t}']) .carousel`, le = "px-spacing", L = (r) => (t, e) => `calc(((100% - ${Math.max(parseInt(t), 2)} * ( var(--px-spacing-${r}-${e}))) / ${t}) - ( 64px / ${Math.max(parseInt(t), 2)}))`;
1050
1055
  class ce extends HTMLElement {
1051
1056
  constructor() {
1052
1057
  super(), this.visibleItemsAttributeDelegate = new F(
1053
1058
  this,
1054
1059
  "visible-items",
1055
- j("s"),
1060
+ L("s"),
1056
1061
  "--px-carousel-min-width"
1057
1062
  ), this.template = `<px-vstack gap="default">
1058
1063
  <div class="carousel">
@@ -1082,7 +1087,7 @@ class ce extends HTMLElement {
1082
1087
  let n = s;
1083
1088
  this.itemNumbers > 5 && (s > 2 && s < this.itemNumbers - 2 ? n = 2 : s === this.itemNumbers - 2 ? n = 3 : s === this.itemNumbers - 1 && (n = 4)), this.$appleseed.setAttribute("active", `${n}`), this.handleNextPrevious();
1084
1089
  }, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [
1085
- I,
1090
+ R,
1086
1091
  lt(
1087
1092
  "gap",
1088
1093
  ne,
@@ -1101,7 +1106,7 @@ class ce extends HTMLElement {
1101
1106
  case "gap--mobile":
1102
1107
  case "gap--tablet":
1103
1108
  case "gap--desktop":
1104
- this.visibleItemsAttributeDelegate.attributeValue = j(i);
1109
+ this.visibleItemsAttributeDelegate.attributeValue = L(i);
1105
1110
  break;
1106
1111
  default:
1107
1112
  this.visibleItemsAttributeDelegate.attributeChangedCallback(
@@ -1112,7 +1117,7 @@ class ce extends HTMLElement {
1112
1117
  }
1113
1118
  }
1114
1119
  connectedCallback() {
1115
- this.visibleItemsAttributeDelegate.init("1"), this.visibleItemsAttributeDelegate.attributeValue = j(
1120
+ this.visibleItemsAttributeDelegate.init("1"), this.visibleItemsAttributeDelegate.attributeValue = L(
1116
1121
  this.getAttribute("gap") || "s"
1117
1122
  ), requestAnimationFrame(() => {
1118
1123
  this.handleAppleSeedDisplay();
@@ -1164,7 +1169,7 @@ class de extends HTMLElement {
1164
1169
  super(), this.template = `
1165
1170
  <div class="carousel-item">
1166
1171
  <slot></slot>
1167
- </div>`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [I, Y];
1172
+ </div>`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [R, Y];
1168
1173
  }
1169
1174
  }
1170
1175
  customElements.get("px-carousel-item") || customElements.define("px-carousel-item", de);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-carousel",
3
- "version": "1.4.1",
3
+ "version": "1.4.2-beta.1",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",