@hitachivantara/uikit-react-core 6.0.0-next.8 → 6.1.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/Calendar/SingleCalendar/SingleCalendar.js +32 -25
- package/dist/Calendar/SingleCalendar/SingleCalendar.styles.js +3 -2
- package/dist/Calendar/utils.js +5 -1
- package/dist/StatusIcon/StatusIcon.styles.js +5 -3
- package/dist/index.d.ts +2 -1
- package/dist/providers/ThemeProvider.js +12 -1
- package/dist/themes/pentaho.js +153 -0
- package/package.json +5 -5
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo } from "react";
|
|
3
|
+
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
3
4
|
import { isKey } from "../../utils/keyboardUtils.js";
|
|
4
5
|
import { HvCalendarHeader } from "../CalendarHeader/CalendarHeader.js";
|
|
5
6
|
import { generateCalendarModel } from "../model.js";
|
|
6
|
-
import { isDate, getWeekdayNamesList,
|
|
7
|
+
import { DEFAULT_LOCALE, isDate, getWeekdayNamesList, isRange } from "../utils.js";
|
|
7
8
|
import { HvCalendarCell } from "./CalendarCell.js";
|
|
8
9
|
import { useClasses } from "./SingleCalendar.styles.js";
|
|
9
10
|
import { staticClasses } from "./SingleCalendar.styles.js";
|
|
@@ -11,25 +12,26 @@ import { HvComposedNavigation } from "../CalendarNavigation/ComposedNavigation/C
|
|
|
11
12
|
import { HvMonthSelector } from "../CalendarNavigation/MonthSelector/MonthSelector.js";
|
|
12
13
|
import { HvPanel } from "../../Panel/Panel.js";
|
|
13
14
|
import { HvTypography } from "../../Typography/Typography.js";
|
|
14
|
-
const HvSingleCalendar = ({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
const HvSingleCalendar = (props) => {
|
|
16
|
+
const {
|
|
17
|
+
classes: classesProp,
|
|
18
|
+
className,
|
|
19
|
+
id,
|
|
20
|
+
locale = DEFAULT_LOCALE,
|
|
21
|
+
value,
|
|
22
|
+
visibleMonth,
|
|
23
|
+
visibleYear,
|
|
24
|
+
minimumDate,
|
|
25
|
+
maximumDate,
|
|
26
|
+
onChange,
|
|
27
|
+
onInputChange,
|
|
28
|
+
onVisibleDateChange,
|
|
29
|
+
showEndDate,
|
|
30
|
+
showDayOfWeek,
|
|
31
|
+
invalidDateLabel,
|
|
32
|
+
children,
|
|
33
|
+
...others
|
|
34
|
+
} = useDefaultProps("HvSingleCalendar", props);
|
|
33
35
|
const { classes, cx } = useClasses(classesProp);
|
|
34
36
|
const today = /* @__PURE__ */ new Date();
|
|
35
37
|
const localValue = value ?? today;
|
|
@@ -121,15 +123,20 @@ const HvSingleCalendar = ({
|
|
|
121
123
|
visibleMonth: visibleMonth || today.getMonth() + 1
|
|
122
124
|
}
|
|
123
125
|
),
|
|
124
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
"div",
|
|
128
|
+
{
|
|
129
|
+
className: cx(classes.calendarGrid, classes.weekdays),
|
|
130
|
+
"aria-controls": HvCalendarHeader?.[0]?.id,
|
|
131
|
+
children: listWeekdayNames.map(renderWeekLabel)
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
125
135
|
"div",
|
|
126
136
|
{
|
|
127
137
|
className: classes.calendarGrid,
|
|
128
138
|
"aria-controls": HvCalendarHeader?.[0]?.id,
|
|
129
|
-
children:
|
|
130
|
-
listWeekdayNames.map(renderWeekLabel),
|
|
131
|
-
calModel.dates.map(renderCalendarDate)
|
|
132
|
-
]
|
|
139
|
+
children: calModel.dates.map(renderCalendarDate)
|
|
133
140
|
}
|
|
134
141
|
)
|
|
135
142
|
] }),
|
|
@@ -27,7 +27,7 @@ const { staticClasses, useClasses } = createClasses("HvSingleCalendar", {
|
|
|
27
27
|
"& $cellsInRange:hover": {
|
|
28
28
|
backgroundColor: theme.colors.bgPageSecondary,
|
|
29
29
|
"& $calendarDate": {
|
|
30
|
-
borderRight: `
|
|
30
|
+
borderRight: `2px solid ${theme.colors.text}`
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"& $cellsInRange:hover ~ $cellsInRange": {
|
|
@@ -61,7 +61,8 @@ const { staticClasses, useClasses } = createClasses("HvSingleCalendar", {
|
|
|
61
61
|
backgroundColor: theme.colors.bgPageSecondary
|
|
62
62
|
},
|
|
63
63
|
cellsOutsideRange: {},
|
|
64
|
-
cellContainer: {}
|
|
64
|
+
cellContainer: {},
|
|
65
|
+
weekdays: {}
|
|
65
66
|
});
|
|
66
67
|
export {
|
|
67
68
|
staticClasses,
|
package/dist/Calendar/utils.js
CHANGED
|
@@ -15,7 +15,11 @@ const isSameDay = (date1, date2) => {
|
|
|
15
15
|
return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
|
|
16
16
|
};
|
|
17
17
|
const getDateISO = (date) => {
|
|
18
|
-
|
|
18
|
+
const d = new Date(date);
|
|
19
|
+
const year = d.getFullYear();
|
|
20
|
+
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
21
|
+
const day = String(d.getDate()).padStart(2, "0");
|
|
22
|
+
return `${year}-${month}-${day}`;
|
|
19
23
|
};
|
|
20
24
|
const getPreviousMonth = (month, year) => {
|
|
21
25
|
const prevMonth = month > 1 ? month - 1 : 12;
|
|
@@ -36,10 +36,12 @@ const { staticClasses, useClasses } = createClasses("HvStatusIcon", {
|
|
|
36
36
|
}
|
|
37
37
|
])
|
|
38
38
|
),
|
|
39
|
-
":where([data-variant=default]
|
|
39
|
+
":where([data-variant=default])": {
|
|
40
40
|
color: theme.colors.text,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
":where([data-type=full])": {
|
|
42
|
+
backgroundColor: theme.colors.bgPage,
|
|
43
|
+
outline: `1px solid ${theme.colors.borderSubtle}`
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
icon: {
|
package/dist/index.d.ts
CHANGED
|
@@ -8633,7 +8633,7 @@ declare const useClasses_38: (classesProp?: Partial<Record<"root" | "invalid" |
|
|
|
8633
8633
|
readonly cx: (...args: any) => string;
|
|
8634
8634
|
};
|
|
8635
8635
|
|
|
8636
|
-
declare const useClasses_39: (classesProp?: Partial<Record<"root" | "focusSelection" | "navigationContainer" | "navigationMonth" | "cellContainer" | "calendarDate" | "calendarDateSelected" | "calendarDateNotInMonth" | "calendarDateInSelectionRange" | "startBookend" | "endBookend" | "cellsInRange" | "cellsOutsideRange" | "calendarGrid" | "calendarDay" | "calendarDateInvalid", string>>, addStatic?: boolean) => {
|
|
8636
|
+
declare const useClasses_39: (classesProp?: Partial<Record<"root" | "focusSelection" | "navigationContainer" | "navigationMonth" | "cellContainer" | "calendarDate" | "calendarDateSelected" | "calendarDateNotInMonth" | "calendarDateInSelectionRange" | "startBookend" | "endBookend" | "cellsInRange" | "cellsOutsideRange" | "calendarGrid" | "calendarDay" | "calendarDateInvalid" | "weekdays", string>>, addStatic?: boolean) => {
|
|
8637
8637
|
readonly classes: {
|
|
8638
8638
|
root: string;
|
|
8639
8639
|
calendarGrid: string;
|
|
@@ -8651,6 +8651,7 @@ declare const useClasses_39: (classesProp?: Partial<Record<"root" | "focusSelect
|
|
|
8651
8651
|
cellsInRange: string;
|
|
8652
8652
|
cellsOutsideRange: string;
|
|
8653
8653
|
cellContainer: string;
|
|
8654
|
+
weekdays: string;
|
|
8654
8655
|
};
|
|
8655
8656
|
readonly css: any;
|
|
8656
8657
|
readonly cx: (...args: any) => string;
|
|
@@ -25,13 +25,24 @@ const HvThemeProvider = ({
|
|
|
25
25
|
const value = useMemo(
|
|
26
26
|
() => ({
|
|
27
27
|
colorModes: ["light", "dark"],
|
|
28
|
-
activeTheme: theme,
|
|
28
|
+
// activeTheme: theme as HvTheme,
|
|
29
29
|
selectedMode: colorMode,
|
|
30
30
|
changeMode(newMode = colorMode) {
|
|
31
31
|
setColorModeValue(newMode);
|
|
32
32
|
},
|
|
33
33
|
rootId,
|
|
34
34
|
// TODO: remove once backwards-compatibility is not needed anymore
|
|
35
|
+
activeTheme: {
|
|
36
|
+
...theme,
|
|
37
|
+
colors: {
|
|
38
|
+
...theme.colors,
|
|
39
|
+
modes: {
|
|
40
|
+
...theme.colors,
|
|
41
|
+
light: { ...theme.colors.light, type: "light" },
|
|
42
|
+
dark: { ...theme.colors.dark, type: "dark" }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
35
46
|
themes: [theme],
|
|
36
47
|
selectedTheme: theme.name,
|
|
37
48
|
changeTheme(theme2, mode) {
|
package/dist/themes/pentaho.js
CHANGED
|
@@ -871,6 +871,159 @@ 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
|
+
}
|
|
874
1027
|
}
|
|
875
1028
|
}
|
|
876
1029
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.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.
|
|
38
|
-
"@hitachivantara/uikit-styles": "^6.0.
|
|
36
|
+
"@hitachivantara/uikit-react-shared": "^6.0.1",
|
|
37
|
+
"@hitachivantara/uikit-react-utils": "^6.1.0",
|
|
38
|
+
"@hitachivantara/uikit-styles": "^6.0.1",
|
|
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": "6a6e77422bfbe5d7d59b447c972ccc0e3cce35d4",
|
|
65
65
|
"exports": {
|
|
66
66
|
".": {
|
|
67
67
|
"types": "./dist/index.d.ts",
|