@hitachivantara/uikit-react-core 5.63.0 → 5.63.2
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/cjs/AppSwitcher/Action/Action.cjs +1 -1
- package/dist/cjs/Avatar/Avatar.cjs +4 -1
- package/dist/cjs/AvatarGroup/AvatarGroup.cjs +95 -51
- package/dist/cjs/AvatarGroup/AvatarGroup.styles.cjs +54 -4
- package/dist/cjs/AvatarGroup/AvatarGroupContext.cjs +19 -0
- package/dist/cjs/CheckBoxGroup/CheckBoxGroup.styles.cjs +2 -2
- package/dist/cjs/Dialog/Dialog.cjs +0 -1
- package/dist/cjs/Drawer/Drawer.cjs +0 -5
- package/dist/cjs/FilterGroup/Counter/Counter.cjs +4 -6
- package/dist/cjs/FilterGroup/LeftPanel/LeftPanel.cjs +13 -17
- package/dist/cjs/FilterGroup/RightPanel/RightPanel.styles.cjs +1 -4
- package/dist/cjs/Input/Input.cjs +1 -3
- package/dist/cjs/List/List.cjs +25 -57
- package/dist/cjs/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.cjs +25 -20
- package/dist/cjs/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.cjs +24 -29
- package/dist/cjs/ScrollTo/Horizontal/ScrollToHorizontal.cjs +28 -66
- package/dist/cjs/ScrollTo/Horizontal/ScrollToHorizontal.styles.cjs +3 -20
- package/dist/cjs/ScrollTo/Vertical/ScrollToVertical.cjs +9 -22
- package/dist/cjs/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.cjs +8 -15
- package/dist/cjs/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.cjs +12 -7
- package/dist/cjs/providers/ThemeProvider.cjs +7 -0
- package/dist/esm/AppSwitcher/Action/Action.js +1 -1
- package/dist/esm/Avatar/Avatar.js +4 -1
- package/dist/esm/Avatar/Avatar.js.map +1 -1
- package/dist/esm/AvatarGroup/AvatarGroup.js +97 -53
- package/dist/esm/AvatarGroup/AvatarGroup.js.map +1 -1
- package/dist/esm/AvatarGroup/AvatarGroup.styles.js +54 -4
- package/dist/esm/AvatarGroup/AvatarGroup.styles.js.map +1 -1
- package/dist/esm/AvatarGroup/AvatarGroupContext.js +19 -0
- package/dist/esm/AvatarGroup/AvatarGroupContext.js.map +1 -0
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.styles.js +2 -2
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.styles.js.map +1 -1
- package/dist/esm/Dialog/Dialog.js +0 -1
- package/dist/esm/Dialog/Dialog.js.map +1 -1
- package/dist/esm/Drawer/Drawer.js +0 -5
- package/dist/esm/Drawer/Drawer.js.map +1 -1
- package/dist/esm/FilterGroup/Counter/Counter.js +4 -6
- package/dist/esm/FilterGroup/Counter/Counter.js.map +1 -1
- package/dist/esm/FilterGroup/LeftPanel/LeftPanel.js +13 -17
- package/dist/esm/FilterGroup/LeftPanel/LeftPanel.js.map +1 -1
- package/dist/esm/FilterGroup/RightPanel/RightPanel.js.map +1 -1
- package/dist/esm/FilterGroup/RightPanel/RightPanel.styles.js +1 -4
- package/dist/esm/FilterGroup/RightPanel/RightPanel.styles.js.map +1 -1
- package/dist/esm/Input/Input.js +1 -3
- package/dist/esm/Input/Input.js.map +1 -1
- package/dist/esm/List/List.js +25 -57
- package/dist/esm/List/List.js.map +1 -1
- package/dist/esm/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.js +26 -21
- package/dist/esm/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.js.map +1 -1
- package/dist/esm/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.js +24 -29
- package/dist/esm/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.js.map +1 -1
- package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.js +29 -67
- package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.js.map +1 -1
- package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.styles.js +3 -20
- package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.styles.js.map +1 -1
- package/dist/esm/ScrollTo/Vertical/ScrollToVertical.js +9 -22
- package/dist/esm/ScrollTo/Vertical/ScrollToVertical.js.map +1 -1
- package/dist/esm/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.js +8 -15
- package/dist/esm/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.js.map +1 -1
- package/dist/esm/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.js +12 -7
- package/dist/esm/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.js.map +1 -1
- package/dist/esm/providers/ThemeProvider.js +7 -0
- package/dist/esm/providers/ThemeProvider.js.map +1 -1
- package/dist/types/index.d.ts +24 -16
- package/package.json +5 -5
- package/dist/cjs/ScrollTo/withTooltip.cjs +0 -17
- package/dist/esm/ScrollTo/withTooltip.js +0 -17
- package/dist/esm/ScrollTo/withTooltip.js.map +0 -1
package/dist/cjs/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.cjs
CHANGED
|
@@ -6,49 +6,44 @@ const focusUtils = require("../../../utils/focusUtils.cjs");
|
|
|
6
6
|
const name = "HvHorizontalScrollListItem";
|
|
7
7
|
const { staticClasses, useClasses } = classes.createClasses(name, {
|
|
8
8
|
root: {
|
|
9
|
-
padding: "
|
|
9
|
+
padding: uikitStyles.theme.spacing("xs", 0),
|
|
10
|
+
maxWidth: 120
|
|
10
11
|
},
|
|
11
12
|
button: {
|
|
12
13
|
display: "flex",
|
|
14
|
+
flexDirection: "column",
|
|
13
15
|
justifyContent: "center",
|
|
14
16
|
alignItems: "center",
|
|
15
|
-
height: "48px",
|
|
16
|
-
cursor: "pointer",
|
|
17
|
-
borderBottom: "none",
|
|
18
|
-
"&:hover": {
|
|
19
|
-
backgroundColor: "transparent",
|
|
20
|
-
"& $notSelected": {
|
|
21
|
-
height: "6px",
|
|
22
|
-
width: "6px",
|
|
23
|
-
backgroundColor: uikitStyles.theme.colors.secondary
|
|
24
|
-
},
|
|
25
|
-
"& $notSelectedRoot": {
|
|
26
|
-
backgroundColor: uikitStyles.theme.colors.containerBackgroundHover
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"&:focus": {
|
|
30
|
-
outline: "none"
|
|
31
|
-
},
|
|
32
17
|
"&:focus-visible": {
|
|
33
18
|
...focusUtils.outlineStyles
|
|
34
19
|
}
|
|
35
20
|
},
|
|
36
21
|
text: {
|
|
22
|
+
margin: uikitStyles.theme.spacing("xs", "xs", "0")
|
|
23
|
+
},
|
|
24
|
+
selected: {
|
|
25
|
+
fontWeight: uikitStyles.theme.typography.label.fontWeight
|
|
26
|
+
},
|
|
27
|
+
bullet: {
|
|
37
28
|
display: "flex",
|
|
38
|
-
flexDirection: "column",
|
|
39
|
-
alignItems: "center",
|
|
40
29
|
justifyContent: "center",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
minHeight: 24,
|
|
32
|
+
height: 24,
|
|
33
|
+
width: 24,
|
|
34
|
+
fontSize: 4,
|
|
35
|
+
color: uikitStyles.theme.colors.secondary_60,
|
|
36
|
+
"& > span": {
|
|
37
|
+
margin: "auto",
|
|
38
|
+
width: "1em",
|
|
39
|
+
height: "1em",
|
|
40
|
+
backgroundColor: "currentcolor",
|
|
41
|
+
borderRadius: "50%"
|
|
48
42
|
}
|
|
49
43
|
},
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
bulletSelected: {
|
|
45
|
+
fontSize: 6,
|
|
46
|
+
color: uikitStyles.theme.colors.secondary
|
|
52
47
|
}
|
|
53
48
|
});
|
|
54
49
|
exports.staticClasses = staticClasses;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
|
-
const React = require("react");
|
|
5
4
|
const styles = require("@mui/material/styles");
|
|
6
5
|
const useMediaQuery = require("@mui/material/useMediaQuery");
|
|
7
|
-
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
8
6
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
9
7
|
const useDefaultProps = require("../../hooks/useDefaultProps.cjs");
|
|
10
|
-
const useTheme = require("../../hooks/useTheme.cjs");
|
|
11
|
-
const useUniqueId = require("../../hooks/useUniqueId.cjs");
|
|
12
8
|
const keyboardUtils = require("../../utils/keyboardUtils.cjs");
|
|
13
9
|
const setId = require("../../utils/setId.cjs");
|
|
14
10
|
const useScrollTo = require("../useScrollTo.cjs");
|
|
15
|
-
const withTooltip = require("../withTooltip.cjs");
|
|
16
11
|
const ScrollToHorizontal_styles = require("./ScrollToHorizontal.styles.cjs");
|
|
17
12
|
const HorizontalScrollListItem = require("./HorizontalScrollListItem/HorizontalScrollListItem.cjs");
|
|
18
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
@@ -40,8 +35,6 @@ const HvScrollToHorizontal = (props) => {
|
|
|
40
35
|
const muiTheme = styles.useTheme();
|
|
41
36
|
const downSm = useMediaQuery__default.default(muiTheme.breakpoints.down("sm"));
|
|
42
37
|
const upMd = useMediaQuery__default.default(muiTheme.breakpoints.up("md"));
|
|
43
|
-
const { activeTheme } = useTheme.useTheme();
|
|
44
|
-
const elementId = useUniqueId.useUniqueId(id);
|
|
45
38
|
const [selectedIndex, setScrollTo, elements] = useScrollTo.useScrollTo(
|
|
46
39
|
defaultSelectedIndex,
|
|
47
40
|
scrollElementId,
|
|
@@ -51,65 +44,34 @@ const HvScrollToHorizontal = (props) => {
|
|
|
51
44
|
options,
|
|
52
45
|
onChange
|
|
53
46
|
);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const Selected = React.useCallback(() => {
|
|
70
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
-
uikitReactIcons.CurrentStep,
|
|
72
|
-
{
|
|
73
|
-
height: activeTheme?.scrollTo.dotSelectedSize,
|
|
74
|
-
width: activeTheme?.scrollTo.dotSelectedSize,
|
|
75
|
-
className: classes.selected
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
}, [classes.selected, activeTheme?.scrollTo.dotSelectedSize]);
|
|
79
|
-
const tabs = elements.map((option, index) => {
|
|
80
|
-
const selected = selectedIndex === index;
|
|
81
|
-
const tooltipWrapper = tooltipWrappers[index];
|
|
82
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
83
|
-
HorizontalScrollListItem.HvHorizontalScrollListItem,
|
|
84
|
-
{
|
|
85
|
-
id: setId.setId(elementId, `item-${index}`),
|
|
86
|
-
onClick: (event) => {
|
|
87
|
-
if (navigationMode !== "none") {
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
}
|
|
90
|
-
handleSelection(event, option.value, index);
|
|
91
|
-
onClick?.(event, index);
|
|
92
|
-
},
|
|
93
|
-
onKeyDown: (event) => {
|
|
94
|
-
if (keyboardUtils.isKey(event, "Enter") === true) {
|
|
95
|
-
if (navigationMode !== "none") {
|
|
96
|
-
event.preventDefault();
|
|
97
|
-
}
|
|
98
|
-
handleSelection(event, option.value, index);
|
|
99
|
-
onEnter?.(event, index);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
href: navigationMode !== "none" ? option.href : void 0,
|
|
103
|
-
tooltipWrapper,
|
|
104
|
-
selected,
|
|
105
|
-
children: [
|
|
106
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { children: option.label }),
|
|
107
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsx(Selected, {}) : /* @__PURE__ */ jsxRuntime.jsx(NotSelected, {})
|
|
108
|
-
]
|
|
47
|
+
const tabs = elements.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
HorizontalScrollListItem.HvHorizontalScrollListItem,
|
|
49
|
+
{
|
|
50
|
+
id: setId.setId(id, `item-${index}`),
|
|
51
|
+
onClick: (event) => {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
setScrollTo(event, option.value, index, () => onChange?.(event, index));
|
|
54
|
+
onClick?.(event, index);
|
|
55
|
+
},
|
|
56
|
+
onKeyDown: (event) => {
|
|
57
|
+
if (keyboardUtils.isKey(event, "Enter") !== true)
|
|
58
|
+
return;
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
setScrollTo(event, option.value, index, () => onChange?.(event, index));
|
|
61
|
+
onEnter?.(event, index);
|
|
109
62
|
},
|
|
110
|
-
option.
|
|
111
|
-
|
|
112
|
-
|
|
63
|
+
href: navigationMode !== "none" ? option.href : void 0,
|
|
64
|
+
tooltipPlacement: tooltipPosition,
|
|
65
|
+
selected: selectedIndex === index,
|
|
66
|
+
label: option.label,
|
|
67
|
+
iconClasses: cx({
|
|
68
|
+
[classes.selected]: selectedIndex === index,
|
|
69
|
+
[classes.notSelected]: selectedIndex !== index,
|
|
70
|
+
[classes.notSelectedRoot]: selectedIndex !== index
|
|
71
|
+
})
|
|
72
|
+
},
|
|
73
|
+
option.key || option.label
|
|
74
|
+
));
|
|
113
75
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
76
|
"ol",
|
|
115
77
|
{
|
|
@@ -128,7 +90,7 @@ const HvScrollToHorizontal = (props) => {
|
|
|
128
90
|
},
|
|
129
91
|
className
|
|
130
92
|
),
|
|
131
|
-
id
|
|
93
|
+
id,
|
|
132
94
|
...others,
|
|
133
95
|
children: tabs
|
|
134
96
|
}
|
|
@@ -25,26 +25,9 @@ const { staticClasses, useClasses } = classes.createClasses(
|
|
|
25
25
|
top: 0,
|
|
26
26
|
left: 0
|
|
27
27
|
},
|
|
28
|
-
notSelectedRoot: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
alignItems: "center",
|
|
32
|
-
height: "16px",
|
|
33
|
-
width: "16px",
|
|
34
|
-
borderRadius: "50%"
|
|
35
|
-
},
|
|
36
|
-
notSelected: {
|
|
37
|
-
height: "4px",
|
|
38
|
-
width: "4px",
|
|
39
|
-
borderRadius: "50%",
|
|
40
|
-
display: "inline-block",
|
|
41
|
-
backgroundColor: uikitStyles.theme.colors.secondary_60
|
|
42
|
-
},
|
|
43
|
-
selected: {
|
|
44
|
-
display: "flex",
|
|
45
|
-
height: "16px",
|
|
46
|
-
width: "16px"
|
|
47
|
-
}
|
|
28
|
+
notSelectedRoot: {},
|
|
29
|
+
notSelected: {},
|
|
30
|
+
selected: {}
|
|
48
31
|
}
|
|
49
32
|
);
|
|
50
33
|
exports.staticClasses = staticClasses;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
4
|
const useDefaultProps = require("../../hooks/useDefaultProps.cjs");
|
|
5
|
-
const useUniqueId = require("../../hooks/useUniqueId.cjs");
|
|
6
5
|
const keyboardUtils = require("../../utils/keyboardUtils.cjs");
|
|
7
6
|
const setId = require("../../utils/setId.cjs");
|
|
8
7
|
const useScrollTo = require("../useScrollTo.cjs");
|
|
@@ -29,7 +28,6 @@ const HvScrollToVertical = (props) => {
|
|
|
29
28
|
...others
|
|
30
29
|
} = useDefaultProps.useDefaultProps("HvScrollToVertical", props);
|
|
31
30
|
const { classes, cx } = ScrollToVertical_styles.useClasses(classesProp);
|
|
32
|
-
const elementId = useUniqueId.useUniqueId(id);
|
|
33
31
|
const [selectedIndex, setScrollTo, elements] = useScrollTo.useScrollTo(
|
|
34
32
|
defaultSelectedIndex,
|
|
35
33
|
scrollElementId,
|
|
@@ -39,32 +37,21 @@ const HvScrollToVertical = (props) => {
|
|
|
39
37
|
options,
|
|
40
38
|
onChange
|
|
41
39
|
);
|
|
42
|
-
const handleSelection = (event, value, index) => {
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
const wrappedOnChange = () => {
|
|
45
|
-
onChange?.(event, index);
|
|
46
|
-
};
|
|
47
|
-
setScrollTo(event, value, index, wrappedOnChange);
|
|
48
|
-
};
|
|
49
40
|
const tabs = elements.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
50
41
|
VerticalScrollListItem.HvVerticalScrollListItem,
|
|
51
42
|
{
|
|
52
|
-
id: setId.setId(
|
|
43
|
+
id: setId.setId(id, `item-${index}`),
|
|
53
44
|
onClick: (event) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
handleSelection(event, option.value, index);
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
setScrollTo(event, option.value, index, () => onChange?.(event, index));
|
|
58
47
|
onClick?.(event, index);
|
|
59
48
|
},
|
|
60
49
|
onKeyDown: (event) => {
|
|
61
|
-
if (keyboardUtils.isKey(event, "Enter")
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
onEnter?.(event, index);
|
|
67
|
-
}
|
|
50
|
+
if (keyboardUtils.isKey(event, "Enter") !== true)
|
|
51
|
+
return;
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
setScrollTo(event, option.value, index, () => onChange?.(event, index));
|
|
54
|
+
onEnter?.(event, index);
|
|
68
55
|
},
|
|
69
56
|
href: navigationMode !== "none" ? option.href : void 0,
|
|
70
57
|
tooltipPlacement: tooltipPosition,
|
|
@@ -86,7 +73,7 @@ const HvScrollToVertical = (props) => {
|
|
|
86
73
|
className
|
|
87
74
|
),
|
|
88
75
|
style: { top: `calc(50% - ${positionOffset}px)`, ...style },
|
|
89
|
-
id
|
|
76
|
+
id,
|
|
90
77
|
...others,
|
|
91
78
|
children: tabs
|
|
92
79
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
|
-
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
5
4
|
const useDefaultProps = require("../../../hooks/useDefaultProps.cjs");
|
|
6
|
-
const useTheme = require("../../../hooks/useTheme.cjs");
|
|
7
5
|
const VerticalScrollListItem_styles = require("./VerticalScrollListItem.styles.cjs");
|
|
8
6
|
const Tooltip = require("../../../Tooltip/Tooltip.cjs");
|
|
9
7
|
const HvVerticalScrollListItem = (props) => {
|
|
@@ -13,33 +11,28 @@ const HvVerticalScrollListItem = (props) => {
|
|
|
13
11
|
classes: classesProp,
|
|
14
12
|
selected,
|
|
15
13
|
label,
|
|
16
|
-
onClick,
|
|
17
|
-
onKeyDown,
|
|
18
14
|
tooltipPlacement = "left",
|
|
19
15
|
href,
|
|
20
16
|
...others
|
|
21
17
|
} = useDefaultProps.useDefaultProps("HvVerticalScrollListItem", props);
|
|
22
18
|
const { classes, cx } = VerticalScrollListItem_styles.useClasses(classesProp);
|
|
23
|
-
const { activeTheme } = useTheme.useTheme();
|
|
24
|
-
const icon = selected ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
25
|
-
uikitReactIcons.CurrentStep,
|
|
26
|
-
{
|
|
27
|
-
height: activeTheme?.scrollTo.dotSelectedSize,
|
|
28
|
-
width: activeTheme?.scrollTo.dotSelectedSize
|
|
29
|
-
}
|
|
30
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.notSelected });
|
|
31
19
|
const Component = href != null ? "a" : "div";
|
|
32
20
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { id, className: cx(classes.root, className), "aria-current": selected, children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip.HvTooltip, { title: label, placement: tooltipPlacement, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
33
21
|
Component,
|
|
34
22
|
{
|
|
35
23
|
role: href == null ? "button" : void 0,
|
|
36
24
|
tabIndex: 0,
|
|
37
|
-
onClick,
|
|
38
|
-
onKeyDown,
|
|
39
25
|
className: cx(classes.button, classes.text),
|
|
40
26
|
href,
|
|
41
27
|
...others,
|
|
42
|
-
children:
|
|
28
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: cx(classes.icon, {
|
|
32
|
+
[classes.notSelected]: !selected
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
)
|
|
43
36
|
}
|
|
44
37
|
) }) });
|
|
45
38
|
};
|
|
@@ -13,12 +13,18 @@ const { staticClasses, useClasses } = classes.createClasses(name, {
|
|
|
13
13
|
justifyContent: "center",
|
|
14
14
|
alignItems: "center"
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
icon: {
|
|
17
|
+
width: "1em",
|
|
18
|
+
height: "1em",
|
|
19
19
|
borderRadius: "50%",
|
|
20
|
+
fontSize: 6,
|
|
21
|
+
color: uikitStyles.theme.colors.secondary,
|
|
20
22
|
display: "inline-block",
|
|
21
|
-
backgroundColor:
|
|
23
|
+
backgroundColor: "currentcolor"
|
|
24
|
+
},
|
|
25
|
+
notSelected: {
|
|
26
|
+
fontSize: 4,
|
|
27
|
+
color: uikitStyles.theme.colors.secondary_60
|
|
22
28
|
},
|
|
23
29
|
// TODO: remove in v6 (use classes.button)
|
|
24
30
|
text: {},
|
|
@@ -33,9 +39,8 @@ const { staticClasses, useClasses } = classes.createClasses(name, {
|
|
|
33
39
|
"&:hover": {
|
|
34
40
|
backgroundColor: uikitStyles.theme.colors.containerBackgroundHover,
|
|
35
41
|
"& $notSelected": {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
backgroundColor: uikitStyles.theme.colors.secondary
|
|
42
|
+
fontSize: 6,
|
|
43
|
+
color: uikitStyles.theme.colors.secondary
|
|
39
44
|
}
|
|
40
45
|
},
|
|
41
46
|
"&:focus": {
|
|
@@ -5,10 +5,10 @@ import { theme, getColor } from "@hitachivantara/uikit-styles";
|
|
|
5
5
|
import { useUniqueId } from "../../hooks/useUniqueId.js";
|
|
6
6
|
import { useClasses } from "./Action.styles.js";
|
|
7
7
|
import { staticClasses } from "./Action.styles.js";
|
|
8
|
-
import { HvOverflowTooltip } from "../../OverflowTooltip/OverflowTooltip.js";
|
|
9
8
|
import { HvAvatar } from "../../Avatar/Avatar.js";
|
|
10
9
|
import { HvTypography } from "../../Typography/Typography.js";
|
|
11
10
|
import { HvListItem } from "../../ListContainer/ListItem/ListItem.js";
|
|
11
|
+
import { HvOverflowTooltip } from "../../OverflowTooltip/OverflowTooltip.js";
|
|
12
12
|
import { HvTooltip } from "../../Tooltip/Tooltip.js";
|
|
13
13
|
const HvAppSwitcherAction = ({
|
|
14
14
|
id,
|
|
@@ -3,6 +3,7 @@ import { forwardRef } from "react";
|
|
|
3
3
|
import MuiAvatar from "@mui/material/Avatar";
|
|
4
4
|
import { User } from "@hitachivantara/uikit-react-icons";
|
|
5
5
|
import { getColor, theme } from "@hitachivantara/uikit-styles";
|
|
6
|
+
import { useAvatarGroupContext } from "../AvatarGroup/AvatarGroupContext.js";
|
|
6
7
|
import { useDefaultProps } from "../hooks/useDefaultProps.js";
|
|
7
8
|
import { useImageLoaded } from "../hooks/useImageLoaded.js";
|
|
8
9
|
import { decreaseSize } from "../utils/sizes.js";
|
|
@@ -15,7 +16,7 @@ const HvAvatar = forwardRef((props, ref) => {
|
|
|
15
16
|
classes: classesProp,
|
|
16
17
|
children: childrenProp,
|
|
17
18
|
component = "div",
|
|
18
|
-
size
|
|
19
|
+
size: sizeProp,
|
|
19
20
|
backgroundColor = "secondary",
|
|
20
21
|
color = "atmo1",
|
|
21
22
|
src,
|
|
@@ -30,6 +31,8 @@ const HvAvatar = forwardRef((props, ref) => {
|
|
|
30
31
|
...others
|
|
31
32
|
} = useDefaultProps("HvAvatar", props);
|
|
32
33
|
const { classes, cx } = useClasses(classesProp);
|
|
34
|
+
const avatarGroupContext = useAvatarGroupContext();
|
|
35
|
+
const size = sizeProp || avatarGroupContext?.size || "sm";
|
|
33
36
|
let children;
|
|
34
37
|
const imageLoaded = useImageLoaded(src, srcSet);
|
|
35
38
|
const hasImg = src || srcSet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../../src/Avatar/Avatar.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport MuiAvatar, { AvatarProps as MuiAvatarProps } from \"@mui/material/Avatar\";\nimport { User } from \"@hitachivantara/uikit-react-icons\";\nimport {
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../../src/Avatar/Avatar.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport MuiAvatar, { AvatarProps as MuiAvatarProps } from \"@mui/material/Avatar\";\nimport { User } from \"@hitachivantara/uikit-react-icons\";\nimport {\n getColor,\n HvColorAny,\n HvSize,\n theme,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { useAvatarGroupContext } from \"../AvatarGroup/AvatarGroupContext\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useImageLoaded } from \"../hooks/useImageLoaded\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { decreaseSize } from \"../utils/sizes\";\nimport { staticClasses, useClasses } from \"./Avatar.styles\";\n\nexport { staticClasses as avatarClasses };\n\nexport type HvAvatarClasses = ExtractNames<typeof useClasses>;\n\nexport type HvAvatarVariant = \"circular\" | \"square\";\n\n/** @deprecated use `HvSize` instead */\nexport type HvAvatarSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface HvAvatarProps extends HvBaseProps {\n /** The component used for the root node. Either a string to use a DOM element or a component. */\n component?: React.ElementType;\n /** Sets one of the standard sizes of the icons */\n size?: HvSize;\n /** A color representing the foreground color of the avatar's letters or the generic User icon fallback. */\n color?: HvColorAny;\n /** A String representing the background color of the avatar. */\n backgroundColor?: HvColorAny;\n /** The `src` attribute for the `img` element. */\n src?: string;\n /** The `srcSet` attribute for the `img` element. Use this attribute for responsive image display. */\n srcSet?: string;\n /** The `sizes` attribute for the `img` element. */\n sizes?: string;\n /** Used in combination with `src` or `srcSet` to provide an alt attribute for the rendered `img` element. */\n alt?: string;\n /**\n * Attributes applied to the `img` element if the component is used to display an image.\n * It can be used to listen for the loading error event.\n */\n imgProps?: React.HTMLAttributes<HTMLImageElement>;\n /** A string representing the type of avatar to display, circular or square. */\n variant?: HvAvatarVariant;\n /** A string representing the color of the avatar border that represents its status. */\n status?: string;\n /** A string representing the color of the avatar badge. */\n badge?: string;\n /** Attributes applied to the avatar element. */\n avatarProps?: MuiAvatarProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvAvatarClasses;\n}\n\n/**\n * Avatars can be used to represent a user or a brand.\n * They can show an image, an icon or the initial letters of a name, for example.\n */\nexport const HvAvatar = forwardRef<any, HvAvatarProps>((props, ref) => {\n const {\n className,\n style,\n classes: classesProp,\n children: childrenProp,\n component = \"div\",\n size: sizeProp,\n backgroundColor = \"secondary\",\n color = \"atmo1\",\n src,\n srcSet,\n sizes,\n alt,\n imgProps,\n status,\n badge,\n variant = \"circular\",\n avatarProps,\n ...others\n } = useDefaultProps(\"HvAvatar\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const avatarGroupContext = useAvatarGroupContext();\n\n const size = sizeProp || avatarGroupContext?.size || \"sm\";\n\n let children: React.ReactNode;\n\n // Use a hook instead of onError on the img element to support server-side rendering.\n const imageLoaded = useImageLoaded(src, srcSet);\n const hasImg = src || srcSet;\n const hasImgNotFailing = hasImg && imageLoaded !== \"error\";\n\n if (hasImgNotFailing) {\n children = (\n <img\n alt={alt}\n src={src}\n srcSet={srcSet}\n sizes={sizes}\n className={classes.img}\n {...imgProps}\n />\n );\n } else if (childrenProp != null) {\n children = childrenProp;\n } else if (hasImg && alt) {\n [children] = alt;\n } else {\n children = (\n <User\n color={color}\n iconSize={decreaseSize(size)}\n className={classes.fallback}\n />\n );\n }\n\n const inlineStyle: React.CSSProperties = {\n ...style,\n };\n\n if (component != null && typeof component !== \"string\") {\n // override border-radius with custom components\n inlineStyle.borderRadius = \"50%\";\n }\n\n if (!hasImgNotFailing) {\n inlineStyle.backgroundColor = getColor(\n backgroundColor,\n theme.colors.secondary,\n );\n inlineStyle.color = getColor(color, theme.colors.atmo1);\n }\n\n const statusInlineStyle: React.CSSProperties = {};\n if (status) {\n // set the status border. we're using the boxShadow property to set the border\n // to be inside the container and not on its edge.\n const statusColor = getColor(status, theme.colors.positive);\n statusInlineStyle.boxShadow = `inset 0px 0px 0px 2px ${statusColor}`;\n }\n\n const badgeColor = getColor(badge || \"\", theme.colors.positive);\n\n return (\n <div ref={ref} className={classes.container} {...others}>\n <div\n className={cx(classes.status, classes[variant], classes[size])}\n style={statusInlineStyle}\n >\n {badge && (\n <div\n className={classes.badge}\n style={{ backgroundColor: badgeColor }}\n />\n )}\n <MuiAvatar\n component={component}\n // Consider not using the root and className classes in this component\n className={cx(classes.root, classes.avatar, classes[size], className)}\n style={inlineStyle}\n variant={variant}\n size={size}\n {...avatarProps}\n >\n {children}\n </MuiAvatar>\n </div>\n </div>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;;;AAiEO,MAAM,WAAW,WAA+B,CAAC,OAAO,QAAQ;AAC/D,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,YAAY,KAAK;AACrC,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAE9C,QAAM,qBAAqB;AAErB,QAAA,OAAO,YAAY,oBAAoB,QAAQ;AAEjD,MAAA;AAGE,QAAA,cAAc,eAAe,KAAK,MAAM;AAC9C,QAAM,SAAS,OAAO;AAChB,QAAA,mBAAmB,UAAU,gBAAgB;AAEnD,MAAI,kBAAkB;AAElB,eAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW,QAAQ;AAAA,QAClB,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EACN,WAEO,gBAAgB,MAAM;AACpB,eAAA;AAAA,EAAA,WACF,UAAU,KAAK;AACxB,KAAC,QAAQ,IAAI;AAAA,EAAA,OACR;AAEH,eAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,UAAU,aAAa,IAAI;AAAA,QAC3B,WAAW,QAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAGzB;AAEA,QAAM,cAAmC;AAAA,IACvC,GAAG;AAAA,EAAA;AAGL,MAAI,aAAa,QAAQ,OAAO,cAAc,UAAU;AAEtD,gBAAY,eAAe;AAAA,EAC7B;AAEA,MAAI,CAAC,kBAAkB;AACrB,gBAAY,kBAAkB;AAAA,MAC5B;AAAA,MACA,MAAM,OAAO;AAAA,IAAA;AAEf,gBAAY,QAAQ,SAAS,OAAO,MAAM,OAAO,KAAK;AAAA,EACxD;AAEA,QAAM,oBAAyC,CAAA;AAC/C,MAAI,QAAQ;AAGV,UAAM,cAAc,SAAS,QAAQ,MAAM,OAAO,QAAQ;AACxC,sBAAA,YAAY,yBAAyB,WAAW;AAAA,EACpE;AAEA,QAAM,aAAa,SAAS,SAAS,IAAI,MAAM,OAAO,QAAQ;AAE9D,6BACG,OAAI,EAAA,KAAU,WAAW,QAAQ,WAAY,GAAG,QAC/C,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,GAAG,QAAQ,QAAQ,QAAQ,OAAO,GAAG,QAAQ,IAAI,CAAC;AAAA,MAC7D,OAAO;AAAA,MAEN,UAAA;AAAA,QACC,SAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW,QAAQ;AAAA,YACnB,OAAO,EAAE,iBAAiB,WAAW;AAAA,UAAA;AAAA,QACvC;AAAA,QAEF;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YAEA,WAAW,GAAG,QAAQ,MAAM,QAAQ,QAAQ,QAAQ,IAAI,GAAG,SAAS;AAAA,YACpE,OAAO;AAAA,YACP;AAAA,YACA;AAAA,YACC,GAAG;AAAA,YAEH;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CAAC;"}
|