Skip to content

Commit

Permalink
[styles] Remove react-jss dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 24, 2018
1 parent 586afb0 commit 3d38cb5
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = [
name: 'The initial cost people pay for using one component',
webpack: true,
path: 'packages/material-ui/build/Paper/index.js',
limit: '17.5 KB',
limit: '17.3 KB',
},
{
name: 'The size of all the modules of material-ui.',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"react-docgen": "^3.0.0-beta10",
"react-dom": "^16.4.0",
"react-inspector": "^2.2.2",
"react-jss": "^8.1.0",
"react-markdown": "^3.4.1",
"react-number-format": "^3.0.2",
"react-redux": "^5.0.6",
Expand Down
1 change: 0 additions & 1 deletion packages/material-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"popper.js": "^1.14.1",
"prop-types": "^15.6.0",
"react-event-listener": "^0.6.2",
"react-jss": "^8.1.0",
"react-transition-group": "^2.2.1",
"recompose": "0.28.0 - 0.30.0",
"warning": "^4.0.1"
Expand Down
9 changes: 9 additions & 0 deletions packages/material-ui/src/styles/reactJssContext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Share the same values than in
// https://github.com/cssinjs/jss/blob/master/packages/react-jss/src/ns.js
const ns = {
jss: '64a55d578f856d258dc345b094a2a2b3',
sheetsRegistry: 'd4bd0baacbc52bbd48bbb9eb24344ecd',
sheetOptions: '6fc570d6bd61383819d0f9e7407c452d',
};

export default ns;
7 changes: 4 additions & 3 deletions packages/material-ui/src/styles/withStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import PropTypes from 'prop-types';
import warning from 'warning';
import hoistNonReactStatics from 'hoist-non-react-statics';
import wrapDisplayName from 'recompose/wrapDisplayName';
import contextTypes from 'react-jss/lib/contextTypes';
import { create } from 'jss';
import * as ns from 'react-jss/lib/ns';
import ns from './reactJssContext';
import jssPreset from './jssPreset';
import mergeClasses from './mergeClasses';
import createMuiTheme from './createMuiTheme';
Expand Down Expand Up @@ -303,7 +302,9 @@ const withStyles = (stylesOrCreator, options = {}) => Component => {

WithStyles.contextTypes = {
muiThemeProviderOptions: PropTypes.object,
...contextTypes,
[ns.jss]: PropTypes.object,
[ns.sheetOptions]: PropTypes.object,
[ns.sheetsRegistry]: PropTypes.object,
...(listenToTheme ? themeListener.contextTypes : {}),
};

Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/test-utils/getClasses.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ns from 'react-jss/lib/ns';
import ns from '../styles/reactJssContext';
import { SheetsRegistry } from 'jss';
import createShallow from './createShallow';
import { sheetsManager } from '../styles/withStyles';
Expand Down

0 comments on commit 3d38cb5

Please sign in to comment.