@razorpay/blade
Version:
The Design System that powers Razorpay
23 lines (21 loc) • 1.09 kB
JavaScript
// The reason we need to omit them is because styled-component thinks they are valid html attributes
// because fontFamily, fontWeight etc are valid SVG props.
// Here are list of valid props which emotion checks https://github.com/emotion-js/emotion/blob/main/packages/is-prop-valid/src/props.js
// Thus we just need to ignore few of these
var filterProps = ['cursor', 'display', 'overflow', 'order', 'color', 'fontFamily', 'fontWeight', 'fontSize', 'fontStyle', 'lineHeight',
// width height are only accepted in few components,
// canvas, embed, iframe, input, object, video, img
// none of them are currently supported in Box
'width', 'height', 'visibility'];
var omitPropsFromHTML = function omitPropsFromHTML(prop, defaultValidatorFn) {
/**
* Element timing is a valid HTML attribute
* Checkout https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/elementtiming
*/
if (prop === 'elementtiming') {
return true;
}
return !filterProps.includes(prop) && defaultValidatorFn(prop);
};
export { omitPropsFromHTML };
//# sourceMappingURL=index.js.map