@hitachivantara/uikit-react-core 6.1.0 → 6.2.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/dist/Badge/Badge.styles.js +0 -2
- package/dist/Banner/Banner.js +2 -0
- package/dist/Banner/BannerContent/BannerContent.js +1 -0
- package/dist/Banner/BannerContent/BannerContent.styles.js +2 -8
- package/dist/BaseSwitch/BaseSwitch.js +5 -2
- package/dist/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/dist/RadioGroup/RadioGroup.js +1 -1
- package/dist/SelectionList/SelectionList.js +1 -1
- package/dist/index.d.ts +355 -298
- package/dist/providers/ThemeProvider.js +19 -51
- package/dist/providers/utils.js +52 -0
- package/dist/themes/pentaho.js +15 -0
- package/dist/utils/Callout.js +19 -4
- package/package.json +5 -5
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useMemo, useState, useEffect } from "react";
|
|
3
|
+
import { ThemeProvider, useColorScheme } from "@mui/material/styles";
|
|
4
|
+
import { EmotionContext, HvThemeContext } from "@hitachivantara/uikit-react-shared";
|
|
5
5
|
import { EmotionContext as EmotionContext2, HvThemeContext as HvThemeContext2, defaultCacheKey, defaultEmotionCache } from "@hitachivantara/uikit-react-shared";
|
|
6
6
|
import { getContainerElement } from "../utils/document.js";
|
|
7
7
|
import { setElementAttrs } from "../utils/theme.js";
|
|
8
|
-
|
|
8
|
+
import { createMuiTheme } from "./utils.js";
|
|
9
|
+
function HvThemeProviderInner({
|
|
9
10
|
children,
|
|
10
11
|
theme,
|
|
11
|
-
emotionCache,
|
|
12
12
|
colorMode: colorModeProp,
|
|
13
13
|
themeRootId: rootId
|
|
14
|
-
})
|
|
14
|
+
}) {
|
|
15
15
|
const [colorModeValue, setColorModeValue] = useState(colorModeProp);
|
|
16
|
+
const { setMode } = useColorScheme();
|
|
16
17
|
const colorMode = colorModeValue === "dark" ? "dark" : "light";
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
setColorModeValue(colorModeProp);
|
|
20
|
+
setMode(colorModeProp);
|
|
19
21
|
}, [colorModeProp]);
|
|
20
22
|
useEffect(() => {
|
|
21
23
|
const element = getContainerElement(rootId);
|
|
@@ -29,6 +31,7 @@ const HvThemeProvider = ({
|
|
|
29
31
|
selectedMode: colorMode,
|
|
30
32
|
changeMode(newMode = colorMode) {
|
|
31
33
|
setColorModeValue(newMode);
|
|
34
|
+
setMode(newMode);
|
|
32
35
|
},
|
|
33
36
|
rootId,
|
|
34
37
|
// TODO: remove once backwards-compatibility is not needed anymore
|
|
@@ -47,59 +50,24 @@ const HvThemeProvider = ({
|
|
|
47
50
|
selectedTheme: theme.name,
|
|
48
51
|
changeTheme(theme2, mode) {
|
|
49
52
|
setColorModeValue(mode);
|
|
53
|
+
setMode(mode);
|
|
50
54
|
}
|
|
51
55
|
}),
|
|
52
|
-
[theme, colorMode, rootId]
|
|
56
|
+
[theme, colorMode, setMode, rootId]
|
|
53
57
|
);
|
|
58
|
+
return /* @__PURE__ */ jsx(HvThemeContext.Provider, { value, children });
|
|
59
|
+
}
|
|
60
|
+
function HvThemeProvider(props) {
|
|
61
|
+
const { theme, emotionCache, colorMode } = props;
|
|
54
62
|
const muiTheme = useMemo(() => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
colorSchemes: { light: true, dark: true },
|
|
58
|
-
spacing: theme.space.base,
|
|
59
|
-
typography: {
|
|
60
|
-
fontFamily: theme.fontFamily.body
|
|
61
|
-
},
|
|
62
|
-
palette: {
|
|
63
|
-
primary: { main: colors.primary },
|
|
64
|
-
success: { main: colors.positive },
|
|
65
|
-
warning: { main: colors.warning },
|
|
66
|
-
error: { main: colors.negative },
|
|
67
|
-
info: { main: colors.info },
|
|
68
|
-
text: {
|
|
69
|
-
primary: colors.text,
|
|
70
|
-
secondary: colors.textSubtle,
|
|
71
|
-
disabled: colors.textDisabled
|
|
72
|
-
},
|
|
73
|
-
background: {
|
|
74
|
-
default: colors.bgPage,
|
|
75
|
-
paper: colors.bgContainer
|
|
76
|
-
},
|
|
77
|
-
divider: colors.border,
|
|
78
|
-
action: {
|
|
79
|
-
active: colors.primary,
|
|
80
|
-
hover: colors.primaryStrong,
|
|
81
|
-
selected: colors.primaryStrong,
|
|
82
|
-
disabled: colors.textDisabled,
|
|
83
|
-
disabledBackground: colors.bgDisabled
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
components: {
|
|
87
|
-
MuiButtonBase: {
|
|
88
|
-
defaultProps: {
|
|
89
|
-
disableRipple: true,
|
|
90
|
-
disableTouchRipple: true
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
breakpoints: theme.breakpoints
|
|
95
|
-
});
|
|
96
|
-
}, [theme, colorMode]);
|
|
63
|
+
return createMuiTheme(theme);
|
|
64
|
+
}, [theme]);
|
|
97
65
|
const emotionCacheValue = useMemo(
|
|
98
66
|
() => ({ cache: emotionCache }),
|
|
99
67
|
[emotionCache]
|
|
100
68
|
);
|
|
101
|
-
return /* @__PURE__ */ jsx(ThemeProvider, { theme: muiTheme, children: /* @__PURE__ */ jsx(
|
|
102
|
-
}
|
|
69
|
+
return /* @__PURE__ */ jsx(ThemeProvider, { theme: muiTheme, defaultMode: colorMode, children: /* @__PURE__ */ jsx(EmotionContext.Provider, { value: emotionCacheValue, children: /* @__PURE__ */ jsx(HvThemeProviderInner, { ...props }) }) });
|
|
70
|
+
}
|
|
103
71
|
export {
|
|
104
72
|
EmotionContext2 as EmotionContext,
|
|
105
73
|
HvThemeContext2 as HvThemeContext,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createTheme } from "@mui/material/styles";
|
|
2
|
+
function createMuiTheme(theme) {
|
|
3
|
+
return createTheme({
|
|
4
|
+
colorSchemes: {
|
|
5
|
+
light: { palette: makePalette(theme.colors.light) },
|
|
6
|
+
dark: { palette: makePalette(theme.colors.dark) }
|
|
7
|
+
},
|
|
8
|
+
// palette: makePalette(colors),
|
|
9
|
+
spacing: theme.space.base,
|
|
10
|
+
typography: {
|
|
11
|
+
fontFamily: theme.fontFamily.body
|
|
12
|
+
},
|
|
13
|
+
breakpoints: theme.breakpoints,
|
|
14
|
+
components: {
|
|
15
|
+
MuiButtonBase: {
|
|
16
|
+
defaultProps: {
|
|
17
|
+
disableRipple: true,
|
|
18
|
+
disableTouchRipple: true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function makePalette(colors) {
|
|
25
|
+
return {
|
|
26
|
+
primary: { main: colors.primary },
|
|
27
|
+
success: { main: colors.positive },
|
|
28
|
+
warning: { main: colors.warning },
|
|
29
|
+
error: { main: colors.negative },
|
|
30
|
+
info: { main: colors.info },
|
|
31
|
+
text: {
|
|
32
|
+
primary: colors.text,
|
|
33
|
+
secondary: colors.textSubtle,
|
|
34
|
+
disabled: colors.textDisabled
|
|
35
|
+
},
|
|
36
|
+
background: {
|
|
37
|
+
default: colors.bgPage,
|
|
38
|
+
paper: colors.bgContainer
|
|
39
|
+
},
|
|
40
|
+
divider: colors.border,
|
|
41
|
+
action: {
|
|
42
|
+
active: colors.primary,
|
|
43
|
+
hover: colors.primaryStrong,
|
|
44
|
+
selected: colors.primaryStrong,
|
|
45
|
+
disabled: colors.textDisabled,
|
|
46
|
+
disabledBackground: colors.bgDisabled
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
createMuiTheme
|
|
52
|
+
};
|
package/dist/themes/pentaho.js
CHANGED
|
@@ -1024,6 +1024,21 @@ const pentaho = mergeTheme(pentaho$1, {
|
|
|
1024
1024
|
borderBottomRightRadius: theme.radii.full
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
+
},
|
|
1028
|
+
HvBannerContent: {
|
|
1029
|
+
classes: {
|
|
1030
|
+
root: {
|
|
1031
|
+
overflow: "hidden",
|
|
1032
|
+
minHeight: "unset"
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
HvSnackbarContent: {
|
|
1037
|
+
classes: {
|
|
1038
|
+
root: {
|
|
1039
|
+
minHeight: "unset"
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1027
1042
|
}
|
|
1028
1043
|
}
|
|
1029
1044
|
});
|
package/dist/utils/Callout.js
CHANGED
|
@@ -13,8 +13,17 @@ const { useClasses } = createClasses("HvCallout", {
|
|
|
13
13
|
position: "relative",
|
|
14
14
|
boxShadow: "none",
|
|
15
15
|
flexWrap: "nowrap",
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
borderRadius: theme.radii.round,
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
"&[data-size='large']": {
|
|
19
|
+
padding: theme.space.sm
|
|
20
|
+
},
|
|
21
|
+
"&[data-size='regular']": {
|
|
22
|
+
padding: theme.space.xs
|
|
23
|
+
},
|
|
24
|
+
"&[data-size='micro']": {
|
|
25
|
+
padding: 0
|
|
26
|
+
}
|
|
18
27
|
},
|
|
19
28
|
success: {
|
|
20
29
|
backgroundColor: theme.colors.positiveDimmed
|
|
@@ -38,7 +47,8 @@ const { useClasses } = createClasses("HvCallout", {
|
|
|
38
47
|
display: "flex",
|
|
39
48
|
alignItems: "center",
|
|
40
49
|
padding: 0,
|
|
41
|
-
color: theme.colors.textDark
|
|
50
|
+
color: theme.colors.textDark,
|
|
51
|
+
width: "100%"
|
|
42
52
|
},
|
|
43
53
|
messageContent: {
|
|
44
54
|
textWrap: "balance",
|
|
@@ -58,7 +68,8 @@ const { useClasses } = createClasses("HvCallout", {
|
|
|
58
68
|
flexDirection: "column",
|
|
59
69
|
height: "100%",
|
|
60
70
|
justifyContent: "space-between",
|
|
61
|
-
gap: theme.space.xs
|
|
71
|
+
gap: theme.space.xs,
|
|
72
|
+
alignItems: "flex-start"
|
|
62
73
|
},
|
|
63
74
|
actionCustom: {
|
|
64
75
|
flex: "0 0 auto"
|
|
@@ -83,6 +94,7 @@ const HvCallout = forwardRef(function HvCallout2(props, ref) {
|
|
|
83
94
|
actionsPosition: actionsPositionProp = "auto",
|
|
84
95
|
children,
|
|
85
96
|
actionProps,
|
|
97
|
+
size = "regular",
|
|
86
98
|
...others
|
|
87
99
|
} = useDefaultProps("HvCallout", props);
|
|
88
100
|
const { classes, cx } = useClasses(classesProp, false);
|
|
@@ -113,10 +125,12 @@ const HvCallout = forwardRef(function HvCallout2(props, ref) {
|
|
|
113
125
|
message: classes.message,
|
|
114
126
|
action: classes.action
|
|
115
127
|
},
|
|
128
|
+
"data-size": size,
|
|
116
129
|
message: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
117
130
|
icon && /* @__PURE__ */ jsx(
|
|
118
131
|
HvStatusIcon,
|
|
119
132
|
{
|
|
133
|
+
size: size === "large" ? "md" : "sm",
|
|
120
134
|
className: classes.messageIcon,
|
|
121
135
|
variant: variant === "default" ? "info" : variant,
|
|
122
136
|
customIcon
|
|
@@ -126,6 +140,7 @@ const HvCallout = forwardRef(function HvCallout2(props, ref) {
|
|
|
126
140
|
title && /* @__PURE__ */ jsx("b", { className: classes.messageTitle, children: title }),
|
|
127
141
|
children
|
|
128
142
|
] }),
|
|
143
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
|
|
129
144
|
actions && actionsPosition === "inline" && actionsContent
|
|
130
145
|
] }),
|
|
131
146
|
action: (showClose || showCustomActions) && /* @__PURE__ */ jsxs("div", { className: classes.actionContent, children: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Hitachi Vantara UI Kit Team",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@emotion/cache": "^11.11.0",
|
|
35
35
|
"@emotion/serialize": "^1.1.2",
|
|
36
|
-
"@hitachivantara/uikit-react-shared": "^6.0.
|
|
37
|
-
"@hitachivantara/uikit-react-utils": "^6.1.
|
|
38
|
-
"@hitachivantara/uikit-styles": "^6.0.
|
|
36
|
+
"@hitachivantara/uikit-react-shared": "^6.0.2",
|
|
37
|
+
"@hitachivantara/uikit-react-utils": "^6.1.1",
|
|
38
|
+
"@hitachivantara/uikit-styles": "^6.0.2",
|
|
39
39
|
"@internationalized/date": "^3.2.0",
|
|
40
40
|
"@mui/base": "5.0.0-beta.68",
|
|
41
41
|
"@popperjs/core": "^2.11.8",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"access": "public",
|
|
62
62
|
"directory": "package"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "7815bbc4041430fbc4fda437e7359ec6cfcb0b32",
|
|
65
65
|
"exports": {
|
|
66
66
|
".": {
|
|
67
67
|
"types": "./dist/index.d.ts",
|