UNPKG

@uifabric/merge-styles

Version:
34 lines 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var concatStyleSets_1 = require("./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. */ 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_1.concatStyleSets.apply(void 0, result); } return {}; } exports.concatStyleSetsWithProps = concatStyleSetsWithProps; //# sourceMappingURL=concatStyleSetsWithProps.js.map