@hitachivantara/uikit-react-core 6.0.0-next.9 → 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.
@@ -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
@@ -37,7 +40,9 @@ const HvThemeProvider = ({
37
40
  colors: {
38
41
  ...theme.colors,
39
42
  modes: {
40
- ...theme.colors
43
+ ...theme.colors,
44
+ light: { ...theme.colors.light, type: "light" },
45
+ dark: { ...theme.colors.dark, type: "dark" }
41
46
  }
42
47
  }
43
48
  },
@@ -45,59 +50,24 @@ const HvThemeProvider = ({
45
50
  selectedTheme: theme.name,
46
51
  changeTheme(theme2, mode) {
47
52
  setColorModeValue(mode);
53
+ setMode(mode);
48
54
  }
49
55
  }),
50
- [theme, colorMode, rootId]
56
+ [theme, colorMode, setMode, rootId]
51
57
  );
58
+ return /* @__PURE__ */ jsx(HvThemeContext.Provider, { value, children });
59
+ }
60
+ function HvThemeProvider(props) {
61
+ const { theme, emotionCache, colorMode } = props;
52
62
  const muiTheme = useMemo(() => {
53
- const colors = theme.colors[colorMode] || theme.colors.light;
54
- return createTheme({
55
- colorSchemes: { light: true, dark: true },
56
- spacing: theme.space.base,
57
- typography: {
58
- fontFamily: theme.fontFamily.body
59
- },
60
- palette: {
61
- primary: { main: colors.primary },
62
- success: { main: colors.positive },
63
- warning: { main: colors.warning },
64
- error: { main: colors.negative },
65
- info: { main: colors.info },
66
- text: {
67
- primary: colors.text,
68
- secondary: colors.textSubtle,
69
- disabled: colors.textDisabled
70
- },
71
- background: {
72
- default: colors.bgPage,
73
- paper: colors.bgContainer
74
- },
75
- divider: colors.border,
76
- action: {
77
- active: colors.primary,
78
- hover: colors.primaryStrong,
79
- selected: colors.primaryStrong,
80
- disabled: colors.textDisabled,
81
- disabledBackground: colors.bgDisabled
82
- }
83
- },
84
- components: {
85
- MuiButtonBase: {
86
- defaultProps: {
87
- disableRipple: true,
88
- disableTouchRipple: true
89
- }
90
- }
91
- },
92
- breakpoints: theme.breakpoints
93
- });
94
- }, [theme, colorMode]);
63
+ return createMuiTheme(theme);
64
+ }, [theme]);
95
65
  const emotionCacheValue = useMemo(
96
66
  () => ({ cache: emotionCache }),
97
67
  [emotionCache]
98
68
  );
99
- return /* @__PURE__ */ jsx(ThemeProvider, { theme: muiTheme, children: /* @__PURE__ */ jsx(HvThemeContext.Provider, { value, children: /* @__PURE__ */ jsx(EmotionContext.Provider, { value: emotionCacheValue, children }) }) });
100
- };
69
+ return /* @__PURE__ */ jsx(ThemeProvider, { theme: muiTheme, defaultMode: colorMode, children: /* @__PURE__ */ jsx(EmotionContext.Provider, { value: emotionCacheValue, children: /* @__PURE__ */ jsx(HvThemeProviderInner, { ...props }) }) });
70
+ }
101
71
  export {
102
72
  EmotionContext2 as EmotionContext,
103
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
+ };
@@ -871,6 +871,174 @@ const pentaho = mergeTheme(pentaho$1, {
871
871
  padding: theme.spacing("xs", "sm")
872
872
  }
873
873
  }
874
+ },
875
+ HvCalendarCell: {
876
+ classes: {
877
+ dateWrapper: {
878
+ width: 32,
879
+ height: 32
880
+ },
881
+ calendarDate: {
882
+ width: 32,
883
+ height: 32,
884
+ ...theme.typography.caption1,
885
+ borderRadius: theme.radii.full,
886
+ ":hover": {
887
+ borderRadius: theme.radii.full
888
+ }
889
+ },
890
+ calendarDateSelected: {
891
+ backgroundColor: theme.colors.primary,
892
+ color: theme.colors.dimmer,
893
+ ":hover": {
894
+ border: `1px solid ${theme.colors.primary}`,
895
+ color: theme.colors.text
896
+ }
897
+ },
898
+ cellContainer: {
899
+ "&:hover": {
900
+ backgroundColor: theme.colors.primaryDimmed,
901
+ borderRadius: theme.radii.full
902
+ },
903
+ ":has(> span.HvCalendarCell-calendarDateInSelectionRange):has(> span.HvCalendarCell-startBookend)": {
904
+ backgroundColor: theme.colors.bgPageSecondary,
905
+ borderTopLeftRadius: theme.radii.full,
906
+ borderBottomLeftRadius: theme.radii.full
907
+ },
908
+ ":has(> span.HvCalendarCell-calendarDateInSelectionRange):has(> span.HvCalendarCell-endBookend)": {
909
+ backgroundColor: theme.colors.bgPageSecondary,
910
+ borderTopRightRadius: theme.radii.full,
911
+ borderBottomRightRadius: theme.radii.full
912
+ }
913
+ },
914
+ calendarDateInSelectionRange: {
915
+ borderRadius: 0
916
+ },
917
+ startBookend: {
918
+ backgroundColor: theme.colors.primary,
919
+ color: theme.colors.dimmer,
920
+ borderRadius: theme.radii.full
921
+ },
922
+ endBookend: {
923
+ backgroundColor: theme.colors.primary,
924
+ color: theme.colors.dimmer,
925
+ borderRadius: theme.radii.full
926
+ }
927
+ }
928
+ },
929
+ HvSingleCalendar: {
930
+ classes: {
931
+ root: {
932
+ " .HvNavigation-text": {
933
+ ...theme.typography.captionLabel
934
+ },
935
+ " .HvNavigation-root": {
936
+ gap: 0
937
+ },
938
+ " .HvMonthSelector-calendarMonthlyGrid": {
939
+ gridTemplateColumns: "repeat(4, 1fr)"
940
+ },
941
+ " .HvMonthSelector-calendarMonthlyCell": {
942
+ borderRadius: theme.radii.full,
943
+ width: 48,
944
+ height: 48
945
+ },
946
+ " .HvMonthSelector-calendarMonthlyCellSelected": {
947
+ backgroundColor: theme.colors.primary,
948
+ color: theme.colors.dimmer,
949
+ ":hover": {
950
+ border: `1px solid ${theme.colors.primary}`,
951
+ color: theme.colors.text,
952
+ backgroundColor: theme.colors.primaryDimmed
953
+ }
954
+ }
955
+ },
956
+ calendarDay: {
957
+ width: 32,
958
+ height: 32,
959
+ ...theme.typography.caption2
960
+ },
961
+ weekdays: {
962
+ borderBottom: `1px solid ${theme.colors.borderSubtle}`,
963
+ marginBottom: theme.space.xs,
964
+ justifyContent: "center"
965
+ },
966
+ calendarGrid: {
967
+ justifyContent: "center",
968
+ gridTemplateColumns: "repeat(7, 32px)",
969
+ "& .HvSingleCalendar-cellsInRange": {
970
+ "& .HvSingleCalendar-startBookend": {
971
+ borderLeft: "none",
972
+ backgroundColor: theme.colors.primary,
973
+ color: theme.colors.dimmer
974
+ }
975
+ },
976
+ "&:hover .HvSingleCalendar-cellsInRange": {
977
+ "& .HvSingleCalendar-startBookend": {
978
+ borderLeft: "none",
979
+ backgroundColor: theme.colors.primary,
980
+ color: theme.colors.dimmer
981
+ }
982
+ },
983
+ "& .HvSingleCalendar-cellsInRange:hover": {
984
+ borderTopRightRadius: theme.radii.full,
985
+ borderBottomRightRadius: theme.radii.full,
986
+ "& .HvSingleCalendar-calendarDate": {
987
+ borderRight: "none",
988
+ backgroundColor: theme.colors.primary,
989
+ color: theme.colors.dimmer
990
+ }
991
+ }
992
+ },
993
+ cellsInRange: {
994
+ ":has(span.HvSingleCalendar-startBookend)": {
995
+ borderTopLeftRadius: theme.radii.full,
996
+ borderBottomLeftRadius: theme.radii.full
997
+ }
998
+ },
999
+ cellContainer: {
1000
+ "&:hover": {
1001
+ ":has(span.HvSingleCalendar-startBookend)": {
1002
+ borderTopRightRadius: 0,
1003
+ borderBottomRightRadius: 0
1004
+ },
1005
+ ":has(span.HvSingleCalendar-endBookend)": {
1006
+ borderTopLeftRadius: 0,
1007
+ borderBottomLeftRadius: 0
1008
+ }
1009
+ }
1010
+ },
1011
+ calendarDateInSelectionRange: {
1012
+ ":hover:not( .HvSingleCalendar-endBookend):not( .HvSingleCalendar-startBookend)": {
1013
+ borderRadius: 0
1014
+ }
1015
+ },
1016
+ startBookend: {
1017
+ borderLeft: "none",
1018
+ borderTopLeftRadius: theme.radii.full,
1019
+ borderBottomLeftRadius: theme.radii.full
1020
+ },
1021
+ endBookend: {
1022
+ borderRight: "none",
1023
+ borderTopRightRadius: theme.radii.full,
1024
+ borderBottomRightRadius: theme.radii.full
1025
+ }
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
+ }
874
1042
  }
875
1043
  }
876
1044
  });
@@ -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.0.0-next.9",
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.0-next.6",
37
- "@hitachivantara/uikit-react-utils": "^6.0.0-next.6",
38
- "@hitachivantara/uikit-styles": "^6.0.0-next.5",
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": "94053ad726b6c19742685dacb64949cd97ab6d4b",
64
+ "gitHead": "7815bbc4041430fbc4fda437e7359ec6cfcb0b32",
65
65
  "exports": {
66
66
  ".": {
67
67
  "types": "./dist/index.d.ts",