UNPKG

@uifabric/merge-styles

Version:
31 lines 1.24 kB
import { concatStyleSets } from './concatStyleSets'; /** * Concatenates style sets into one, but resolves functional sets using the given props. * @param styleProps - Props used to resolve functional sets. * @param allStyles - Style sets, which can be functions or objects. */ export function concatStyleSetsWithProps(styleProps) { var allStyles = []; for (var _i = 1; _i < arguments.length; _i++) { allStyles[_i - 1] = arguments[_i]; } var result = []; for (var _a = 0, allStyles_1 = allStyles; _a < allStyles_1.length; _a++) { var styles = allStyles_1[_a]; if (styles) { result.push(typeof styles === 'function' ? styles(styleProps) : styles); } } if (result.length === 1) { return result[0]; } else if (result.length) { // cliffkoh: I cannot figure out how to avoid the cast to any here. // It is something to do with the use of Omit in IStyleSet. // It might not be necessary once Omit becomes part of lib.d.ts (when we remove our own Omit and rely on // the official version). return concatStyleSets.apply(void 0, result); } return {}; } //# sourceMappingURL=concatStyleSetsWithProps.js.map