Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
1234567891011121314151617181920212223242526272829303132333435
  1. import _extends from "@babel/runtime/helpers/extends";
  2. import PropTypes from 'prop-types';
  3. import merge from './merge';
  4. function omit(input, fields) {
  5. const output = {};
  6. Object.keys(input).forEach(prop => {
  7. if (fields.indexOf(prop) === -1) {
  8. output[prop] = input[prop];
  9. }
  10. });
  11. return output;
  12. }
  13. function css(styleFunction) {
  14. const newStyleFunction = props => {
  15. const output = styleFunction(props);
  16. if (props.css) {
  17. return _extends({}, merge(output, styleFunction(_extends({
  18. theme: props.theme
  19. }, props.css))), omit(props.css, [styleFunction.filterProps]));
  20. }
  21. return output;
  22. };
  23. newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? _extends({}, styleFunction.propTypes, {
  24. css: PropTypes.object
  25. }) : {};
  26. newStyleFunction.filterProps = ['css', ...styleFunction.filterProps];
  27. return newStyleFunction;
  28. }
  29. export default css;