@hitachivantara/uikit-react-core 6.1.0 → 6.3.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.
@@ -1,21 +1,23 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useState, useEffect, useMemo } from "react";
3
- import { createTheme, ThemeProvider } from "@mui/material/styles";
4
- import { HvThemeContext, EmotionContext } from "@hitachivantara/uikit-react-shared";
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
- const HvThemeProvider = ({
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
- const colors = theme.colors[colorMode] || theme.colors.light;
56
- return createTheme({
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(HvThemeContext.Provider, { value, children: /* @__PURE__ */ jsx(EmotionContext.Provider, { value: emotionCacheValue, children }) }) });
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
+ };
@@ -552,9 +552,6 @@ const pentaho = mergeTheme(pentaho$1, {
552
552
  },
553
553
  HvPagination: {
554
554
  classes: {
555
- root: {
556
- ...theme.typography.caption1
557
- },
558
555
  icon: {
559
556
  fontSize: 16
560
557
  }
@@ -748,6 +745,23 @@ const pentaho = mergeTheme(pentaho$1, {
748
745
  HvFooter: {
749
746
  name: "Pentaho"
750
747
  },
748
+ HvTableCell: {
749
+ classes: {
750
+ root: {
751
+ borderColor: theme.colors.borderSubtle
752
+ }
753
+ }
754
+ },
755
+ HvTableHeader: {
756
+ classes: {
757
+ root: {
758
+ borderColor: theme.colors.borderSubtle
759
+ },
760
+ head: {
761
+ backgroundColor: theme.colors.bgPage
762
+ }
763
+ }
764
+ },
751
765
  HvTabs: {
752
766
  classes: {
753
767
  floating: {
@@ -1024,6 +1038,21 @@ const pentaho = mergeTheme(pentaho$1, {
1024
1038
  borderBottomRightRadius: theme.radii.full
1025
1039
  }
1026
1040
  }
1041
+ },
1042
+ HvBannerContent: {
1043
+ classes: {
1044
+ root: {
1045
+ overflow: "hidden",
1046
+ minHeight: "unset"
1047
+ }
1048
+ }
1049
+ },
1050
+ HvSnackbarContent: {
1051
+ classes: {
1052
+ root: {
1053
+ minHeight: "unset"
1054
+ }
1055
+ }
1027
1056
  }
1028
1057
  }
1029
1058
  });
@@ -13,8 +13,17 @@ const { useClasses } = createClasses("HvCallout", {
13
13
  position: "relative",
14
14
  boxShadow: "none",
15
15
  flexWrap: "nowrap",
16
- padding: 0,
17
- borderRadius: theme.radii.round
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.1.0",
3
+ "version": "6.3.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.1",
37
- "@hitachivantara/uikit-react-utils": "^6.1.0",
38
- "@hitachivantara/uikit-styles": "^6.0.1",
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",
@@ -50,7 +50,7 @@
50
50
  "rc-slider": "^10.5.0",
51
51
  "rc-tooltip": "~6.3.0",
52
52
  "react-popper": "^2.3.0",
53
- "react-resize-detector": "^8.1.0",
53
+ "react-resize-detector": "^12.3.0",
54
54
  "react-table": "^7.8.0",
55
55
  "react-window": "^1.8.10"
56
56
  },
@@ -61,7 +61,7 @@
61
61
  "access": "public",
62
62
  "directory": "package"
63
63
  },
64
- "gitHead": "6a6e77422bfbe5d7d59b447c972ccc0e3cce35d4",
64
+ "gitHead": "f2b8a9e107bc8886231d527b37b30716d891105c",
65
65
  "exports": {
66
66
  ".": {
67
67
  "types": "./dist/index.d.ts",