@xsolla/xui-button 0.181.0 → 0.182.0

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/web/index.mjs CHANGED
@@ -645,6 +645,15 @@ var cloneIconWithDefaults2 = (icon, defaultSize, defaultColor) => {
645
645
  color: existingProps.color ?? defaultColor
646
646
  });
647
647
  };
648
+ var TRANSPARENT_RGBA = /^rgba\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*,\s*(?:0|0?\.0+)\s*\)$/;
649
+ var isTransparentColor = (color) => {
650
+ if (!color) return true;
651
+ const value = color.trim().toLowerCase();
652
+ if (value === "transparent") return true;
653
+ if (TRANSPARENT_RGBA.test(value)) return true;
654
+ if (/^#[0-9a-f]{6}00$/.test(value)) return true;
655
+ return false;
656
+ };
648
657
  var IconButton = ({
649
658
  variant = "primary",
650
659
  tone = "brand",
@@ -711,7 +720,9 @@ var IconButton = ({
711
720
  }
712
721
  };
713
722
  const brandControl = theme.colors.control.brand;
714
- const disabledBg = brandControl.primary.bgDisable ?? "transparent";
723
+ const variantHasFill = !isTransparentColor(variantStyles.bg);
724
+ const filledDisabledBg = brandControl.primary.bgDisable ?? variantStyles.bgDisable ?? variantStyles.bg;
725
+ const disabledBg = variantHasFill ? filledDisabledBg : variantStyles.bg;
715
726
  const disabledBorder = brandControl.primary.borderDisable ?? "transparent";
716
727
  const disabledText = brandControl.text.disable;
717
728
  let backgroundColor = variantStyles.bg;