@hitachivantara/uikit-react-core 6.3.0 → 6.4.1

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,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useCallback } from "react";
2
+ import { useCallback } from "react";
3
3
  import { getColor } from "@hitachivantara/uikit-styles";
4
4
  import { useUniqueId } from "../../hooks/useUniqueId.js";
5
5
  import { HvIcon } from "../../icons.js";
@@ -22,30 +22,25 @@ const HvAppSwitcherAction = ({
22
22
  const { classes, cx } = useClasses(classesProp);
23
23
  const { name, description, disabled, iconElement, iconUrl, url, target } = application;
24
24
  const color = getColor(
25
- disabled ? "textDisabled" : application?.color,
26
- "text"
25
+ disabled && "textDisabled" || application?.color || "text"
27
26
  );
28
- const [validIconUrl, setValidIconUrl] = useState(true);
29
27
  const renderApplicationIcon = () => {
30
- if (iconElement) {
31
- return iconElement;
32
- }
33
- if (iconUrl && validIconUrl) {
34
- return /* @__PURE__ */ jsx(
35
- "img",
36
- {
37
- className: classes.iconUrl,
38
- src: iconUrl,
39
- onError: () => {
40
- setValidIconUrl(false);
41
- },
42
- alt: description
43
- }
44
- );
45
- }
46
- const brokenTitle = name.split(" ");
47
- const initials = brokenTitle[0].slice(0, 1) + (brokenTitle[1] ? brokenTitle[1].slice(0, 1) : "");
48
- return /* @__PURE__ */ jsx(HvAvatar, { size: "sm", backgroundColor: color, variant: "square", "aria-hidden": true, children: initials });
28
+ if (iconElement) return iconElement;
29
+ const nameParts = name.split(/\s+/);
30
+ const initials = nameParts[0].charAt(0) + (nameParts[1]?.charAt(0) || "");
31
+ return /* @__PURE__ */ jsx(
32
+ HvAvatar,
33
+ {
34
+ size: "sm",
35
+ src: iconUrl,
36
+ className: classes.iconUrl,
37
+ alt: description,
38
+ backgroundColor: color,
39
+ color: "bgContainer",
40
+ "aria-hidden": true,
41
+ children: initials
42
+ }
43
+ );
49
44
  };
50
45
  const isSelected = isSelectedCallback(application);
51
46
  const handleOnClick = useCallback(
@@ -1,7 +1,7 @@
1
1
  import { createClasses } from "@hitachivantara/uikit-react-utils";
2
2
  import { theme } from "@hitachivantara/uikit-styles";
3
3
  const { staticClasses, useClasses } = createClasses(
4
- "HvAppSwitcher-Action",
4
+ "HvAppSwitcherAction",
5
5
  {
6
6
  root: {
7
7
  width: "100%",
@@ -9,7 +9,7 @@ const { staticClasses, useClasses } = createClasses(
9
9
  minHeight: 52
10
10
  },
11
11
  icon: { display: "flex", minWidth: 40, justifyContent: "center" },
12
- iconUrl: { width: 32 },
12
+ iconUrl: { borderColor: "transparent" },
13
13
  iconInfo: { minWidth: 32 },
14
14
  disabled: {},
15
15
  selected: {},
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import MuiAvatar from "@mui/material/Avatar";
4
- import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
4
+ import { useDefaultProps, mergeStyles } from "@hitachivantara/uikit-react-utils";
5
5
  import { getColor } from "@hitachivantara/uikit-styles";
6
6
  import { useAvatarGroupContext } from "../AvatarGroup/AvatarGroupContext.js";
7
7
  import { useImageLoaded } from "../hooks/useImageLoaded.js";
@@ -23,8 +23,8 @@ const HvAvatar = forwardRef(function HvAvatar2(props, ref) {
23
23
  children: childrenProp,
24
24
  component = "div",
25
25
  size: sizeProp,
26
- backgroundColor = "text",
27
- color = "bgContainer",
26
+ backgroundColor,
27
+ color: colorProp,
28
28
  src,
29
29
  srcSet,
30
30
  sizes,
@@ -37,6 +37,7 @@ const HvAvatar = forwardRef(function HvAvatar2(props, ref) {
37
37
  ...others
38
38
  } = useDefaultProps("HvAvatar", props);
39
39
  const { classes, cx } = useClasses(classesProp);
40
+ const color = props.backgroundColor ? props.color || "bgContainer" : colorProp;
40
41
  const avatarGroupContext = useAvatarGroupContext();
41
42
  const size = sizeProp || avatarGroupContext?.size || "sm";
42
43
  let children;
@@ -57,40 +58,28 @@ const HvAvatar = forwardRef(function HvAvatar2(props, ref) {
57
58
  );
58
59
  } else if (childrenProp != null) {
59
60
  children = childrenProp;
60
- } else if (hasImg && alt) {
61
+ } else if (alt) {
61
62
  [children] = alt;
62
63
  } else {
63
64
  children = /* @__PURE__ */ jsx(
64
65
  HvIcon,
65
66
  {
66
67
  name: "User",
67
- color,
68
68
  size: decreaseSizeMap[size],
69
69
  className: classes.fallback
70
70
  }
71
71
  );
72
72
  }
73
- const inlineStyle = {
74
- ...style
75
- };
76
- if (component != null && typeof component !== "string") {
77
- inlineStyle.borderRadius = "50%";
78
- }
79
- if (!hasImgNotFailing) {
80
- inlineStyle.backgroundColor = getColor(backgroundColor, "text");
81
- inlineStyle.color = getColor(color, "textDimmed");
82
- }
83
- const statusInlineStyle = {};
84
- if (status) {
85
- const statusColor = getColor(status, "positive");
86
- statusInlineStyle.boxShadow = `inset 0px 0px 0px 2px ${statusColor}`;
87
- }
73
+ const statusColor = getColor(status, "positive");
88
74
  return /* @__PURE__ */ jsxs(
89
75
  "div",
90
76
  {
91
77
  ref,
92
78
  className: cx(classes.container, classes[variant]),
93
- style: statusInlineStyle,
79
+ style: mergeStyles(void 0, {
80
+ // we're using the boxShadow to have the border inside the container and not on its edge.
81
+ boxShadow: status && `inset 0px 0px 0px 2px ${statusColor}`
82
+ }),
94
83
  ...others,
95
84
  children: [
96
85
  badge && /* @__PURE__ */ jsx(
@@ -105,7 +94,12 @@ const HvAvatar = forwardRef(function HvAvatar2(props, ref) {
105
94
  {
106
95
  component,
107
96
  className: cx(classes.root, classes.avatar, classes[size], className),
108
- style: inlineStyle,
97
+ "data-color": color,
98
+ style: mergeStyles(style, {
99
+ "--bgColor": !hasImgNotFailing && getColor(backgroundColor, "text"),
100
+ "--textColor": !hasImgNotFailing && getColor(color, "bgContainer"),
101
+ borderRadius: component != null && typeof component !== "string" && "50%"
102
+ }),
109
103
  variant,
110
104
  size,
111
105
  ...avatarProps,
@@ -1,10 +1,8 @@
1
1
  import { createClasses } from "@hitachivantara/uikit-react-utils";
2
2
  import { theme } from "@hitachivantara/uikit-styles";
3
- import { outlineStyles } from "../utils/focusUtils.js";
4
3
  const { staticClasses, useClasses } = createClasses("HvAvatar", {
5
- root: {
6
- fontSize: "1rem"
7
- },
4
+ // use `classes.avatar` instead
5
+ root: {},
8
6
  img: {
9
7
  width: "100%",
10
8
  height: "100%",
@@ -23,17 +21,21 @@ const { staticClasses, useClasses } = createClasses("HvAvatar", {
23
21
  position: "relative",
24
22
  padding: theme.space.xxs,
25
23
  height: "fit-content",
26
- ":focus-visible": {
27
- ...outlineStyles,
28
- borderRadius: 0
29
- }
24
+ fontSize: "1rem"
25
+ },
26
+ xs: { "--size": "24px", fontSize: theme.fontSizes.sm },
27
+ sm: { "--size": "32px", fontSize: theme.fontSizes.base },
28
+ md: { "--size": "40px", fontSize: theme.fontSizes.xl },
29
+ lg: { "--size": "52px", fontSize: theme.fontSizes.xl2 },
30
+ xl: { "--size": "88px", fontSize: theme.fontSizes.xl3 },
31
+ avatar: {
32
+ fontSize: "1em",
33
+ borderRadius: "inherit",
34
+ color: "var(--textColor)",
35
+ width: "var(--size)",
36
+ height: "var(--size)",
37
+ backgroundColor: "var(--bgColor)"
30
38
  },
31
- xs: { width: 24, height: 24, fontSize: "0.5rem" },
32
- sm: { width: 32, height: 32, fontSize: "0.625rem" },
33
- md: { width: 40, height: 40, fontSize: "1rem" },
34
- lg: { width: 52, height: 52, fontSize: "1.5rem" },
35
- xl: { width: 88, height: 88, fontSize: "2rem" },
36
- avatar: { borderRadius: "inherit" },
37
39
  badge: {
38
40
  width: 8,
39
41
  height: 8,
@@ -1,82 +1,23 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, Children } from "react";
3
- import { useDefaultProps, mergeStyles, useCss } from "@hitachivantara/uikit-react-utils";
4
- import { theme } from "@hitachivantara/uikit-styles";
3
+ import { useDefaultProps, mergeStyles } from "@hitachivantara/uikit-react-utils";
5
4
  import { HvAvatar } from "../Avatar/Avatar.js";
6
5
  import { useClasses } from "./AvatarGroup.styles.js";
7
6
  import { staticClasses } from "./AvatarGroup.styles.js";
8
7
  import { HvAvatarGroupProvider } from "./AvatarGroupContext.js";
9
8
  const getSpacingValue = (spacing, size) => {
10
9
  switch (size) {
11
- case "xs":
12
- return spacing === "compact" ? 24 : 16;
13
- case "sm":
14
- return spacing === "compact" ? 30 : 18;
15
- case "md":
16
- return spacing === "compact" ? 36 : 20;
17
- case "lg":
18
- return spacing === "compact" ? 44 : 24;
19
10
  case "xl":
20
- return spacing === "compact" ? 72 : 34;
21
- default:
22
- return spacing === "compact" ? 30 : 18;
23
- }
24
- };
25
- const getFontSize = (size) => {
26
- switch (size) {
11
+ return spacing === "compact" ? 40 : 16;
12
+ case "lg":
13
+ case "md":
14
+ return spacing === "compact" ? 32 : 20;
27
15
  case "xs":
28
- return "1em";
29
16
  case "sm":
30
- return "1.25em";
31
- case "md":
32
- return "1.5em";
33
- case "lg":
34
- return "1.75em";
35
- case "xl":
36
- return "3em";
37
17
  default:
38
- return "1em";
18
+ return spacing === "compact" ? 24 : 12;
39
19
  }
40
20
  };
41
- const Overflow = ({
42
- direction,
43
- childrenToShow,
44
- spacingValue,
45
- overflowComponent,
46
- totalChildren,
47
- maxVisible,
48
- size
49
- }) => {
50
- const { css } = useCss();
51
- return /* @__PURE__ */ jsx(
52
- "div",
53
- {
54
- style: {
55
- marginLeft: direction === "row" && childrenToShow.length > 0 ? -spacingValue : 0,
56
- marginTop: direction === "column" && childrenToShow.length > 0 ? -spacingValue : 0,
57
- zIndex: 0
58
- },
59
- children: overflowComponent ? overflowComponent(totalChildren - maxVisible) : /* @__PURE__ */ jsxs(
60
- HvAvatar,
61
- {
62
- size,
63
- backgroundColor: theme.colors.border,
64
- classes: {
65
- avatar: css({
66
- [`&.HvAvatar-${size}`]: {
67
- fontSize: getFontSize(size)
68
- }
69
- })
70
- },
71
- children: [
72
- "+",
73
- totalChildren - maxVisible
74
- ]
75
- }
76
- )
77
- }
78
- );
79
- };
80
21
  const HvAvatarGroup = forwardRef(
81
22
  function HvAvatarGroup2(props, ref) {
82
23
  const {
@@ -94,11 +35,20 @@ const HvAvatarGroup = forwardRef(
94
35
  ...others
95
36
  } = useDefaultProps("HvAvatarGroup", props);
96
37
  const { classes, cx } = useClasses(classesProp);
97
- const spacingValue = getSpacingValue(spacing, size);
98
38
  const totalChildren = Children.count(children);
99
39
  const willOverflow = totalChildren > maxVisible;
40
+ const overflowValue = totalChildren - maxVisible;
100
41
  const childrenToShow = Children.toArray(children).slice(0, maxVisible);
101
42
  if (toBack) childrenToShow.reverse();
43
+ const overflowElement = /* @__PURE__ */ jsx("div", { children: overflowComponent?.(overflowValue) || /* @__PURE__ */ jsx(
44
+ HvAvatar,
45
+ {
46
+ size,
47
+ avatarProps: { ["data-color"]: "neutral" },
48
+ backgroundColor: "border",
49
+ children: `+${overflowValue}`
50
+ }
51
+ ) });
102
52
  return /* @__PURE__ */ jsx(
103
53
  "div",
104
54
  {
@@ -112,36 +62,14 @@ const HvAvatarGroup = forwardRef(
112
62
  className
113
63
  ),
114
64
  style: mergeStyles(style, {
115
- "--spacing": `-${spacingValue}px`
65
+ "--spacing": `-${getSpacingValue(spacing, size)}px`
116
66
  }),
117
67
  ref,
118
68
  ...others,
119
69
  children: /* @__PURE__ */ jsxs(HvAvatarGroupProvider, { size, children: [
120
- toBack && willOverflow && /* @__PURE__ */ jsx(
121
- Overflow,
122
- {
123
- childrenToShow,
124
- direction,
125
- maxVisible,
126
- overflowComponent,
127
- size,
128
- spacingValue,
129
- totalChildren
130
- }
131
- ),
70
+ toBack && willOverflow && overflowElement,
132
71
  childrenToShow,
133
- !toBack && willOverflow && /* @__PURE__ */ jsx(
134
- Overflow,
135
- {
136
- childrenToShow,
137
- direction,
138
- maxVisible,
139
- overflowComponent,
140
- size,
141
- spacingValue,
142
- totalChildren
143
- }
144
- )
72
+ !toBack && willOverflow && overflowElement
145
73
  ] })
146
74
  }
147
75
  );
@@ -16,15 +16,13 @@ const { staticClasses, useClasses } = createClasses("HvAvatarGroup", {
16
16
  row: {
17
17
  flexDirection: "row",
18
18
  justifyContent: "flex-start",
19
- [`& .${staticClasses$1.container}`]: {
20
- "&:not(:first-of-type)": {
21
- marginLeft: "var(--spacing)"
22
- }
19
+ "&>*:not(:first-of-type)": {
20
+ marginLeft: "var(--spacing)"
23
21
  },
24
22
  "&$toBack": {
25
23
  flexDirection: "row-reverse",
26
24
  justifyContent: "flex-end",
27
- [`& .${staticClasses$1.container}`]: {
25
+ "&>*": {
28
26
  "&:last-of-type": {
29
27
  marginLeft: 0
30
28
  },
@@ -36,14 +34,12 @@ const { staticClasses, useClasses } = createClasses("HvAvatarGroup", {
36
34
  },
37
35
  column: {
38
36
  flexDirection: "column",
39
- [`& .${staticClasses$1.container}`]: {
40
- "&:not(:first-of-type)": {
41
- marginTop: "var(--spacing)"
42
- }
37
+ "&>*:not(:first-of-type)": {
38
+ marginTop: "var(--spacing)"
43
39
  },
44
40
  "&$toBack": {
45
41
  flexDirection: "column-reverse",
46
- [`& .${staticClasses$1.container}`]: {
42
+ "&>*": {
47
43
  "&:last-of-type": {
48
44
  marginTop: 0
49
45
  },
@@ -54,7 +50,7 @@ const { staticClasses, useClasses } = createClasses("HvAvatarGroup", {
54
50
  }
55
51
  },
56
52
  highlight: {
57
- [`& .${staticClasses$1.container}:hover`]: {
53
+ "&>*:hover": {
58
54
  zIndex: theme.zIndices.popover
59
55
  }
60
56
  },
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, isValidElement } from "react";
3
- import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
3
+ import { useDefaultProps, useTheme } from "@hitachivantara/uikit-react-utils";
4
4
  import { useClasses } from "./BreadCrumb.styles.js";
5
5
  import { staticClasses } from "./BreadCrumb.styles.js";
6
6
  import { pathWithSubMenu, removeExtension } from "./utils.js";
@@ -18,9 +18,11 @@ const HvBreadCrumb = forwardRef(function HvBreadCrumb2(props, ref) {
18
18
  onClick,
19
19
  component,
20
20
  dropDownMenuProps,
21
+ separator,
21
22
  ...others
22
23
  } = useDefaultProps("HvBreadCrumb", props);
23
24
  const { classes, cx } = useClasses(classesProp);
25
+ const { activeTheme } = useTheme();
24
26
  const maxVisibleElem = maxVisible && maxVisible < 2 ? 2 : maxVisible;
25
27
  let listPath = listRoute.slice();
26
28
  if (url != null) {
@@ -36,11 +38,13 @@ const HvBreadCrumb = forwardRef(function HvBreadCrumb2(props, ref) {
36
38
  listPath,
37
39
  maxVisibleElem,
38
40
  onClick,
39
- dropDownMenuProps
41
+ dropDownMenuProps,
42
+ activeTheme?.name === "pentahoPlus" ? 2 : 1
40
43
  ) : listPath;
41
44
  return /* @__PURE__ */ jsx("nav", { ref, id, className: cx(classes.root, className), ...others, children: /* @__PURE__ */ jsx("ol", { className: classes.orderedList, children: listPath.map((elem, index) => {
42
45
  const key = `key_${index}`;
43
46
  const isLast = index === breadcrumbPath.length - 1;
47
+ const isFirst = index === 0;
44
48
  return /* @__PURE__ */ jsx(
45
49
  HvPathElement,
46
50
  {
@@ -49,10 +53,19 @@ const HvBreadCrumb = forwardRef(function HvBreadCrumb2(props, ref) {
49
53
  separatorContainer: classes.separatorContainer
50
54
  },
51
55
  last: isLast,
52
- children: isValidElement(elem) && elem || isLast && /* @__PURE__ */ jsx(HvTypography, { className: classes.currentPage, variant: "body", children: removeExtension(elem.label) }) || /* @__PURE__ */ jsx(
56
+ separator,
57
+ children: isValidElement(elem) && elem || isLast && /* @__PURE__ */ jsx(
58
+ HvTypography,
59
+ {
60
+ className: classes.currentPage,
61
+ variant: "caption1",
62
+ children: removeExtension(elem.label)
63
+ }
64
+ ) || /* @__PURE__ */ jsx(
53
65
  HvBreadCrumbPage,
54
66
  {
55
67
  elem,
68
+ showHome: isFirst && activeTheme?.name === "pentahoPlus",
56
69
  classes: {
57
70
  a: classes.a,
58
71
  link: classes.link
@@ -1,14 +1,18 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
3
+ import { SvgBase } from "../../icons.js";
3
4
  import { useClasses } from "./Page.styles.js";
4
5
  import { staticClasses } from "./Page.styles.js";
6
+ import { HvIconButton } from "../../IconButton/IconButton.js";
5
7
  import { HvTypography } from "../../Typography/Typography.js";
6
8
  import { HvOverflowTooltip } from "../../OverflowTooltip/OverflowTooltip.js";
9
+ const HomeIcon = (props) => /* @__PURE__ */ jsx(SvgBase, { viewBox: "0 0 256 256", width: "16", height: "16", ...props, children: /* @__PURE__ */ jsx("path", { d: "M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z" }) });
7
10
  const HvBreadCrumbPage = (props) => {
8
11
  const {
9
12
  component,
10
13
  onClick,
11
14
  elem,
15
+ showHome,
12
16
  classes: classesProp
13
17
  } = useDefaultProps("HvBreadCrumbPage", props);
14
18
  const { classes, cx } = useClasses(classesProp);
@@ -17,11 +21,20 @@ const HvBreadCrumbPage = (props) => {
17
21
  event.preventDefault();
18
22
  onClick?.(event, elem);
19
23
  };
20
- return /* @__PURE__ */ jsx(
24
+ return showHome ? /* @__PURE__ */ jsx(
25
+ HvIconButton,
26
+ {
27
+ title: elem.label,
28
+ component: component || "a",
29
+ href: elem.path,
30
+ onClick: onClick && handleClick,
31
+ children: /* @__PURE__ */ jsx(HomeIcon, {})
32
+ }
33
+ ) : /* @__PURE__ */ jsx(
21
34
  HvTypography,
22
35
  {
23
36
  noWrap: true,
24
- variant: "label",
37
+ variant: "captionLabel",
25
38
  component: component || "a",
26
39
  href: elem.path,
27
40
  onClick: onClick && handleClick,
@@ -5,20 +5,13 @@ import { staticClasses } from "./PathElement.styles.js";
5
5
  const HvPathElement = ({
6
6
  classes: classesProp,
7
7
  last = false,
8
+ separator,
8
9
  children
9
10
  }) => {
10
11
  const { classes } = useClasses(classesProp);
11
12
  return /* @__PURE__ */ jsxs("li", { className: classes.centerContainer, children: [
12
13
  children,
13
- !last && /* @__PURE__ */ jsx(
14
- HvIcon,
15
- {
16
- name: "CaretRight",
17
- size: "xs",
18
- className: classes.separatorContainer,
19
- color: "textDisabled"
20
- }
21
- )
14
+ !last && /* @__PURE__ */ jsx("div", { className: classes.separatorContainer, children: separator || /* @__PURE__ */ jsx(HvIcon, { name: "CaretRight", size: "xs", color: "textDisabled" }) })
22
15
  ] });
23
16
  };
24
17
  export {
@@ -2,15 +2,18 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { HvIcon } from "../icons.js";
3
3
  import { HvDropDownMenu } from "../DropDownMenu/DropDownMenu.js";
4
4
  const removeExtension = (label) => label.includes(".") ? label.slice(0, label.lastIndexOf(".")) : label;
5
- const pathWithSubMenu = (id, listRoute, maxVisible, onClick, dropDownMenuProps) => {
5
+ const pathWithSubMenu = (id, listRoute, maxVisible, onClick, dropDownMenuProps, moreOptionsPosition = 1) => {
6
6
  const nbrElemToSubMenu = listRoute.length - maxVisible;
7
- const subMenuList = listRoute.slice(1, nbrElemToSubMenu + 1);
7
+ const subMenuList = listRoute.slice(
8
+ 1,
9
+ nbrElemToSubMenu + moreOptionsPosition
10
+ );
8
11
  const handleClick = (event, data) => {
9
12
  event.preventDefault();
10
13
  onClick?.(event, data);
11
14
  };
12
15
  listRoute.splice(
13
- 1,
16
+ moreOptionsPosition,
14
17
  nbrElemToSubMenu,
15
18
  /* @__PURE__ */ jsx(
16
19
  HvDropDownMenu,
@@ -1,7 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useState, useRef, useEffect } from "react";
2
+ import { useState } from "react";
3
+ import { useResizeDetector } from "react-resize-detector";
3
4
  import MuiDialogContent from "@mui/material/DialogContent";
4
- import { useDefaultProps, mergeStyles } from "@hitachivantara/uikit-react-utils";
5
+ import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
5
6
  import { useClasses } from "./Content.styles.js";
6
7
  import { staticClasses } from "./Content.styles.js";
7
8
  import { HvTypography } from "../../Typography/Typography.js";
@@ -10,44 +11,34 @@ const HvDialogContent = (props) => {
10
11
  classes: classesProp,
11
12
  className,
12
13
  children,
13
- indentContent = false,
14
- style,
14
+ indentContent,
15
+ dividers,
15
16
  ...others
16
17
  } = useDefaultProps("HvDialogContent", props);
17
18
  const { classes, cx } = useClasses(classesProp);
18
19
  const [hasBorder, setHasBorder] = useState(false);
19
- const elRef = useRef(null);
20
- useEffect(() => {
21
- if (typeof ResizeObserver !== "undefined") {
22
- const resizeObserver = new ResizeObserver(() => {
23
- const el = elRef.current;
24
- if (el) {
25
- const hasOverflow = el.scrollHeight > el.clientHeight;
26
- setHasBorder(hasOverflow);
27
- }
28
- });
29
- if (elRef.current) {
30
- resizeObserver.observe(elRef.current);
31
- }
32
- return () => {
33
- resizeObserver.disconnect();
34
- };
20
+ const { ref: elRef } = useResizeDetector({
21
+ refreshMode: "throttle",
22
+ refreshRate: 100,
23
+ handleWidth: false,
24
+ disableRerender: true,
25
+ onResize: ({ entry }) => {
26
+ if (!entry) return;
27
+ const hasOverflow = entry.target.scrollHeight > entry.target.clientHeight;
28
+ setHasBorder(hasOverflow);
35
29
  }
36
- return void 0;
37
- }, []);
30
+ });
38
31
  return /* @__PURE__ */ jsx(
39
32
  HvTypography,
40
33
  {
41
34
  ref: elRef,
42
35
  component: MuiDialogContent,
36
+ dividers: dividers ?? hasBorder,
43
37
  className: cx(
44
38
  classes.root,
45
39
  { [classes.textContent]: !!indentContent },
46
40
  className
47
41
  ),
48
- style: mergeStyles(style, {
49
- "--borderW": hasBorder ? "1px" : "0px"
50
- }),
51
42
  ...others,
52
43
  children
53
44
  }
@@ -3,9 +3,7 @@ import { theme } from "@hitachivantara/uikit-styles";
3
3
  const { staticClasses, useClasses } = createClasses("HvDialogContent", {
4
4
  root: {
5
5
  padding: theme.spacing(0, "sm", "sm"),
6
- borderColor: theme.colors.borderSubtle,
7
- borderTopWidth: "var(--borderW)",
8
- borderBottomWidth: "var(--borderW)"
6
+ borderColor: theme.colors.borderSubtle
9
7
  },
10
8
  textContent: {
11
9
  paddingLeft: `calc(42px + ${theme.space.sm})`,
@@ -7,7 +7,7 @@ const { staticClasses, useClasses } = createClasses("HvDialog", {
7
7
  },
8
8
  paper: {
9
9
  color: theme.colors.text,
10
- backgroundColor: theme.colors.bgContainer,
10
+ background: theme.colors.bgContainer,
11
11
  boxShadow: theme.colors.shadow,
12
12
  borderColor: theme.colors.border,
13
13
  borderRadius: theme.radii.round
@@ -140,26 +140,28 @@ const HvFilterGroupContent = forwardRef(function HvFilterGroupContent2(props, re
140
140
  }
141
141
  ),
142
142
  /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: classes.space, children: " " }),
143
- /* @__PURE__ */ jsx(
144
- HvButton,
145
- {
146
- id: setId(id, "apply-button"),
147
- disabled: applyDisabled,
148
- variant: "primary",
149
- onClick: onApplyHandler,
150
- className: classes.applyButton,
151
- children: labels?.applyLabel
152
- }
153
- ),
154
- /* @__PURE__ */ jsx(
155
- HvButton,
156
- {
157
- id: setId(id, "cancel-button"),
158
- variant: "secondarySubtle",
159
- onClick: onCancelHandler,
160
- children: labels?.cancelLabel
161
- }
162
- )
143
+ /* @__PURE__ */ jsxs("div", { className: classes.actions, children: [
144
+ /* @__PURE__ */ jsx(
145
+ HvButton,
146
+ {
147
+ id: setId(id, "apply-button"),
148
+ disabled: applyDisabled,
149
+ variant: "primary",
150
+ onClick: onApplyHandler,
151
+ className: classes.applyButton,
152
+ children: labels?.applyLabel
153
+ }
154
+ ),
155
+ /* @__PURE__ */ jsx(
156
+ HvButton,
157
+ {
158
+ id: setId(id, "cancel-button"),
159
+ variant: "secondarySubtle",
160
+ onClick: onCancelHandler,
161
+ children: labels?.cancelLabel
162
+ }
163
+ )
164
+ ] })
163
165
  ] })
164
166
  ]
165
167
  }
@@ -40,12 +40,14 @@ const { staticClasses, useClasses } = createClasses(name, {
40
40
  minHeight: "calc(370px - 75px)"
41
41
  },
42
42
  actionBar: {},
43
+ actions: {
44
+ display: "flex",
45
+ gap: theme.space.xs
46
+ },
43
47
  space: {
44
48
  flex: 1
45
49
  },
46
- applyButton: {
47
- marginRight: "8px"
48
- }
50
+ applyButton: {}
49
51
  });
50
52
  export {
51
53
  staticClasses,
@@ -1,31 +1,15 @@
1
- const isDateInPeriod = (timeAgoMs, period, referenceDate = /* @__PURE__ */ new Date()) => {
2
- const date = new Date(timeAgoMs);
3
- const startOfToday = new Date(referenceDate);
4
- startOfToday.setHours(0, 0, 0, 0);
5
- const startOfTomorrow = new Date(startOfToday);
6
- startOfTomorrow.setDate(startOfToday.getDate() + 1);
7
- const startOfDayAfterTomorrow = new Date(startOfTomorrow);
8
- startOfDayAfterTomorrow.setDate(startOfTomorrow.getDate() + 1);
9
- if (period === "tomorrow") {
10
- return date >= startOfTomorrow && date < startOfDayAfterTomorrow;
11
- }
12
- if (period === "afterTomorrow") {
13
- return date >= startOfDayAfterTomorrow;
14
- }
15
- return false;
16
- };
17
1
  const formatTimeAgo = (timeAgoMs, locale, showSeconds = false, referenceDate = /* @__PURE__ */ new Date()) => {
18
2
  const relFormatter = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
19
3
  const dayFormatter = new Intl.DateTimeFormat(locale, {
20
4
  hour: "numeric",
21
5
  minute: "numeric",
22
- second: showSeconds ? "numeric" : void 0
6
+ ...showSeconds && { second: "numeric" }
23
7
  });
24
8
  const weekFormatter = new Intl.DateTimeFormat(locale, {
25
9
  weekday: "short",
26
10
  hour: "numeric",
27
11
  minute: "numeric",
28
- second: showSeconds ? "numeric" : void 0
12
+ ...showSeconds && { second: "numeric" }
29
13
  });
30
14
  const fullFormatter = new Intl.DateTimeFormat(locale, {
31
15
  year: "numeric",
@@ -33,33 +17,43 @@ const formatTimeAgo = (timeAgoMs, locale, showSeconds = false, referenceDate = /
33
17
  day: "numeric",
34
18
  hour: "numeric",
35
19
  minute: "numeric",
36
- second: showSeconds ? "numeric" : void 0
20
+ ...showSeconds && { second: "numeric" }
37
21
  });
38
22
  const date = new Date(timeAgoMs);
39
- const secsInDay = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
40
- const secsInWeek = date.getDay() * 86400 + secsInDay;
41
23
  const secsAgo = Math.floor((referenceDate.getTime() - timeAgoMs) / 1e3);
42
24
  const minsAgo = Math.floor(secsAgo / 60);
25
+ const getStartOfDay = (offset) => {
26
+ const d = new Date(referenceDate);
27
+ d.setHours(0, 0, 0, 0);
28
+ d.setDate(d.getDate() + offset);
29
+ return d;
30
+ };
31
+ const startOfYesterday = getStartOfDay(-1);
32
+ const startOfToday = getStartOfDay(0);
33
+ const startOfTomorrow = getStartOfDay(1);
34
+ const startOfDayAfterTomorrow = getStartOfDay(2);
35
+ const secsInDay = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
36
+ const secsInWeek = date.getDay() * 86400 + secsInDay;
43
37
  switch (true) {
44
- case isDateInPeriod(timeAgoMs, "afterTomorrow", referenceDate):
38
+ case date >= startOfDayAfterTomorrow:
45
39
  return fullFormatter.format(date);
46
- case isDateInPeriod(timeAgoMs, "tomorrow", referenceDate):
40
+ case date >= startOfTomorrow:
47
41
  return `${relFormatter.format(1, "days")}, ${dayFormatter.format(date)}`;
48
42
  case minsAgo < -60:
49
43
  return `${relFormatter.format(0, "days")}, ${dayFormatter.format(date)}`;
50
44
  case minsAgo < -2:
51
45
  return relFormatter.format(-minsAgo, "minutes");
52
46
  case secsAgo < 0:
53
- return `${relFormatter.format(Math.abs(secsAgo), "seconds")}`;
47
+ return relFormatter.format(Math.abs(secsAgo), "seconds");
54
48
  case secsAgo < 20:
55
49
  return relFormatter.format(0, "seconds");
56
50
  case minsAgo < 2:
57
51
  return relFormatter.format(-secsAgo, "seconds");
58
52
  case minsAgo < 60:
59
53
  return relFormatter.format(-minsAgo, "minutes");
60
- case secsAgo < secsInDay:
54
+ case date >= startOfToday:
61
55
  return `${relFormatter.format(0, "days")}, ${dayFormatter.format(date)}`;
62
- case secsAgo < secsInDay + 86400:
56
+ case date >= startOfYesterday:
63
57
  return `${relFormatter.format(-1, "days")}, ${dayFormatter.format(date)}`;
64
58
  case secsAgo < secsInWeek:
65
59
  return weekFormatter.format(date);
@@ -134,7 +134,8 @@ const { staticClasses, useClasses } = createClasses(
134
134
  marginLeft: "auto"
135
135
  },
136
136
  [`&& .${staticClasses$1.root}`]: {
137
- fontSize: "15px"
137
+ fontSize: "15px",
138
+ borderColor: "transparent"
138
139
  }
139
140
  }
140
141
  }
package/dist/index.d.ts CHANGED
@@ -1707,6 +1707,8 @@ export declare interface HvBreadCrumbProps extends HvBaseProps<HTMLDivElement, "
1707
1707
  onClick?: (event: React.MouseEvent<HTMLElement>, data: any) => void;
1708
1708
  /** Props passed down to the DropDownMenu sub-menu component. */
1709
1709
  dropDownMenuProps?: Partial<HvDropDownMenuProps>;
1710
+ /** Separator element between breadcrumb items. */
1711
+ separator?: React.ReactNode;
1710
1712
  /** A Jss Object used to override or extend the styles applied to the component. */
1711
1713
  classes?: HvBreadCrumbClasses;
1712
1714
  }
@@ -8207,7 +8209,7 @@ declare const useClasses_127: (classesProp?: Partial<Record<"action" | "minimize
8207
8209
  readonly cx: (...args: any) => string;
8208
8210
  };
8209
8211
 
8210
- declare const useClasses_128: (classesProp?: Partial<Record<"list" | "popup" | "root" | "collapsed" | "listItem" | "navigationPopup", string>>, addStatic?: boolean) => {
8212
+ declare const useClasses_128: (classesProp?: Partial<Record<"list" | "popup" | "root" | "listItem" | "collapsed" | "navigationPopup", string>>, addStatic?: boolean) => {
8211
8213
  readonly classes: {
8212
8214
  root: string;
8213
8215
  list: string;
@@ -9291,7 +9293,7 @@ declare const useClasses_74: (classesProp?: Partial<Record<"label" | "error" | "
9291
9293
  readonly cx: (...args: any) => string;
9292
9294
  };
9293
9295
 
9294
- declare const useClasses_75: (classesProp?: Partial<Record<"dropdown" | "space" | "header" | "root" | "panel" | "baseDropdownSelection" | "rightSidePanel" | "leftSidePanel" | "actionBar" | "applyButton", string>>, addStatic?: boolean) => {
9296
+ declare const useClasses_75: (classesProp?: Partial<Record<"dropdown" | "space" | "header" | "root" | "panel" | "actions" | "baseDropdownSelection" | "rightSidePanel" | "leftSidePanel" | "actionBar" | "applyButton", string>>, addStatic?: boolean) => {
9295
9297
  readonly classes: {
9296
9298
  dropdown: string;
9297
9299
  panel: string;
@@ -9301,6 +9303,7 @@ declare const useClasses_75: (classesProp?: Partial<Record<"dropdown" | "space"
9301
9303
  rightSidePanel: string;
9302
9304
  leftSidePanel: string;
9303
9305
  actionBar: string;
9306
+ actions: string;
9304
9307
  space: string;
9305
9308
  applyButton: string;
9306
9309
  };
@@ -1,6 +1,36 @@
1
- import { mergeTheme, pentaho as pentaho$1, theme, neutral, slate, blue } from "@hitachivantara/uikit-styles";
1
+ import { mergeTheme, pentaho as pentaho$1, theme, neutral, slate, blue, yellow, pink, violet, teal, orange } from "@hitachivantara/uikit-styles";
2
2
  const ld = (c1, c2) => `light-dark(${c1}, ${c2})`;
3
3
  const semaColors = ["positive", "warning", "negative", "info"];
4
+ const avatarColors = {
5
+ blue: {
6
+ color: ld(theme.colors.primaryStrong, blue[300]),
7
+ backgroundColor: ld(theme.colors.primaryDimmed, blue[900])
8
+ },
9
+ orange: {
10
+ color: ld(orange[700], orange[200]),
11
+ backgroundColor: ld(orange[200], orange[900])
12
+ },
13
+ teal: {
14
+ color: ld(teal[800], teal[200]),
15
+ backgroundColor: ld(teal[200], teal[900])
16
+ },
17
+ violet: {
18
+ color: ld(violet[800], violet[200]),
19
+ backgroundColor: ld(violet[200], violet[900])
20
+ },
21
+ pink: {
22
+ color: ld(pink[900], pink[200]),
23
+ backgroundColor: ld(pink[200], pink[900])
24
+ },
25
+ yellow: {
26
+ color: ld(yellow[700], yellow[100]),
27
+ backgroundColor: ld(yellow[200], yellow[900])
28
+ },
29
+ neutral: {
30
+ color: ld(slate[400], slate[300]),
31
+ backgroundColor: ld(slate[200], slate[700])
32
+ }
33
+ };
4
34
  const notificationMap = {
5
35
  success: "positive",
6
36
  warning: "warning",
@@ -33,6 +63,44 @@ const pentaho = mergeTheme(pentaho$1, {
33
63
  End: "M141.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L124.69,128,50.34,53.66A8,8,0,0,1,61.66,42.34l80,80A8,8,0,0,1,141.66,133.66Zm80-11.32-80-80a8,8,0,0,0-11.32,11.32L204.69,128l-74.35,74.34a8,8,0,0,0,11.32,11.32l80-80A8,8,0,0,0,221.66,122.34Z"
34
64
  },
35
65
  components: {
66
+ HvAvatar: {
67
+ color: "primaryStrong",
68
+ backgroundColor: "primaryDimmed",
69
+ classes: {
70
+ avatar: {
71
+ border: `1px solid ${theme.colors.bgContainerSecondary}`,
72
+ fontWeight: theme.fontWeights.semibold,
73
+ ...Object.entries(avatarColors).reduce(
74
+ (acc, [color, styles]) => {
75
+ acc[`&[data-color=${color}]`] = styles;
76
+ return acc;
77
+ },
78
+ {}
79
+ )
80
+ },
81
+ xs: { "--size": "24px", fontSize: theme.fontSizes.sm },
82
+ sm: { "--size": "24px", fontSize: theme.fontSizes.sm },
83
+ md: { "--size": "32px", fontSize: theme.fontSizes.base },
84
+ lg: { "--size": "48px", fontSize: theme.fontSizes.xl2 },
85
+ xl: { "--size": "64px", fontSize: theme.fontSizes.xl3 }
86
+ }
87
+ },
88
+ HvAvatarGroup: {
89
+ maxVisible: 4,
90
+ classes: {
91
+ root: {
92
+ // eslint-disable-next-line no-useless-spread
93
+ ...Object.values(avatarColors).reduce(
94
+ (acc, styles, i) => {
95
+ const key = `&>.HvAvatar-container:nth-of-type(${i + 1}) .HvAvatar-avatar`;
96
+ acc[key] = styles;
97
+ return acc;
98
+ },
99
+ {}
100
+ )
101
+ }
102
+ }
103
+ },
36
104
  HvLoading: {
37
105
  classes: {
38
106
  loadingBar: {
@@ -43,7 +111,8 @@ const pentaho = mergeTheme(pentaho$1, {
43
111
  HvBadge: {
44
112
  classes: {
45
113
  badge: {
46
- color: ld(theme.colors.textLight, theme.colors.textDark),
114
+ "--bg-color": theme.colors.textSubtle,
115
+ color: ld("white", "black"),
47
116
  "&[data-color='textSubtle']:not(:empty)": {
48
117
  color: theme.colors.textSubtle,
49
118
  backgroundColor: theme.colors.bgPageSecondary
@@ -378,6 +447,7 @@ const pentaho = mergeTheme(pentaho$1, {
378
447
  HvButtonBase: {
379
448
  classes: {
380
449
  root: {
450
+ borderRadius: theme.radii.base,
381
451
  ":where(:not(.HvButtonBase-disabled))": {
382
452
  ":hover": { backgroundColor: theme.colors.primaryDimmed },
383
453
  ":active": { backgroundColor: theme.colors.primarySubtle }
@@ -1053,6 +1123,32 @@ const pentaho = mergeTheme(pentaho$1, {
1053
1123
  minHeight: "unset"
1054
1124
  }
1055
1125
  }
1126
+ },
1127
+ HvBreadCrumb: {
1128
+ classes: {
1129
+ currentPage: {
1130
+ fontWeight: theme.fontWeights.semibold,
1131
+ padding: `0 ${theme.space.xxs}`
1132
+ },
1133
+ separatorContainer: {
1134
+ padding: `0 ${theme.space.xxs}`
1135
+ },
1136
+ link: {
1137
+ height: 24,
1138
+ display: "flex",
1139
+ alignItems: "center",
1140
+ padding: `0px ${theme.space.xxs}`,
1141
+ fontWeight: theme.fontWeights.normal
1142
+ }
1143
+ },
1144
+ separator: "/"
1145
+ },
1146
+ HvFilterGroupContent: {
1147
+ classes: {
1148
+ actions: {
1149
+ flexDirection: "row-reverse"
1150
+ }
1151
+ }
1056
1152
  }
1057
1153
  }
1058
1154
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-core",
3
- "version": "6.3.0",
3
+ "version": "6.4.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "Hitachi Vantara UI Kit Team",
@@ -34,7 +34,7 @@
34
34
  "@emotion/cache": "^11.11.0",
35
35
  "@emotion/serialize": "^1.1.2",
36
36
  "@hitachivantara/uikit-react-shared": "^6.0.2",
37
- "@hitachivantara/uikit-react-utils": "^6.1.1",
37
+ "@hitachivantara/uikit-react-utils": "^6.2.0",
38
38
  "@hitachivantara/uikit-styles": "^6.0.2",
39
39
  "@internationalized/date": "^3.2.0",
40
40
  "@mui/base": "5.0.0-beta.68",
@@ -61,7 +61,7 @@
61
61
  "access": "public",
62
62
  "directory": "package"
63
63
  },
64
- "gitHead": "f2b8a9e107bc8886231d527b37b30716d891105c",
64
+ "gitHead": "5dc28acf7238a5b194609f7e671b618fe7f0b0bc",
65
65
  "exports": {
66
66
  ".": {
67
67
  "types": "./dist/index.d.ts",