@instructure/emotion 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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 +13 -0
- package/es/EmotionTypes.js +1 -1
- package/es/InstUISettingsProvider/index.js +23 -65
- package/es/getComponentThemeOverride.js +20 -65
- package/es/getTheme.js +33 -81
- package/es/index.js +1 -26
- package/es/styleUtils/ThemeablePropValues.js +60 -117
- package/es/styleUtils/applyColorModifiers.js +31 -86
- package/es/styleUtils/calcFocusOutlineStyles.js +38 -67
- package/es/styleUtils/calcSpacingFromShorthand.js +35 -108
- package/es/styleUtils/getShorthandPropValue.js +22 -72
- package/es/styleUtils/index.js +1 -25
- package/es/styleUtils/makeThemeVars.js +6 -41
- package/es/styleUtils/mirrorShorthand.js +37 -87
- package/es/styleUtils/mirrorShorthandCorners.js +1 -24
- package/es/styleUtils/mirrorShorthandEdges.js +1 -24
- package/es/useComputedTheme.js +16 -51
- package/es/useStyle.js +12 -51
- package/es/useStyleNew.js +29 -78
- package/es/useTheme.js +10 -41
- package/es/withStyle.js +53 -107
- package/es/withStyleNew.js +73 -157
- package/package.json +13 -16
- package/tsconfig.build.json +0 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/EmotionTypes.js +0 -5
- package/lib/InstUISettingsProvider/index.js +0 -79
- package/lib/getComponentThemeOverride.js +0 -74
- package/lib/getTheme.js +0 -93
- package/lib/index.js +0 -140
- package/lib/package.json +0 -1
- package/lib/styleUtils/ThemeablePropValues.js +0 -124
- package/lib/styleUtils/applyColorModifiers.js +0 -99
- package/lib/styleUtils/calcFocusOutlineStyles.js +0 -77
- package/lib/styleUtils/calcSpacingFromShorthand.js +0 -118
- package/lib/styleUtils/getShorthandPropValue.js +0 -84
- package/lib/styleUtils/index.js +0 -61
- package/lib/styleUtils/makeThemeVars.js +0 -51
- package/lib/styleUtils/mirrorShorthand.js +0 -97
- package/lib/styleUtils/mirrorShorthandCorners.js +0 -37
- package/lib/styleUtils/mirrorShorthandEdges.js +0 -37
- package/lib/useComputedTheme.js +0 -59
- package/lib/useStyle.js +0 -60
- package/lib/useStyleNew.js +0 -88
- package/lib/useTheme.js +0 -53
- package/lib/withStyle.js +0 -125
- package/lib/withStyleNew.js +0 -176
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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
|
+
## [11.7.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* **many:** `@instructure/ui-babel-preset` and
|
|
15
|
+
`@instructure/browserslist-config-instui` are removed and will no longer be
|
|
16
|
+
published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @instructure/emotion
|
package/es/EmotionTypes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { };
|
|
@@ -1,73 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
25
2
|
import { useContext } from 'react';
|
|
26
3
|
import { ThemeProvider } from '@emotion/react';
|
|
27
4
|
import { TextDirectionContext } from '@instructure/ui-i18n';
|
|
28
5
|
import { DeterministicIdContextProvider } from '@instructure/ui-react-utils';
|
|
29
6
|
import { getTheme } from '../getTheme.js';
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
const finalDir = dir || useContext(TextDirectionContext);
|
|
45
|
-
if (typeof process !== 'undefined' && (process?.env?.NODE_ENV !== 'production' || process?.env?.GITHUB_PULL_REQUEST_PREVIEW === 'true') && finalDir === 'auto') {}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* new pattern: if you want to replace a theme inside an InstUISettingsProvider, provide it via the theme prop. It'll
|
|
49
|
-
* override everything, replacing the otherwise used theme.
|
|
50
|
-
* if you want to apply an override, use the themeOverride prop.
|
|
51
|
-
* For backward compatibility reasons, the old way of passing a partial theme to the theme prop is still supported, however only for
|
|
52
|
-
* legacy (pre v11_7) components. Overriding the newTheme this way could break the system.
|
|
53
|
-
*/
|
|
54
|
-
let providers = _jsx(DeterministicIdContextProvider, {
|
|
55
|
-
instanceCounterMap: instanceCounterMap,
|
|
56
|
-
children: _jsx(ThemeProvider, {
|
|
57
|
-
theme: getTheme(theme, themeOverride),
|
|
58
|
-
children: _jsx(TextDirectionContext.Provider, {
|
|
59
|
-
value: finalDir,
|
|
60
|
-
children: children
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
});
|
|
64
|
-
if (dir) {
|
|
65
|
-
providers = _jsx("span", {
|
|
66
|
-
dir: finalDir,
|
|
67
|
-
children: providers
|
|
7
|
+
function InstUISettingsProvider({ children, theme = {}, dir, instanceCounterMap, themeOverride }) {
|
|
8
|
+
const finalDir = dir || useContext(TextDirectionContext);
|
|
9
|
+
if (typeof process !== 'undefined' && (process?.env?.NODE_ENV !== 'production' || process?.env?.GITHUB_PULL_REQUEST_PREVIEW === 'true') && finalDir === 'auto') {
|
|
10
|
+
void 0;
|
|
11
|
+
}
|
|
12
|
+
let providers = /*#__PURE__*/ _jsx(DeterministicIdContextProvider, {
|
|
13
|
+
instanceCounterMap: instanceCounterMap,
|
|
14
|
+
children: /*#__PURE__*/ _jsx(ThemeProvider, {
|
|
15
|
+
theme: getTheme(theme, themeOverride),
|
|
16
|
+
children: /*#__PURE__*/ _jsx(TextDirectionContext.Provider, {
|
|
17
|
+
value: finalDir,
|
|
18
|
+
children: children
|
|
19
|
+
})
|
|
20
|
+
})
|
|
68
21
|
});
|
|
69
|
-
|
|
70
|
-
|
|
22
|
+
if (dir) {
|
|
23
|
+
providers = /*#__PURE__*/ _jsx("span", {
|
|
24
|
+
dir: finalDir,
|
|
25
|
+
children: providers
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return providers;
|
|
71
29
|
}
|
|
72
30
|
export default InstUISettingsProvider;
|
|
73
|
-
export { InstUISettingsProvider };
|
|
31
|
+
export { InstUISettingsProvider };
|
|
@@ -1,68 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* ---
|
|
27
|
-
* private: true
|
|
28
|
-
* ---
|
|
29
|
-
* This is a utility function which calculates the correct component theme
|
|
30
|
-
* based on every possible override there is.
|
|
31
|
-
|
|
32
|
-
* @param theme - Theme object
|
|
33
|
-
* @param displayName - Name of the component
|
|
34
|
-
* @param componentId - componentId of the component
|
|
35
|
-
* @param themeOverride - The theme override object
|
|
36
|
-
* @param componentTheme - The component's default theme
|
|
37
|
-
* @returns The calculated theme override object
|
|
38
|
-
*/
|
|
39
|
-
const getComponentThemeOverride = (theme, displayName, componentId, themeOverride, componentTheme) => {
|
|
40
|
-
const name = displayName;
|
|
41
|
-
const id = componentId;
|
|
42
|
-
const {
|
|
43
|
-
componentOverrides
|
|
44
|
-
} = theme;
|
|
45
|
-
let overridesFromTheme = {};
|
|
46
|
-
let overrideFromComponent = {};
|
|
47
|
-
if (componentOverrides) {
|
|
48
|
-
overridesFromTheme = name && componentOverrides[name] || id && componentOverrides[id] || {};
|
|
49
|
-
}
|
|
50
|
-
if (themeOverride) {
|
|
51
|
-
if (typeof themeOverride === 'function') {
|
|
52
|
-
overrideFromComponent = themeOverride(
|
|
53
|
-
//TODO type properly when the old theme is gone
|
|
54
|
-
componentTheme || {},
|
|
55
|
-
// the `theme` technically could be a partial theme / override object too,
|
|
56
|
-
// but we want to display all possible options
|
|
57
|
-
theme);
|
|
58
|
-
} else {
|
|
59
|
-
overrideFromComponent = themeOverride;
|
|
1
|
+
const getComponentThemeOverride = (theme, displayName, componentId, themeOverride, componentTheme)=>{
|
|
2
|
+
const name = displayName;
|
|
3
|
+
const id = componentId;
|
|
4
|
+
const { componentOverrides } = theme;
|
|
5
|
+
let overridesFromTheme = {};
|
|
6
|
+
let overrideFromComponent = {};
|
|
7
|
+
if (componentOverrides) {
|
|
8
|
+
overridesFromTheme = name && componentOverrides[name] || id && componentOverrides[id] || {};
|
|
60
9
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
10
|
+
if (themeOverride) {
|
|
11
|
+
if (typeof themeOverride === 'function') {
|
|
12
|
+
overrideFromComponent = themeOverride(componentTheme || {}, theme);
|
|
13
|
+
} else {
|
|
14
|
+
overrideFromComponent = themeOverride;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
...overridesFromTheme,
|
|
19
|
+
...overrideFromComponent
|
|
20
|
+
};
|
|
66
21
|
};
|
|
67
22
|
export default getComponentThemeOverride;
|
|
68
|
-
export { getComponentThemeOverride };
|
|
23
|
+
export { getComponentThemeOverride };
|
package/es/getTheme.js
CHANGED
|
@@ -1,84 +1,36 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
1
|
import canvas from '@instructure/ui-themes';
|
|
25
2
|
import { isBaseTheme, mergeDeep } from '@instructure/ui-utils';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
...(resolvedThemeOverride ? {
|
|
59
|
-
themeOverride: resolvedThemeOverride
|
|
60
|
-
} : {})
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
} catch {
|
|
64
|
-
// If the prop passed is not an Object, it will throw an error.
|
|
65
|
-
// We are using this fail-safe here for the non-TS users,
|
|
66
|
-
// because the whole page can break without a theme.
|
|
67
|
-
if (typeof process !== 'undefined' && (process?.env?.NODE_ENV !== 'production' || process?.env?.GITHUB_PULL_REQUEST_PREVIEW === 'true')) {}
|
|
68
|
-
resolvedLegacyThemeOrOverride = {};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// We only get here if no full theme was given, so the overrides are merged
|
|
72
|
-
// into the implicit `canvas` fallback instead of a theme the consumer chose.
|
|
73
|
-
if (!hasAncestorTheme && typeof process !== 'undefined' && (process?.env?.NODE_ENV !== 'production' || process?.env?.GITHUB_PULL_REQUEST_PREVIEW === 'true')) {}
|
|
74
|
-
const themeName = currentTheme.key;
|
|
75
|
-
|
|
76
|
-
// legacy: we pick the overrides for the current theme from the override object
|
|
77
|
-
const specificOverrides = resolvedLegacyThemeOrOverride?.themeOverrides;
|
|
78
|
-
const currentThemeOverrides = specificOverrides?.[themeName] || specificOverrides || {};
|
|
79
|
-
return mergeDeep(currentTheme, resolvedLegacyThemeOrOverride, currentThemeOverrides, ...(resolvedThemeOverride ? [{
|
|
80
|
-
themeOverride: resolvedThemeOverride
|
|
81
|
-
}] : []));
|
|
82
|
-
};
|
|
3
|
+
const getTheme = (themeOrLegacyOverride, themeOverride)=>(ancestorTheme = {})=>{
|
|
4
|
+
const hasAncestorTheme = Object.keys(ancestorTheme).length > 0;
|
|
5
|
+
const currentTheme = hasAncestorTheme ? ancestorTheme : canvas;
|
|
6
|
+
const resolvedThemeOverride = typeof themeOverride === 'function' ? themeOverride(currentTheme) : themeOverride;
|
|
7
|
+
let resolvedLegacyThemeOrOverride = typeof themeOrLegacyOverride === 'function' ? themeOrLegacyOverride(currentTheme) : themeOrLegacyOverride;
|
|
8
|
+
try {
|
|
9
|
+
if (isBaseTheme(resolvedLegacyThemeOrOverride)) {
|
|
10
|
+
return {
|
|
11
|
+
...resolvedLegacyThemeOrOverride,
|
|
12
|
+
...resolvedThemeOverride ? {
|
|
13
|
+
themeOverride: resolvedThemeOverride
|
|
14
|
+
} : {}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
} catch {
|
|
18
|
+
if (typeof process !== 'undefined' && (process?.env?.NODE_ENV !== 'production' || process?.env?.GITHUB_PULL_REQUEST_PREVIEW === 'true')) {
|
|
19
|
+
void 0;
|
|
20
|
+
}
|
|
21
|
+
resolvedLegacyThemeOrOverride = {};
|
|
22
|
+
}
|
|
23
|
+
if (!hasAncestorTheme && typeof process !== 'undefined' && (process?.env?.NODE_ENV !== 'production' || process?.env?.GITHUB_PULL_REQUEST_PREVIEW === 'true')) {
|
|
24
|
+
void 0;
|
|
25
|
+
}
|
|
26
|
+
const themeName = currentTheme.key;
|
|
27
|
+
const specificOverrides = resolvedLegacyThemeOrOverride?.themeOverrides;
|
|
28
|
+
const currentThemeOverrides = specificOverrides?.[themeName] || specificOverrides || {};
|
|
29
|
+
return mergeDeep(currentTheme, resolvedLegacyThemeOrOverride, currentThemeOverrides, ...resolvedThemeOverride ? [
|
|
30
|
+
{
|
|
31
|
+
themeOverride: resolvedThemeOverride
|
|
32
|
+
}
|
|
33
|
+
] : []);
|
|
34
|
+
};
|
|
83
35
|
export default getTheme;
|
|
84
|
-
export { getTheme };
|
|
36
|
+
export { getTheme };
|
package/es/index.js
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
/// <reference types="@emotion/react/types/css-prop" />
|
|
25
|
-
|
|
26
1
|
export * from '@emotion/react';
|
|
27
2
|
export { useComputedTheme } from './useComputedTheme.js';
|
|
28
3
|
export { InstUISettingsProvider } from './InstUISettingsProvider/index.js';
|
|
@@ -32,4 +7,4 @@ export { withStyleNew } from './withStyleNew.js';
|
|
|
32
7
|
export { ThemeablePropValues, makeThemeVars, getShorthandPropValue, mirrorShorthandCorners, mirrorShorthandEdges, calcSpacingFromShorthand, calcFocusOutlineStyles, applyColorModifiers } from './styleUtils/index.js';
|
|
33
8
|
export { useStyle } from './useStyle.js';
|
|
34
9
|
export { useStyleNew } from './useStyleNew.js';
|
|
35
|
-
export { useTheme } from './useTheme.js';
|
|
10
|
+
export { useTheme } from './useTheme.js';
|
|
@@ -1,120 +1,63 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
1
|
const ThemeablePropValues = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
2
|
+
SHADOW_TYPES: {
|
|
3
|
+
resting: 'resting',
|
|
4
|
+
above: 'above',
|
|
5
|
+
topmost: 'topmost',
|
|
6
|
+
none: 'none',
|
|
7
|
+
elevation1: 'elevation1',
|
|
8
|
+
elevation2: 'elevation2',
|
|
9
|
+
elevation3: 'elevation3',
|
|
10
|
+
elevation4: 'elevation4'
|
|
11
|
+
},
|
|
12
|
+
STACKING_TYPES: {
|
|
13
|
+
deepest: 'deepest',
|
|
14
|
+
below: 'below',
|
|
15
|
+
resting: 'resting',
|
|
16
|
+
above: 'above',
|
|
17
|
+
topmost: 'topmost'
|
|
18
|
+
},
|
|
19
|
+
BORDER_WIDTHS: {
|
|
20
|
+
0: '0',
|
|
21
|
+
none: 'none',
|
|
22
|
+
small: 'small',
|
|
23
|
+
medium: 'medium',
|
|
24
|
+
large: 'large'
|
|
25
|
+
},
|
|
26
|
+
BORDER_RADII: {
|
|
27
|
+
0: '0',
|
|
28
|
+
none: 'none',
|
|
29
|
+
small: 'small',
|
|
30
|
+
medium: 'medium',
|
|
31
|
+
large: 'large',
|
|
32
|
+
circle: 'circle',
|
|
33
|
+
pill: 'pill'
|
|
34
|
+
},
|
|
35
|
+
BACKGROUNDS: {
|
|
36
|
+
default: 'default',
|
|
37
|
+
inverse: 'inverse',
|
|
38
|
+
transparent: 'transparent'
|
|
39
|
+
},
|
|
40
|
+
SIZES: {
|
|
41
|
+
xSmall: 'x-small',
|
|
42
|
+
small: 'small',
|
|
43
|
+
medium: 'medium',
|
|
44
|
+
large: 'large',
|
|
45
|
+
xLarge: 'x-large'
|
|
46
|
+
},
|
|
47
|
+
SPACING: {
|
|
48
|
+
0: '0',
|
|
49
|
+
none: 'none',
|
|
50
|
+
auto: 'auto',
|
|
51
|
+
xxxSmall: 'xxx-small',
|
|
52
|
+
xxSmall: 'xx-small',
|
|
53
|
+
xSmall: 'x-small',
|
|
54
|
+
small: 'small',
|
|
55
|
+
mediumSmall: 'mediumSmall',
|
|
56
|
+
medium: 'medium',
|
|
57
|
+
large: 'large',
|
|
58
|
+
xLarge: 'x-large',
|
|
59
|
+
xxLarge: 'xx-large'
|
|
60
|
+
}
|
|
85
61
|
};
|
|
86
|
-
|
|
87
|
-
// SPACING
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @deprecated Era-1 (legacy) spacing keywords. Still resolved at runtime, but
|
|
91
|
-
* prefer the current `CurrentSpacingValues` dot-path tokens (e.g. `general.spaceMd`).
|
|
92
|
-
* See https://instructure.design/layout-spacing.
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @deprecated Era-2 spacing tokens (the `space0`–`space60` and flat semantic set)
|
|
97
|
-
* have been phased out. Still resolved at runtime, but prefer the current
|
|
98
|
-
* `CurrentSpacingValues` dot-path tokens (e.g. `general.spaceMd`, `gap.cards.md`).
|
|
99
|
-
* See https://instructure.design/layout-spacing.
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Current (era-3) spacing tokens. Referenced via dot-path notation and resolved
|
|
104
|
-
* against the new theme's `sharedTokens.spacing` map (see
|
|
105
|
-
* `@instructure/ui-themes` `newThemeTokens`). These are the recommended values
|
|
106
|
-
* for the `margin`/`padding` props. See https://instructure.design/layout-spacing.
|
|
107
|
-
*/
|
|
108
|
-
|
|
109
|
-
// adding `(string & {})` allows to use any string while still allowing specific string values to be suggested by IDEs
|
|
110
|
-
|
|
111
|
-
// SHADOW_TYPES
|
|
112
|
-
|
|
113
|
-
// STACKING_TYPES
|
|
114
|
-
|
|
115
|
-
// BACKGROUNDS
|
|
116
|
-
|
|
117
|
-
// BORDER_WIDTHS
|
|
118
|
-
|
|
119
62
|
export default ThemeablePropValues;
|
|
120
|
-
export { ThemeablePropValues };
|
|
63
|
+
export { ThemeablePropValues };
|