fix(heading): keep units and auto in margin shortcut props

NI
10h ago
+51-3

Fixes #3924

What

<Heading> margin shortcut props always got px appended, so mt="1.5rem" rendered margin-top:1.5rempx and values like auto or m="0 auto" were dropped entirely.

Fix

withSpace now resolves each prop per token:

  • bare numbers and numeric strings (10, "10", -5) still get px appended
  • values already carrying a unit ("1.5rem", "10px", "10%"), auto, and multi-value shorthands of those ("0 auto", "10px 20px") are emitted unchanged
  • anything that isn't a CSS length or auto ("invalid", "10 px", "") is still dropped, preserving the existing invalid-value behavior

Testing

New cases in utils.spec.ts for both withMargin and withSpace covering unit passthrough, auto, shorthands, numeric px suffixing, and invalid-value dropping. pnpm vitest run src/components/heading — 18/18 pass. Typecheck clean, biome lint clean.


Summary by cubic

Fixes #3924 by making <Heading> margin shortcut props preserve units and auto values instead of always appending px. Previously mt="1.5rem" rendered margin-top:1.5rempx and values like auto or m="0 auto" were dropped entirely. Numeric values still get px appended, values with units, auto, and multi-value shorthands pass through unchanged, and invalid values like "10 px" are still dropped.