@amsintegra/design-system 1.1.1 → 2.0.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,89 @@ All notable changes to `@amsintegra/design-system` are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.1] - 2026-10-15
9
+
10
+ Default theme is now the AMS brand (red); the primary button moves to a dark
11
+ neutral so that red stays reserved for danger (resolves AMSSLO-1181). Supersedes
12
+ the unpublished `2.0.0`, whose version number cannot be reused on the registry.
13
+
14
+ ### Changed (BREAKING)
15
+
16
+ - **`Tema` now requires `color_peligro`.** The danger red (destructive buttons and
17
+ error text) is a themeable token instead of a hardcoded literal. Any caller that
18
+ builds a `Tema` object must provide `color_peligro`.
19
+ - **Default theme is the brand red** (`--tema-primario` `#A72432`), not the neutral
20
+ emerald, so AI-generated screens come themed by default. `TEMA_DEFAULT` and the
21
+ `:root` in `tokens.css` are kept in sync.
22
+ - **Primary button no longer uses the brand red.** `CLASE_BOTON_PRIMARIO`,
23
+ `CLASE_BOTON_PRIMARIO_COMPACTO`, the `Dialogo` primary trigger and the
24
+ `PantallaAcceso` login button fill with the dark neutral `var(--tema-texto)`.
25
+
26
+ ### Added
27
+
28
+ - **`--tema-peligro` token** (`Tema.color_peligro` / `variablesDeTema`), declared in
29
+ `tokens.css` (`:root` + `@theme inline`). `CLASE_BOTON_PELIGRO`, `CLASE_ERROR_CAMPO`
30
+ and the error text in `Insignia`, `Avisos`, `BotonAccionAviso` and `PantallaAcceso`
31
+ consume it; `--texto-error` is now an alias of `--tema-peligro`.
32
+ - **`docs/criterio-color-acciones.md`** — official criterion for normal vs. dangerous
33
+ actions when the brand is red (red reserved for danger; normal in dark neutral;
34
+ reinforced by shape, icon and text).
35
+
36
+ ## [2.0.0] - 2026-10-14
37
+
38
+ Full rebuild of the library. The Ant Design v6 + Metronic foundation is replaced by
39
+ a Tailwind CSS v4 component set based on the `kit-ui-plataforma` guidelines.
40
+
41
+ ### Changed (BREAKING)
42
+
43
+ - **Styling foundation is now Tailwind CSS v4 with COMPILED CSS.** Consumers import
44
+ `@amsintegra/design-system/styles.css` once and do **not** need Tailwind installed
45
+ or configured. Brand colors remain CSS variables (`--tema-*`) overridable via
46
+ `variablesDeTema()`.
47
+ - **Peer dependencies replaced**: `antd`, `@ant-design/icons` and `dayjs` are removed.
48
+ New peers are `react`, `react-dom` and `lucide-react` (the single icon library).
49
+ - **Component surface replaced**: the antd wrapper components (Button, DataTable,
50
+ Modal, Form, …) and `AmsConfigProvider` are gone. The public API is now the kit:
51
+ `CascaronApp`, `MarcoTabla`, `TablaConfigurable`, `PaginaListado`, `BarraListado`,
52
+ `Insignia`, `Tarjeta`, `Metrica`, `Aviso`, `ModalPanel`, `PantallaAcceso`,
53
+ `InfoExplicacion`, the `ICONO_*` constants, formatting helpers and canonical
54
+ `CLASE_*` strings.
55
+ - **New `./styles.css` export** added to `package.json` `exports`.
56
+
57
+ ### Added
58
+
59
+ - **Framework-agnostic adapters.** Components previously coupled to Next.js are
60
+ decoupled: `LinkComponentProvider` injects a router link (default `<a>`), and
61
+ `ListadoNavProvider` wires listing navigation (`ir`/`params`/`pendiente`) to any
62
+ router or local state. The pure helpers `leerListado`, `aplicarListado` and
63
+ `hrefListado` remain for URL-driven listings.
64
+ - **Compiled stylesheet** `dist/styles.css` produced by the Tailwind v4 CLI,
65
+ scanning the kit sources so no utility is purged.
66
+
67
+ ### Removed
68
+
69
+ - `src/components` (antd wrappers), `src/theme` (`AmsConfigProvider`, Metronic
70
+ tokens), `src/pilot`, old `src/hooks`, antd-specific docs and scaffolding scripts.
71
+
72
+ ### Known limitations
73
+
74
+ - Storybook needs the Tailwind Vite/PostCSS plugin wired to process the stylesheet
75
+ before stories render with full styling; no component stories ship in this version.
76
+ - No component unit tests ship yet (the antd wrapper tests were removed with their
77
+ components). `npm test` passes with no test files.
78
+
79
+ ## [1.1.2] - 2026-10-10
80
+
81
+ ### Added
82
+
83
+ - **UI design guidelines** (`docs/lineamientos-ui.md`). A screen-design guide that
84
+ complements the component reference in `docs/skills/ams-design-system/SKILL.md`:
85
+ how to design with the design system (density, semantic color, typography, data
86
+ presentation, empty/loading/error states, accessibility and tone), expressed
87
+ against the real stack (Ant Design v6, Metronic theme — primary `#A72432`, Inter
88
+ 13px, `@ant-design/icons`) and the theme tokens in `src/theme/tokens.ts`. No
89
+ Tailwind, Lucide or hardcoded brand colors.
90
+
8
91
  ## [1.1.1] - 2026-09-30
9
92
 
10
93
  ### Fixed
package/README.md CHANGED
@@ -1,18 +1,14 @@
1
1
  # @amsintegra/design-system
2
2
 
3
- Sistema de diseño de React para la plataforma B2BMX de AMS Integra. Está construido sobre **Ant Design v6** con el tema de marca **Metronic** (primario `#A72432`, tipografía Inter, base de 13px) e incluye **Storybook** para explorar y documentar cada componente.
3
+ Sistema de diseño de React para AMS Integra, construido con **Tailwind CSS v4** sobre los lineamientos de `kit-ui-plataforma`. La librería **envía su CSS ya compilado**: el proyecto que la consume importa una hoja de estilos y **no necesita tener Tailwind instalado ni configurado**.
4
4
 
5
- Cubre **todos los componentes de Ant Design v6** como wrappers/re-exports tipados con el tema aplicado, más composites propios que consolidan patrones ya usados en los microfrontends.
5
+ Incluye el cascarón de aplicación (menú lateral colapsable), tablas con columnas fijas, filtros, insignias, tarjetas KPI, modales, estados de carga/vacío/error, íconos de explicación (i) y la pantalla de acceso. Los componentes son agnósticos del framework: no dependen de Next.js.
6
6
 
7
7
  > ### 📦 Se instala en cada proyecto
8
8
  >
9
- > Este es un paquete de librería: **cada proyecto que lo use tiene que instalarlo
10
- > por su cuenta**. No es algo que se instale una sola vez y quede disponible para
11
- > todos los proyectos. Cuando arranques un portal o microfrontend nuevo, corré la
12
- > instalación de abajo dentro de _ese_ proyecto.
13
- >
14
- > Es una dependencia normal de la app (sus componentes se renderizan en runtime),
15
- > así que va en `dependencies`, no en `devDependencies`.
9
+ > Es un paquete de librería: **cada proyecto que lo use lo instala por su cuenta**.
10
+ > Sus componentes se renderizan en runtime, así que va en `dependencies`, no en
11
+ > `devDependencies`.
16
12
 
17
13
  ## Instalación
18
14
 
@@ -22,159 +18,112 @@ Cubre **todos los componentes de Ant Design v6** como wrappers/re-exports tipado
22
18
  npm install @amsintegra/design-system
23
19
  ```
24
20
 
25
- ### 2. Asegurate de tener sus peers
26
-
27
- La librería necesita que tu proyecto tenga estas piezas (son **peer dependencies**,
28
- o sea que las comparte con tu app en vez de traer su propia copia):
21
+ ### 2. Instalá sus peers
29
22
 
30
23
  | Peer | Versión |
31
24
  |------|---------|
32
- | `react` / `react-dom` | 18, 19 o 20 |
33
- | `antd` | 6 |
34
- | `@ant-design/icons` | 6 |
35
- | `dayjs` | 1.11+ |
36
-
37
- - **Si tu proyecto ya tiene React y antd 6** (por ejemplo un portal con Next.js):
38
- no hacés nada más, la librería usa los que ya tenés.
39
- - **Si te falta alguno**, instalalos de una:
25
+ | `react` / `react-dom` | 18 o 19 |
26
+ | `lucide-react` | 1 (única librería de íconos) |
40
27
 
41
- ```bash
42
- npm install antd@^6 @ant-design/icons@^6 dayjs react react-dom
43
- ```
28
+ ```bash
29
+ npm install react react-dom lucide-react
30
+ ```
44
31
 
45
- > **Ojo con antd:** tiene que ser la **versión 6**, igual que `@ant-design/icons`
46
- > (icons 6 no funciona con antd 5). Y antd 6 pide React 18 o superior.
47
- >
48
32
  > Requiere **Node.js 18 o superior** para desarrollar.
49
33
 
50
- <details>
51
- <summary>¿Por qué peer dependencies y no dependencias normales?</summary>
34
+ ### 3. Importá la hoja de estilos UNA vez
52
35
 
53
- Declarar React y antd como peers (en vez de empaquetarlos dentro de la librería)
54
- evita terminar con **dos instancias de React/antd** en runtime —el clásico
55
- `Invalid hook call` y los contextos de tema duplicados— cuando la librería se
56
- consume bajo Module Federation. La librería reutiliza la copia que ya tiene tu app.
57
- </details>
36
+ En el punto de entrada de tu app (por ejemplo `main.tsx`, o el layout raíz):
37
+
38
+ ```ts
39
+ import "@amsintegra/design-system/styles.css";
40
+ ```
41
+
42
+ Eso trae los tokens (variables CSS), las utilidades que usan los componentes y las reglas globales (tablas fijas, spinner de marca, feedback de botón, impresión). No hace falta Tailwind en tu proyecto.
58
43
 
59
44
  ## Uso
60
45
 
61
- Envuelve la app una sola vez en la raíz con `AmsConfigProvider` (aplica el tema y el contexto de antd `App` para `message`/`notification`/`Modal`):
46
+ Importá los componentes con named imports:
62
47
 
63
48
  ```tsx
64
- import { AmsConfigProvider, Button, DataTable } from '@amsintegra/design-system';
65
- import esES from 'antd/locale/es_ES';
66
-
67
- export function Root({ children }) {
68
- return (
69
- <AmsConfigProvider mode="light" locale={esES}>
70
- {children}
71
- </AmsConfigProvider>
72
- );
49
+ import { Insignia, Tarjeta, Metrica, CascaronApp } from "@amsintegra/design-system";
50
+
51
+ export function Estado() {
52
+ return <Insignia tono="exito" info="plataforma.rol">Activo</Insignia>;
73
53
  }
74
54
  ```
75
55
 
76
- Luego importa componentes con named imports:
56
+ ### Marca (tema)
57
+
58
+ Los colores de marca son variables CSS (`--tema-primario`, `--tema-acento`, etc.) con un verde esmeralda neutro por defecto. Se sobrescriben **sin tocar componentes**, inyectándolas en `<html>`:
77
59
 
78
60
  ```tsx
79
- import { Button, DataTable, ModalDialog, FilterSelect } from '@amsintegra/design-system';
61
+ import { variablesDeTema, TEMA_DEFAULT } from "@amsintegra/design-system";
62
+
63
+ <html style={variablesDeTema({ ...TEMA_DEFAULT, color_primario: "#A72432" })} />
80
64
  ```
81
65
 
82
- Modo oscuro:
66
+ ### Enlaces y routing (agnóstico del framework)
67
+
68
+ Por defecto los componentes de navegación renderizan un `<a>` normal. Si usás un router con cliente (Next, React Router), inyectá su `Link` una vez:
83
69
 
84
70
  ```tsx
85
- <AmsConfigProvider mode="dark">…</AmsConfigProvider>
71
+ import { LinkComponentProvider } from "@amsintegra/design-system";
72
+ import NextLink from "next/link";
73
+
74
+ <LinkComponentProvider value={NextLink}>{children}</LinkComponentProvider>
86
75
  ```
87
76
 
88
- Toasts context-safe (sin el warning de método estático de antd):
77
+ ### Listados con estado en la URL
78
+
79
+ Los componentes `BarraListado`, `PaginadorUrl` y `EncabezadoOrdenUrl` leen y escriben la navegación a través de un contexto, así funcionan con cualquier router o con estado local:
89
80
 
90
81
  ```tsx
91
- import { useAmsMessage } from '@amsintegra/design-system';
82
+ import { ListadoNavProvider } from "@amsintegra/design-system";
92
83
 
93
- function Guardar() {
94
- const message = useAmsMessage();
95
- return <Button onClick={() => message.success('Guardado')}>Guardar</Button>;
96
- }
84
+ <ListadoNavProvider value={{ ir, pendiente, params }}>
85
+ {/* tu pantalla de listado */}
86
+ </ListadoNavProvider>
97
87
  ```
98
88
 
99
- ## Qué incluye
89
+ `ir(cambios, { scroll })` aplica cambios sobre la query actual; `params` es un `URLSearchParams`; `pendiente` indica navegación en curso. Las funciones puras `leerListado`, `aplicarListado` y `hrefListado` ayudan a derivar el estado y las URLs.
100
90
 
101
- - **Tema**: `AmsConfigProvider`, `buildTheme`, tokens de Metronic (`primitives`, `semantic`, `radius`, `typography`, `sizing`).
102
- - **Todos los componentes de antd v6** como re-exports tipados (General, Layout, Navigation, Data Entry, Data Display, Feedback y otros).
103
- - **Composites AMS**: `DataTable`, `ModalDialog`, `FilterSelect`, `FileUploadDragger`, `PageHeader`, `DownloadButton`, `ConfirmModal`.
104
- - **Hooks**: `useAmsMessage`, `useAmsNotification`, `useControllableState`.
91
+ ## Qué incluye
105
92
 
106
- El inventario completo con estado por componente está en [`plan/03-component-inventory.md`](./plan/03-component-inventory.md).
93
+ - **Tokens y marca**: `variablesDeTema`, `TEMA_DEFAULT`, `NOMBRE_PRODUCTO_DEFAULT`.
94
+ - **Cascarón y navegación**: `CascaronApp`, `SidebarColapsable`, `EnlaceNav`, `Migas`, `SubNav`.
95
+ - **Tablas**: `MarcoTabla`, `TablaConfigurable`, `CeldaIdentidad`, `AccionesFila`, `EncabezadoOrdenUrl`, `col`, `fija`.
96
+ - **Listados**: `PaginaListado`, `BarraListado`, `PaginadorUrl`, `PaginadorLocal`.
97
+ - **Piezas**: `Insignia`, `Tarjeta`, `Metrica`, `MetricaKpi`, `GrupoMetricas`, `Aviso`, `ModalPanel`, `Dialogo`, `Pestanas`, `PopoverHover`.
98
+ - **Estados**: `OverlayCargando`, `PantallaCargando`, `SpinnerMarca`, `EstadoVacio`, `NoDisponible`, `BarraProgreso`.
99
+ - **Acceso**: `PantallaAcceso`.
100
+ - **Explicaciones (i)**: `InfoExplicacion`, catálogo `EXPLICACIONES`, `explicacionDe`, `verificarCatalogo`.
101
+ - **Íconos**: constantes semánticas `ICONO_*` (sobre `lucide-react`).
102
+ - **Formatos**: `formatoMxn`, `formatoNumero`, `formatoPct`, `formatearFechaHora`, `formatearBytes`, etc.
103
+ - **Clases canónicas**: `CLASE_BOTON_PRIMARIO`, `CLASE_CAMPO`, `CLASE_TARJETA`, etc.
107
104
 
108
105
  ## Desarrollo
109
106
 
110
107
  ```bash
111
108
  npm install # instala dependencias
112
- npm run storybook # levanta Storybook en http://localhost:6006
113
- npm run test # corre los tests (Vitest)
109
+ npm run build # build completo: CSS (Tailwind v4) + JS/tipos (tsup)
110
+ npm run build:css # solo la hoja de estilos -> dist/styles.css
111
+ npm run build:js # solo JS (ESM + CJS) + tipos
114
112
  npm run typecheck # tsc --noEmit
115
- npm run build # build de la librería (ESM + CJS + tipos) con tsup
116
- npm run build-storybook # Storybook estático (para publicar la doc)
117
- ```
118
-
119
- ## Storybook
120
-
121
- Storybook (v10, `@storybook/react-vite`) es la documentación viva del design
122
- system: una story por componente, docs en MDX y un piloto de pantalla real
123
- (`Pilot/Consulta de Facturas`). Incluye los addons de accesibilidad (a11y),
124
- themes (light/dark) y docs.
125
-
126
- ### Desarrollo local
127
-
128
- ```bash
129
- npm run storybook
130
- ```
131
-
132
- Levanta el servidor en `http://localhost:6006` con hot reload.
133
-
134
- ### Build del sitio estático
135
-
136
- ```bash
137
- npm run build-storybook
113
+ npm run test # tests (Vitest)
114
+ npm run storybook # Storybook en http://localhost:6006
138
115
  ```
139
116
 
140
- Genera el sitio en `storybook-static/`. Esa carpeta es un sitio estático
141
- autocontenido que se puede servir con cualquier hosting de estáticos.
142
-
143
- ### Despliegue
144
-
145
- Publicá el contenido de `storybook-static/` en el hosting que use el equipo:
146
-
147
- - **Servir localmente para revisar el build**:
148
-
149
- ```bash
150
- npx http-server storybook-static
151
- ```
152
-
153
- - **Bitbucket Pages / hosting estático**: subí el contenido de
154
- `storybook-static/` como artefacto del pipeline.
155
- - **Netlify / Vercel / S3+CloudFront**: apuntá el directorio de publicación a
156
- `storybook-static` y el comando de build a `npm run build-storybook`.
157
-
158
- > `storybook-static/` está en `.gitignore` — es un artefacto de build, no se
159
- > commitea. Se regenera en cada despliegue.
160
-
161
117
  ## Publicación
162
118
 
163
- El paquete se publica en el **registry público de npm** bajo el scope
164
- `@amsintegra`, con acceso público (`publishConfig.access = "public"`).
165
- `prepublishOnly` corre typecheck + tests + build automáticamente, así que no se
166
- publica un build roto.
119
+ El paquete se publica en el registry público de npm bajo el scope `@amsintegra`. `prepublishOnly` corre typecheck + tests + build, así no se publica un build roto.
167
120
 
168
121
  ```bash
169
- npm login # autenticación en npmjs.com (requiere permiso en el scope @amsintegra)
170
- npm publish # publica la versión actual de package.json
122
+ npm login
123
+ npm publish
171
124
  ```
172
125
 
173
- > El scope `@amsintegra` debe existir en npm y tu cuenta necesita permiso de
174
- > publicación en él. Una versión publicada es prácticamente inmutable: no se
175
- > puede re-publicar el mismo número con otro contenido.
176
-
177
- Generar un tarball para entregar/instalar sin registry:
126
+ Tarball para instalar sin registry:
178
127
 
179
128
  ```bash
180
129
  npm run pack:tarball # genera amsintegra-design-system-<version>.tgz
@@ -182,28 +131,10 @@ npm run pack:tarball # genera amsintegra-design-system-<version>.tgz
182
131
  npm install /ruta/al/amsintegra-design-system-<version>.tgz
183
132
  ```
184
133
 
185
- ## Para asistentes de IA
186
-
187
- En la raíz del paquete hay un [`llms.txt`](./llms.txt): una guía concisa y legible
188
- por máquina para que un asistente de IA descubra e interprete cómo usar la librería
189
- (imports, reglas de oro, setup) aunque no tenga la skill dedicada. Se incluye dentro
190
- del paquete publicado en npm, así que también aparece en `node_modules`. La
191
- referencia completa por componente vive en
192
- [`docs/skills/ams-design-system/SKILL.md`](./docs/skills/ams-design-system/SKILL.md).
193
-
194
- ## Changelog
195
-
196
- El historial de versiones está en [`CHANGELOG.md`](./CHANGELOG.md).
197
-
198
134
  ## Licencia
199
135
 
200
136
  [MIT](./LICENSE) © AMS Integra
201
137
 
202
- ## Estado
203
-
204
- - ✅ Tema (light + dark, tokens Metronic)
205
- - ✅ Cobertura completa de componentes antd v6 + composites AMS
206
- - ✅ Storybook con story por componente y un piloto (`Pilot/Consulta de Facturas`)
207
- - ✅ Empaquetado listo para publicar (`@amsintegra/design-system`)
138
+ ## Changelog
208
139
 
209
- Detalles y roadmap en [`plan/`](./plan).
140
+ El historial de versiones está en [`CHANGELOG.md`](./CHANGELOG.md).