@instructure/emotion 10.26.1 → 11.0.1-snapshot-0
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 +30 -1
- package/es/InstUISettingsProvider/index.js +3 -15
- package/es/getTheme.js +2 -4
- package/es/index.js +1 -1
- package/es/styleUtils/index.js +0 -1
- package/es/useTheme.js +1 -7
- package/es/withStyle.js +1 -7
- package/lib/InstUISettingsProvider/index.js +3 -16
- package/lib/getTheme.js +2 -4
- package/lib/index.js +0 -7
- package/lib/styleUtils/index.js +0 -7
- package/lib/useTheme.js +1 -7
- package/lib/withStyle.js +1 -7
- package/package.json +13 -15
- package/src/InstUISettingsProvider/index.tsx +11 -46
- package/src/getTheme.ts +2 -5
- package/src/index.ts +0 -1
- package/src/styleUtils/index.ts +0 -1
- package/src/useTheme.ts +1 -9
- package/src/withStyle.tsx +2 -6
- package/tsconfig.build.json +0 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/InstUISettingsProvider/index.d.ts +3 -29
- package/types/InstUISettingsProvider/index.d.ts.map +1 -1
- package/types/getTheme.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/styleUtils/index.d.ts +0 -1
- package/types/styleUtils/index.d.ts.map +1 -1
- package/types/useTheme.d.ts +1 -2
- package/types/useTheme.d.ts.map +1 -1
- package/types/withStyle.d.ts +1 -1
- package/types/withStyle.d.ts.map +1 -1
- package/es/styleUtils/ThemeablePropTypes.js +0 -74
- package/lib/styleUtils/ThemeablePropTypes.js +0 -81
- package/src/styleUtils/ThemeablePropTypes.ts +0 -121
- package/types/styleUtils/ThemeablePropTypes.d.ts +0 -22
- package/types/styleUtils/ThemeablePropTypes.d.ts.map +0 -1
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
|
-
## [
|
|
6
|
+
## [11.0.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v11.0.0...v11.0.1-snapshot-0) (2025-10-07)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/emotion
|
|
9
9
|
|
|
@@ -11,6 +11,35 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
# [11.0.0](https://github.com/instructure/instructure-ui/compare/v10.26.0...v11.0.0) (2025-10-06)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* **many:** InstUI v11 contains the following breaking changes:
|
|
25
|
+
- React 16 and 17 are no longer supported
|
|
26
|
+
- remove `PropTypes` from all packages
|
|
27
|
+
- remove `CodeEditor` component
|
|
28
|
+
- remove `@instui/theme-registry` package
|
|
29
|
+
- remove `@testable`, `@experimental`, `@hack` decorators
|
|
30
|
+
- InstUISettingsProvider's `as` prop is removed
|
|
31
|
+
- `canvas.use()`, `canvasHighContrast.use()` functions are removed
|
|
32
|
+
- `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
|
|
33
|
+
- `variables` field on theme objects are removed
|
|
34
|
+
- remove deprecated props from Table: Row's `isStacked`, Body's
|
|
35
|
+
`isStacked`, `hover`, and `headers`
|
|
36
|
+
- `Table`'s `caption` prop is now required
|
|
37
|
+
- `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
14
43
|
# [10.26.0](https://github.com/instructure/instructure-ui/compare/v10.25.0...v10.26.0) (2025-10-01)
|
|
15
44
|
|
|
16
45
|
**Note:** Version bump only for package @instructure/emotion
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { useContext } from 'react';
|
|
26
|
-
import PropTypes from 'prop-types';
|
|
27
26
|
import { ThemeProvider } from '@emotion/react';
|
|
28
27
|
import { TextDirectionContext } from '@instructure/ui-i18n';
|
|
29
28
|
import { DeterministicIdContextProvider } from '@instructure/ui-react-utils';
|
|
@@ -39,8 +38,7 @@ function InstUISettingsProvider({
|
|
|
39
38
|
children,
|
|
40
39
|
theme = {},
|
|
41
40
|
dir,
|
|
42
|
-
instanceCounterMap
|
|
43
|
-
as
|
|
41
|
+
instanceCounterMap
|
|
44
42
|
}) {
|
|
45
43
|
const finalDir = dir || useContext(TextDirectionContext);
|
|
46
44
|
if (process.env.NODE_ENV !== 'production' && finalDir === 'auto') {}
|
|
@@ -55,22 +53,12 @@ function InstUISettingsProvider({
|
|
|
55
53
|
})
|
|
56
54
|
});
|
|
57
55
|
if (dir) {
|
|
58
|
-
|
|
59
|
-
providers = _jsx(Element, {
|
|
56
|
+
providers = _jsx("span", {
|
|
60
57
|
dir: finalDir,
|
|
61
58
|
children: providers
|
|
62
59
|
});
|
|
63
|
-
}
|
|
60
|
+
}
|
|
64
61
|
return providers;
|
|
65
62
|
}
|
|
66
|
-
InstUISettingsProvider.propTypes = {
|
|
67
|
-
/* eslint-disable react/require-default-props */
|
|
68
|
-
children: PropTypes.node,
|
|
69
|
-
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
|
70
|
-
dir: PropTypes.oneOf(['ltr', 'rtl']),
|
|
71
|
-
instanceCounterMap: PropTypes.instanceOf(Map),
|
|
72
|
-
as: PropTypes.string
|
|
73
|
-
/* eslint-enable react/require-default-props */
|
|
74
|
-
};
|
|
75
63
|
export default InstUISettingsProvider;
|
|
76
64
|
export { InstUISettingsProvider };
|
package/es/getTheme.js
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import canvas from '@instructure/ui-themes';
|
|
25
|
-
import { ThemeRegistry } from '@instructure/theme-registry';
|
|
26
25
|
import { isBaseTheme, mergeDeep } from '@instructure/ui-utils';
|
|
27
26
|
/**
|
|
28
27
|
* ---
|
|
@@ -45,9 +44,8 @@ const getTheme = themeOrOverride => (ancestorTheme = {}) => {
|
|
|
45
44
|
// we need to clone the ancestor theme not to override it
|
|
46
45
|
let currentTheme;
|
|
47
46
|
if (Object.keys(ancestorTheme).length === 0) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
currentTheme = globalTheme || canvas;
|
|
47
|
+
if (process.env.NODE_ENV !== 'production') {}
|
|
48
|
+
currentTheme = canvas;
|
|
51
49
|
} else {
|
|
52
50
|
currentTheme = ancestorTheme;
|
|
53
51
|
}
|
package/es/index.js
CHANGED
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
export * from '@emotion/react';
|
|
27
27
|
export { InstUISettingsProvider } from './InstUISettingsProvider';
|
|
28
28
|
export { withStyle } from './withStyle';
|
|
29
|
-
export { ThemeablePropValues,
|
|
29
|
+
export { ThemeablePropValues, makeThemeVars, getShorthandPropValue, mirrorShorthandCorners, mirrorShorthandEdges, mapSpacingToShorthand } from './styleUtils';
|
|
30
30
|
export { useStyle } from './useStyle';
|
package/es/styleUtils/index.js
CHANGED
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
export { ThemeablePropValues } from './ThemeablePropValues';
|
|
26
|
-
export { ThemeablePropTypes } from './ThemeablePropTypes';
|
|
27
26
|
export { makeThemeVars } from './makeThemeVars';
|
|
28
27
|
export { getShorthandPropValue } from './getShorthandPropValue';
|
|
29
28
|
export { mirrorShorthandCorners } from './mirrorShorthandCorners';
|
package/es/useTheme.js
CHANGED
|
@@ -25,24 +25,18 @@
|
|
|
25
25
|
import { useTheme as useEmotionTheme } from '@emotion/react';
|
|
26
26
|
import canvas from '@instructure/ui-themes';
|
|
27
27
|
import { isEmpty } from '@instructure/ui-utils';
|
|
28
|
-
import { ThemeRegistry } from '@instructure/theme-registry';
|
|
29
28
|
/**
|
|
30
29
|
* ---
|
|
31
30
|
* private: true
|
|
32
31
|
* ---
|
|
33
32
|
* A hook that will return the currently applied theme object from the nearest Context.
|
|
34
|
-
* If there is no
|
|
35
|
-
* If there is no theme provided to the Context and ThemeRegistry it will return the default `canvas` theme.
|
|
33
|
+
* If there is no theme provided to the Context, it will return the default `canvas` theme.
|
|
36
34
|
* @returns The theme object
|
|
37
35
|
*/
|
|
38
36
|
const useTheme = () => {
|
|
39
37
|
// This reads the theme from Emotion's ThemeContext
|
|
40
38
|
let theme = useEmotionTheme();
|
|
41
39
|
if (isEmpty(theme)) {
|
|
42
|
-
const globalTheme = ThemeRegistry.getCurrentTheme();
|
|
43
|
-
if (globalTheme) {
|
|
44
|
-
return globalTheme;
|
|
45
|
-
}
|
|
46
40
|
if (process.env.NODE_ENV !== 'production') {}
|
|
47
41
|
theme = canvas;
|
|
48
42
|
}
|
package/es/withStyle.js
CHANGED
|
@@ -69,7 +69,7 @@ const defaultValues = {
|
|
|
69
69
|
* [InstUISettingsProvider](#InstUISettingsProvider) component, and/or set
|
|
70
70
|
* explicitly via its `themeOverride` prop.
|
|
71
71
|
*
|
|
72
|
-
* InstUISettingsProvider provides a theme object
|
|
72
|
+
* InstUISettingsProvider provides a theme object (e.g. the [canvas theme](/#canvas)).
|
|
73
73
|
* These variables are mapped to the component's own variables in `theme.js` (see [theming](#theming-basics) for more info).
|
|
74
74
|
*
|
|
75
75
|
* With the `themeOverride` prop you can directly set/override the component theme variables declared in theme.js. It accepts an object or a function. The function has the component's theme and the currently active main theme as its parameter.
|
|
@@ -164,13 +164,7 @@ const withStyle = decorator((ComposedComponent, generateStyle, generateComponent
|
|
|
164
164
|
// added so it can be tested with ReactTestUtils
|
|
165
165
|
// more info: https://github.com/facebook/react/issues/13455
|
|
166
166
|
WithStyle.originalType = ComposedComponent.originalType || ComposedComponent;
|
|
167
|
-
|
|
168
|
-
// we have to pass these on, because sometimes users
|
|
169
|
-
// access propTypes of the component in other components
|
|
170
|
-
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
171
|
-
WithStyle.propTypes = ComposedComponent.propTypes;
|
|
172
167
|
WithStyle.defaultProps = ComposedComponent.defaultProps;
|
|
173
|
-
|
|
174
168
|
// These static fields exist on InstUI components
|
|
175
169
|
WithStyle.allowedProps = ComposedComponent.allowedProps;
|
|
176
170
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.InstUISettingsProvider = InstUISettingsProvider;
|
|
8
7
|
exports.default = void 0;
|
|
9
8
|
var _react = require("react");
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
9
|
var _react2 = require("@emotion/react");
|
|
12
10
|
var _TextDirectionContext = require("@instructure/ui-i18n/lib/TextDirectionContext.js");
|
|
13
11
|
var _DeterministicIdContextProvider = require("@instructure/ui-react-utils/lib/DeterministicIdContext/DeterministicIdContextProvider.js");
|
|
@@ -47,8 +45,7 @@ function InstUISettingsProvider({
|
|
|
47
45
|
children,
|
|
48
46
|
theme = {},
|
|
49
47
|
dir,
|
|
50
|
-
instanceCounterMap
|
|
51
|
-
as
|
|
48
|
+
instanceCounterMap
|
|
52
49
|
}) {
|
|
53
50
|
const finalDir = dir || (0, _react.useContext)(_TextDirectionContext.TextDirectionContext);
|
|
54
51
|
if (process.env.NODE_ENV !== 'production' && finalDir === 'auto') {}
|
|
@@ -63,21 +60,11 @@ function InstUISettingsProvider({
|
|
|
63
60
|
})
|
|
64
61
|
});
|
|
65
62
|
if (dir) {
|
|
66
|
-
|
|
67
|
-
providers = (0, _jsxRuntime.jsx)(Element, {
|
|
63
|
+
providers = (0, _jsxRuntime.jsx)("span", {
|
|
68
64
|
dir: finalDir,
|
|
69
65
|
children: providers
|
|
70
66
|
});
|
|
71
|
-
}
|
|
67
|
+
}
|
|
72
68
|
return providers;
|
|
73
69
|
}
|
|
74
|
-
InstUISettingsProvider.propTypes = {
|
|
75
|
-
/* eslint-disable react/require-default-props */
|
|
76
|
-
children: _propTypes.default.node,
|
|
77
|
-
theme: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.func]),
|
|
78
|
-
dir: _propTypes.default.oneOf(['ltr', 'rtl']),
|
|
79
|
-
instanceCounterMap: _propTypes.default.instanceOf(Map),
|
|
80
|
-
as: _propTypes.default.string
|
|
81
|
-
/* eslint-enable react/require-default-props */
|
|
82
|
-
};
|
|
83
70
|
var _default = exports.default = InstUISettingsProvider;
|
package/lib/getTheme.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getTheme = exports.default = void 0;
|
|
8
8
|
var _uiThemes = _interopRequireDefault(require("@instructure/ui-themes"));
|
|
9
|
-
var _themeRegistry = require("@instructure/theme-registry");
|
|
10
9
|
var _isBaseTheme = require("@instructure/ui-utils/lib/isBaseTheme.js");
|
|
11
10
|
var _mergeDeep = require("@instructure/ui-utils/lib/mergeDeep.js");
|
|
12
11
|
/*
|
|
@@ -54,9 +53,8 @@ const getTheme = themeOrOverride => (ancestorTheme = {}) => {
|
|
|
54
53
|
// we need to clone the ancestor theme not to override it
|
|
55
54
|
let currentTheme;
|
|
56
55
|
if (Object.keys(ancestorTheme).length === 0) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
currentTheme = globalTheme || _uiThemes.default;
|
|
56
|
+
if (process.env.NODE_ENV !== 'production') {}
|
|
57
|
+
currentTheme = _uiThemes.default;
|
|
60
58
|
} else {
|
|
61
59
|
currentTheme = ancestorTheme;
|
|
62
60
|
}
|
package/lib/index.js
CHANGED
|
@@ -7,7 +7,6 @@ var _exportNames = {
|
|
|
7
7
|
InstUISettingsProvider: true,
|
|
8
8
|
withStyle: true,
|
|
9
9
|
ThemeablePropValues: true,
|
|
10
|
-
ThemeablePropTypes: true,
|
|
11
10
|
makeThemeVars: true,
|
|
12
11
|
getShorthandPropValue: true,
|
|
13
12
|
mirrorShorthandCorners: true,
|
|
@@ -21,12 +20,6 @@ Object.defineProperty(exports, "InstUISettingsProvider", {
|
|
|
21
20
|
return _InstUISettingsProvider.InstUISettingsProvider;
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
|
-
Object.defineProperty(exports, "ThemeablePropTypes", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _styleUtils.ThemeablePropTypes;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
23
|
Object.defineProperty(exports, "ThemeablePropValues", {
|
|
31
24
|
enumerable: true,
|
|
32
25
|
get: function () {
|
package/lib/styleUtils/index.js
CHANGED
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "ThemeablePropTypes", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _ThemeablePropTypes.ThemeablePropTypes;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
Object.defineProperty(exports, "ThemeablePropValues", {
|
|
13
7
|
enumerable: true,
|
|
14
8
|
get: function () {
|
|
@@ -46,7 +40,6 @@ Object.defineProperty(exports, "mirrorShorthandEdges", {
|
|
|
46
40
|
}
|
|
47
41
|
});
|
|
48
42
|
var _ThemeablePropValues = require("./ThemeablePropValues");
|
|
49
|
-
var _ThemeablePropTypes = require("./ThemeablePropTypes");
|
|
50
43
|
var _makeThemeVars = require("./makeThemeVars");
|
|
51
44
|
var _getShorthandPropValue = require("./getShorthandPropValue");
|
|
52
45
|
var _mirrorShorthandCorners = require("./mirrorShorthandCorners");
|
package/lib/useTheme.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.useTheme = exports.default = void 0;
|
|
|
8
8
|
var _react = require("@emotion/react");
|
|
9
9
|
var _uiThemes = _interopRequireDefault(require("@instructure/ui-themes"));
|
|
10
10
|
var _isEmpty = require("@instructure/ui-utils/lib/isEmpty.js");
|
|
11
|
-
var _themeRegistry = require("@instructure/theme-registry");
|
|
12
11
|
/*
|
|
13
12
|
* The MIT License (MIT)
|
|
14
13
|
*
|
|
@@ -38,18 +37,13 @@ var _themeRegistry = require("@instructure/theme-registry");
|
|
|
38
37
|
* private: true
|
|
39
38
|
* ---
|
|
40
39
|
* A hook that will return the currently applied theme object from the nearest Context.
|
|
41
|
-
* If there is no
|
|
42
|
-
* If there is no theme provided to the Context and ThemeRegistry it will return the default `canvas` theme.
|
|
40
|
+
* If there is no theme provided to the Context, it will return the default `canvas` theme.
|
|
43
41
|
* @returns The theme object
|
|
44
42
|
*/
|
|
45
43
|
const useTheme = () => {
|
|
46
44
|
// This reads the theme from Emotion's ThemeContext
|
|
47
45
|
let theme = (0, _react.useTheme)();
|
|
48
46
|
if ((0, _isEmpty.isEmpty)(theme)) {
|
|
49
|
-
const globalTheme = _themeRegistry.ThemeRegistry.getCurrentTheme();
|
|
50
|
-
if (globalTheme) {
|
|
51
|
-
return globalTheme;
|
|
52
|
-
}
|
|
53
47
|
if (process.env.NODE_ENV !== 'production') {}
|
|
54
48
|
theme = _uiThemes.default;
|
|
55
49
|
}
|
package/lib/withStyle.js
CHANGED
|
@@ -76,7 +76,7 @@ const defaultValues = {
|
|
|
76
76
|
* [InstUISettingsProvider](#InstUISettingsProvider) component, and/or set
|
|
77
77
|
* explicitly via its `themeOverride` prop.
|
|
78
78
|
*
|
|
79
|
-
* InstUISettingsProvider provides a theme object
|
|
79
|
+
* InstUISettingsProvider provides a theme object (e.g. the [canvas theme](/#canvas)).
|
|
80
80
|
* These variables are mapped to the component's own variables in `theme.js` (see [theming](#theming-basics) for more info).
|
|
81
81
|
*
|
|
82
82
|
* With the `themeOverride` prop you can directly set/override the component theme variables declared in theme.js. It accepts an object or a function. The function has the component's theme and the currently active main theme as its parameter.
|
|
@@ -171,13 +171,7 @@ const withStyle = exports.withStyle = (0, _decorator.decorator)((ComposedCompone
|
|
|
171
171
|
// added so it can be tested with ReactTestUtils
|
|
172
172
|
// more info: https://github.com/facebook/react/issues/13455
|
|
173
173
|
WithStyle.originalType = ComposedComponent.originalType || ComposedComponent;
|
|
174
|
-
|
|
175
|
-
// we have to pass these on, because sometimes users
|
|
176
|
-
// access propTypes of the component in other components
|
|
177
|
-
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
178
|
-
WithStyle.propTypes = ComposedComponent.propTypes;
|
|
179
174
|
WithStyle.defaultProps = ComposedComponent.defaultProps;
|
|
180
|
-
|
|
181
175
|
// These static fields exist on InstUI components
|
|
182
176
|
WithStyle.allowedProps = ComposedComponent.allowedProps;
|
|
183
177
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/emotion",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.1-snapshot-0",
|
|
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,27 +25,25 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.27.6",
|
|
27
27
|
"@emotion/react": "^11",
|
|
28
|
-
"@instructure/console": "
|
|
29
|
-
"@instructure/shared-types": "
|
|
30
|
-
"@instructure/
|
|
31
|
-
"@instructure/ui-
|
|
32
|
-
"@instructure/ui-
|
|
33
|
-
"@instructure/ui-
|
|
34
|
-
"@instructure/ui-
|
|
35
|
-
"
|
|
36
|
-
"hoist-non-react-statics": "^3.3.2",
|
|
37
|
-
"prop-types": "^15.8.1"
|
|
28
|
+
"@instructure/console": "11.0.1-snapshot-0",
|
|
29
|
+
"@instructure/shared-types": "11.0.1-snapshot-0",
|
|
30
|
+
"@instructure/ui-decorator": "11.0.1-snapshot-0",
|
|
31
|
+
"@instructure/ui-i18n": "11.0.1-snapshot-0",
|
|
32
|
+
"@instructure/ui-react-utils": "11.0.1-snapshot-0",
|
|
33
|
+
"@instructure/ui-themes": "11.0.1-snapshot-0",
|
|
34
|
+
"@instructure/ui-utils": "11.0.1-snapshot-0",
|
|
35
|
+
"hoist-non-react-statics": "^3.3.2"
|
|
38
36
|
},
|
|
39
37
|
"devDependencies": {
|
|
40
|
-
"@instructure/ui-babel-preset": "
|
|
38
|
+
"@instructure/ui-babel-preset": "11.0.1-snapshot-0",
|
|
41
39
|
"@testing-library/jest-dom": "^6.6.3",
|
|
42
|
-
"@testing-library/react": "
|
|
40
|
+
"@testing-library/react": "15.0.7",
|
|
43
41
|
"@testing-library/user-event": "^14.6.1",
|
|
44
|
-
"react-dom": "
|
|
42
|
+
"react-dom": "18.3.1",
|
|
45
43
|
"vitest": "^3.2.2"
|
|
46
44
|
},
|
|
47
45
|
"peerDependencies": {
|
|
48
|
-
"react": ">=
|
|
46
|
+
"react": ">=18 <=19"
|
|
49
47
|
},
|
|
50
48
|
"publishConfig": {
|
|
51
49
|
"access": "public"
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { useContext } from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
import { ThemeProvider } from '@emotion/react'
|
|
28
27
|
|
|
29
28
|
import { TextDirectionContext } from '@instructure/ui-i18n'
|
|
@@ -33,7 +32,6 @@ import { getTheme } from '../getTheme'
|
|
|
33
32
|
|
|
34
33
|
import type { ThemeOrOverride } from '../EmotionTypes'
|
|
35
34
|
import type { DeterministicIdProviderValue } from '@instructure/ui-react-utils'
|
|
36
|
-
import type { AsElementType } from '@instructure/shared-types'
|
|
37
35
|
|
|
38
36
|
type InstUIProviderProps = {
|
|
39
37
|
children?: React.ReactNode
|
|
@@ -51,32 +49,15 @@ type InstUIProviderProps = {
|
|
|
51
49
|
* specific InstUI components. (generally this is used for deterministic id generation for [SSR](/#server-side-rendering))
|
|
52
50
|
*/
|
|
53
51
|
instanceCounterMap?: DeterministicIdProviderValue
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @deprecated This prop will be removed in InstUI v11
|
|
65
|
-
*
|
|
66
|
-
* The element type to render as
|
|
67
|
-
*/
|
|
68
|
-
as?: AsElementType
|
|
69
|
-
}
|
|
70
|
-
| {
|
|
71
|
-
dir?: never
|
|
72
|
-
/**
|
|
73
|
-
* @deprecated This prop will be removed in InstUI v11
|
|
74
|
-
*
|
|
75
|
-
* The element type to render as
|
|
76
|
-
*/
|
|
77
|
-
as?: never
|
|
78
|
-
}
|
|
79
|
-
)
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The text direction to use in the descendants. If not provided, it uses the following in this priority order:
|
|
55
|
+
* - The value given in a parent `TextDirectionContext`
|
|
56
|
+
* - The `dir` prop of `document.documentElement` or its `direction` CSS prop
|
|
57
|
+
* - The default `ltr`
|
|
58
|
+
*/
|
|
59
|
+
dir?: 'ltr' | 'rtl'
|
|
60
|
+
}
|
|
80
61
|
|
|
81
62
|
/**
|
|
82
63
|
* ---
|
|
@@ -88,8 +69,7 @@ function InstUISettingsProvider({
|
|
|
88
69
|
children,
|
|
89
70
|
theme = {},
|
|
90
71
|
dir,
|
|
91
|
-
instanceCounterMap
|
|
92
|
-
as
|
|
72
|
+
instanceCounterMap
|
|
93
73
|
}: InstUIProviderProps) {
|
|
94
74
|
const finalDir = dir || useContext(TextDirectionContext)
|
|
95
75
|
|
|
@@ -110,26 +90,11 @@ function InstUISettingsProvider({
|
|
|
110
90
|
)
|
|
111
91
|
|
|
112
92
|
if (dir) {
|
|
113
|
-
|
|
114
|
-
providers = <Element dir={finalDir}>{providers}</Element>
|
|
115
|
-
} else if (as && process.env.NODE_ENV !== 'production') {
|
|
116
|
-
console.warn(
|
|
117
|
-
"The 'as' property should be used in conjunction with the 'dir' property!"
|
|
118
|
-
)
|
|
93
|
+
providers = <span dir={finalDir}>{providers}</span>
|
|
119
94
|
}
|
|
120
95
|
|
|
121
96
|
return providers
|
|
122
97
|
}
|
|
123
98
|
|
|
124
|
-
InstUISettingsProvider.propTypes = {
|
|
125
|
-
/* eslint-disable react/require-default-props */
|
|
126
|
-
children: PropTypes.node,
|
|
127
|
-
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
|
128
|
-
dir: PropTypes.oneOf(['ltr', 'rtl']),
|
|
129
|
-
instanceCounterMap: PropTypes.instanceOf(Map),
|
|
130
|
-
as: PropTypes.string
|
|
131
|
-
/* eslint-enable react/require-default-props */
|
|
132
|
-
}
|
|
133
|
-
|
|
134
99
|
export default InstUISettingsProvider
|
|
135
100
|
export { InstUISettingsProvider }
|
package/src/getTheme.ts
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import canvas from '@instructure/ui-themes'
|
|
25
|
-
import { ThemeRegistry } from '@instructure/theme-registry'
|
|
26
25
|
import { isBaseTheme, mergeDeep } from '@instructure/ui-utils'
|
|
27
26
|
|
|
28
27
|
import type { BaseTheme } from '@instructure/shared-types'
|
|
@@ -55,14 +54,12 @@ const getTheme =
|
|
|
55
54
|
// we need to clone the ancestor theme not to override it
|
|
56
55
|
let currentTheme
|
|
57
56
|
if (Object.keys(ancestorTheme).length === 0) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (process.env.NODE_ENV !== 'production' && !globalTheme) {
|
|
57
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
61
58
|
console.warn(
|
|
62
59
|
'No theme provided for [InstUISettingsProvider], using default `canvas` theme.'
|
|
63
60
|
)
|
|
64
61
|
}
|
|
65
|
-
currentTheme =
|
|
62
|
+
currentTheme = canvas
|
|
66
63
|
} else {
|
|
67
64
|
currentTheme = ancestorTheme
|
|
68
65
|
}
|
package/src/index.ts
CHANGED
package/src/styleUtils/index.ts
CHANGED
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
export { ThemeablePropValues } from './ThemeablePropValues'
|
|
26
|
-
export { ThemeablePropTypes } from './ThemeablePropTypes'
|
|
27
26
|
export { makeThemeVars } from './makeThemeVars'
|
|
28
27
|
export { getShorthandPropValue } from './getShorthandPropValue'
|
|
29
28
|
export { mirrorShorthandCorners } from './mirrorShorthandCorners'
|
package/src/useTheme.ts
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
import { useTheme as useEmotionTheme } from '@emotion/react'
|
|
26
26
|
import canvas from '@instructure/ui-themes'
|
|
27
27
|
import { isEmpty } from '@instructure/ui-utils'
|
|
28
|
-
import { ThemeRegistry } from '@instructure/theme-registry'
|
|
29
28
|
|
|
30
29
|
import type { BaseThemeOrOverride } from './EmotionTypes'
|
|
31
30
|
|
|
@@ -34,20 +33,13 @@ import type { BaseThemeOrOverride } from './EmotionTypes'
|
|
|
34
33
|
* private: true
|
|
35
34
|
* ---
|
|
36
35
|
* A hook that will return the currently applied theme object from the nearest Context.
|
|
37
|
-
* If there is no
|
|
38
|
-
* If there is no theme provided to the Context and ThemeRegistry it will return the default `canvas` theme.
|
|
36
|
+
* If there is no theme provided to the Context, it will return the default `canvas` theme.
|
|
39
37
|
* @returns The theme object
|
|
40
38
|
*/
|
|
41
39
|
const useTheme = () => {
|
|
42
40
|
// This reads the theme from Emotion's ThemeContext
|
|
43
41
|
let theme = useEmotionTheme() as BaseThemeOrOverride
|
|
44
|
-
|
|
45
42
|
if (isEmpty(theme)) {
|
|
46
|
-
const globalTheme = ThemeRegistry.getCurrentTheme()
|
|
47
|
-
|
|
48
|
-
if (globalTheme) {
|
|
49
|
-
return globalTheme
|
|
50
|
-
}
|
|
51
43
|
if (process.env.NODE_ENV !== 'production') {
|
|
52
44
|
console.warn(
|
|
53
45
|
`No theme provided for [InstUISettingsProvider], using default <canvas> theme.`
|
package/src/withStyle.tsx
CHANGED
|
@@ -116,7 +116,7 @@ const defaultValues = {
|
|
|
116
116
|
* [InstUISettingsProvider](#InstUISettingsProvider) component, and/or set
|
|
117
117
|
* explicitly via its `themeOverride` prop.
|
|
118
118
|
*
|
|
119
|
-
* InstUISettingsProvider provides a theme object
|
|
119
|
+
* InstUISettingsProvider provides a theme object (e.g. the [canvas theme](/#canvas)).
|
|
120
120
|
* These variables are mapped to the component's own variables in `theme.js` (see [theming](#theming-basics) for more info).
|
|
121
121
|
*
|
|
122
122
|
* With the `themeOverride` prop you can directly set/override the component theme variables declared in theme.js. It accepts an object or a function. The function has the component's theme and the currently active main theme as its parameter.
|
|
@@ -177,6 +177,7 @@ const withStyle = decorator(
|
|
|
177
177
|
generateComponentTheme?: GenerateComponentTheme
|
|
178
178
|
allowedProps?: string[]
|
|
179
179
|
originalType?: WithStyleComponent
|
|
180
|
+
defaultProps?: Partial<any>
|
|
180
181
|
} = forwardRef((props, ref) => {
|
|
181
182
|
const theme = useTheme()
|
|
182
183
|
|
|
@@ -251,12 +252,7 @@ const withStyle = decorator(
|
|
|
251
252
|
// more info: https://github.com/facebook/react/issues/13455
|
|
252
253
|
WithStyle.originalType = ComposedComponent.originalType || ComposedComponent
|
|
253
254
|
|
|
254
|
-
// we have to pass these on, because sometimes users
|
|
255
|
-
// access propTypes of the component in other components
|
|
256
|
-
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
257
|
-
WithStyle.propTypes = ComposedComponent.propTypes
|
|
258
255
|
WithStyle.defaultProps = ComposedComponent.defaultProps
|
|
259
|
-
|
|
260
256
|
// These static fields exist on InstUI components
|
|
261
257
|
WithStyle.allowedProps = ComposedComponent.allowedProps
|
|
262
258
|
|