@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/README.md
CHANGED
|
@@ -4,6 +4,37 @@ Librería de componentes React enterprise-ready con **Tailwind CSS v4**. Diseña
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## Documentación para IA
|
|
8
|
+
|
|
9
|
+
Si vas a generar código con esta librería (Copilot, Claude, Cursor, un agente propio), pásale:
|
|
10
|
+
|
|
11
|
+
| Archivo | Qué contiene |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| [`docs/llm/GUIA.md`](docs/llm/GUIA.md) | Guía de uso: reglas, composición de pantallas, theming, i18n, accesibilidad, trampas conocidas y recetas |
|
|
14
|
+
| [`docs/llm/catalogo.md`](docs/llm/catalogo.md) | **Generado desde el código**: 61 componentes con props, tipos, defaults y ejemplo |
|
|
15
|
+
| [`docs/llm/catalogo.json`](docs/llm/catalogo.json) | El mismo catálogo en JSON, para indexar |
|
|
16
|
+
| [`docs/llm/ejemplos-reales.md`](docs/llm/ejemplos-reales.md) | **Así se usa en producción** (CYC ERP): capas de CSS, provider real, chassis, listados, formularios, tablas con API y toasts |
|
|
17
|
+
| [`LLM_DOCS.md`](LLM_DOCS.md) | Theming a fondo: variables CSS `--it-*`, escalas y chassis de layout |
|
|
18
|
+
|
|
19
|
+
### Carpeta [`ai/`](ai/) — copiar y pegar
|
|
20
|
+
|
|
21
|
+
Si no quieres ir archivo por archivo, la carpeta [`ai/`](ai/) trae el paquete **autocontenido** listo para
|
|
22
|
+
pegar en un chat o subir como conocimiento del proyecto:
|
|
23
|
+
|
|
24
|
+
| Archivo | Tamaño | Contenido |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| [`ai/AXZY-UI-SYSTEM.md`](ai/AXZY-UI-SYSTEM.md) | ~150 KB (~38k tokens) | Todo en uno: guía + ejemplos reales + catálogo completo |
|
|
27
|
+
| [`ai/AXZY-UI-SYSTEM-compacto.md`](ai/AXZY-UI-SYSTEM-compacto.md) | ~65 KB (~17k tokens) | Igual, con el catálogo sin descripciones de props |
|
|
28
|
+
| `ai/catalogo.md` · `ai/catalogo.json` | — | Solo el catálogo |
|
|
29
|
+
| `ai/plantillas/` | — | Reglas para Cursor (`.mdc`), Copilot, Claude Code y prompt inicial |
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm docs:llm # regenera el catálogo (compilador de TS sobre src/index.ts), docs/llm/ y ai/
|
|
33
|
+
pnpm docs:ai # solo el paquete ai/ (usa docs/llm/ ya generado)
|
|
34
|
+
pnpm audit:sandbox # audita el sandbox: axe (set completo) + contenido recortado, 45 páginas
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
|
|
7
38
|
## Instalación en un proyecto nuevo
|
|
8
39
|
|
|
9
40
|
### 1. Crear proyecto Vite + React + TypeScript
|
|
@@ -62,6 +93,18 @@ capas explícitamente, para que el reset/tema de AXZY nunca dependa del orden de
|
|
|
62
93
|
|
|
63
94
|
Con esto **ya no** se importa `dist/index.css` desde `main.tsx` — todo entra por `index.css`.
|
|
64
95
|
|
|
96
|
+
> **Orden alternativo (y su consecuencia):** si colocas `axzy-ui-system` *después* de `utilities`,
|
|
97
|
+
> los estilos de la librería ganan a tus utilidades y tendrás que forzarlas con el sufijo `!` de
|
|
98
|
+
> Tailwind v4 (`m-0! px-4! max-w-screen!`). El orden de arriba te ahorra esos `!`.
|
|
99
|
+
|
|
100
|
+
**Modo oscuro por defecto:** el provider arranca en `system` y guarda la preferencia en la clave
|
|
101
|
+
`it-theme-dark-mode` (`"light" | "dark" | "system"`). Si quieres otro default, escríbela **antes** de
|
|
102
|
+
montar la app:
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
if (!localStorage.getItem("it-theme-dark-mode")) localStorage.setItem("it-theme-dark-mode", "light");
|
|
106
|
+
```
|
|
107
|
+
|
|
65
108
|
### 5. Envolver con ITThemeProvider
|
|
66
109
|
|
|
67
110
|
`src/main.tsx`:
|
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
|
}
|