@bianic-ui/system
Version:
Bianic UI system primitives
27 lines (23 loc) • 950 B
JavaScript
import { propNames } from "@bianic-ui/styled-system";
import { memoize } from "@bianic-ui/utils";
/**
* List of props for emotion to omit from DOM.
* It mostly consists of Bianic props
*/
var allPropNames = [...propNames, "textStyle", "layerStyle", "apply", "isTruncated", "noOfLines", "focusBorderColor", "errorBorderColor", "as", "__css", "css", "sx"];
/**
* htmlWidth and htmlHeight is used in the <Image />
* component to support the native `width` and `height` attributes
*
* https://gitlab.com/bia-design/bianic-ui/issues/149
*/
var validHTMLProps = ["htmlWidth", "htmlHeight", "htmlSize"];
function createShouldForwardProp(props) {
var regex = new RegExp("^(" + props.join("|") + ")$");
return memoize(prop => {
if (validHTMLProps.includes(prop)) return true;
return !regex.test(prop);
});
}
export var shouldForwardProp = createShouldForwardProp(allPropNames);
//# sourceMappingURL=should-forward-prop.js.map