@axzydev/axzy_ui_system 1.5.1 → 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/README.md +43 -0
- package/dist/index.cjs +24 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +23 -6
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +4 -2
- package/src/components/atoms/button/button.props.ts +3 -3
- package/src/components/atoms/button/button.tsx +27 -7
- package/src/sandbox/i18n.ts +2 -0
- package/src/showcases/DataShowcases.tsx +41 -0
- package/src/showcases/FeedbackShowcases.tsx +82 -0
- package/src/showcases/FormShowcases.tsx +320 -0
- package/src/showcases/LayoutPrimitivesShowcases.tsx +110 -0
- package/src/showcases/NavigationShowcases.tsx +94 -0
- package/src/showcases/PageShowcases.tsx +62 -0
- package/src/showcases/StructureShowcases.tsx +48 -0
- package/src/types/button.types.ts +19 -1
package/dist/index.d.cts
CHANGED
|
@@ -636,15 +636,15 @@ interface ITButtonProps {
|
|
|
636
636
|
label?: string;
|
|
637
637
|
/** Custom content to render inside the button. Takes precedence over `label`. */
|
|
638
638
|
children?: React.ReactNode;
|
|
639
|
-
/** Icon element rendered before the label. */
|
|
639
|
+
/** Icon element rendered before the label. With `variant="icon-only"` and no `label`/`children` it becomes the only content and is centered in the square button. */
|
|
640
640
|
icon?: React.ReactNode;
|
|
641
641
|
/** Click handler for the button. */
|
|
642
642
|
onClick?: () => void;
|
|
643
643
|
/** Color theme key. Values come from the semantic color palette (e.g. `"primary"`, `"secondary"`, `"success"`, `"danger"`, `"warning"`, `"info"`, `"purple"`, `"error"`, `"gray"`). @default "primary" */
|
|
644
644
|
color?: ColorsTypes;
|
|
645
|
-
/** Button size. Valid values: `"sm"`, `"md"`, `"lg"`. @default "md" */
|
|
645
|
+
/** Button size. Valid values: `"sm"`, `"md"`, `"lg"`. In `variant="icon-only"` it also scales the square padding (`buttonIconPadding`: `sm` 0.5rem, `md` 0.625rem, `lg` 0.75rem). @default "md" */
|
|
646
646
|
size?: SizesTypes;
|
|
647
|
-
/** Button visual style. Valid values: `"filled"`, `"outlined"`, `"raised"`, `"rounded"`, `"text"`, `"raised-text"`, `"icon-only"`, `"link"`. @default "filled" */
|
|
647
|
+
/** Button visual style. Valid values: `"filled"`, `"outlined"`, `"raised"`, `"rounded"`, `"text"`, `"raised-text"`, `"icon-only"`, `"link"`. `"icon-only"` renders a centered square icon button; combine it with `icon` and `ariaLabel`. @default "filled" */
|
|
648
648
|
variant?: keyof typeof buttonVariants;
|
|
649
649
|
/** Disables the button interaction and applies reduced opacity. @default false */
|
|
650
650
|
disabled?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -636,15 +636,15 @@ interface ITButtonProps {
|
|
|
636
636
|
label?: string;
|
|
637
637
|
/** Custom content to render inside the button. Takes precedence over `label`. */
|
|
638
638
|
children?: React.ReactNode;
|
|
639
|
-
/** Icon element rendered before the label. */
|
|
639
|
+
/** Icon element rendered before the label. With `variant="icon-only"` and no `label`/`children` it becomes the only content and is centered in the square button. */
|
|
640
640
|
icon?: React.ReactNode;
|
|
641
641
|
/** Click handler for the button. */
|
|
642
642
|
onClick?: () => void;
|
|
643
643
|
/** Color theme key. Values come from the semantic color palette (e.g. `"primary"`, `"secondary"`, `"success"`, `"danger"`, `"warning"`, `"info"`, `"purple"`, `"error"`, `"gray"`). @default "primary" */
|
|
644
644
|
color?: ColorsTypes;
|
|
645
|
-
/** Button size. Valid values: `"sm"`, `"md"`, `"lg"`. @default "md" */
|
|
645
|
+
/** Button size. Valid values: `"sm"`, `"md"`, `"lg"`. In `variant="icon-only"` it also scales the square padding (`buttonIconPadding`: `sm` 0.5rem, `md` 0.625rem, `lg` 0.75rem). @default "md" */
|
|
646
646
|
size?: SizesTypes;
|
|
647
|
-
/** Button visual style. Valid values: `"filled"`, `"outlined"`, `"raised"`, `"rounded"`, `"text"`, `"raised-text"`, `"icon-only"`, `"link"`. @default "filled" */
|
|
647
|
+
/** Button visual style. Valid values: `"filled"`, `"outlined"`, `"raised"`, `"rounded"`, `"text"`, `"raised-text"`, `"icon-only"`, `"link"`. `"icon-only"` renders a centered square icon button; combine it with `icon` and `ariaLabel`. @default "filled" */
|
|
648
648
|
variant?: keyof typeof buttonVariants;
|
|
649
649
|
/** Disables the button interaction and applies reduced opacity. @default false */
|
|
650
650
|
disabled?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1513,7 +1513,8 @@ var buttonVariants = {
|
|
|
1513
1513
|
rounded: "border-transparent shadow-sm rounded-full",
|
|
1514
1514
|
text: "bg-transparent border-transparent shadow-none hover:bg-black/5 dark:hover:bg-white/10",
|
|
1515
1515
|
"raised-text": "bg-white border border-gray-200 shadow-sm hover:shadow-md",
|
|
1516
|
-
|
|
1516
|
+
// No lleva utilidades de padding: el cuadrado lo define `buttonIconPadding` por tamaño.
|
|
1517
|
+
"icon-only": "aspect-square flex items-center justify-center border-transparent shadow-sm",
|
|
1517
1518
|
link: "bg-transparent border-transparent shadow-none hover:underline px-0"
|
|
1518
1519
|
};
|
|
1519
1520
|
var buttonSizes = {
|
|
@@ -1521,6 +1522,16 @@ var buttonSizes = {
|
|
|
1521
1522
|
md: "text-[13px] px-3.5 py-1.5",
|
|
1522
1523
|
lg: "text-sm px-4 py-2"
|
|
1523
1524
|
};
|
|
1525
|
+
var buttonIconSizes = {
|
|
1526
|
+
sm: "text-xs",
|
|
1527
|
+
md: "text-[13px]",
|
|
1528
|
+
lg: "text-sm"
|
|
1529
|
+
};
|
|
1530
|
+
var buttonIconPadding = {
|
|
1531
|
+
sm: "0.5rem",
|
|
1532
|
+
md: "0.625rem",
|
|
1533
|
+
lg: "0.75rem"
|
|
1534
|
+
};
|
|
1524
1535
|
|
|
1525
1536
|
// src/components/atoms/button/button.tsx
|
|
1526
1537
|
import clsx6 from "clsx";
|
|
@@ -1542,6 +1553,8 @@ function ITButton({
|
|
|
1542
1553
|
}) {
|
|
1543
1554
|
const [isHovered, setIsHovered] = useState6(false);
|
|
1544
1555
|
const [isFocused, setIsFocused] = useState6(false);
|
|
1556
|
+
const isIconOnly = variant === "icon-only";
|
|
1557
|
+
const isIconOnlyContent = isIconOnly && Boolean(icon) && !children;
|
|
1545
1558
|
const themeBtn = theme.button;
|
|
1546
1559
|
const themeConfig = themeBtn[color] || themeBtn.primary;
|
|
1547
1560
|
const isSolid = ["filled", "raised", "rounded", "icon-only"].includes(variant || "filled");
|
|
@@ -1562,8 +1575,9 @@ function ITButton({
|
|
|
1562
1575
|
if (variant === "rounded") {
|
|
1563
1576
|
style.borderRadius = "9999px";
|
|
1564
1577
|
}
|
|
1565
|
-
if (
|
|
1566
|
-
style.padding = "0.5rem";
|
|
1578
|
+
if (isIconOnly) {
|
|
1579
|
+
style.padding = buttonIconPadding[size] ?? "0.5rem";
|
|
1580
|
+
style.lineHeight = 1;
|
|
1567
1581
|
}
|
|
1568
1582
|
if (isSolid) {
|
|
1569
1583
|
style.backgroundColor = isHovered && !disabled ? themeConfig.hover : mainColor;
|
|
@@ -1598,7 +1612,7 @@ function ITButton({
|
|
|
1598
1612
|
// Apply variant base styles (border, shadow, rounded-full)
|
|
1599
1613
|
buttonVariants[variant || "filled"],
|
|
1600
1614
|
// Apply size classes (padding/font-size)
|
|
1601
|
-
buttonSizes[size],
|
|
1615
|
+
isIconOnly ? buttonIconSizes[size] : buttonSizes[size],
|
|
1602
1616
|
className,
|
|
1603
1617
|
{ "opacity-50 cursor-not-allowed": disabled }
|
|
1604
1618
|
),
|
|
@@ -1611,10 +1625,13 @@ function ITButton({
|
|
|
1611
1625
|
disabled,
|
|
1612
1626
|
"aria-label": ariaLabel || label,
|
|
1613
1627
|
title: title || ariaLabel || label,
|
|
1614
|
-
children: children ||
|
|
1628
|
+
children: children || (isIconOnlyContent ? (
|
|
1629
|
+
// Icono solo: sin wrapper con `gap` ni `ITText` vacío, que lo desplazaban a la izquierda.
|
|
1630
|
+
/* @__PURE__ */ jsx8("span", { className: "inline-flex items-center justify-center leading-none", children: icon })
|
|
1631
|
+
) : /* @__PURE__ */ jsxs5("span", { className: clsx6("inline-flex items-center gap-1.5 font-semibold", { "opacity-50": disabled }), children: [
|
|
1615
1632
|
icon && /* @__PURE__ */ jsx8("span", { className: "flex-shrink-0", children: icon }),
|
|
1616
1633
|
/* @__PURE__ */ jsx8(ITText, { as: "span", children: label })
|
|
1617
|
-
] })
|
|
1634
|
+
] }))
|
|
1618
1635
|
}
|
|
1619
1636
|
);
|
|
1620
1637
|
}
|