@amsintegra/design-system 1.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@amsintegra/design-system` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-09-23
9
+
10
+ First public release of the AMS Integra Design System, published to npm as
11
+ `@amsintegra/design-system` under the MIT license.
12
+
13
+ ### Added
14
+
15
+ - **Theme layer** built on Ant Design v5 with the B2BMX (Metronic) brand:
16
+ - `AmsConfigProvider` — single root provider that applies the theme and the
17
+ antd `App` context (context-safe `message` / `notification` / `Modal`).
18
+ - `buildTheme` and Metronic design tokens (`primitives`, `semantic`, `radius`,
19
+ `typography`, `sizing`); primary `#A72432`, Inter typeface, 13px base.
20
+ - Light and dark modes via the `mode` prop on `AmsConfigProvider`.
21
+ - **Full Ant Design v5 component coverage** — 76 components re-exported as typed
22
+ wrappers with the theme applied (General, Layout, Navigation, Data Entry,
23
+ Data Display, Feedback, and others).
24
+ - **AMS composites** consolidating patterns already used across the
25
+ microfrontends: `DataTable`, `ModalDialog`, `FilterSelect`,
26
+ `FileUploadDragger`, `PageHeader`, `DownloadButton`, `ConfirmModal`,
27
+ `ThemeToggle`.
28
+ - **Hooks**: `useAmsMessage`, `useAmsNotification`, `useControllableState`.
29
+ - **Storybook v10** (`@storybook/react-vite`) with a story per component, MDX
30
+ docs (Introducción, Componentes, Tema y modo oscuro, Instalación, Uso,
31
+ Publicación) and the `Pilot/Consulta de Facturas` example, plus the a11y,
32
+ themes and docs addons.
33
+ - **Packaging** with tsup: dual ESM + CJS output and TypeScript declarations.
34
+ React, antd, `@ant-design/icons` and `dayjs` are declared as
35
+ `peerDependencies` so the library reuses the consumer's versions (critical
36
+ under Module Federation) and npm 7+ installs them automatically in projects
37
+ that do not already have them.
38
+ - **`llms.txt`** at the package root — a concise, machine-readable usage guide
39
+ so AI assistants can discover and interpret how to use the library (imports,
40
+ golden rules, setup) when the dedicated skill is not available. Shipped inside
41
+ the published npm package.
42
+
43
+ [1.0.0]: https://bitbucket.org/amsintegra/design-system/src/main/
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AMS Integra
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,188 @@
1
+ # @amsintegra/design-system
2
+
3
+ Sistema de diseño de React para la plataforma B2BMX de AMS Integra. Está construido sobre **Ant Design v5** con el tema de marca **Metronic** (primario `#A72432`, tipografía Inter, base de 13px) e incluye **Storybook** para explorar y documentar cada componente.
4
+
5
+ Cubre **todos los componentes de Ant Design v5** como wrappers/re-exports tipados con el tema aplicado, más composites propios que consolidan patrones ya usados en los microfrontends.
6
+
7
+ ## Requisitos
8
+
9
+ - Node.js >= 18
10
+ - React 18.3, antd 5.28, `@ant-design/icons` 5.x y `dayjs` en el proyecto consumidor (son **peer dependencies**).
11
+
12
+ ## Instalación
13
+
14
+ ```bash
15
+ npm install @amsintegra/design-system
16
+ ```
17
+
18
+ Eso alcanza. `antd`, `@ant-design/icons`, `dayjs`, `react` y `react-dom` están
19
+ declarados como **peer dependencies**, así que:
20
+
21
+ - **Proyecto React sin antd** → npm 7+ instala los peers automáticamente al
22
+ correr `npm install @amsintegra/design-system`. No hay que instalarlos a mano.
23
+ - **Microfrontend con Module Federation** (donde React/antd ya existen) → el
24
+ peer se satisface con la copia que ya tiene el host, sin duplicar instancias.
25
+
26
+ Declarar React y antd como peers (y no como dependencias directas) es lo que
27
+ evita **dos instancias de React/antd** en runtime —el clásico `Invalid hook
28
+ call` y los contextos de tema duplicados— cuando la librería se consume bajo
29
+ Module Federation.
30
+
31
+ Si tu gestor no resuelve los peers de forma automática (por ejemplo con un
32
+ conflicto de versiones), instalálos explícitamente:
33
+
34
+ ```bash
35
+ npm install antd @ant-design/icons dayjs react react-dom
36
+ ```
37
+
38
+ ## Uso
39
+
40
+ 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`):
41
+
42
+ ```tsx
43
+ import { AmsConfigProvider, Button, DataTable } from '@amsintegra/design-system';
44
+ import esES from 'antd/locale/es_ES';
45
+
46
+ export function Root({ children }) {
47
+ return (
48
+ <AmsConfigProvider mode="light" locale={esES}>
49
+ {children}
50
+ </AmsConfigProvider>
51
+ );
52
+ }
53
+ ```
54
+
55
+ Luego importa componentes con named imports:
56
+
57
+ ```tsx
58
+ import { Button, DataTable, ModalDialog, FilterSelect } from '@amsintegra/design-system';
59
+ ```
60
+
61
+ Modo oscuro:
62
+
63
+ ```tsx
64
+ <AmsConfigProvider mode="dark">…</AmsConfigProvider>
65
+ ```
66
+
67
+ Toasts context-safe (sin el warning de método estático de antd v5):
68
+
69
+ ```tsx
70
+ import { useAmsMessage } from '@amsintegra/design-system';
71
+
72
+ function Guardar() {
73
+ const message = useAmsMessage();
74
+ return <Button onClick={() => message.success('Guardado')}>Guardar</Button>;
75
+ }
76
+ ```
77
+
78
+ ## Qué incluye
79
+
80
+ - **Tema**: `AmsConfigProvider`, `buildTheme`, tokens de Metronic (`primitives`, `semantic`, `radius`, `typography`, `sizing`).
81
+ - **Todos los componentes de antd v5** como re-exports tipados (General, Layout, Navigation, Data Entry, Data Display, Feedback y otros).
82
+ - **Composites AMS**: `DataTable`, `ModalDialog`, `FilterSelect`, `FileUploadDragger`, `PageHeader`, `DownloadButton`, `ConfirmModal`.
83
+ - **Hooks**: `useAmsMessage`, `useAmsNotification`, `useControllableState`.
84
+
85
+ El inventario completo con estado por componente está en [`plan/03-component-inventory.md`](./plan/03-component-inventory.md).
86
+
87
+ ## Desarrollo
88
+
89
+ ```bash
90
+ npm install # instala dependencias
91
+ npm run storybook # levanta Storybook en http://localhost:6006
92
+ npm run test # corre los tests (Vitest)
93
+ npm run typecheck # tsc --noEmit
94
+ npm run build # build de la librería (ESM + CJS + tipos) con tsup
95
+ npm run build-storybook # Storybook estático (para publicar la doc)
96
+ ```
97
+
98
+ ## Storybook
99
+
100
+ Storybook (v10, `@storybook/react-vite`) es la documentación viva del design
101
+ system: una story por componente, docs en MDX y un piloto de pantalla real
102
+ (`Pilot/Consulta de Facturas`). Incluye los addons de accesibilidad (a11y),
103
+ themes (light/dark) y docs.
104
+
105
+ ### Desarrollo local
106
+
107
+ ```bash
108
+ npm run storybook
109
+ ```
110
+
111
+ Levanta el servidor en `http://localhost:6006` con hot reload.
112
+
113
+ ### Build del sitio estático
114
+
115
+ ```bash
116
+ npm run build-storybook
117
+ ```
118
+
119
+ Genera el sitio en `storybook-static/`. Esa carpeta es un sitio estático
120
+ autocontenido que se puede servir con cualquier hosting de estáticos.
121
+
122
+ ### Despliegue
123
+
124
+ Publicá el contenido de `storybook-static/` en el hosting que use el equipo:
125
+
126
+ - **Servir localmente para revisar el build**:
127
+
128
+ ```bash
129
+ npx http-server storybook-static
130
+ ```
131
+
132
+ - **Bitbucket Pages / hosting estático**: subí el contenido de
133
+ `storybook-static/` como artefacto del pipeline.
134
+ - **Netlify / Vercel / S3+CloudFront**: apuntá el directorio de publicación a
135
+ `storybook-static` y el comando de build a `npm run build-storybook`.
136
+
137
+ > `storybook-static/` está en `.gitignore` — es un artefacto de build, no se
138
+ > commitea. Se regenera en cada despliegue.
139
+
140
+ ## Publicación
141
+
142
+ El paquete se publica en el **registry público de npm** bajo el scope
143
+ `@amsintegra`, con acceso público (`publishConfig.access = "public"`).
144
+ `prepublishOnly` corre typecheck + tests + build automáticamente, así que no se
145
+ publica un build roto.
146
+
147
+ ```bash
148
+ npm login # autenticación en npmjs.com (requiere permiso en el scope @amsintegra)
149
+ npm publish # publica la versión actual de package.json
150
+ ```
151
+
152
+ > El scope `@amsintegra` debe existir en npm y tu cuenta necesita permiso de
153
+ > publicación en él. Una versión publicada es prácticamente inmutable: no se
154
+ > puede re-publicar el mismo número con otro contenido.
155
+
156
+ Generar un tarball para entregar/instalar sin registry:
157
+
158
+ ```bash
159
+ npm run pack:tarball # genera amsintegra-design-system-<version>.tgz
160
+ # en el proyecto consumidor:
161
+ npm install /ruta/al/amsintegra-design-system-<version>.tgz
162
+ ```
163
+
164
+ ## Para asistentes de IA
165
+
166
+ En la raíz del paquete hay un [`llms.txt`](./llms.txt): una guía concisa y legible
167
+ por máquina para que un asistente de IA descubra e interprete cómo usar la librería
168
+ (imports, reglas de oro, setup) aunque no tenga la skill dedicada. Se incluye dentro
169
+ del paquete publicado en npm, así que también aparece en `node_modules`. La
170
+ referencia completa por componente vive en
171
+ [`docs/skills/ams-design-system/SKILL.md`](./docs/skills/ams-design-system/SKILL.md).
172
+
173
+ ## Changelog
174
+
175
+ El historial de versiones está en [`CHANGELOG.md`](./CHANGELOG.md).
176
+
177
+ ## Licencia
178
+
179
+ [MIT](./LICENSE) © AMS Integra
180
+
181
+ ## Estado
182
+
183
+ - ✅ Tema (light + dark, tokens Metronic)
184
+ - ✅ Cobertura completa de componentes antd v5 + composites AMS
185
+ - ✅ Storybook con story por componente y un piloto (`Pilot/Consulta de Facturas`)
186
+ - ✅ Empaquetado listo para publicar (`@amsintegra/design-system`)
187
+
188
+ Detalles y roadmap en [`plan/`](./plan).