@instructure/emotion 8.56.0 → 8.56.2-pr-snapshot-1721749364069
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,6 +3,22 @@
|
|
|
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.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/emotion
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @instructure/emotion
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [8.56.0](https://github.com/instructure/instructure-ui/compare/v8.55.1...v8.56.0) (2024-05-06)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @instructure/emotion
|
|
@@ -10,9 +10,8 @@ exports.default = void 0;
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
13
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
14
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
16
15
|
var _getTheme = require("../getTheme");
|
|
17
16
|
/*
|
|
18
17
|
* The MIT License (MIT)
|
|
@@ -51,17 +50,17 @@ function InstUISettingsProvider({
|
|
|
51
50
|
instanceCounterMap,
|
|
52
51
|
as
|
|
53
52
|
}) {
|
|
54
|
-
const finalDir = dir || (0, _react.useContext)(
|
|
53
|
+
const finalDir = dir || (0, _react.useContext)(_uiI18n.TextDirectionContext);
|
|
55
54
|
if (process.env.NODE_ENV !== 'production' && finalDir === 'auto') {}
|
|
56
|
-
let providers = /*#__PURE__*/_react.default.createElement(
|
|
55
|
+
let providers = /*#__PURE__*/_react.default.createElement(_uiReactUtils.DeterministicIdContextProvider, {
|
|
57
56
|
instanceCounterMap: instanceCounterMap
|
|
58
57
|
}, /*#__PURE__*/_react.default.createElement(_react2.ThemeProvider, {
|
|
59
58
|
theme: (0, _getTheme.getTheme)(theme)
|
|
60
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(_uiI18n.TextDirectionContext.Provider, {
|
|
61
60
|
value: finalDir
|
|
62
61
|
}, children)));
|
|
63
62
|
if (dir) {
|
|
64
|
-
const Element = (0,
|
|
63
|
+
const Element = (0, _uiReactUtils.getElementType)(InstUISettingsProvider, {
|
|
65
64
|
as
|
|
66
65
|
});
|
|
67
66
|
providers = /*#__PURE__*/_react.default.createElement(Element, {
|
package/lib/getTheme.js
CHANGED
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getTheme = exports.default = void 0;
|
|
7
7
|
var _uiThemes = require("@instructure/ui-themes");
|
|
8
8
|
var _themeRegistry = require("@instructure/theme-registry");
|
|
9
|
-
var
|
|
10
|
-
var _mergeDeep = require("@instructure/ui-utils/lib/mergeDeep.js");
|
|
9
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
11
10
|
/*
|
|
12
11
|
* The MIT License (MIT)
|
|
13
12
|
*
|
|
@@ -50,7 +49,7 @@ const getTheme = themeOrOverride => (ancestorTheme = {}) => {
|
|
|
50
49
|
var _themeOrOverride, _themeOrOverride$them;
|
|
51
50
|
try {
|
|
52
51
|
// If a valid InstUI theme is given, it just returns the theme.
|
|
53
|
-
if ((0,
|
|
52
|
+
if ((0, _uiUtils.isBaseTheme)(themeOrOverride)) {
|
|
54
53
|
return themeOrOverride;
|
|
55
54
|
}
|
|
56
55
|
} catch {
|
|
@@ -75,7 +74,7 @@ const getTheme = themeOrOverride => (ancestorTheme = {}) => {
|
|
|
75
74
|
|
|
76
75
|
// we pick the overrides for the current theme from the override object
|
|
77
76
|
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
|
-
return (0,
|
|
77
|
+
return (0, _uiUtils.mergeDeep)(currentTheme, themeOrOverride, currentThemeOverrides);
|
|
79
78
|
};
|
|
80
79
|
exports.getTheme = getTheme;
|
|
81
80
|
var _default = exports.default = getTheme;
|
|
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.getShorthandPropValue = getShorthandPropValue;
|
|
8
|
-
var
|
|
9
|
-
var _camelize = require("@instructure/ui-utils/lib/camelize.js");
|
|
8
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
10
9
|
var _console = require("@instructure/console");
|
|
11
10
|
/*
|
|
12
11
|
* The MIT License (MIT)
|
|
@@ -49,7 +48,7 @@ var _console = require("@instructure/console");
|
|
|
49
48
|
* @returns {String} a string with each value replaced with a value from the theme object
|
|
50
49
|
*/
|
|
51
50
|
function getShorthandPropValue(componentName, componentTheme, propValue, propName) {
|
|
52
|
-
if (typeof propValue !== 'string' || (0,
|
|
51
|
+
if (typeof propValue !== 'string' || (0, _uiUtils.isEmpty)(componentTheme)) {
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
54
|
return propValue.split(' ').map(shortHandValue => {
|
|
@@ -65,7 +64,7 @@ function getShorthandPropValue(componentName, componentTheme, propValue, propNam
|
|
|
65
64
|
if (shortHandValue === 'pill') {
|
|
66
65
|
return '999em';
|
|
67
66
|
}
|
|
68
|
-
const themeVariableName = (0,
|
|
67
|
+
const themeVariableName = (0, _uiUtils.camelize)(`${propName}-${shortHandValue}`);
|
|
69
68
|
const themeVariableValue = componentTheme[themeVariableName];
|
|
70
69
|
(0, _console.logError)(typeof themeVariableValue !== 'undefined', `[${componentName}] '${themeVariableName}' is an invalid '${propName}' value.`);
|
|
71
70
|
return themeVariableValue || '0';
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.makeThemeVars = makeThemeVars;
|
|
8
|
-
var
|
|
8
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
11
11
|
*
|
|
@@ -44,7 +44,7 @@ var _camelize = require("@instructure/ui-utils/lib/camelize.js");
|
|
|
44
44
|
function makeThemeVars(prefix, vars) {
|
|
45
45
|
const themeVars = {};
|
|
46
46
|
Object.keys(vars).forEach(variable => {
|
|
47
|
-
themeVars[(0,
|
|
47
|
+
themeVars[(0, _uiUtils.camelize)(`${prefix}-${String(variable)}`)] = vars[variable];
|
|
48
48
|
});
|
|
49
49
|
return themeVars;
|
|
50
50
|
}
|
package/lib/useTheme.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useTheme = exports.default = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _uiThemes = require("@instructure/ui-themes");
|
|
9
|
-
var
|
|
9
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
10
10
|
var _themeRegistry = require("@instructure/theme-registry");
|
|
11
11
|
/*
|
|
12
12
|
* The MIT License (MIT)
|
|
@@ -43,7 +43,7 @@ var _themeRegistry = require("@instructure/theme-registry");
|
|
|
43
43
|
*/
|
|
44
44
|
const useTheme = () => {
|
|
45
45
|
let theme = (0, _react.useTheme)();
|
|
46
|
-
if ((0,
|
|
46
|
+
if ((0, _uiUtils.isEmpty)(theme)) {
|
|
47
47
|
const globalTheme = _themeRegistry.ThemeRegistry.getCurrentTheme();
|
|
48
48
|
if (globalTheme) {
|
|
49
49
|
return globalTheme;
|
package/lib/withStyle.js
CHANGED
|
@@ -9,9 +9,9 @@ exports.withStyle = exports.default = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
|
12
|
-
var
|
|
12
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
13
13
|
var _console = require("@instructure/console");
|
|
14
|
-
var
|
|
14
|
+
var _uiDecorator = require("@instructure/ui-decorator");
|
|
15
15
|
var _getComponentThemeOverride = require("./getComponentThemeOverride");
|
|
16
16
|
var _useTheme = require("./useTheme");
|
|
17
17
|
/*
|
|
@@ -118,7 +118,7 @@ const defaultValues = {
|
|
|
118
118
|
* @param {function} generateComponentTheme - The function that returns the component's theme variables object
|
|
119
119
|
* @returns {ReactElement} The decorated WithStyle Component
|
|
120
120
|
*/
|
|
121
|
-
const withStyle = exports.withStyle = (0,
|
|
121
|
+
const withStyle = exports.withStyle = (0, _uiDecorator.decorator)((ComposedComponent, generateStyle, generateComponentTheme) => {
|
|
122
122
|
const displayName = ComposedComponent.displayName || ComposedComponent.name;
|
|
123
123
|
const WithStyle = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
124
124
|
const theme = (0, _useTheme.useTheme)();
|
|
@@ -145,7 +145,7 @@ const withStyle = exports.withStyle = (0, _decorator.decorator)((ComposedCompone
|
|
|
145
145
|
setStyles = _useState2[1];
|
|
146
146
|
const makeStyleHandler = extraArgs => {
|
|
147
147
|
const calculatedStyles = generateStyle(componentTheme, componentProps, extraArgs);
|
|
148
|
-
if (!(0,
|
|
148
|
+
if (!(0, _uiUtils.deepEqual)(calculatedStyles, styles)) {
|
|
149
149
|
setStyles(calculatedStyles);
|
|
150
150
|
}
|
|
151
151
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/emotion",
|
|
3
|
-
"version": "8.56.
|
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.23.2",
|
|
27
27
|
"@emotion/react": "^11.11.1",
|
|
28
|
-
"@instructure/console": "8.56.
|
|
29
|
-
"@instructure/shared-types": "8.56.
|
|
30
|
-
"@instructure/theme-registry": "8.56.
|
|
31
|
-
"@instructure/ui-decorator": "8.56.
|
|
32
|
-
"@instructure/ui-i18n": "8.56.
|
|
33
|
-
"@instructure/ui-react-utils": "8.56.
|
|
34
|
-
"@instructure/ui-themes": "8.56.
|
|
35
|
-
"@instructure/ui-utils": "8.56.
|
|
28
|
+
"@instructure/console": "8.56.2-pr-snapshot-1721749364069",
|
|
29
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
|
30
|
+
"@instructure/theme-registry": "8.56.2-pr-snapshot-1721749364069",
|
|
31
|
+
"@instructure/ui-decorator": "8.56.2-pr-snapshot-1721749364069",
|
|
32
|
+
"@instructure/ui-i18n": "8.56.2-pr-snapshot-1721749364069",
|
|
33
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
34
|
+
"@instructure/ui-themes": "8.56.2-pr-snapshot-1721749364069",
|
|
35
|
+
"@instructure/ui-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
36
36
|
"hoist-non-react-statics": "^3.3.2",
|
|
37
37
|
"prop-types": "^15.8.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@instructure/ui-babel-preset": "8.56.
|
|
41
|
-
"@instructure/ui-test-utils": "8.56.
|
|
40
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
|
41
|
+
"@instructure/ui-test-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
42
42
|
"react-dom": "^18.2.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|