@react-hive/honey-style 2.1.0 → 2.2.0

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.
@@ -1879,6 +1879,9 @@ const CSS_SPACING_PROPERTIES = [
1879
1879
  'paddingRight',
1880
1880
  'paddingBottom',
1881
1881
  'paddingLeft',
1882
+ 'paddingBlock',
1883
+ 'paddingBlockStart',
1884
+ 'paddingBlockEnd',
1882
1885
  'top',
1883
1886
  'right',
1884
1887
  'bottom',
@@ -1998,15 +2001,18 @@ const createSpacingMiddleware = ({ spacingMultiplier }) => element => {
1998
2001
  if (typeof element.props === 'string' &&
1999
2002
  KEBAB_CASE_SPACING_PROPERTIES.includes(element.props) &&
2000
2003
  typeof element.children === 'string') {
2001
- const transformed = element.children
2002
- .split(/\s+/)
2003
- .map(value => {
2004
- if (/[a-z%]+$/i.test(value)) {
2005
- return value;
2006
- }
2007
- return `${parseFloat(value) * spacingMultiplier}px`;
2008
- })
2009
- .join(' ');
2004
+ // If the whole value contains parentheses, skip entirely (likely calc or var)
2005
+ if (/[()]/.test(element.children)) {
2006
+ return;
2007
+ }
2008
+ const transformedParts = [];
2009
+ const parts = element.children.trim().split(/\s+/);
2010
+ for (const value of parts) {
2011
+ transformedParts.push(
2012
+ // Accept only numeric strings (integers or floats), no units or symbols
2013
+ /^(\d+|\d*\.\d+)$/.test(value) ? `${parseFloat(value) * spacingMultiplier}px` : value);
2014
+ }
2015
+ const transformed = transformedParts.join(' ');
2010
2016
  element.return = `${element.props}:${transformed};`;
2011
2017
  }
2012
2018
  };