@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.
@@ -2674,7 +2674,7 @@ const componentName$V = getComponentName('icon');
2674
2674
 
2675
2675
  class RawIcon extends createBaseClass({ componentName: componentName$V, baseSelector: 'slot' }) {
2676
2676
  static get observedAttributes() {
2677
- return ['src', 'fill-color'];
2677
+ return ['src'];
2678
2678
  }
2679
2679
 
2680
2680
  #icon;
@@ -2699,36 +2699,23 @@ class RawIcon extends createBaseClass({ componentName: componentName$V, baseSele
2699
2699
  `;
2700
2700
  }
2701
2701
 
2702
- get fillColor() {
2703
- return this.getAttribute('fill-color') === 'true';
2704
- }
2705
-
2706
2702
  get src() {
2707
2703
  return this.getAttribute('src');
2708
2704
  }
2709
2705
 
2710
2706
  // in order to fill an SVG with `currentColor` override all of its `fill` and `path` nodes
2711
2707
  // with the value from the `st-fill` attribute
2712
- updateFillColor() {
2713
- if (this.#icon && this.fillColor) {
2714
- const fillCssVar = (selector) => {
2715
- this.querySelectorAll(selector).forEach((ele) =>
2716
- ele.setAttribute(
2717
- 'fill',
2718
- `var(${IconClass.cssVarList.fill}, ${ele.getAttribute('fill') || "''"})`
2719
- )
2720
- );
2721
- };
2722
-
2723
- fillCssVar('*[fill]');
2724
- fillCssVar('path');
2725
- }
2726
- }
2727
-
2728
- resetIcon() {
2729
- if (!this.#icon) return;
2730
- this.innerHTML = '';
2731
- this.appendChild(this.#icon.cloneNode(true));
2708
+ // eslint-disable-next-line class-methods-use-this
2709
+ updateFillColor(node) {
2710
+ // set fill to root node and all its relevant selectors
2711
+ const elementsToReplace = [node, ...node.querySelectorAll('*[fill]')];
2712
+
2713
+ elementsToReplace.forEach((ele) => {
2714
+ ele.setAttribute(
2715
+ 'fill',
2716
+ `var(${IconClass.cssVarList.fill}, ${ele.getAttribute('fill') || "''"})`
2717
+ );
2718
+ });
2732
2719
  }
2733
2720
 
2734
2721
  attributeChangedCallback(attrName, oldValue, newValue) {
@@ -2738,13 +2725,13 @@ class RawIcon extends createBaseClass({ componentName: componentName$V, baseSele
2738
2725
 
2739
2726
  if (attrName === 'src') {
2740
2727
  createIcon(this.src).then((res) => {
2741
- this.#icon = res;
2742
- this.resetIcon();
2743
- this.updateFillColor();
2728
+ this.innerHTML = '';
2729
+ if (res) {
2730
+ const clonedNode = res.cloneNode(true);
2731
+ this.updateFillColor(clonedNode);
2732
+ this.appendChild(clonedNode);
2733
+ }
2744
2734
  });
2745
- } else if (attrName === 'fill-color') {
2746
- this.resetIcon();
2747
- this.updateFillColor();
2748
2735
  }
2749
2736
  }
2750
2737
  }
@@ -2969,7 +2956,6 @@ const button = {
2969
2956
  [compVars$6.outlineColor]: 'transparent',
2970
2957
 
2971
2958
  [compVars$6.iconSize]: '1.5em',
2972
- [compVars$6.iconColor]: 'currentColor',
2973
2959
 
2974
2960
  size: {
2975
2961
  xs: { [compVars$6.fontSize]: '12px' },