UNPKG

@compiled/react

Version:

A familiar and performant compile time CSS-in-JS library for React.

28 lines 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Returns a CSS custom property value with an optional suffix & prefix. * Prefix will only be added if there is a suffix. * If the value is undefined a fallback value will be returned to prevent children inheriting parent values. * * @param value * @param suffix * @param prefix */ function cssCustomPropertyValue(value, suffix, prefix) { if (value != undefined) { if (suffix) { if (prefix) { return prefix + value + suffix; } return value + suffix; } return value; } // Currently React trims these values so we can't use a space " " to block the value. // Instead we use a CSS variable that doesn't exist which falls back to " ". // Bug raised here: https://github.com/facebook/react/issues/20497 return 'var(--c-, )'; } exports.default = cssCustomPropertyValue; //# sourceMappingURL=css-custom-property.js.map