@hitachivantara/uikit-react-core 6.2.0 → 6.4.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/AppSwitcher/Action/Action.js +18 -23
- package/dist/AppSwitcher/Action/Action.styles.js +2 -2
- package/dist/Avatar/Avatar.js +16 -22
- package/dist/Avatar/Avatar.styles.js +16 -14
- package/dist/AvatarGroup/AvatarGroup.js +19 -91
- package/dist/AvatarGroup/AvatarGroup.styles.js +7 -11
- package/dist/BreadCrumb/BreadCrumb.js +16 -3
- package/dist/BreadCrumb/Page/Page.js +15 -2
- package/dist/BreadCrumb/PathElement/PathElement.js +2 -9
- package/dist/BreadCrumb/utils.js +6 -3
- package/dist/Pagination/Pagination.js +10 -12
- package/dist/Pagination/Pagination.styles.js +11 -29
- package/dist/Section/Section.js +2 -2
- package/dist/SimpleGrid/SimpleGrid.styles.js +2 -2
- package/dist/StatusIcon/StatusIcon.styles.js +2 -2
- package/dist/Table/TableCell/TableCell.styles.js +1 -1
- package/dist/Table/TableHeader/TableHeader.js +18 -18
- package/dist/Table/TableHeader/TableHeader.styles.js +20 -21
- package/dist/Table/TableSection/TableSection.js +1 -4
- package/dist/Table/renderers/renderers.js +24 -21
- package/dist/TimeAgo/formatUtils.js +20 -26
- package/dist/VerticalNavigation/TreeView/TreeView.js +1 -1
- package/dist/VerticalNavigation/TreeView/TreeViewItem.styles.js +2 -1
- package/dist/hooks/useWidth.js +3 -1
- package/dist/index.d.ts +4 -2
- package/dist/themes/pentaho.js +108 -5
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
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
|
|
26
|
-
"text"
|
|
25
|
+
disabled && "textDisabled" || application?.color || "text"
|
|
27
26
|
);
|
|
28
|
-
const [validIconUrl, setValidIconUrl] = useState(true);
|
|
29
27
|
const renderApplicationIcon = () => {
|
|
30
|
-
if (iconElement)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
"
|
|
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: {
|
|
12
|
+
iconUrl: { borderColor: "transparent" },
|
|
13
13
|
iconInfo: { minWidth: 32 },
|
|
14
14
|
disabled: {},
|
|
15
15
|
selected: {},
|
package/dist/Avatar/Avatar.js
CHANGED
|
@@ -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
|
|
27
|
-
color
|
|
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 (
|
|
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
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
|
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" ?
|
|
21
|
-
|
|
22
|
-
|
|
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 "
|
|
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": `-${
|
|
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 &&
|
|
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 &&
|
|
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
|
-
|
|
20
|
-
"
|
|
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
|
-
|
|
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
|
-
|
|
40
|
-
"
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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: "
|
|
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 {
|
package/dist/BreadCrumb/utils.js
CHANGED
|
@@ -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(
|
|
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
|
-
|
|
16
|
+
moreOptionsPosition,
|
|
14
17
|
nbrElemToSubMenu,
|
|
15
18
|
/* @__PURE__ */ jsx(
|
|
16
19
|
HvDropDownMenu,
|
|
@@ -9,12 +9,11 @@ import { useClasses } from "./Pagination.styles.js";
|
|
|
9
9
|
import { staticClasses } from "./Pagination.styles.js";
|
|
10
10
|
import HvSelect, { Option } from "./Select.js";
|
|
11
11
|
import { HvIconButton } from "../IconButton/IconButton.js";
|
|
12
|
-
import { HvTypography } from "../Typography/Typography.js";
|
|
13
12
|
import { HvBaseInput } from "../BaseInput/BaseInput.js";
|
|
14
13
|
const defaultPageSizeOptions = [5, 10, 20, 25, 50, 100];
|
|
15
14
|
const DEFAULT_LABELS = {
|
|
16
15
|
/** The show label. */
|
|
17
|
-
pageSizePrev: "
|
|
16
|
+
pageSizePrev: "",
|
|
18
17
|
/** Indicate the units of the page size selection. */
|
|
19
18
|
pageSizeEntryName: "rows",
|
|
20
19
|
/** Used for the aria-label of the selection of number of unit.s */
|
|
@@ -36,15 +35,14 @@ const HvPagination = forwardRef(function HvPagination2(props, ref) {
|
|
|
36
35
|
const {
|
|
37
36
|
classes: classesProp,
|
|
38
37
|
className,
|
|
39
|
-
id,
|
|
40
38
|
pages = 1,
|
|
41
39
|
page = 0,
|
|
42
40
|
showPageSizeOptions = true,
|
|
43
41
|
pageSizeOptions = defaultPageSizeOptions,
|
|
44
42
|
pageSize = defaultPageSizeOptions[1],
|
|
45
43
|
showPageJump = true,
|
|
46
|
-
canPrevious
|
|
47
|
-
canNext
|
|
44
|
+
canPrevious,
|
|
45
|
+
canNext,
|
|
48
46
|
onPageChange,
|
|
49
47
|
onPageSizeChange,
|
|
50
48
|
labels: labelsProp,
|
|
@@ -56,7 +54,7 @@ const HvPagination = forwardRef(function HvPagination2(props, ref) {
|
|
|
56
54
|
const { classes, cx } = useClasses(classesProp);
|
|
57
55
|
const labels = useLabels(DEFAULT_LABELS, labelsProp);
|
|
58
56
|
const muiTheme = useTheme();
|
|
59
|
-
const isXsDown = useMediaQuery(muiTheme.breakpoints.
|
|
57
|
+
const isXsDown = useMediaQuery(muiTheme.breakpoints.only("xs"));
|
|
60
58
|
const [pageInput, setPageInput] = useState(page);
|
|
61
59
|
const changePage = useCallback(
|
|
62
60
|
(newPage) => {
|
|
@@ -97,14 +95,14 @@ const HvPagination = forwardRef(function HvPagination2(props, ref) {
|
|
|
97
95
|
...currentPageInputProps
|
|
98
96
|
}
|
|
99
97
|
);
|
|
100
|
-
return /* @__PURE__ */ jsxs("div", { ref,
|
|
101
|
-
/* @__PURE__ */ jsx("div", { className: classes.pageSizeOptions, ...showPageProps, children:
|
|
102
|
-
!isXsDown && /* @__PURE__ */ jsx("span", { className: classes
|
|
98
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cx(classes.root, className), ...others, children: [
|
|
99
|
+
showPageSizeOptions && /* @__PURE__ */ jsx("div", { className: classes.pageSizeOptions, ...showPageProps, children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
100
|
+
!isXsDown && labels.pageSizePrev && /* @__PURE__ */ jsx("span", { className: classes.pageSizeTextContainer, children: labels.pageSizePrev }),
|
|
103
101
|
/* @__PURE__ */ jsx(
|
|
104
102
|
HvSelect,
|
|
105
103
|
{
|
|
106
104
|
disabled: pageSize === 0,
|
|
107
|
-
"aria-label": labels
|
|
105
|
+
"aria-label": labels.pageSizeSelectorDescription,
|
|
108
106
|
onChange: (evt, val) => onPageSizeChange?.(val),
|
|
109
107
|
value: pageSize,
|
|
110
108
|
classes: {
|
|
@@ -114,7 +112,7 @@ const HvPagination = forwardRef(function HvPagination2(props, ref) {
|
|
|
114
112
|
children: pageSizeOptions.map((option) => /* @__PURE__ */ jsx(Option, { value: option, children: option }, option))
|
|
115
113
|
}
|
|
116
114
|
),
|
|
117
|
-
!isXsDown && /* @__PURE__ */ jsx("span", { className: classes.pageSizeTextContainer, children: labels
|
|
115
|
+
!isXsDown && labels.pageSizeEntryName && /* @__PURE__ */ jsx("span", { className: classes.pageSizeTextContainer, children: labels.pageSizeEntryName })
|
|
118
116
|
] }) }),
|
|
119
117
|
/* @__PURE__ */ jsxs("div", { className: classes.pageNavigator, ...navigationProps, children: [
|
|
120
118
|
/* @__PURE__ */ jsx(
|
|
@@ -139,7 +137,7 @@ const HvPagination = forwardRef(function HvPagination2(props, ref) {
|
|
|
139
137
|
),
|
|
140
138
|
/* @__PURE__ */ jsxs("div", { className: classes.pageInfo, children: [
|
|
141
139
|
showPageJump ? renderPageJump() : /* @__PURE__ */ jsx("span", { children: `${page + 1}` }),
|
|
142
|
-
/* @__PURE__ */ jsx(
|
|
140
|
+
/* @__PURE__ */ jsx("span", { children: `${labels?.pagesSeparator} ` }),
|
|
143
141
|
/* @__PURE__ */ jsx("span", { children: pages })
|
|
144
142
|
] }),
|
|
145
143
|
/* @__PURE__ */ jsx(
|