UNPKG

@hitachivantara/uikit-react-utils

Version:
19 lines (18 loc) 488 B
//#region src/utils/styles.ts function stripEmpty(obj) { return Object.entries(obj).reduce((acc, [key, value]) => { if (value || value === 0) acc[key] = value; return acc; }, {}); } /** * Utility that merges the `style` prop (`styleProp`) with an external `style` object. * * The external object accepts CSS vars (`--var`) and removes empty style entries. */ var mergeStyles = (styleProp, styles) => ({ ...stripEmpty(styles), ...styleProp }); //#endregion export { mergeStyles };