@axzydev/axzy_ui_system 1.5.2 → 1.6.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/dist/index.cjs +54 -18
- 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 +59 -23
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +1 -1
- package/src/components/atoms/button/button.props.ts +3 -3
- package/src/components/atoms/button/button.tsx +27 -7
- package/src/components/organisms/sidebar/sidebar.tsx +51 -14
- package/src/sandbox/i18n.ts +2 -0
- package/src/showcases/FormShowcases.tsx +9 -0
- package/src/showcases/StructureShowcases.tsx +3 -2
- package/src/types/button.types.ts +19 -1
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
|
-
|
|
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 =
|
|
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 (
|
|
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
|
}
|
|
@@ -8199,6 +8216,19 @@ function flattenSubItems(entries) {
|
|
|
8199
8216
|
(entry) => isSubItemGroup(entry) ? entry.items : [entry]
|
|
8200
8217
|
);
|
|
8201
8218
|
}
|
|
8219
|
+
var RAIL_BADGE_MAX_CHARS = 3;
|
|
8220
|
+
function RailBadge({ value }) {
|
|
8221
|
+
const text = String(value);
|
|
8222
|
+
if (text.length <= RAIL_BADGE_MAX_CHARS) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: text });
|
|
8223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
8224
|
+
"span",
|
|
8225
|
+
{
|
|
8226
|
+
"aria-hidden": "true",
|
|
8227
|
+
className: "block w-1.5 h-1.5 rounded-full",
|
|
8228
|
+
style: { backgroundColor: "currentColor" }
|
|
8229
|
+
}
|
|
8230
|
+
);
|
|
8231
|
+
}
|
|
8202
8232
|
function ITSidebar({
|
|
8203
8233
|
navigationItems = [],
|
|
8204
8234
|
isCollapsed = false,
|
|
@@ -8269,7 +8299,9 @@ function ITSidebar({
|
|
|
8269
8299
|
}
|
|
8270
8300
|
}, [navigationItems]);
|
|
8271
8301
|
const isSidebarCollapsed = visibleOnMobile ? false : isCollapsed && !(expandOnHover && isHovering);
|
|
8272
|
-
const
|
|
8302
|
+
const collapsedWidth = flat ? "w-[72px]" : "w-[88px]";
|
|
8303
|
+
const expandedWidth = flat ? "w-[248px]" : "w-[280px]";
|
|
8304
|
+
const sidebarWidth = isSidebarCollapsed ? collapsedWidth : expandedWidth;
|
|
8273
8305
|
const fixedRail = isSidebarCollapsed && !expandOnHover;
|
|
8274
8306
|
const toggleExpanded = (itemId) => {
|
|
8275
8307
|
const newExpanded = new Set(expandedItems);
|
|
@@ -8381,7 +8413,7 @@ function ITSidebar({
|
|
|
8381
8413
|
size: "sm",
|
|
8382
8414
|
...badgeRest,
|
|
8383
8415
|
className: (0, import_clsx40.default)("shadow-md", badgeClassName),
|
|
8384
|
-
children: String(count)
|
|
8416
|
+
children: isSidebarCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(RailBadge, { value: count }) : String(count)
|
|
8385
8417
|
}
|
|
8386
8418
|
);
|
|
8387
8419
|
if (isSidebarCollapsed) {
|
|
@@ -8392,7 +8424,7 @@ function ITSidebar({
|
|
|
8392
8424
|
"aria-label": label,
|
|
8393
8425
|
title: label,
|
|
8394
8426
|
onClick,
|
|
8395
|
-
className:
|
|
8427
|
+
className: `relative flex items-center w-full h-10 mb-1 rounded-xl transition-all duration-300 ${flat ? "px-3" : "px-5"}`,
|
|
8396
8428
|
style: { color: "var(--it-sidebar-icon-color, var(--color-secondary-500))" },
|
|
8397
8429
|
onMouseEnter: (e) => {
|
|
8398
8430
|
e.currentTarget.style.backgroundColor = "var(--it-sidebar-hover-bg, var(--color-secondary-100))";
|
|
@@ -8402,7 +8434,7 @@ function ITSidebar({
|
|
|
8402
8434
|
},
|
|
8403
8435
|
children: [
|
|
8404
8436
|
icon && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "flex items-center justify-center text-[1.05rem]", children: icon }),
|
|
8405
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "absolute top-0.5 right-0.5 pointer-events-none", children: badge })
|
|
8437
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "absolute top-0.5 right-0.5 max-w-[2.1rem] overflow-hidden pointer-events-none", children: badge })
|
|
8406
8438
|
]
|
|
8407
8439
|
}
|
|
8408
8440
|
);
|
|
@@ -8414,7 +8446,7 @@ function ITSidebar({
|
|
|
8414
8446
|
"aria-label": label,
|
|
8415
8447
|
title: label,
|
|
8416
8448
|
onClick,
|
|
8417
|
-
className:
|
|
8449
|
+
className: `flex items-center gap-2.5 w-full text-left h-10 mb-1 rounded-xl transition-all duration-300 ${flat ? "px-3" : "px-5"}`,
|
|
8418
8450
|
style: { color: "var(--it-sidebar-label-color, var(--color-secondary-600))" },
|
|
8419
8451
|
onMouseEnter: (e) => {
|
|
8420
8452
|
e.currentTarget.style.backgroundColor = "var(--it-sidebar-hover-bg, var(--color-secondary-100))";
|
|
@@ -8482,9 +8514,9 @@ function ITSidebar({
|
|
|
8482
8514
|
]
|
|
8483
8515
|
}
|
|
8484
8516
|
),
|
|
8485
|
-
header &&
|
|
8517
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `px-4 pt-4 pb-1 flex-shrink-0 ${isSidebarCollapsed ? "overflow-hidden" : ""}`, children: isSidebarCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `${expandedWidth} invisible`, "aria-hidden": "true", children: header }) : header }),
|
|
8486
8518
|
notification && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "px-4 pt-3 flex-shrink-0", children: renderNotification() }),
|
|
8487
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("nav", { "aria-label": t("sidebar.navAria"), className: `flex-1 py-4 custom-scrollbar ${fixedRail ? "overflow-visible" : "overflow-y-auto overflow-x-hidden"}
|
|
8519
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("nav", { "aria-label": t("sidebar.navAria"), className: `flex-1 py-4 px-4 custom-scrollbar ${fixedRail ? "overflow-visible" : "overflow-y-auto overflow-x-hidden"}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ul", { className: "space-y-1", children: navigationItems.map((item) => {
|
|
8488
8520
|
const hasSubmenu = !!item.subitems && item.subitems.length > 0;
|
|
8489
8521
|
const submenuId = `it-sidebar-submenu-${item.id}`;
|
|
8490
8522
|
const hasRenderedSubmenu = hasSubmenu && !isSidebarCollapsed;
|
|
@@ -8502,7 +8534,9 @@ function ITSidebar({
|
|
|
8502
8534
|
className: `flex items-center cursor-pointer
|
|
8503
8535
|
transition-all duration-300 ease-[cubic-bezier(0.2,0,0,1)]
|
|
8504
8536
|
rounded-xl relative overflow-visible
|
|
8505
|
-
|
|
8537
|
+
h-10
|
|
8538
|
+
${flat ? "px-3" : "px-5"}
|
|
8539
|
+
${isSidebarCollapsed ? "justify-start" : "justify-between"}
|
|
8506
8540
|
`,
|
|
8507
8541
|
style: {
|
|
8508
8542
|
backgroundColor: active ? "var(--it-sidebar-active-bg, var(--color-secondary-50))" : "transparent",
|
|
@@ -8530,7 +8564,7 @@ function ITSidebar({
|
|
|
8530
8564
|
style: { backgroundColor: "var(--it-sidebar-active-icon, var(--color-primary-500))", boxShadow: "0 0 10px var(--it-sidebar-active-icon, var(--color-primary-500))" }
|
|
8531
8565
|
}
|
|
8532
8566
|
),
|
|
8533
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className:
|
|
8567
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center gap-2.5 relative z-10 w-full", children: [
|
|
8534
8568
|
item.icon && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
8535
8569
|
"div",
|
|
8536
8570
|
{
|
|
@@ -8574,10 +8608,12 @@ function ITSidebar({
|
|
|
8574
8608
|
...badgeRest,
|
|
8575
8609
|
className: (0, import_clsx40.default)(
|
|
8576
8610
|
"absolute shadow-md",
|
|
8577
|
-
|
|
8611
|
+
// En el riel no hay ancho para una etiqueta larga: el badge se
|
|
8612
|
+
// ancla a la esquina y se recorta, así nunca desborda ni tapa el icono.
|
|
8613
|
+
isSidebarCollapsed ? "top-0.5 right-0.5 max-w-[2.1rem] overflow-hidden" : "right-3 top-1/2 -translate-y-1/2",
|
|
8578
8614
|
badgeClassName
|
|
8579
8615
|
),
|
|
8580
|
-
children: String(item.badge)
|
|
8616
|
+
children: isSidebarCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(RailBadge, { value: item.badge }) : String(item.badge)
|
|
8581
8617
|
}
|
|
8582
8618
|
)
|
|
8583
8619
|
]
|