@descope/web-components-ui 1.0.370 → 1.0.371

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -1453,7 +1453,7 @@ const componentName$_ = getComponentName('icon');
1453
1453
 
1454
1454
  class RawIcon extends createBaseClass({ componentName: componentName$_, baseSelector: 'slot' }) {
1455
1455
  static get observedAttributes() {
1456
- return ['src', 'fill-color'];
1456
+ return ['src'];
1457
1457
  }
1458
1458
 
1459
1459
  #icon;
@@ -1478,36 +1478,23 @@ class RawIcon extends createBaseClass({ componentName: componentName$_, baseSele
1478
1478
  `;
1479
1479
  }
1480
1480
 
1481
- get fillColor() {
1482
- return this.getAttribute('fill-color') === 'true';
1483
- }
1484
-
1485
1481
  get src() {
1486
1482
  return this.getAttribute('src');
1487
1483
  }
1488
1484
 
1489
1485
  // in order to fill an SVG with `currentColor` override all of its `fill` and `path` nodes
1490
1486
  // with the value from the `st-fill` attribute
1491
- updateFillColor() {
1492
- if (this.#icon && this.fillColor) {
1493
- const fillCssVar = (selector) => {
1494
- this.querySelectorAll(selector).forEach((ele) =>
1495
- ele.setAttribute(
1496
- 'fill',
1497
- `var(${IconClass.cssVarList.fill}, ${ele.getAttribute('fill') || "''"})`
1498
- )
1499
- );
1500
- };
1501
-
1502
- fillCssVar('*[fill]');
1503
- fillCssVar('path');
1504
- }
1505
- }
1506
-
1507
- resetIcon() {
1508
- if (!this.#icon) return;
1509
- this.innerHTML = '';
1510
- this.appendChild(this.#icon.cloneNode(true));
1487
+ // eslint-disable-next-line class-methods-use-this
1488
+ updateFillColor(node) {
1489
+ // set fill to root node and all its relevant selectors
1490
+ const elementsToReplace = [node, ...node.querySelectorAll('*[fill]')];
1491
+
1492
+ elementsToReplace.forEach((ele) => {
1493
+ ele.setAttribute(
1494
+ 'fill',
1495
+ `var(${IconClass.cssVarList.fill}, ${ele.getAttribute('fill') || "''"})`
1496
+ );
1497
+ });
1511
1498
  }
1512
1499
 
1513
1500
  attributeChangedCallback(attrName, oldValue, newValue) {
@@ -1517,13 +1504,13 @@ class RawIcon extends createBaseClass({ componentName: componentName$_, baseSele
1517
1504
 
1518
1505
  if (attrName === 'src') {
1519
1506
  createIcon(this.src).then((res) => {
1520
- this.#icon = res;
1521
- this.resetIcon();
1522
- this.updateFillColor();
1507
+ this.innerHTML = '';
1508
+ if (res) {
1509
+ const clonedNode = res.cloneNode(true);
1510
+ this.updateFillColor(clonedNode);
1511
+ this.appendChild(clonedNode);
1512
+ }
1523
1513
  });
1524
- } else if (attrName === 'fill-color') {
1525
- this.resetIcon();
1526
- this.updateFillColor();
1527
1514
  }
1528
1515
  }
1529
1516
  }
@@ -12791,7 +12778,6 @@ const button = {
12791
12778
  [compVars$6.outlineColor]: 'transparent',
12792
12779
 
12793
12780
  [compVars$6.iconSize]: '1.5em',
12794
- [compVars$6.iconColor]: 'currentColor',
12795
12781
 
12796
12782
  size: {
12797
12783
  xs: { [compVars$6.fontSize]: '12px' },