@bebranded/bb-contents 1.0.151 → 1.0.152

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.
Files changed (2) hide show
  1. package/bb-contents.js +44 -12
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -32,7 +32,7 @@
32
32
  window._bbContentsInitialized = true;
33
33
 
34
34
  // Log de démarrage simple (une seule fois)
35
- console.log('bb-contents | v1.0.151');
35
+ console.log('bb-contents | v1.0.152');
36
36
 
37
37
  // Configuration
38
38
  const config = {
@@ -320,11 +320,16 @@
320
320
  const isVertical = orientation === 'vertical';
321
321
  const useAutoHeight = isVertical && height === 'auto';
322
322
 
323
+ // Vérifier le overflow du parent pour respecter overflow: visible
324
+ const parentComputedStyle = getComputedStyle(element);
325
+ const parentOverflow = parentComputedStyle.overflow;
326
+ const shouldHideOverflow = parentOverflow !== 'visible' && parentOverflow !== '';
327
+
323
328
  mainContainer.style.cssText = `
324
329
  position: relative;
325
330
  width: 100%;
326
331
  height: ${isVertical ? (height === 'auto' ? 'auto' : height + 'px') : 'auto'};
327
- overflow: hidden;
332
+ ${shouldHideOverflow ? 'overflow: hidden;' : 'overflow: visible;'}
328
333
  min-height: auto;
329
334
  ${minHeight ? `min-height: ${minHeight};` : ''}
330
335
  `;
@@ -451,20 +456,47 @@
451
456
  }
452
457
 
453
458
  // Permettre le retour à la ligne pour les conteneurs de texte
459
+ // Ne pas toucher aux éléments qui doivent garder leur taille auto (comme .tag-m)
454
460
  const textContainers = item.querySelectorAll('.use-case_client, .testimonial_client-info, [class*="text"], p, span');
455
461
  textContainers.forEach(container => {
462
+ // Exclure les éléments qui doivent garder leur taille auto (tags, badges, etc.)
463
+ const shouldPreserveAuto = container.classList.contains('tag-m') ||
464
+ container.classList.contains('tag') ||
465
+ container.classList.contains('badge') ||
466
+ container.getAttribute('style') && container.getAttribute('style').includes('width');
467
+
468
+ if (shouldPreserveAuto) {
469
+ // Ne pas toucher à ces éléments, ils gardent leur taille auto
470
+ return;
471
+ }
472
+
456
473
  const containerComputed = getComputedStyle(container);
457
- // Si l'élément a une largeur définie, la préserver
458
- if (containerComputed.width && containerComputed.width !== 'auto' && containerComputed.width !== '0px') {
459
- container.style.width = containerComputed.width;
460
- } else {
461
- // Sinon, prendre 100% de la largeur du parent
462
- container.style.width = '100%';
474
+ // Vérifier si l'élément a un style inline width défini
475
+ const hasInlineWidth = container.style.width && container.style.width !== '';
476
+
477
+ // Si l'élément a une largeur inline définie, la préserver
478
+ if (hasInlineWidth) {
479
+ // Garder la largeur inline
480
+ return;
481
+ }
482
+
483
+ // Si l'élément a une largeur calculée qui n'est pas auto, vérifier si c'est une valeur fixe
484
+ // Sinon, appliquer width: 100% seulement aux conteneurs de texte qui doivent wrapper
485
+ const isTextContainer = container.classList.contains('use-case_client') ||
486
+ container.classList.contains('testimonial_client-info') ||
487
+ container.tagName === 'P' && !container.classList.contains('tag');
488
+
489
+ if (isTextContainer) {
490
+ // Pour les conteneurs de texte principaux, permettre le wrapping
491
+ // Ne pas forcer width si déjà défini
492
+ if (!containerComputed.width || containerComputed.width === 'auto' || containerComputed.width === '0px') {
493
+ container.style.width = '100%';
494
+ }
495
+ // Forcer le retour à la ligne
496
+ container.style.whiteSpace = 'normal';
497
+ container.style.wordWrap = 'break-word';
498
+ container.style.overflowWrap = 'break-word';
463
499
  }
464
- // Forcer le retour à la ligne
465
- container.style.whiteSpace = 'normal';
466
- container.style.wordWrap = 'break-word';
467
- container.style.overflowWrap = 'break-word';
468
500
  });
469
501
  });
470
502
  }, 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.151",
3
+ "version": "1.0.152",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {