@itwin/itwinui-react 2.12.13 → 2.12.15
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.
|
@@ -33,15 +33,19 @@ import { useStyles } from '../utils/hooks/useStyles.js';
|
|
|
33
33
|
* </ThemeProvider>
|
|
34
34
|
*/
|
|
35
35
|
export const ThemeProvider = React.forwardRef((props, ref) => {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
const { theme: themeProp, children, themeOptions, includeCss = { withLayer: true }, ...rest } = props;
|
|
36
|
+
var _a, _b, _c, _d;
|
|
37
|
+
const { theme: themeProp, children, themeOptions = {}, includeCss = { withLayer: true }, ...rest } = props;
|
|
38
38
|
const rootRef = React.useRef(null);
|
|
39
39
|
const mergedRefs = useMergedRefs(rootRef, ref);
|
|
40
40
|
const hasChildren = React.Children.count(children) > 0;
|
|
41
41
|
const parentContext = React.useContext(ThemeContext);
|
|
42
42
|
const theme = themeProp === 'inherit' ? (_a = parentContext === null || parentContext === void 0 ? void 0 : parentContext.theme) !== null && _a !== void 0 ? _a : 'light' : themeProp;
|
|
43
|
+
// default inherit highContrast option from parent if also inheriting base theme
|
|
44
|
+
(_b = themeOptions.highContrast) !== null && _b !== void 0 ? _b : (themeOptions.highContrast = themeProp === 'inherit'
|
|
45
|
+
? (_c = parentContext === null || parentContext === void 0 ? void 0 : parentContext.themeOptions) === null || _c === void 0 ? void 0 : _c.highContrast
|
|
46
|
+
: undefined);
|
|
43
47
|
const newStylesLoaded = React.useRef(false);
|
|
44
|
-
const stylesLoaded = (
|
|
48
|
+
const stylesLoaded = (_d = parentContext === null || parentContext === void 0 ? void 0 : parentContext.stylesLoaded) !== null && _d !== void 0 ? _d : newStylesLoaded;
|
|
45
49
|
const contextValue = React.useMemo(() => ({
|
|
46
50
|
theme,
|
|
47
51
|
themeOptions,
|