GoScrobble/web/node_modules/@material-ui/styles/mergeClasses/mergeClasses.js

49 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = mergeClasses;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _utils = require("@material-ui/utils");
function mergeClasses() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var baseClasses = options.baseClasses,
newClasses = options.newClasses,
Component = options.Component;
if (!newClasses) {
return baseClasses;
}
var nextClasses = (0, _extends2.default)({}, baseClasses);
if (process.env.NODE_ENV !== 'production') {
if (typeof newClasses === 'string') {
console.error(["Material-UI: The value `".concat(newClasses, "` ") + "provided to the classes prop of ".concat((0, _utils.getDisplayName)(Component), " is incorrect."), 'You might want to use the className prop instead.'].join('\n'));
return baseClasses;
}
}
Object.keys(newClasses).forEach(function (key) {
if (process.env.NODE_ENV !== 'production') {
if (!baseClasses[key] && newClasses[key]) {
console.error(["Material-UI: The key `".concat(key, "` ") + "provided to the classes prop is not implemented in ".concat((0, _utils.getDisplayName)(Component), "."), "You can only override one of the following: ".concat(Object.keys(baseClasses).join(','), ".")].join('\n'));
}
if (newClasses[key] && typeof newClasses[key] !== 'string') {
console.error(["Material-UI: The key `".concat(key, "` ") + "provided to the classes prop is not valid for ".concat((0, _utils.getDisplayName)(Component), "."), "You need to provide a non empty string instead of: ".concat(newClasses[key], ".")].join('\n'));
}
}
if (newClasses[key]) {
nextClasses[key] = "".concat(baseClasses[key], " ").concat(newClasses[key]);
}
});
return nextClasses;
}