@cerca/design-system 1.0.0 → 1.0.2

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 CHANGED
@@ -1,390 +1,63 @@
1
- # @cerca/design-system
1
+ # DesignSystem
2
2
 
3
- Librería compartida de componentes del Design System para el ecosistema Cerca. Implementa **Atomic Design** con componentes basados en ng-zorro-antd para mantener uniformidad visual en todas las aplicaciones.
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.1.0.
4
4
 
5
- ---
5
+ ## Code scaffolding
6
6
 
7
- ## 📦 Instalación
8
-
9
- ### Como Librería Local (Monorepo)
10
-
11
- La librería ya está configurada en el monorepo. Solo necesitas configurar el path mapping en tu proyecto:
12
-
13
- **tsconfig.json:**
14
- ```json
15
- {
16
- "compilerOptions": {
17
- "paths": {
18
- "@cerca/design-system": [
19
- "../../libs/design-system/src/public-api.ts"
20
- ]
21
- }
22
- }
23
- }
24
- ```
25
-
26
- ### Build de la Librería
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
27
8
 
28
9
  ```bash
29
- # Desde la raíz del monorepo
30
- cd libs
31
- ng build design-system
32
-
33
- # Output: libs/dist/design-system/
34
- ```
35
-
36
- ---
37
-
38
- ## 🎨 Estructura de Componentes
39
-
40
- La librería sigue la metodología **Atomic Design**:
41
-
42
- ### Atoms (Componentes Básicos)
43
- - `ButtonComponent` - Botones con variantes (primary, secondary, danger, etc.)
44
- - `InputComponent` - Campos de entrada de texto
45
- - `SelectComponent` - Selectores dropdown
46
- - `BadgeComponent` - Insignias y etiquetas
47
- - `LabelComponent` - Etiquetas de texto
48
- - `IconComponent` - Iconos de Ant Design
49
-
50
- ### Molecules (Componentes Compuestos)
51
- - `CardComponent` - Tarjetas de contenido
52
- - `FormFieldComponent` - Campo de formulario con label + input + validación
53
- - `SearchBarComponent` - Barra de búsqueda
54
-
55
- ### Organisms (Componentes Complejos)
56
- - `DataTableComponent` - Tabla de datos con paginación, ordenamiento y filtros
57
- - `HeaderComponent` - Encabezado de página
58
- - `SidebarComponent` - Barra lateral de navegación
59
- - `ModalComponent` - Ventanas modales
60
-
61
- ### Templates (Plantillas de Página)
62
- - `AdminLayoutComponent` - Layout principal de administración
63
- - `AuthLayoutComponent` - Layout para páginas de autenticación
64
- - `DashboardTemplateComponent` - Plantilla de dashboard
65
- - `FormPageTemplateComponent` - Plantilla para páginas de formularios
66
- - `ListPageTemplateComponent` - Plantilla para páginas de listados
67
-
68
- ### Layout (Componentes de Disposición)
69
- - `ContainerComponent` - Contenedor principal
70
- - `GridComponent` - Sistema de grilla
71
- - `StackComponent` - Apilamiento vertical/horizontal
72
- - `InlineComponent` - Disposición en línea
73
-
74
- ### Tokens (Variables de Diseño)
75
- - `_colors.scss` - Paleta de colores
76
- - `_typography.scss` - Tipografía y fuentes
77
- - `_spacing.scss` - Espaciados y márgenes
78
- - `_shadows.scss` - Sombras y elevaciones
79
- - `_radius.scss` - Bordes redondeados
80
- - `_theme-strategy.scss` - Estrategia de temas
81
-
82
- ---
83
-
84
- ## 🚀 Uso
85
-
86
- ### Importar Componentes
87
-
88
- ```typescript
89
- import {
90
- ButtonComponent,
91
- InputComponent,
92
- CardComponent,
93
- DataTableComponent,
94
- AdminLayoutComponent
95
- } from '@cerca/design-system';
96
-
97
- @Component({
98
- selector: 'app-my-page',
99
- standalone: true,
100
- imports: [
101
- ButtonComponent,
102
- InputComponent,
103
- CardComponent
104
- ],
105
- template: `
106
- <cc-card>
107
- <cc-input placeholder="Nombre" />
108
- <cc-button type="primary">Guardar</cc-button>
109
- </cc-card>
110
- `
111
- })
112
- export class MyPageComponent {}
10
+ ng generate component component-name
113
11
  ```
114
12
 
115
- ### Importar Tokens SCSS
116
-
117
- ```scss
118
- // En tu archivo SCSS
119
- @import '@cerca/design-system/tokens';
120
-
121
- .my-component {
122
- color: var(--color-primary);
123
- padding: var(--spacing-md);
124
- border-radius: var(--radius-md);
125
- box-shadow: var(--shadow-md);
126
- }
127
- ```
128
-
129
- ---
130
-
131
- ## 🎯 Componentes Disponibles
132
-
133
- ### ButtonComponent
134
-
135
- **Selector:** `cc-button`
136
-
137
- **Props:**
138
- - `type`: `'primary' | 'secondary' | 'danger' | 'link'` (default: `'primary'`)
139
- - `size`: `'small' | 'medium' | 'large'` (default: `'medium'`)
140
- - `disabled`: `boolean` (default: `false`)
141
- - `loading`: `boolean` (default: `false`)
142
- - `icon`: `string` (nombre del icono de Ant Design)
143
-
144
- **Ejemplo:**
145
- ```html
146
- <cc-button type="primary" size="large" icon="save">
147
- Guardar
148
- </cc-button>
149
- ```
150
-
151
- ### InputComponent
152
-
153
- **Selector:** `cc-input`
154
-
155
- **Props:**
156
- - `type`: `'text' | 'password' | 'email' | 'number'` (default: `'text'`)
157
- - `placeholder`: `string`
158
- - `disabled`: `boolean` (default: `false`)
159
- - `required`: `boolean` (default: `false`)
160
- - `prefix`: `string` (icono prefijo)
161
- - `suffix`: `string` (icono sufijo)
162
-
163
- **Ejemplo:**
164
- ```html
165
- <cc-input
166
- type="email"
167
- placeholder="correo@ejemplo.com"
168
- prefix="mail"
169
- required
170
- />
171
- ```
172
-
173
- ### CardComponent
174
-
175
- **Selector:** `cc-card`
176
-
177
- **Props:**
178
- - `title`: `string`
179
- - `bordered`: `boolean` (default: `true`)
180
- - `hoverable`: `boolean` (default: `false`)
181
- - `loading`: `boolean` (default: `false`)
182
-
183
- **Ejemplo:**
184
- ```html
185
- <cc-card title="Información del Usuario" hoverable>
186
- <p>Contenido de la tarjeta</p>
187
- </cc-card>
188
- ```
189
-
190
- ### DataTableComponent
191
-
192
- **Selector:** `cc-data-table`
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
193
14
 
194
- **Props:**
195
- - `data`: `any[]` (datos de la tabla)
196
- - `columns`: `TableColumn[]` (configuración de columnas)
197
- - `loading`: `boolean` (default: `false`)
198
- - `pageSize`: `number` (default: `10`)
199
- - `showPagination`: `boolean` (default: `true`)
200
-
201
- **Ejemplo:**
202
- ```typescript
203
- columns = [
204
- { title: 'Nombre', key: 'name', sortable: true },
205
- { title: 'Email', key: 'email' },
206
- { title: 'Rol', key: 'role', filterable: true }
207
- ];
208
-
209
- data = [
210
- { name: 'Juan Pérez', email: 'juan@ejemplo.com', role: 'Admin' },
211
- { name: 'María García', email: 'maria@ejemplo.com', role: 'User' }
212
- ];
213
- ```
214
-
215
- ```html
216
- <cc-data-table
217
- [data]="data"
218
- [columns]="columns"
219
- [pageSize]="20"
220
- />
221
- ```
222
-
223
- ---
224
-
225
- ## 🎨 Tokens de Diseño
226
-
227
- ### Colores
228
-
229
- ```scss
230
- // Primarios
231
- --color-primary: #1890ff;
232
- --color-secondary: #52c41a;
233
- --color-danger: #ff4d4f;
234
- --color-warning: #faad14;
235
- --color-info: #13c2c2;
236
-
237
- // Grises
238
- --color-text-primary: #262626;
239
- --color-text-secondary: #8c8c8c;
240
- --color-border: #d9d9d9;
241
- --color-background: #f5f5f5;
242
- ```
243
-
244
- ### Espaciados
245
-
246
- ```scss
247
- --spacing-xs: 4px;
248
- --spacing-sm: 8px;
249
- --spacing-md: 16px;
250
- --spacing-lg: 24px;
251
- --spacing-xl: 32px;
252
- --spacing-2xl: 48px;
15
+ ```bash
16
+ ng generate --help
253
17
  ```
254
18
 
255
- ### Tipografía
19
+ ## Building
256
20
 
257
- ```scss
258
- --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
259
-
260
- --font-size-xs: 12px;
261
- --font-size-sm: 14px;
262
- --font-size-md: 16px;
263
- --font-size-lg: 18px;
264
- --font-size-xl: 24px;
265
- --font-size-2xl: 32px;
266
-
267
- --font-weight-normal: 400;
268
- --font-weight-medium: 500;
269
- --font-weight-semibold: 600;
270
- --font-weight-bold: 700;
271
- ```
21
+ To build the library, run:
272
22
 
273
- ### Sombras
274
-
275
- ```scss
276
- --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
277
- --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
278
- --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
279
- --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
23
+ ```bash
24
+ ng build design-system
280
25
  ```
281
26
 
282
- ---
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
283
28
 
284
- ## 🔧 Desarrollo
29
+ ### Publishing the Library
285
30
 
286
- ### Estructura del Proyecto
31
+ Once the project is built, you can publish your library by following these steps:
287
32
 
288
- ```
289
- libs/design-system/
290
- ├── src/
291
- │ ├── lib/
292
- │ │ ├── atoms/
293
- │ │ ├── molecules/
294
- │ │ ├── organisms/
295
- │ │ ├── templates/
296
- │ │ ├── layout/
297
- │ │ ├── tokens/
298
- │ │ └── public-api.ts
299
- │ └── public-api.ts
300
- ├── ng-package.json
301
- ├── package.json
302
- ├── tsconfig.lib.json
303
- └── README.md
304
- ```
305
-
306
- ### Agregar Nuevo Componente
307
-
308
- 1. **Crear el componente en la carpeta correspondiente:**
33
+ 1. Navigate to the `dist` directory:
309
34
  ```bash
310
- cd libs/design-system/src/lib/atoms
311
- ng generate component my-atom --standalone
312
- ```
313
-
314
- 2. **Exportar en `public-api.ts`:**
315
- ```typescript
316
- // libs/design-system/src/lib/public-api.ts
317
- export * from './atoms/my-atom/my-atom.component';
35
+ cd dist/design-system
318
36
  ```
319
37
 
320
- 3. **Rebuild la librería:**
38
+ 2. Run the `npm publish` command to publish your library to the npm registry:
321
39
  ```bash
322
- ng build design-system
40
+ npm publish
323
41
  ```
324
42
 
325
- ### Testing
43
+ ## Running unit tests
44
+
45
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
326
46
 
327
47
  ```bash
328
- # Ejecutar tests de la librería
329
- ng test design-system
48
+ ng test
330
49
  ```
331
50
 
332
- ---
333
-
334
- ## 📋 Peer Dependencies
51
+ ## Running end-to-end tests
335
52
 
336
- La librería requiere las siguientes dependencias en el proyecto consumidor:
53
+ For end-to-end (e2e) testing, run:
337
54
 
338
- ```json
339
- {
340
- "@angular/common": "^21.1.0",
341
- "@angular/core": "^21.1.0",
342
- "ng-zorro-antd": "^21.1.0",
343
- "@ant-design/icons-angular": "^21.0.0"
344
- }
55
+ ```bash
56
+ ng e2e
345
57
  ```
346
58
 
347
- ---
348
-
349
- ## 📝 Versionado
350
-
351
- La librería sigue [Semantic Versioning](https://semver.org/):
352
-
353
- - **MAJOR** (1.x.x): Cambios incompatibles en la API
354
- - **MINOR** (x.1.x): Nueva funcionalidad compatible
355
- - **PATCH** (x.x.1): Correcciones de bugs
356
-
357
- **Versión actual:** `1.0.0`
358
-
359
- ---
360
-
361
- ## 🤝 Contribuir
362
-
363
- ### Reglas de Contribución
364
-
365
- 1. **Atomic Design:** Todos los componentes deben seguir la metodología Atomic Design
366
- 2. **Standalone Components:** Usar componentes standalone de Angular
367
- 3. **ng-zorro-antd:** Basar componentes en ng-zorro cuando sea posible
368
- 4. **TypeScript Strict:** Código con tipado estricto
369
- 5. **SCSS Tokens:** Usar variables de diseño definidas en `tokens/`
370
-
371
- ### Proceso de Desarrollo
372
-
373
- 1. Crear rama feature: `git checkout -b feature/nuevo-componente`
374
- 2. Desarrollar componente siguiendo las reglas
375
- 3. Exportar en `public-api.ts`
376
- 4. Rebuild: `ng build design-system`
377
- 5. Commit: `git commit -m "feat: agregar nuevo componente"`
378
- 6. Push y crear PR
379
-
380
- ---
381
-
382
- ## 📄 Licencia
383
-
384
- Propiedad de Cerca Ecosystem. Uso interno únicamente.
385
-
386
- ---
59
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
387
60
 
388
- ## 📞 Soporte
61
+ ## Additional Resources
389
62
 
390
- Para preguntas o problemas, contactar al equipo de desarrollo de Cerca.
63
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.