@bebranded/bb-contents 1.0.126 → 1.0.127

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 +40 -6
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * BeBranded Contents
3
3
  * Contenus additionnels français pour Webflow
4
- * @version 1.0.126
4
+ * @version 1.0.127
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -32,11 +32,11 @@
32
32
  window._bbContentsInitialized = true;
33
33
 
34
34
  // Log de démarrage simple (une seule fois)
35
- console.log('bb-contents | v1.0.126');
35
+ console.log('bb-contents | v1.0.127');
36
36
 
37
37
  // Configuration
38
38
  const config = {
39
- version: '1.0.126',
39
+ version: '1.0.127',
40
40
  debug: false, // Debug désactivé pour rendu propre
41
41
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
42
42
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
@@ -1323,10 +1323,30 @@
1323
1323
  });
1324
1324
  }
1325
1325
 
1326
- // Créer le wrapper
1326
+ // Récupérer les dimensions du select natif avant de le masquer
1327
+ const selectComputedStyle = window.getComputedStyle(element);
1328
+ const selectWidth = element.offsetWidth || parseFloat(selectComputedStyle.width) || 'auto';
1329
+ const selectHeight = element.offsetHeight || parseFloat(selectComputedStyle.height) || 'auto';
1330
+ const selectMinWidth = selectComputedStyle.minWidth !== 'none' ? selectComputedStyle.minWidth : null;
1331
+ const selectMaxWidth = selectComputedStyle.maxWidth !== 'none' ? selectComputedStyle.maxWidth : null;
1332
+ const selectMinHeight = selectComputedStyle.minHeight !== 'none' ? selectComputedStyle.minHeight : null;
1333
+ const selectMaxHeight = selectComputedStyle.maxHeight !== 'none' ? selectComputedStyle.maxHeight : null;
1334
+
1335
+ // Créer le wrapper avec les dimensions du select
1327
1336
  const wrapper = document.createElement('div');
1328
1337
  wrapper.className = 'bb-country-select-wrapper';
1329
- wrapper.style.cssText = 'position: relative; width: 100%;';
1338
+ let wrapperStyle = 'position: relative;';
1339
+ if (selectWidth !== 'auto' && selectWidth > 0) {
1340
+ wrapperStyle += ' width: ' + selectWidth + 'px;';
1341
+ }
1342
+ if (selectHeight !== 'auto' && selectHeight > 0) {
1343
+ wrapperStyle += ' min-height: ' + selectHeight + 'px;';
1344
+ }
1345
+ if (selectMinWidth) wrapperStyle += ' min-width: ' + selectMinWidth + ';';
1346
+ if (selectMaxWidth) wrapperStyle += ' max-width: ' + selectMaxWidth + ';';
1347
+ if (selectMinHeight) wrapperStyle += ' min-height: ' + selectMinHeight + ';';
1348
+ if (selectMaxHeight) wrapperStyle += ' max-height: ' + selectMaxHeight + ';';
1349
+ wrapper.style.cssText = wrapperStyle;
1330
1350
 
1331
1351
  // Masquer le select natif mais le garder fonctionnel
1332
1352
  const selectStyle = element.style.cssText || '';
@@ -1347,7 +1367,21 @@
1347
1367
  '';
1348
1368
 
1349
1369
  trigger.innerHTML = '<div style="display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;"><span class="bb-country-flag" style="flex-shrink: 0;">' + selectedFlag + '</span><span class="bb-country-name" style="flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">' + bbContents.utils.sanitize(selectedName) + '</span></div><svg width="16" height="16" viewBox="0 0 16 16" fill="none" style="flex-shrink: 0; transition: transform 0.2s;"><path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
1350
- trigger.style.cssText = 'display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 6px; background: white; cursor: pointer; font-size: inherit; font-family: inherit; color: inherit; transition: border-color 0.2s; box-sizing: border-box;';
1370
+ let triggerStyle = 'display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 6px; background: white; cursor: pointer; font-size: inherit; font-family: inherit; color: inherit; transition: border-color 0.2s; box-sizing: border-box;';
1371
+ // Utiliser les dimensions du select natif
1372
+ if (selectWidth !== 'auto' && selectWidth > 0) {
1373
+ triggerStyle += ' width: ' + selectWidth + 'px;';
1374
+ } else {
1375
+ triggerStyle += ' width: 100%;';
1376
+ }
1377
+ if (selectHeight !== 'auto' && selectHeight > 0) {
1378
+ triggerStyle += ' height: ' + selectHeight + 'px;';
1379
+ }
1380
+ if (selectMinWidth) triggerStyle += ' min-width: ' + selectMinWidth + ';';
1381
+ if (selectMaxWidth) triggerStyle += ' max-width: ' + selectMaxWidth + ';';
1382
+ if (selectMinHeight) triggerStyle += ' min-height: ' + selectMinHeight + ';';
1383
+ if (selectMaxHeight) triggerStyle += ' max-height: ' + selectMaxHeight + ';';
1384
+ trigger.style.cssText = triggerStyle;
1351
1385
 
1352
1386
  // Variable pour stocker le pays sélectionné (pour chaque instance)
1353
1387
  let currentSelectedCountry = defaultCountry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.126",
3
+ "version": "1.0.127",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {