valtech-components 2.0.305 → 2.0.307

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.
@@ -11,6 +11,10 @@
11
11
  * @property size - The image size ('small' | 'medium' | 'large' | 'xlarge').
12
12
  * @property width - The image width in px (optional).
13
13
  * @property height - The image height in px (optional).
14
+ * @property alignment - The alignment of the image container ('left' | 'center' | 'right').
15
+ * @property caption - Optional caption text below the image.
16
+ * @property captionSize - Size of the caption text ('small' | 'medium' | 'large').
17
+ * @property containerClass - Additional CSS classes for the container.
14
18
  */
15
19
  export type ImageMetadata = {
16
20
  src: string;
@@ -23,4 +27,8 @@ export type ImageMetadata = {
23
27
  size: 'small' | 'medium' | 'large' | 'xlarge';
24
28
  width?: number;
25
29
  height?: number;
30
+ alignment?: 'left' | 'center' | 'right';
31
+ caption?: string;
32
+ captionSize?: 'small' | 'medium' | 'large';
33
+ containerClass?: string;
26
34
  };
@@ -0,0 +1,84 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { ImageMetadata } from '../../atoms/image/types';
3
+ import { ArticleButtonElement, ArticleCodeElement, ArticleCustomElement, ArticleElement, ArticleHighlightElement, ArticleImageElement, ArticleListElement, ArticleMetadata, ArticleQuoteElement, ArticleSeparatorElement, ArticleSubtitleElement, ArticleTextElement, ArticleTitleElement, ArticleVideoElement } from './types';
4
+ import * as i0 from "@angular/core";
5
+ export declare class ArticleComponent implements OnInit {
6
+ /**
7
+ * Configuración del artículo
8
+ * @type {ArticleMetadata}
9
+ */
10
+ props: ArticleMetadata;
11
+ constructor();
12
+ ngOnInit(): void;
13
+ /**
14
+ * Función de trackBy para optimizar el rendering de elementos
15
+ */
16
+ trackByFn(index: number, element: ArticleElement): any;
17
+ /**
18
+ * Obtiene las clases CSS para el espaciado del elemento
19
+ */
20
+ getElementSpacingClass(element: ArticleElement): string;
21
+ getTitleElement(element: ArticleElement): ArticleTitleElement;
22
+ getSubtitleElement(element: ArticleElement): ArticleSubtitleElement;
23
+ getTextElement(element: ArticleElement): ArticleTextElement;
24
+ getQuoteElement(element: ArticleElement): ArticleQuoteElement;
25
+ getHighlightElement(element: ArticleElement): ArticleHighlightElement;
26
+ getCodeElement(element: ArticleElement): ArticleCodeElement;
27
+ getListElement(element: ArticleElement): ArticleListElement;
28
+ getButtonElement(element: ArticleElement): ArticleButtonElement;
29
+ getSeparatorElement(element: ArticleElement): ArticleSeparatorElement;
30
+ getImageElement(element: ArticleElement): ArticleImageElement;
31
+ getVideoElement(element: ArticleElement): ArticleVideoElement;
32
+ getCustomElement(element: ArticleElement): ArticleCustomElement;
33
+ getQuoteTextProps(element: ArticleElement): {
34
+ size: "small" | "medium" | "large" | "xlarge";
35
+ color: import("@ionic/core").Color;
36
+ content?: string;
37
+ bold: boolean;
38
+ contentKey?: string;
39
+ contentClass?: string;
40
+ contentFallback?: string;
41
+ contentInterpolation?: Record<string, string | number>;
42
+ processLinks?: boolean;
43
+ linkConfig?: import("valtech-components").LinkProcessorConfig;
44
+ };
45
+ getHighlightTextProps(element: ArticleElement): {
46
+ size: "small" | "medium" | "large" | "xlarge";
47
+ color: import("@ionic/core").Color;
48
+ content?: string;
49
+ bold: boolean;
50
+ contentKey?: string;
51
+ contentClass?: string;
52
+ contentFallback?: string;
53
+ contentInterpolation?: Record<string, string | number>;
54
+ processLinks?: boolean;
55
+ linkConfig?: import("valtech-components").LinkProcessorConfig;
56
+ };
57
+ getHighlightColor(element: ArticleElement): string;
58
+ getButtonProps(element: ArticleElement): {
59
+ actionType?: import("valtech-components").ActionType;
60
+ expand?: "full" | "block";
61
+ link?: string;
62
+ href?: string;
63
+ target?: "_blank" | "_self" | "_parent" | "_top";
64
+ download?: string;
65
+ color: import("@ionic/core").Color;
66
+ state: import("valtech-components").ComponentState;
67
+ text?: string;
68
+ contentKey?: string;
69
+ contentClass?: string;
70
+ contentFallback?: string;
71
+ contentInterpolation?: Record<string, string | number>;
72
+ icon?: import("valtech-components").IconMetada;
73
+ shape?: "round";
74
+ size?: "small" | "large" | "default";
75
+ fill?: "default" | "clear" | "outline" | "solid";
76
+ type: "button" | "submit" | "reset";
77
+ token?: string;
78
+ ref?: any;
79
+ handler?: (value: any) => any;
80
+ };
81
+ getImageMetadata(element: ArticleElement): ImageMetadata;
82
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArticleComponent, never>;
83
+ static ɵcmp: i0.ɵɵComponentDeclaration<ArticleComponent, "val-article", never, { "props": { "alias": "props"; "required": false; }; }, {}, never, never, true, never>;
84
+ }
@@ -0,0 +1,293 @@
1
+ import { Color } from '@ionic/core';
2
+ import { TextMetadata } from '../../atoms/text/types';
3
+ import { TitleMetadata } from '../../atoms/title/types';
4
+ import { ButtonMetadata } from '../../types';
5
+ /**
6
+ * Tipos de contenido soportados en el componente val-article
7
+ */
8
+ export type ArticleContentType = 'title' | 'subtitle' | 'text' | 'paragraph' | 'quote' | 'highlight' | 'code' | 'list' | 'button' | 'separator' | 'image' | 'video' | 'custom';
9
+ /**
10
+ * Configuración de espaciado entre elementos
11
+ */
12
+ export interface ArticleSpacing {
13
+ /** Espaciado superior */
14
+ top?: 'none' | 'small' | 'medium' | 'large' | 'xlarge';
15
+ /** Espaciado inferior */
16
+ bottom?: 'none' | 'small' | 'medium' | 'large' | 'xlarge';
17
+ /** Espaciado lateral */
18
+ horizontal?: 'none' | 'small' | 'medium' | 'large' | 'xlarge';
19
+ }
20
+ /**
21
+ * Configuración base para cualquier elemento del artículo
22
+ */
23
+ export interface BaseArticleElement {
24
+ /** Tipo de elemento */
25
+ type: ArticleContentType;
26
+ /** ID único del elemento (opcional) */
27
+ id?: string;
28
+ /** Clases CSS adicionales */
29
+ cssClass?: string;
30
+ /** Configuración de espaciado */
31
+ spacing?: ArticleSpacing;
32
+ /** Elemento visible condicionalmente */
33
+ visible?: boolean;
34
+ }
35
+ /**
36
+ * Elemento de título
37
+ */
38
+ export interface ArticleTitleElement extends BaseArticleElement {
39
+ type: 'title';
40
+ props: TitleMetadata;
41
+ }
42
+ /**
43
+ * Elemento de subtítulo
44
+ */
45
+ export interface ArticleSubtitleElement extends BaseArticleElement {
46
+ type: 'subtitle';
47
+ props: TitleMetadata;
48
+ }
49
+ /**
50
+ * Elemento de texto/párrafo
51
+ */
52
+ export interface ArticleTextElement extends BaseArticleElement {
53
+ type: 'text' | 'paragraph';
54
+ props: TextMetadata;
55
+ }
56
+ /**
57
+ * Elemento de cita
58
+ */
59
+ export interface ArticleQuoteElement extends BaseArticleElement {
60
+ type: 'quote';
61
+ props: TextMetadata & {
62
+ /** Autor de la cita */
63
+ author?: string;
64
+ /** Fuente de la cita */
65
+ source?: string;
66
+ };
67
+ }
68
+ /**
69
+ * Elemento de texto destacado
70
+ */
71
+ export interface ArticleHighlightElement extends BaseArticleElement {
72
+ type: 'highlight';
73
+ props: TextMetadata & {
74
+ /** Color de fondo del highlight */
75
+ backgroundColor?: Color;
76
+ /** Esquinas redondeadas */
77
+ rounded?: boolean;
78
+ };
79
+ }
80
+ /**
81
+ * Elemento de código
82
+ */
83
+ export interface ArticleCodeElement extends BaseArticleElement {
84
+ type: 'code';
85
+ props: {
86
+ /** Código a mostrar */
87
+ code: string;
88
+ /** Lenguaje de programación */
89
+ language?: string;
90
+ /** Mostrar números de línea */
91
+ showLineNumbers?: boolean;
92
+ /** Tema del código */
93
+ theme?: 'light' | 'dark';
94
+ };
95
+ }
96
+ /**
97
+ * Elemento de lista
98
+ */
99
+ export interface ArticleListElement extends BaseArticleElement {
100
+ type: 'list';
101
+ props: {
102
+ /** Elementos de la lista */
103
+ items: Array<{
104
+ /** Texto del elemento */
105
+ text: string;
106
+ /** Configuración de contenido reactivo */
107
+ contentKey?: string;
108
+ contentClass?: string;
109
+ contentFallback?: string;
110
+ contentInterpolation?: Record<string, string | number>;
111
+ }>;
112
+ /** Tipo de lista */
113
+ listType?: 'unordered' | 'ordered' | 'checklist';
114
+ /** Color de los elementos */
115
+ color?: Color;
116
+ };
117
+ }
118
+ /**
119
+ * Elemento de botón
120
+ */
121
+ export interface ArticleButtonElement extends BaseArticleElement {
122
+ type: 'button';
123
+ props: ButtonMetadata & {
124
+ /** Alineación del botón */
125
+ alignment?: 'left' | 'center' | 'right';
126
+ };
127
+ }
128
+ /**
129
+ * Elemento separador
130
+ */
131
+ export interface ArticleSeparatorElement extends BaseArticleElement {
132
+ type: 'separator';
133
+ props: {
134
+ /** Tipo de separador */
135
+ style?: 'line' | 'dots' | 'space';
136
+ /** Color del separador */
137
+ color?: Color;
138
+ /** Grosor del separador */
139
+ thickness?: 'thin' | 'medium' | 'thick';
140
+ };
141
+ }
142
+ /**
143
+ * Elemento de imagen
144
+ */
145
+ export interface ArticleImageElement extends BaseArticleElement {
146
+ type: 'image';
147
+ props: {
148
+ /** URL de la imagen */
149
+ src: string;
150
+ /** Texto alternativo */
151
+ alt: string;
152
+ /** Título de la imagen */
153
+ title?: string;
154
+ /** Leyenda de la imagen */
155
+ caption?: string;
156
+ /** Configuración de contenido reactivo para caption */
157
+ captionContentKey?: string;
158
+ captionContentClass?: string;
159
+ captionContentFallback?: string;
160
+ /** Alineación de la imagen */
161
+ alignment?: 'left' | 'center' | 'right';
162
+ /** Ancho máximo */
163
+ maxWidth?: string;
164
+ /** Imagen con bordes redondeados */
165
+ rounded?: boolean;
166
+ };
167
+ }
168
+ /**
169
+ * Elemento de video
170
+ */
171
+ export interface ArticleVideoElement extends BaseArticleElement {
172
+ type: 'video';
173
+ props: {
174
+ /** URL del video */
175
+ src: string;
176
+ /** Imagen de poster */
177
+ poster?: string;
178
+ /** Título del video */
179
+ title?: string;
180
+ /** Controles visibles */
181
+ controls?: boolean;
182
+ /** Reproducción automática */
183
+ autoplay?: boolean;
184
+ /** Silenciado por defecto */
185
+ muted?: boolean;
186
+ /** Ancho máximo */
187
+ maxWidth?: string;
188
+ };
189
+ }
190
+ /**
191
+ * Elemento personalizado
192
+ */
193
+ export interface ArticleCustomElement extends BaseArticleElement {
194
+ type: 'custom';
195
+ props: {
196
+ /** Contenido HTML personalizado */
197
+ htmlContent?: string;
198
+ /** Clase de componente personalizado */
199
+ componentClass?: any;
200
+ /** Props para el componente personalizado */
201
+ componentProps?: any;
202
+ };
203
+ }
204
+ /**
205
+ * Unión de todos los tipos de elementos posibles
206
+ */
207
+ export type ArticleElement = ArticleTitleElement | ArticleSubtitleElement | ArticleTextElement | ArticleQuoteElement | ArticleHighlightElement | ArticleCodeElement | ArticleListElement | ArticleButtonElement | ArticleSeparatorElement | ArticleImageElement | ArticleVideoElement | ArticleCustomElement;
208
+ /**
209
+ * Configuración del artículo completo
210
+ */
211
+ export interface ArticleMetadata {
212
+ /** Elementos del artículo */
213
+ elements: ArticleElement[];
214
+ /** Configuración de espaciado global */
215
+ defaultSpacing?: ArticleSpacing;
216
+ /** Ancho máximo del artículo */
217
+ maxWidth?: string;
218
+ /** Centrar el artículo */
219
+ centered?: boolean;
220
+ /** Tema del artículo */
221
+ theme?: 'light' | 'dark' | 'auto';
222
+ /** Clases CSS adicionales */
223
+ cssClass?: string;
224
+ }
225
+ /**
226
+ * Configuración de espaciado predefinida
227
+ */
228
+ export declare const ARTICLE_SPACING: {
229
+ readonly NONE: ArticleSpacing;
230
+ readonly SMALL: ArticleSpacing;
231
+ readonly MEDIUM: ArticleSpacing;
232
+ readonly LARGE: ArticleSpacing;
233
+ readonly XLARGE: ArticleSpacing;
234
+ readonly TITLE: ArticleSpacing;
235
+ readonly SUBTITLE: ArticleSpacing;
236
+ readonly PARAGRAPH: ArticleSpacing;
237
+ readonly QUOTE: ArticleSpacing;
238
+ readonly CODE: ArticleSpacing;
239
+ readonly LIST: ArticleSpacing;
240
+ readonly BUTTON: ArticleSpacing;
241
+ readonly IMAGE: ArticleSpacing;
242
+ readonly SEPARATOR: ArticleSpacing;
243
+ };
244
+ /**
245
+ * Función helper para crear elementos de artículo de forma fácil
246
+ */
247
+ export declare class ArticleBuilder {
248
+ private elements;
249
+ /**
250
+ * Añade un título al artículo
251
+ */
252
+ title(props: TitleMetadata, options?: Partial<BaseArticleElement>): ArticleBuilder;
253
+ /**
254
+ * Añade un subtítulo al artículo
255
+ */
256
+ subtitle(props: TitleMetadata, options?: Partial<BaseArticleElement>): ArticleBuilder;
257
+ /**
258
+ * Añade un párrafo al artículo
259
+ */
260
+ paragraph(props: TextMetadata, options?: Partial<BaseArticleElement>): ArticleBuilder;
261
+ /**
262
+ * Añade una cita al artículo
263
+ */
264
+ quote(props: ArticleQuoteElement['props'], options?: Partial<BaseArticleElement>): ArticleBuilder;
265
+ /**
266
+ * Añade código al artículo
267
+ */
268
+ code(code: string, language?: string, options?: Partial<BaseArticleElement>): ArticleBuilder;
269
+ /**
270
+ * Añade una lista al artículo
271
+ */
272
+ list(items: ArticleListElement['props']['items'], listType?: ArticleListElement['props']['listType'], options?: Partial<BaseArticleElement>): ArticleBuilder;
273
+ /**
274
+ * Añade un botón al artículo
275
+ */
276
+ button(props: ButtonMetadata, alignment?: 'left' | 'center' | 'right', options?: Partial<BaseArticleElement>): ArticleBuilder;
277
+ /**
278
+ * Añade un separador al artículo
279
+ */
280
+ separator(style?: 'line' | 'dots' | 'space', options?: Partial<BaseArticleElement>): ArticleBuilder;
281
+ /**
282
+ * Añade una imagen al artículo
283
+ */
284
+ image(src: string, alt: string, caption?: string, options?: Partial<BaseArticleElement>): ArticleBuilder;
285
+ /**
286
+ * Construye el artículo final
287
+ */
288
+ build(config?: Partial<ArticleMetadata>): ArticleMetadata;
289
+ /**
290
+ * Resetea el builder para crear un nuevo artículo
291
+ */
292
+ clear(): ArticleBuilder;
293
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.305",
3
+ "version": "2.0.307",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^18.0.0",
6
6
  "@angular/core": "^18.0.0",
package/public-api.d.ts CHANGED
@@ -63,6 +63,8 @@ export * from './lib/components/molecules/select-search/select-search.component'
63
63
  export * from './lib/components/molecules/text-input/text-input.component';
64
64
  export * from './lib/components/molecules/title-block/title-block.component';
65
65
  export * from './lib/components/molecules/title-block/types';
66
+ export * from './lib/components/organisms/article/article.component';
67
+ export * from './lib/components/organisms/article/types';
66
68
  export * from './lib/components/organisms/banner/banner.component';
67
69
  export * from './lib/components/organisms/banner/types';
68
70
  export * from './lib/components/organisms/footer/footer.component';
@@ -80,6 +82,8 @@ export * from './lib/components/organisms/toolbar/types';
80
82
  export * from './lib/components/organisms/wizard/types';
81
83
  export * from './lib/components/organisms/wizard/wizard-footer/wizard-footer.component';
82
84
  export * from './lib/components/organisms/wizard/wizard.component';
85
+ export * from './lib/components/organisms/article/article.component';
86
+ export * from './lib/components/organisms/article/types';
83
87
  export * from './lib/components/templates/layout/layout.component';
84
88
  export * from './lib/components/templates/simple/simple.component';
85
89
  export * from './lib/components/templates/simple/types';