@instructure/emotion 8.33.2-snapshot-0 → 8.33.2-snapshot-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [8.33.2-snapshot-0](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2-snapshot-0) (2023-01-13)
6
+ ## [8.33.2-snapshot-5](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2-snapshot-5) (2023-01-23)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/emotion
9
9
 
@@ -21,10 +21,10 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import React from 'react';
25
26
  import { ThemeProvider } from '@emotion/react';
26
27
  import { getTheme } from '../getTheme';
27
-
28
28
  /**
29
29
  * ---
30
30
  * category: components/utilities
@@ -33,13 +33,12 @@ import { getTheme } from '../getTheme';
33
33
  */
34
34
  function EmotionThemeProvider(_ref) {
35
35
  let children = _ref.children,
36
- _ref$theme = _ref.theme,
37
- theme = _ref$theme === void 0 ? {} : _ref$theme;
36
+ _ref$theme = _ref.theme,
37
+ theme = _ref$theme === void 0 ? {} : _ref$theme;
38
38
  return /*#__PURE__*/React.createElement(ThemeProvider, {
39
39
  theme: getTheme(theme)
40
40
  }, children);
41
41
  }
42
-
43
42
  EmotionThemeProvider.defaultProps = {
44
43
  theme: {}
45
44
  };
@@ -21,13 +21,13 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import React, { useContext } from 'react';
25
26
  import PropTypes from 'prop-types';
26
27
  import { ThemeProvider } from '@emotion/react';
27
28
  import { TextDirectionContext } from '@instructure/ui-i18n';
28
29
  import { DeterministicIdContextProvider, getElementType } from '@instructure/ui-react-utils';
29
30
  import { getTheme } from '../getTheme';
30
-
31
31
  /**
32
32
  * ---
33
33
  * category: components/utilities
@@ -37,15 +37,13 @@ import { getTheme } from '../getTheme';
37
37
  */
38
38
  function InstUISettingsProvider(_ref) {
39
39
  let children = _ref.children,
40
- _ref$theme = _ref.theme,
41
- theme = _ref$theme === void 0 ? {} : _ref$theme,
42
- dir = _ref.dir,
43
- instanceCounterMap = _ref.instanceCounterMap,
44
- as = _ref.as;
40
+ _ref$theme = _ref.theme,
41
+ theme = _ref$theme === void 0 ? {} : _ref$theme,
42
+ dir = _ref.dir,
43
+ instanceCounterMap = _ref.instanceCounterMap,
44
+ as = _ref.as;
45
45
  const finalDir = dir || useContext(TextDirectionContext);
46
-
47
46
  if (process.env.NODE_ENV !== 'production' && finalDir === 'auto') {}
48
-
49
47
  let providers = /*#__PURE__*/React.createElement(DeterministicIdContextProvider, {
50
48
  instanceCounterMap: instanceCounterMap
51
49
  }, /*#__PURE__*/React.createElement(ThemeProvider, {
@@ -53,7 +51,6 @@ function InstUISettingsProvider(_ref) {
53
51
  }, /*#__PURE__*/React.createElement(TextDirectionContext.Provider, {
54
52
  value: finalDir
55
53
  }, children)));
56
-
57
54
  if (dir) {
58
55
  const Element = getElementType(InstUISettingsProvider, {
59
56
  as
@@ -62,10 +59,8 @@ function InstUISettingsProvider(_ref) {
62
59
  dir: finalDir
63
60
  }, providers);
64
61
  } else if (as && process.env.NODE_ENV !== 'production') {}
65
-
66
62
  return providers;
67
63
  }
68
-
69
64
  InstUISettingsProvider.propTypes = {
70
65
  /* eslint-disable react/require-default-props */
71
66
  children: PropTypes.node,
@@ -74,8 +69,8 @@ InstUISettingsProvider.propTypes = {
74
69
  instanceCounterMap: PropTypes.instanceOf(Map),
75
70
  as: PropTypes.string
76
71
  /* eslint-enable react/require-default-props */
77
-
78
72
  };
73
+
79
74
  InstUISettingsProvider.defaultProps = {
80
75
  theme: {},
81
76
  as: void 0
@@ -40,30 +40,28 @@ const getComponentThemeOverride = (theme, displayName, componentId, props, compo
40
40
  const name = displayName;
41
41
  const id = componentId;
42
42
  const _ref = props,
43
- themeOverride = _ref.themeOverride;
43
+ themeOverride = _ref.themeOverride;
44
44
  const _ref2 = theme,
45
- componentOverrides = _ref2.componentOverrides;
45
+ componentOverrides = _ref2.componentOverrides;
46
46
  let overridesFromTheme = {};
47
47
  let overrideFromComponent = {};
48
-
49
48
  if (componentOverrides) {
50
49
  overridesFromTheme = name && componentOverrides[name] || id && componentOverrides[id] || {};
51
50
  }
52
-
53
51
  if (themeOverride) {
54
52
  if (typeof themeOverride === 'function') {
55
- overrideFromComponent = themeOverride(componentTheme || {}, // the `theme` technically could be a partial theme / override object too,
53
+ overrideFromComponent = themeOverride(componentTheme || {},
54
+ // the `theme` technically could be a partial theme / override object too,
56
55
  // but we want to display all possible options
57
56
  theme);
58
57
  } else {
59
58
  overrideFromComponent = themeOverride;
60
59
  }
61
60
  }
62
-
63
- return { ...overridesFromTheme,
61
+ return {
62
+ ...overridesFromTheme,
64
63
  ...overrideFromComponent
65
64
  };
66
65
  };
67
-
68
66
  export default getComponentThemeOverride;
69
67
  export { getComponentThemeOverride };
package/es/getTheme.js CHANGED
@@ -24,7 +24,6 @@
24
24
  import { canvas } from '@instructure/ui-themes';
25
25
  import { ThemeRegistry } from '@instructure/theme-registry';
26
26
  import { isBaseTheme, mergeDeep } from '@instructure/ui-utils';
27
-
28
27
  /**
29
28
  * ---
30
29
  * private: true
@@ -41,9 +40,7 @@ import { isBaseTheme, mergeDeep } from '@instructure/ui-utils';
41
40
  */
42
41
  const getTheme = themeOrOverride => function () {
43
42
  var _themeOrOverride, _themeOrOverride$them;
44
-
45
43
  let ancestorTheme = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
46
-
47
44
  try {
48
45
  // If a valid InstUI theme is given, it just returns the theme.
49
46
  if (isBaseTheme(themeOrOverride)) {
@@ -53,30 +50,25 @@ const getTheme = themeOrOverride => function () {
53
50
  // If the prop passed is not an Object, it will throw an error.
54
51
  // We are using this fail-safe here for the non-TS users,
55
52
  // because the whole page can break without a theme.
56
- if (process.env.NODE_ENV !== 'production') {} // eslint-disable-next-line no-param-reassign
57
-
58
-
53
+ if (process.env.NODE_ENV !== 'production') {}
54
+ // eslint-disable-next-line no-param-reassign
59
55
  themeOrOverride = {};
60
- } // we need to clone the ancestor theme not to override it
61
-
56
+ }
62
57
 
58
+ // we need to clone the ancestor theme not to override it
63
59
  let currentTheme;
64
-
65
60
  if (Object.keys(ancestorTheme).length === 0) {
66
61
  const globalTheme = ThemeRegistry.getCurrentTheme();
67
-
68
62
  if (process.env.NODE_ENV !== 'production' && !globalTheme) {}
69
-
70
63
  currentTheme = globalTheme || canvas;
71
64
  } else {
72
65
  currentTheme = ancestorTheme;
73
66
  }
67
+ const themeName = currentTheme.key;
74
68
 
75
- const themeName = currentTheme.key; // we pick the overrides for the current theme from the override object
76
-
69
+ // we pick the overrides for the current theme from the override object
77
70
  const currentThemeOverrides = ((_themeOrOverride = themeOrOverride) === null || _themeOrOverride === void 0 ? void 0 : (_themeOrOverride$them = _themeOrOverride.themeOverrides) === null || _themeOrOverride$them === void 0 ? void 0 : _themeOrOverride$them[themeName]) || themeOrOverride.themeOverrides || {};
78
71
  return mergeDeep(currentTheme, themeOrOverride, currentThemeOverrides);
79
72
  };
80
-
81
73
  export default getTheme;
82
74
  export { getTheme };
package/es/index.js CHANGED
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
  /// <reference types="@emotion/react/types/css-prop" />
25
+
25
26
  export * from '@emotion/react';
26
27
  export { EmotionThemeProvider } from './EmotionThemeProvider';
27
28
  export { InstUISettingsProvider } from './InstUISettingsProvider';
@@ -21,15 +21,17 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import PropTypes from 'prop-types';
25
26
  import { ThemeablePropValues } from './ThemeablePropValues';
26
27
  const SHADOW_TYPES = ThemeablePropValues.SHADOW_TYPES,
27
- STACKING_TYPES = ThemeablePropValues.STACKING_TYPES,
28
- BORDER_WIDTHS = ThemeablePropValues.BORDER_WIDTHS,
29
- BORDER_RADII = ThemeablePropValues.BORDER_RADII,
30
- BACKGROUNDS = ThemeablePropValues.BACKGROUNDS,
31
- SIZES = ThemeablePropValues.SIZES,
32
- SPACING = ThemeablePropValues.SPACING;
28
+ STACKING_TYPES = ThemeablePropValues.STACKING_TYPES,
29
+ BORDER_WIDTHS = ThemeablePropValues.BORDER_WIDTHS,
30
+ BORDER_RADII = ThemeablePropValues.BORDER_RADII,
31
+ BACKGROUNDS = ThemeablePropValues.BACKGROUNDS,
32
+ SIZES = ThemeablePropValues.SIZES,
33
+ SPACING = ThemeablePropValues.SPACING;
34
+
33
35
  /**
34
36
  * ---
35
37
  * category: utilities/themes
@@ -37,7 +39,6 @@ const SHADOW_TYPES = ThemeablePropValues.SHADOW_TYPES,
37
39
  * Custom prop types for themeable React components.
38
40
  * @module ThemeablePropTypes
39
41
  */
40
-
41
42
  const ThemeablePropTypes = {
42
43
  shadow: PropTypes.oneOf(Object.values(SHADOW_TYPES)),
43
44
  stacking: PropTypes.oneOf(Object.values(STACKING_TYPES)),
@@ -47,26 +48,20 @@ const ThemeablePropTypes = {
47
48
  size: PropTypes.oneOf(Object.values(SIZES)),
48
49
  spacing: shorthandPropType(Object.values(SPACING))
49
50
  };
50
-
51
51
  function shorthandPropType(validValues) {
52
52
  return function (props, propName, componentName, location) {
53
53
  const propValue = props[propName];
54
-
55
54
  if (typeof propValue === 'undefined') {
56
55
  return null;
57
56
  }
58
-
59
57
  if (typeof propValue !== 'string') {
60
58
  return new Error(`Invalid ${location} \`${propName}\` of type \`${typeof propValue}\` supplied to \`${componentName}\`, expected ` + `a string.`);
61
59
  }
62
-
63
60
  const propValues = propValue.split(' ');
64
61
  const valuesLength = propValues.length;
65
-
66
62
  if (valuesLength > 0 && valuesLength < 5) {
67
63
  for (let i = 0; i < valuesLength; i++) {
68
64
  const valueIndex = validValues.indexOf(propValues[i]);
69
-
70
65
  if (valueIndex === -1) {
71
66
  return new Error(`Invalid ${location} \`${propName}\` \`${propValues[i]}\` supplied to \`${componentName}\`, expected ` + `a one of \`${validValues.join(', ')}\`.`);
72
67
  }
@@ -74,10 +69,8 @@ function shorthandPropType(validValues) {
74
69
  } else {
75
70
  return new Error(`Invalid ${location} \`${propName}\` \`${propValue}\` supplied to \`${componentName}\`, expected ` + `between one and four of the following valid values: \`${validValues.join(', ')}\`.`);
76
71
  }
77
-
78
72
  return null;
79
73
  };
80
74
  }
81
-
82
75
  export default ThemeablePropTypes;
83
76
  export { ThemeablePropTypes, shorthandPropType };
@@ -21,6 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  const ThemeablePropValues = {
25
26
  SHADOW_TYPES: {
26
27
  resting: 'resting',
@@ -76,7 +77,9 @@ const ThemeablePropValues = {
76
77
  xLarge: 'x-large',
77
78
  xxLarge: 'xx-large'
78
79
  }
79
- }; // SPACING
80
+ };
81
+
82
+ // SPACING
80
83
 
81
84
  export default ThemeablePropValues;
82
85
  export { ThemeablePropValues };
@@ -21,8 +21,10 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import { isEmpty, camelize } from '@instructure/ui-utils';
25
26
  import { logError as error } from '@instructure/console';
27
+
26
28
  /**
27
29
  * ---
28
30
  * category: utilities/themes
@@ -39,35 +41,28 @@ import { logError as error } from '@instructure/console';
39
41
  * @param {String} propName - a prefix to combine with each propValue
40
42
  * @returns {String} a string with each value replaced with a value from the theme object
41
43
  */
42
-
43
44
  function getShorthandPropValue(componentName, componentTheme, propValue, propName) {
44
45
  if (typeof propValue !== 'string' || isEmpty(componentTheme)) {
45
46
  return;
46
47
  }
47
-
48
48
  return propValue.split(' ').map(shortHandValue => {
49
49
  if (shortHandValue === 'auto' || shortHandValue === '0') {
50
50
  return shortHandValue;
51
51
  }
52
-
53
52
  if (shortHandValue === 'none') {
54
53
  return '0';
55
54
  }
56
-
57
55
  if (shortHandValue === 'circle') {
58
56
  return '100%';
59
57
  }
60
-
61
58
  if (shortHandValue === 'pill') {
62
59
  return '999em';
63
60
  }
64
-
65
61
  const themeVariableName = camelize(`${propName}-${shortHandValue}`);
66
62
  const themeVariableValue = componentTheme[themeVariableName];
67
63
  error(typeof themeVariableValue !== 'undefined', `[${componentName}] '${themeVariableName}' is an invalid '${propName}' value.`);
68
64
  return themeVariableValue || '0';
69
65
  }).join(' ').trim();
70
66
  }
71
-
72
67
  export default getShorthandPropValue;
73
68
  export { getShorthandPropValue };
@@ -21,6 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  export { ThemeablePropValues } from './ThemeablePropValues';
25
26
  export { ThemeablePropTypes } from './ThemeablePropTypes';
26
27
  export { makeThemeVars } from './makeThemeVars';
@@ -21,8 +21,8 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- import { camelize } from '@instructure/ui-utils';
25
24
 
25
+ import { camelize } from '@instructure/ui-utils';
26
26
  /**
27
27
  * ---
28
28
  * category: utilities/themes
@@ -41,6 +41,5 @@ function makeThemeVars(prefix, vars) {
41
41
  });
42
42
  return themeVars;
43
43
  }
44
-
45
44
  export default makeThemeVars;
46
45
  export { makeThemeVars };
@@ -46,9 +46,7 @@ function mirrorShorthandEdges(values) {
46
46
  if (typeof values !== 'string') {
47
47
  return;
48
48
  }
49
-
50
49
  const valuesArr = values.split(' ');
51
-
52
50
  if (valuesArr.length === 4) {
53
51
  // swap the 2nd and 4th values
54
52
  ;
@@ -56,9 +54,9 @@ function mirrorShorthandEdges(values) {
56
54
  valuesArr[1] = _ref[0];
57
55
  valuesArr[3] = _ref[1];
58
56
  }
59
-
60
57
  return valuesArr.join(' ');
61
58
  }
59
+
62
60
  /**
63
61
  * Convert shorthand CSS properties for corners to rtl
64
62
  *
@@ -72,15 +70,11 @@ function mirrorShorthandEdges(values) {
72
70
  * @param {String} values - space delimited string values representing a CSS shorthand
73
71
  * @returns {String} a space delimited CSS shorthand string converted to RTL
74
72
  */
75
-
76
-
77
73
  function mirrorShorthandCorners(values) {
78
74
  if (typeof values !== 'string') {
79
75
  return;
80
76
  }
81
-
82
77
  const valuesArr = values.split(' ');
83
-
84
78
  if (valuesArr.length === 2) {
85
79
  // swap the 1st and 2nd values
86
80
  ;
@@ -88,12 +82,10 @@ function mirrorShorthandCorners(values) {
88
82
  valuesArr[0] = _ref2[0];
89
83
  valuesArr[1] = _ref2[1];
90
84
  }
91
-
92
85
  if (valuesArr.length === 3) {
93
86
  // convert 3 value syntax to 4 value syntax
94
87
  valuesArr.push(valuesArr[1]);
95
88
  }
96
-
97
89
  if (valuesArr.length === 4) {
98
90
  ;
99
91
  var _ref3 = [valuesArr[1], valuesArr[0], valuesArr[3], valuesArr[2]];
@@ -102,8 +94,6 @@ function mirrorShorthandCorners(values) {
102
94
  valuesArr[2] = _ref3[2];
103
95
  valuesArr[3] = _ref3[3];
104
96
  }
105
-
106
97
  return valuesArr.join(' ');
107
98
  }
108
-
109
99
  export { mirrorShorthandEdges, mirrorShorthandCorners };
package/es/useTheme.js CHANGED
@@ -21,11 +21,11 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import { useTheme as useEmotionTheme } from '@emotion/react';
25
26
  import { canvas } from '@instructure/ui-themes';
26
27
  import { isEmpty } from '@instructure/ui-utils';
27
28
  import { ThemeRegistry } from '@instructure/theme-registry';
28
-
29
29
  /**
30
30
  * ---
31
31
  * private: true
@@ -37,21 +37,15 @@ import { ThemeRegistry } from '@instructure/theme-registry';
37
37
  */
38
38
  const useTheme = () => {
39
39
  let theme = useEmotionTheme();
40
-
41
40
  if (isEmpty(theme)) {
42
41
  const globalTheme = ThemeRegistry.getCurrentTheme();
43
-
44
42
  if (globalTheme) {
45
43
  return globalTheme;
46
44
  }
47
-
48
45
  if (process.env.NODE_ENV !== 'production') {}
49
-
50
46
  theme = canvas;
51
47
  }
52
-
53
48
  return theme;
54
49
  };
55
-
56
50
  export default useTheme;
57
51
  export { useTheme };
package/es/withStyle.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
-
3
2
  /*
4
3
  * The MIT License (MIT)
5
4
  *
@@ -23,6 +22,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
23
22
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
23
  * SOFTWARE.
25
24
  */
25
+
26
26
  import React, { forwardRef, useState } from 'react';
27
27
  import hoistNonReactStatics from 'hoist-non-react-statics';
28
28
  import { deepEqual as isEqual } from '@instructure/ui-utils';
@@ -34,6 +34,7 @@ const defaultValues = {
34
34
  styles: {},
35
35
  makeStyles: () => {}
36
36
  };
37
+
37
38
  /**
38
39
  * ---
39
40
  * category: utilities/themes
@@ -109,75 +110,73 @@ const defaultValues = {
109
110
  * @param {function} generateComponentTheme - The function that returns the component's theme variables object
110
111
  * @returns {ReactElement} The decorated WithStyle Component
111
112
  */
112
-
113
113
  const withStyle = decorator((ComposedComponent, generateStyle, generateComponentTheme) => {
114
114
  const displayName = ComposedComponent.displayName || ComposedComponent.name;
115
115
  const WithStyle = /*#__PURE__*/forwardRef((props, ref) => {
116
116
  const theme = useTheme();
117
-
118
117
  if (props.styles) {
119
118
  warn(false, `Manually passing the "styles" property is not allowed on the ${displayName} component. Using the default styles calculated by the @withStyle decorator instead.\n`, props.styles);
120
119
  }
121
-
122
120
  if (props.makeStyles) {
123
121
  warn(false, `Manually passing the "makeStyles" property is not allowed on the ${displayName} component. Styles are calculated by the @withStyle decorator.`);
124
122
  }
125
-
126
- const componentProps = { ...ComposedComponent.defaultProps,
123
+ const componentProps = {
124
+ ...ComposedComponent.defaultProps,
127
125
  ...props,
128
126
  ...defaultValues
129
127
  };
130
128
  let componentTheme = typeof generateComponentTheme === 'function' ? generateComponentTheme(theme) : {};
131
129
  const themeOverride = getComponentThemeOverride(theme, displayName, ComposedComponent.componentId, componentProps, componentTheme);
132
- componentTheme = { ...componentTheme,
130
+ componentTheme = {
131
+ ...componentTheme,
133
132
  ...themeOverride
134
133
  };
135
-
136
134
  const _useState = useState(generateStyle ? generateStyle(componentTheme, componentProps, {}) : {}),
137
- _useState2 = _slicedToArray(_useState, 2),
138
- styles = _useState2[0],
139
- setStyles = _useState2[1];
140
-
135
+ _useState2 = _slicedToArray(_useState, 2),
136
+ styles = _useState2[0],
137
+ setStyles = _useState2[1];
141
138
  const makeStyleHandler = extraArgs => {
142
139
  const calculatedStyles = generateStyle(componentTheme, componentProps, extraArgs);
143
-
144
140
  if (!isEqual(calculatedStyles, styles)) {
145
141
  setStyles(calculatedStyles);
146
142
  }
147
143
  };
148
-
149
144
  return /*#__PURE__*/React.createElement(ComposedComponent, Object.assign({
150
145
  ref: ref
151
146
  }, props, {
152
147
  makeStyles: makeStyleHandler,
153
- styles: styles // passing themeOverrides is needed for components like Button
148
+ styles: styles
149
+ // passing themeOverrides is needed for components like Button
154
150
  // that have no makeStyles of their own and only pass themeOverrides
155
151
  // to the underlying component (e.g.: BaseButton)
156
152
  ,
157
153
  themeOverride: themeOverride
158
154
  }));
159
155
  });
160
- hoistNonReactStatics(WithStyle, ComposedComponent); // we have to pass these on, because sometimes users
156
+ hoistNonReactStatics(WithStyle, ComposedComponent);
157
+
158
+ // we have to pass these on, because sometimes users
161
159
  // access propTypes of the component in other components
162
160
  // eslint-disable-next-line react/forbid-foreign-prop-types
163
-
164
161
  WithStyle.propTypes = ComposedComponent.propTypes;
165
- WithStyle.defaultProps = ComposedComponent.defaultProps; // These static fields exist on InstUI components
162
+ WithStyle.defaultProps = ComposedComponent.defaultProps;
166
163
 
167
- WithStyle.allowedProps = ComposedComponent.allowedProps; // we are exposing the theme generator for the docs generation
164
+ // These static fields exist on InstUI components
165
+ WithStyle.allowedProps = ComposedComponent.allowedProps;
168
166
 
169
- WithStyle.generateComponentTheme = generateComponentTheme; // we have to add defaults to makeStyles and styles added by this decorator
170
- // eslint-disable-next-line no-param-reassign
167
+ // we are exposing the theme generator for the docs generation
168
+ WithStyle.generateComponentTheme = generateComponentTheme;
171
169
 
172
- ComposedComponent.defaultProps = { ...ComposedComponent.defaultProps,
170
+ // we have to add defaults to makeStyles and styles added by this decorator
171
+ // eslint-disable-next-line no-param-reassign
172
+ ComposedComponent.defaultProps = {
173
+ ...ComposedComponent.defaultProps,
173
174
  makeStyles: defaultValues.makeStyles,
174
175
  styles: defaultValues.styles
175
176
  };
176
-
177
177
  if (process.env.NODE_ENV !== 'production') {
178
178
  WithStyle.displayName = `WithStyle(${displayName})`;
179
179
  }
180
-
181
180
  return WithStyle;
182
181
  });
183
182
  export default withStyle;
@@ -1,19 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.EmotionThemeProvider = EmotionThemeProvider;
9
8
  exports.default = void 0;
10
-
11
9
  var _react = _interopRequireDefault(require("react"));
12
-
13
10
  var _react2 = require("@emotion/react");
14
-
15
11
  var _getTheme = require("../getTheme");
16
-
17
12
  /*
18
13
  * The MIT License (MIT)
19
14
  *
@@ -46,13 +41,12 @@ var _getTheme = require("../getTheme");
46
41
  */
47
42
  function EmotionThemeProvider(_ref) {
48
43
  let children = _ref.children,
49
- _ref$theme = _ref.theme,
50
- theme = _ref$theme === void 0 ? {} : _ref$theme;
44
+ _ref$theme = _ref.theme,
45
+ theme = _ref$theme === void 0 ? {} : _ref$theme;
51
46
  return /*#__PURE__*/_react.default.createElement(_react2.ThemeProvider, {
52
47
  theme: (0, _getTheme.getTheme)(theme)
53
48
  }, children);
54
49
  }
55
-
56
50
  EmotionThemeProvider.defaultProps = {
57
51
  theme: {}
58
52
  };