@axzydev/axzy_ui_system 1.5.2 → 1.5.3

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/dist/index.cjs CHANGED
@@ -1625,7 +1625,8 @@ var buttonVariants = {
1625
1625
  rounded: "border-transparent shadow-sm rounded-full",
1626
1626
  text: "bg-transparent border-transparent shadow-none hover:bg-black/5 dark:hover:bg-white/10",
1627
1627
  "raised-text": "bg-white border border-gray-200 shadow-sm hover:shadow-md",
1628
- "icon-only": "p-2 aspect-square flex items-center justify-center border-transparent shadow-sm",
1628
+ // No lleva utilidades de padding: el cuadrado lo define `buttonIconPadding` por tamaño.
1629
+ "icon-only": "aspect-square flex items-center justify-center border-transparent shadow-sm",
1629
1630
  link: "bg-transparent border-transparent shadow-none hover:underline px-0"
1630
1631
  };
1631
1632
  var buttonSizes = {
@@ -1633,11 +1634,24 @@ var buttonSizes = {
1633
1634
  md: "text-[13px] px-3.5 py-1.5",
1634
1635
  lg: "text-sm px-4 py-2"
1635
1636
  };
1637
+ var buttonIconSizes = {
1638
+ sm: "text-xs",
1639
+ md: "text-[13px]",
1640
+ lg: "text-sm"
1641
+ };
1642
+ var buttonIconPadding = {
1643
+ sm: "0.5rem",
1644
+ md: "0.625rem",
1645
+ lg: "0.75rem"
1646
+ };
1636
1647
 
1637
1648
  // src/components/atoms/button/button.tsx
1638
1649
  var import_clsx6 = __toESM(require("clsx"), 1);
1639
1650
  var import_react10 = require("react");
1640
- var import_jsx_runtime8 = require("react/jsx-runtime");
1651
+ var import_jsx_runtime8 = (
1652
+ // Icono solo: sin wrapper con `gap` ni `ITText` vacío, que lo desplazaban a la izquierda.
1653
+ require("react/jsx-runtime")
1654
+ );
1641
1655
  function ITButton({
1642
1656
  children,
1643
1657
  label,
@@ -1654,6 +1668,8 @@ function ITButton({
1654
1668
  }) {
1655
1669
  const [isHovered, setIsHovered] = (0, import_react10.useState)(false);
1656
1670
  const [isFocused, setIsFocused] = (0, import_react10.useState)(false);
1671
+ const isIconOnly = variant === "icon-only";
1672
+ const isIconOnlyContent = isIconOnly && Boolean(icon) && !children;
1657
1673
  const themeBtn = theme.button;
1658
1674
  const themeConfig = themeBtn[color] || themeBtn.primary;
1659
1675
  const isSolid = ["filled", "raised", "rounded", "icon-only"].includes(variant || "filled");
@@ -1674,8 +1690,9 @@ function ITButton({
1674
1690
  if (variant === "rounded") {
1675
1691
  style.borderRadius = "9999px";
1676
1692
  }
1677
- if (variant === "icon-only") {
1678
- style.padding = "0.5rem";
1693
+ if (isIconOnly) {
1694
+ style.padding = buttonIconPadding[size] ?? "0.5rem";
1695
+ style.lineHeight = 1;
1679
1696
  }
1680
1697
  if (isSolid) {
1681
1698
  style.backgroundColor = isHovered && !disabled ? themeConfig.hover : mainColor;
@@ -1710,7 +1727,7 @@ function ITButton({
1710
1727
  // Apply variant base styles (border, shadow, rounded-full)
1711
1728
  buttonVariants[variant || "filled"],
1712
1729
  // Apply size classes (padding/font-size)
1713
- buttonSizes[size],
1730
+ isIconOnly ? buttonIconSizes[size] : buttonSizes[size],
1714
1731
  className,
1715
1732
  { "opacity-50 cursor-not-allowed": disabled }
1716
1733
  ),
@@ -1723,10 +1740,10 @@ function ITButton({
1723
1740
  disabled,
1724
1741
  "aria-label": ariaLabel || label,
1725
1742
  title: title || ariaLabel || label,
1726
- children: children || /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: (0, import_clsx6.default)("inline-flex items-center gap-1.5 font-semibold", { "opacity-50": disabled }), children: [
1743
+ children: children || (isIconOnlyContent ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "inline-flex items-center justify-center leading-none", children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: (0, import_clsx6.default)("inline-flex items-center gap-1.5 font-semibold", { "opacity-50": disabled }), children: [
1727
1744
  icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "flex-shrink-0", children: icon }),
1728
1745
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ITText, { as: "span", children: label })
1729
- ] })
1746
+ ] }))
1730
1747
  }
1731
1748
  );
1732
1749
  }