@bbl-digital/snorre 4.2.39 → 4.2.41

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/dist/bundle.js CHANGED
@@ -6349,8 +6349,13 @@
6349
6349
  });
6350
6350
  alpha$1.alpha = alpha;
6351
6351
  function alpha(hexColor, alphaPercentage) {
6352
- const opacity = ~~(alphaPercentage * 2.55);
6353
- return hexColor + opacity.toString(16).toUpperCase().padStart(2, '0');
6352
+ // Ensure alphaPercentage is between 0 and 100
6353
+ const normalizedPercentage = Math.max(0, Math.min(100, alphaPercentage));
6354
+ // Convert percentage to hex (0-255)
6355
+ const opacity = Math.round(normalizedPercentage * 2.55);
6356
+ // Convert to hex and ensure 2 characters
6357
+ const hexOpacity = opacity.toString(16).padStart(2, '0');
6358
+ return hexColor + hexOpacity.toUpperCase();
6354
6359
  }
6355
6360
 
6356
6361
  Object.defineProperty(styles$1i, "__esModule", {
@@ -5,6 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.alpha = alpha;
7
7
  function alpha(hexColor, alphaPercentage) {
8
- const opacity = ~~(alphaPercentage * 2.55);
9
- return hexColor + opacity.toString(16).toUpperCase().padStart(2, '0');
8
+ // Ensure alphaPercentage is between 0 and 100
9
+ const normalizedPercentage = Math.max(0, Math.min(100, alphaPercentage));
10
+ // Convert percentage to hex (0-255)
11
+ const opacity = Math.round(normalizedPercentage * 2.55);
12
+ // Convert to hex and ensure 2 characters
13
+ const hexOpacity = opacity.toString(16).padStart(2, '0');
14
+ return hexColor + hexOpacity.toUpperCase();
10
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.d.ts","sourceRoot":"","sources":["../../src/packages/utils/alpha.ts"],"names":[],"mappings":"AAAA,iBAAS,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAGvD;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
1
+ {"version":3,"file":"alpha.d.ts","sourceRoot":"","sources":["../../src/packages/utils/alpha.ts"],"names":[],"mappings":"AAAA,iBAAS,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAQvD;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
@@ -5,6 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.alpha = alpha;
7
7
  function alpha(hexColor, alphaPercentage) {
8
- const opacity = ~~(alphaPercentage * 2.55);
9
- return hexColor + opacity.toString(16).toUpperCase().padStart(2, '0');
8
+ // Ensure alphaPercentage is between 0 and 100
9
+ const normalizedPercentage = Math.max(0, Math.min(100, alphaPercentage));
10
+ // Convert percentage to hex (0-255)
11
+ const opacity = Math.round(normalizedPercentage * 2.55);
12
+ // Convert to hex and ensure 2 characters
13
+ const hexOpacity = opacity.toString(16).padStart(2, '0');
14
+ return hexColor + hexOpacity.toUpperCase();
10
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "4.2.39",
3
+ "version": "4.2.41",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",