@proximus/lavender-light 1.3.0-beta.6 → 1.4.1-alpha.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.
@@ -84,6 +84,7 @@ class WithExtraAttributes extends HTMLElement {
84
84
  ];
85
85
  }
86
86
  attributeChangedCallback(name, oldValue, newValue) {
87
+ var _a;
87
88
  if (WithExtraAttributes.observedAttributes.indexOf(name) === -1) {
88
89
  return;
89
90
  }
@@ -114,7 +115,7 @@ class WithExtraAttributes extends HTMLElement {
114
115
  name,
115
116
  oldValue,
116
117
  newValue,
117
- this.isGrid ? cssGridAlignSelfValues : flexboxAlignSelfValues
118
+ ((_a = this.parentElement) == null ? void 0 : _a.localName) === "px-grid" ? cssGridAlignSelfValues : flexboxAlignSelfValues
118
119
  );
119
120
  break;
120
121
  case "justify-self":
@@ -193,11 +194,19 @@ class WithExtraAttributes extends HTMLElement {
193
194
  var _a;
194
195
  return (_a = this.parentElement) == null ? void 0 : _a.tagName.toLowerCase();
195
196
  }
196
- get isGrid() {
197
- return this.$parentElementName === "px-grid";
198
- }
199
- get isStack() {
200
- return this.$parentElementName === "px-stack";
197
+ get isInsideGridOrStack() {
198
+ let parent = this.parentElement;
199
+ while (parent) {
200
+ if (parent.localName === "px-grid" || parent.localName === "px-stack" && (parent == null ? void 0 : parent.getAttribute("direction")) === "row") {
201
+ return true;
202
+ }
203
+ if (window.getComputedStyle(parent).display === "contents") {
204
+ parent = parent.parentElement;
205
+ continue;
206
+ }
207
+ break;
208
+ }
209
+ return false;
201
210
  }
202
211
  get grow() {
203
212
  return this.getAttribute("grow");
@@ -456,7 +465,6 @@ class PxElement extends WithExtraAttributes {
456
465
  }
457
466
  }
458
467
  connectedCallback() {
459
- var _a;
460
468
  for (const name of getSupportedPropertyNames(this.nativeName)) {
461
469
  if (name === "constructor" || this.accessorExclusions.includes(name)) {
462
470
  continue;
@@ -476,12 +484,9 @@ class PxElement extends WithExtraAttributes {
476
484
  console.warn(`Could not create property ${name} for`, this.$el, e);
477
485
  }
478
486
  }
479
- if (this.isGrid || this.isStack) {
480
- const parentDirection = (_a = this.parentElement) == null ? void 0 : _a.getAttribute("direction");
487
+ if (this.isInsideGridOrStack) {
481
488
  this.$el.style.display = "block";
482
- if (this.isGrid || this.isStack && parentDirection === "row") {
483
- this.$el.style.height = "100%";
484
- }
489
+ this.$el.style.height = "100%";
485
490
  }
486
491
  }
487
492
  get $el() {
@@ -963,7 +968,6 @@ class AttributeBreakpointHandlerDelegate {
963
968
  }
964
969
  const containerStyles = new CSSStyleSheet();
965
970
  containerStyles.replaceSync(containerCss);
966
- const anchorValues = ["anchor-right", "anchor-left", "anchor-full"];
967
971
  const attributeBreakpointCSSSelector$1 = (attributeName, attributeValue, device) => `:host([${attributeName}${device ? `--${device}` : ""}='${attributeValue}']) .container`;
968
972
  const paddingPrefix = "px-padding";
969
973
  const _Container = class _Container extends PxElement {
@@ -1070,12 +1074,19 @@ const _Container = class _Container extends PxElement {
1070
1074
  if (!this.borderColor) {
1071
1075
  this.borderColor = "main";
1072
1076
  }
1073
- const anchorSlot = this.querySelector("[slot]");
1074
- if (anchorSlot) {
1075
- if (anchorValues.includes(anchorSlot.getAttribute("slot"))) {
1076
- this.shadowRoot.querySelector(".container").classList.toggle("anchored");
1077
- }
1077
+ if (this.$slotAnchor) {
1078
+ this.addAnchorClass();
1078
1079
  }
1080
+ this.contentObserver = new MutationObserver(() => {
1081
+ if (this.$slotAnchor) {
1082
+ this.addAnchorClass();
1083
+ }
1084
+ });
1085
+ this.contentObserver.observe(this, {
1086
+ childList: true,
1087
+ subtree: true,
1088
+ characterData: true
1089
+ });
1079
1090
  this._bgObserver = new IntersectionObserver((entries) => {
1080
1091
  entries.forEach((entry) => {
1081
1092
  var _a;
@@ -1091,6 +1102,7 @@ const _Container = class _Container extends PxElement {
1091
1102
  disconnectedCallback() {
1092
1103
  var _a;
1093
1104
  (_a = this._bgObserver) == null ? void 0 : _a.disconnect();
1105
+ this.contentObserver.disconnect();
1094
1106
  }
1095
1107
  attributeChangedCallback(attrName, oldValue, newValue) {
1096
1108
  if (oldValue !== newValue) {
@@ -1303,6 +1315,14 @@ const _Container = class _Container extends PxElement {
1303
1315
  updateAnchorOffsetStyle(oldValue);
1304
1316
  updateAnchorOffsetStyle(newValue);
1305
1317
  }
1318
+ addAnchorClass() {
1319
+ if (!this.$el.classList.contains("anchored")) {
1320
+ this.$el.classList.add("anchored");
1321
+ }
1322
+ }
1323
+ get $slotAnchor() {
1324
+ return this.querySelector('[slot^="anchor"]');
1325
+ }
1306
1326
  get padding() {
1307
1327
  return this.getAttribute("padding");
1308
1328
  }
@@ -2657,6 +2677,7 @@ class Icon extends WithExtraAttributes {
2657
2677
  <use xlink:href="#icon-${this.name}"></use>
2658
2678
  </svg>`);
2659
2679
  this.shadowRoot.innerHTML = __privateGet(this, _template).call(this);
2680
+ this.role = "img";
2660
2681
  __privateSet(this, _internals, (_a = this.attachInternals) == null ? void 0 : _a.call(this));
2661
2682
  if (__privateGet(this, _internals)) {
2662
2683
  __privateGet(this, _internals).role = "img";