@hitachivantara/uikit-react-core 6.0.0-next.9 → 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.
@@ -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, DEFAULT_LOCALE, isRange } from "../utils.js";
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
- classes: classesProp,
16
- className,
17
- id,
18
- locale = DEFAULT_LOCALE,
19
- value,
20
- visibleMonth,
21
- visibleYear,
22
- minimumDate,
23
- maximumDate,
24
- onChange,
25
- onInputChange,
26
- onVisibleDateChange,
27
- showEndDate,
28
- showDayOfWeek,
29
- invalidDateLabel,
30
- children,
31
- ...others
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__ */ jsxs(
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: `1px solid ${theme.colors.text}`
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,
@@ -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
- return new Date(date).toISOString().slice(0, 10);
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][data-type=full])": {
39
+ ":where([data-variant=default])": {
40
40
  color: theme.colors.text,
41
- backgroundColor: theme.colors.bgPage,
42
- outline: `1px solid ${theme.colors.borderSubtle}`
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;
@@ -37,7 +37,9 @@ const HvThemeProvider = ({
37
37
  colors: {
38
38
  ...theme.colors,
39
39
  modes: {
40
- ...theme.colors
40
+ ...theme.colors,
41
+ light: { ...theme.colors.light, type: "light" },
42
+ dark: { ...theme.colors.dark, type: "dark" }
41
43
  }
42
44
  }
43
45
  },
@@ -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.0.0-next.9",
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.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.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": "94053ad726b6c19742685dacb64949cd97ab6d4b",
64
+ "gitHead": "6a6e77422bfbe5d7d59b447c972ccc0e3cce35d4",
65
65
  "exports": {
66
66
  ".": {
67
67
  "types": "./dist/index.d.ts",