libreria-astro-lefebvre 0.1.63 → 0.1.64

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libreria-astro-lefebvre",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
4
4
  "description": "Librería de componentes Astro, React y Vue para Lefebvre",
5
5
  "author": "Equipo web desarrollo Lefebvre",
6
6
  "type": "module",
@@ -3,11 +3,11 @@ import type { ComponentMetadata } from '../interfaces/types';
3
3
  export const metadata: ComponentMetadata = {
4
4
  component_name: 'Contenido_2025_Malaga',
5
5
  category: 'Contenido de Imagen',
6
- name: 'Sección hiper-configurable con texto, imagen lateral, botón y modal LF2 2025',
7
- description: 'Sección de contenido altamente configurable con más de 20 campos: título pequeño tipo badge, subtítulo h2 con tamaño conmutable (56px/46px/40px), descripción HTML, imagen lateral opcional (posicionable a izquierda o derecha), botón primario y botón secundario que abre un modal con formulario LF2 inyectado dinámicamente. Ofrece controles finos de alineación vertical, tamaño de fuente del texto, padding horizontal, ancho del contenedor (full/3-5/7xl) y variantes de orientación icono-texto',
6
+ name: 'Sección hiper-configurable con texto, imagen o vídeo lateral, botón y modal LF2 2025',
7
+ description: 'Sección de contenido altamente configurable con más de 20 campos: título pequeño tipo badge, subtítulo h2 con tamaño conmutable (56px/46px/40px), descripción HTML, imagen o vídeo MP4 lateral opcional (posicionable a izquierda o derecha, mutuamente excluyentes: si se rellena el vídeo, la imagen se ignora), botón primario y botón secundario que abre un modal con formulario LF2 inyectado dinámicamente. Ofrece controles finos de alineación vertical, tamaño de fuente del texto, padding horizontal, ancho del contenedor (full/3-5/7xl) y variantes de orientación icono-texto',
8
8
  framework: 'Astro',
9
9
  priority: 1,
10
- tags: ['contenido', 'imagen', 'icono', 'texto', 'modal', 'formulario', 'lf2', 'cta', 'boton'],
10
+ tags: ['contenido', 'imagen', 'video', 'icono', 'texto', 'modal', 'formulario', 'lf2', 'cta', 'boton'],
11
11
  fields: [
12
12
  {
13
13
  name: 'showIco',
@@ -134,7 +134,7 @@ export const metadata: ComponentMetadata = {
134
134
  {
135
135
  name: 'showImage',
136
136
  type: 'boolean',
137
- help: 'Si está activado, se renderiza el layout con imagen (texto + imagen). Si está desactivado, se renderiza un layout alternativo solo con texto (con más padding)',
137
+ help: 'Si está activado, se renderiza el layout con media lateral (texto + imagen o vídeo). Si está desactivado, se renderiza un layout alternativo solo con texto (con más padding)',
138
138
  label: 'Mostrar imagen',
139
139
  mandatory: false,
140
140
  options: ['false', 'true'],
@@ -144,11 +144,23 @@ export const metadata: ComponentMetadata = {
144
144
  {
145
145
  name: 'image',
146
146
  type: 'image',
147
- help: 'URL de la imagen principal. Solo se renderiza si "Mostrar imagen" está activado',
147
+ help: 'URL de la imagen principal. Solo se renderiza si "Mostrar imagen" está activado. Mutuamente exclusivo con el vídeo: si se rellena "URL del video", este campo se ignora',
148
148
  label: 'Src de la imagen',
149
149
  mandatory: false,
150
+ exclusive_group: 'media',
151
+ exclusive_group_label: 'Contenido multimedia',
150
152
  example_value: 'https://assets.lefebvre.es/media/img/preview-comp/comp-w-4-3.png',
151
153
  },
154
+ {
155
+ name: 'iframeSrc',
156
+ type: 'video',
157
+ help: 'URL del vídeo MP4 lateral (se reproduce con autoplay, muted y loop). Solo se renderiza si "Mostrar imagen" está activado. Tiene prioridad sobre la imagen: si se rellena, la imagen se ignora',
158
+ label: 'URL del video',
159
+ mandatory: false,
160
+ exclusive_group: 'media',
161
+ exclusive_group_label: 'Contenido multimedia',
162
+ example_value: 'https://player.vimeo.com/video/1087114916?controls=0&autoplay=1&muted=1&loop=1&badge=0&autopause=0&player_id=0&app_id=58479'
163
+ },
152
164
  {
153
165
  name: 'loading',
154
166
  type: 'select',
@@ -6,6 +6,7 @@ const {
6
6
  subtitle,
7
7
  description,
8
8
  image,
9
+ iframeSrc,
9
10
  orientation = 'left',
10
11
  width = 'full',
11
12
  flexOrientation = 'row',
@@ -43,8 +44,10 @@ const imageSkyscraper = crops['skyscraper'] || ''; // Disponible para uso en el
43
44
  // const baseUrl = getCropByName(image, 'base');
44
45
  // const skyUrl = getCropByName(image, 'skyscraper', { fallback: baseUrl });
45
46
 
46
- // Fallback: si solo viene una URL directa, usar extractImageUrl
47
- const imageUrl = imageBase || extractImageUrl(image);
47
+ // Fallback: si solo viene una URL directa, usar extractImageUrl.
48
+ // Si no hay imagen configurada, se muestra una imagen por defecto
49
+ const DEFAULT_IMAGE = 'https://assets.lefebvre.es/media/img/preview-comp/comp-w-4-3.png';
50
+ const imageUrl = imageBase || extractImageUrl(image) || DEFAULT_IMAGE;
48
51
  ---
49
52
 
50
53
  <section class="w-full flex items-center justify-center">
@@ -122,7 +125,13 @@ const imageUrl = imageBase || extractImageUrl(image);
122
125
  )}
123
126
 
124
127
  <div class={`w-full md:w-1/2 p-4 flex items-center ${orientation === 'left' ? 'justify-end' : 'justify-start'} aspect-auto`}>
125
- <img src={imageUrl} alt={title} width="600" height="450" class="md:max-w-xl w-full md:w-[75%] h-auto object-cover rounded-lg m-auto" loading={loading} />
128
+ {iframeSrc ? (
129
+ <video autoplay loop muted playsinline preload="metadata" width="600" height="450" class="md:max-w-xl w-full md:w-[75%] h-auto object-cover rounded-lg m-auto">
130
+ <source src={iframeSrc} type="video/mp4" />
131
+ </video>
132
+ ) : (
133
+ <img src={imageUrl} alt={title} width="600" height="450" class="md:max-w-xl w-full md:w-[75%] h-auto object-cover rounded-lg m-auto" loading={loading} />
134
+ )}
126
135
  </div>
127
136
 
128
137
  {/* <div class={`w-full lg:w-1/2 p-4 flex items-center ${orientation === 'left' ? 'justify-end' : 'justify-start'} aspect-square`}>